Page source added to Meta page

This commit is contained in:
Dirk Alders 2024-11-10 18:22:38 +01:00
parent abc0f749e6
commit 77ce338874

View File

@ -148,7 +148,7 @@ class PikiPage(models.Model):
tags = h_page.tags tags = h_page.tags
meta += " --- | --- |\n" meta += " --- | --- |\n"
# Diff # Diff
html_diff = "" appendix = ""
if history: if history:
h_page = self.history.get(history_id=history) h_page = self.history.get(history_id=history)
# #
@ -156,9 +156,15 @@ class PikiPage(models.Model):
# #
left_lines = self.page_txt.splitlines() left_lines = self.page_txt.splitlines()
right_lines = h_page.page_txt.splitlines() right_lines = h_page.page_txt.splitlines()
html_diff = difflib.HtmlDiff(wrapcolumn=80).make_table(left_lines, right_lines, "Current page", "Page Version %d" % history) appendix = difflib.HtmlDiff(wrapcolumn=80).make_table(left_lines, right_lines, "Current page", "Page Version %d" % history)
else:
appendix = "<h1>" + _("Page source") + "</h1>\n"
appendix += "<pre>\n"
appendix += self.page_txt
appendix += "</pre>\n"
# #
return mycreole.render_simple(meta) + html_diff return mycreole.render_simple(meta) + appendix
# #
# Creole stuff # Creole stuff