]> git.ipfire.org Git - ipfire.org.git/commitdiff
docs: Move the diff UI module
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 1 Jul 2023 10:13:43 +0000 (10:13 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 1 Jul 2023 10:13:43 +0000 (10:13 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/docs/diff.html
src/templates/docs/modules/diff.html [moved from src/templates/wiki/modules/diff.html with 100% similarity]
src/web/__init__.py
src/web/docs.py
src/web/wiki.py

index 539cb70a94299f0c640e33b3313c7638d1b48024..03a1d2054d06dd7c6f8f53850a74bbe7fbb02d8e 100644 (file)
@@ -207,6 +207,7 @@ templates_docs_DATA = \
 templates_docsdir = $(templatesdir)/docs
 
 templates_docs_modules_DATA = \
+       src/templates/docs/modules/diff.html \
        src/templates/docs/modules/header.html
 
 templates_docs_modulesdir = $(templates_docsdir)/modules
@@ -358,7 +359,6 @@ templates_wiki_messages_DATA = \
 templates_wiki_messagesdir = $(templates_wikidir)/messages
 
 templates_wiki_modules_DATA = \
-       src/templates/wiki/modules/diff.html \
        src/templates/wiki/modules/list.html
 
 templates_wiki_modulesdir = $(templates_wikidir)/modules
index 71f171d5e8084fd195a1ef7966951b39fd3f7030..80b6b523f524a94caa479a29a97cf4d22180520e 100644 (file)
@@ -37,7 +37,7 @@
                                </div>
                        {% end %}
 
-                       {% module WikiDiff(a, b) %}
+                       {% module DocsDiff(a, b) %}
                </div>
        </div>
 {% end block %}
index 144787afd5ebf4f2b1b7cff7fd62f6f9fbdc9a9d..f21f2822a4d3ecd7f5aa348b278c895212664066 100644 (file)
@@ -75,6 +75,7 @@ class Application(tornado.web.Application):
                                "BootMenuSeparator"    : boot.MenuSeparatorModule,
 
                                # Docs
+                               "DocsDiff"             : docs.DiffModule,
                                "DocsHeader"           : docs.HeaderModule,
 
                                # Nopaste
@@ -96,7 +97,6 @@ class Application(tornado.web.Application):
                                "VoIPRegistrations"    : voip.RegistrationsModule,
 
                                # Wiki
-                               "WikiDiff"             : wiki.WikiDiffModule,
                                "WikiList"             : wiki.WikiListModule,
 
                                # Misc
index 1f60d13f6373ba59a0791a86312679d468829625..ef1c969a13a9f0b1c220e25259f625d6b4cc27c1 100644 (file)
@@ -161,3 +161,15 @@ class HeaderModule(ui_modules.UIModule):
 
                return self.render_string("docs/modules/header.html",
                        breadcrumbs=breadcrumbs, page=self.page, page_title=title, suffix=suffix)
+
+
+class DiffModule(ui_modules.UIModule):
+       differ = difflib.Differ()
+
+       def render(self, a, b):
+               diff = self.differ.compare(
+                       a.markdown.splitlines(),
+                       b.markdown.splitlines(),
+               )
+
+               return self.render_string("docs/modules/diff.html", diff=diff)
index d90fcacb7558b6315f1df3ece442639abc385f30..bf9fe54e3325a80a83a07d832e72a4c64781b14f 100644 (file)
@@ -1,6 +1,5 @@
 #!/usr/bin/python3
 
-import difflib
 import tornado.web
 
 from . import base
@@ -241,18 +240,6 @@ class WatchlistHandler(base.BaseHandler):
                self.render("wiki/watchlist.html", pages=pages)
 
 
-class WikiDiffModule(ui_modules.UIModule):
-       differ = difflib.Differ()
-
-       def render(self, a, b):
-               diff = self.differ.compare(
-                       a.markdown.splitlines(),
-                       b.markdown.splitlines(),
-               )
-
-               return self.render_string("wiki/modules/diff.html", diff=diff)
-
-
 class WikiListModule(ui_modules.UIModule):
        def render(self, pages, link_revision=False, show_breadcrumbs=True,
                        show_author=True, show_changes=False):