diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Move syntax highlighting to a Lua source filter
Diffstat (limited to 'source/ui-tree.c')
-rw-r--r--source/ui-tree.c12
1 file changed, 4 insertions, 8 deletions
diff --git a/source/ui-tree.c b/source/ui-tree.c
index d3b3a30..df7e9e5 100644
--- a/source/ui-tree.c
+++ b/source/ui-tree.c
@@ -30,7 +30,6 @@ struct walk_tree_context {
static void print_text_buffer(const char *name, char *buf, unsigned long size)
{
unsigned long lineno, idx;
- const char *ext;
const char *numberfmt = "<a id='n%1$d' href='#n%1$d'>%1$d</a>\n";
html("<table summary='blob content' class='blob'>\n");
@@ -68,13 +67,10 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
return;
}
- /* No source filter is configured, so tag the code with its file
- * extension (or bare name, for Makefile and the like) and let
- * cgit.js highlight it client-side. */
- ext = strrchr(name, '.');
- html("<td class='lines'><pre><code data-lang='");
- html_attr(ext && ext[1] ? ext + 1 : name);
- html("'>");
+ /* No source filter is configured, so serve the text plain. Syntax
+ * highlighting ships as an optional source filter in extensions/,
+ * keeping language knowledge out of the core. */
+ html("<td class='lines'><pre><code>");
html_txt(buf);
html("</code></pre></td></tr></table>\n");
}