Browse Source

Page source added to Meta page

master
Dirk Alders 1 month ago
parent
commit
77ce338874
1 changed files with 9 additions and 3 deletions
  1. 9
    3
      pages/models.py

+ 9
- 3
pages/models.py View File

@@ -148,7 +148,7 @@ class PikiPage(models.Model):
148 148
                     tags = h_page.tags
149 149
             meta += " --- | --- |\n"
150 150
         # Diff
151
-        html_diff = ""
151
+        appendix = ""
152 152
         if history:
153 153
             h_page = self.history.get(history_id=history)
154 154
             #
@@ -156,9 +156,15 @@ class PikiPage(models.Model):
156 156
             #
157 157
             left_lines = self.page_txt.splitlines()
158 158
             right_lines = h_page.page_txt.splitlines()
159
-            html_diff = difflib.HtmlDiff(wrapcolumn=80).make_table(left_lines, right_lines, "Current page", "Page Version %d" % history)
159
+            appendix = difflib.HtmlDiff(wrapcolumn=80).make_table(left_lines, right_lines, "Current page", "Page Version %d" % history)
160
+        else:
161
+            appendix = "<h1>" + _("Page source") + "</h1>\n"
162
+            appendix += "<pre>\n"
163
+            appendix += self.page_txt
164
+            appendix += "</pre>\n"
165
+
160 166
         #
161
-        return mycreole.render_simple(meta) + html_diff
167
+        return mycreole.render_simple(meta) + appendix
162 168
 
163 169
     #
164 170
     # Creole stuff

Loading…
Cancel
Save