This patch changes the way `void artifact_page(void)` renders a files content.
Formerly a `<blockquote><pre>` was issued for content, whereas now a
`<blockquote><pre><code class=$ext>` is issued where $ext is the file's
extension (example, "blah.lua" extension would be "lua").

This allows for proper integration with syntax highlighting systems such as "highlight.js" and "prism.js" where only the former was tested. This allows
syntax highlighting without having to have language detection.

Remaining work likely includes changing the CSS of all themes to take this into account. Other things that might be considered is to conditionally remove the `<blockquote>` part from all but the content rendering. Another part would be
rendering syntax highlights with line numbers (currently unimplemented).

Below is the output of 'fossil diff' ran against checkout
'6a7d2ad8f1dd5c542eba0b885418328803d8d802' with my changes:

Index: src/info.c
==================================================================
--- /home/masky/misc/fossil/src/info.c~0 2018-06-27 23:21:48.520779000 -0500 +++ /home/masky/misc/fossil/src/info.c 2018-06-27 16:48:28.683256000 -0500
@@ -670 +670 @@
-
+
@@ -2157 +2157,2 @@
-        const char *z;
+        const char *z, *ext, *name;
+        char *tmp;
@@ -2158,0 +2160,3 @@
+        name = blob_str(&downloadName);
+
+        ext = (tmp = strrchr(name, '.')) == NULL ? "" : tmp+1;
@@ -2162 +2166 @@
-          @ <pre>
+          @ <pre><code class="%h(ext)">
@@ -2164 +2168 @@
-          @ </pre>
+          @ </code></pre>
@@ -2232 +2236 @@
-      ? db_text("(No title)",
+      ? db_text("(No title)",

!!END!!

I'm unsure why "@@ -2232 +2236 @@" section got included as no changes were
made to that.

I submit these works under the BSD 2 Clause license as found in
"COPYRIGHT-BSD2.txt" and assign the rights to D. Richard Hipp.

I would like to submit a contributor agreement to make it official. This
change is so small that my previous post to the list serv considered,
one could have implemented it in less time than it would take for a
contributor agreement to finally be filed but as there was no reply
I didn't wait upon such.

With the notes at the beginning portion of this email as to CSS changes,
final note is, if changing the section of code to omit `<blockquote>`
around content and reserving it for only the other cases, CSS changes
would not need to be made.

If this is not fit for contribution please let me know what I might need
to do to get it fit and I'll proceed further.

Thanks,

--
Lester L. Martin II
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to