]> git.za3k.com Git - blog.git/commitdiff
Improve side-by-side view to have source links
authorZachary Vance <za3k@za3k.com>
Fri, 12 Jul 2024 01:18:02 +0000 (21:18 -0400)
committerZachary Vance <za3k@za3k.com>
Fri, 12 Jul 2024 01:18:02 +0000 (21:18 -0400)
blog
templates/postcombined.mustache.html

diff --git a/blog b/blog
index 476f479f68e9d39b03b1b15714b570ce125d0732..bb7a179c2a823cb0c79f017eb95fe72169ff09ab 100755 (executable)
--- a/blog
+++ b/blog
@@ -182,12 +182,13 @@ class Templatable(PseudoMap):
     def url(self):
         return self.blog.web_root + "/" + str(self.output_path.relative_to(Path(self.blog.destination)))
 
-    def render_template(source, blog, name, context):
+    def render_template(source, blog, name, context, replace_links=True):
         template_path = blog["{}_template".format(name)]
         with open(template_path, "r") as f:
             template = f.read()
         html = mustache.render(template, context, warn=True)
-        html = blog.replace_links(source, html)
+        if replace_links:
+            html = blog.replace_links(source, html)
         return html
 
     def content(self):
@@ -260,7 +261,7 @@ class Post(Templatable):
         return self.blog.web_root + "/" + str(self.output_path_html.relative_to(self.blog.destination))
 
     def content_combined(self):
-        return self.render_template(self.blog, "postcombined", self.context).encode("utf8")
+        return self.render_template(self.blog, "postcombined", self.context, replace_links=False).encode("utf8")
 
     def content_md(self):
         content = self.render_template(self.blog, self.type, collections.ChainMap({
index 77f60c7f4319eb6b1663f3441a5bd7502ee08aec..ba0758988fd6b7cf6c7d04d76556557bb3f67193 100644 (file)
@@ -7,7 +7,16 @@ html, body {
     padding: 0;
     border: 0;
 }
-body {
+#links {
+    margin: 0;
+    padding: 5px 0;
+    display: flex;
+}
+#links > * {
+    flex: 1 1;
+    text-align: center;
+}
+#iframes {
     display: flex;
 }
 iframe {
@@ -28,5 +37,11 @@ iframe::-webkit-scrollbar {
 
 </style>
 </head>
-<body><iframe src="{{url_html}}"></iframe><iframe src="{{url_md}}"></iframe></body>
+<body>
+<ul id="links">
+    <a href="https://blog.za3k.com/{{id}}/">original blog</a>
+    <a href="https://git.za3k.com/?p=blog.git;a=blob_plain;f=posts-html/{{id}}.html;hb=HEAD">html source</a>
+    <a href="https://git.za3k.com/?p=blog.git;a=blob_plain;f=posts-md/{{id}}.md;hb=HEAD">markdown source</a>
+</ul>
+<div id="iframes"><iframe src="{{url_html}}" id="html"></iframe><iframe src="{{url_md}}" id="markdown"></iframe></body></div>
 </html>