]> sipb.mit.edu Git - ikiwiki.git/blobdiff - doc/todo/syntax_highlighting.mdwn
fix link to Jason Blevins user page
[ikiwiki.git] / doc / todo / syntax_highlighting.mdwn
index 645dd56bcedf110e48f673e6dece38fac2373b04..2bdeb62be5dc8db7af7435d1379d5ad4728fd5bd 100644 (file)
@@ -23,6 +23,8 @@ pages, as well as doing syntax highlighting as a preprocessor directive
 * [[sourcecode|todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion]]
   also uses src-highlight, and operates on whole source files.
   Updated to work with the fix for [[bugs/multiple_pages_with_same_name]].  Untested with files with no extension, e.g. `Makefile`.
 * [[sourcecode|todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion]]
   also uses src-highlight, and operates on whole source files.
   Updated to work with the fix for [[bugs/multiple_pages_with_same_name]].  Untested with files with no extension, e.g. `Makefile`.
+* [[users/jasonblevins]]'s code plugin uses src-highlight, and supports both
+  while file and directive use.
 
 ## General problems
 
 
 ## General problems
 
@@ -76,10 +78,27 @@ pages, as well as doing syntax highlighting as a preprocessor directive
   extensions. The workaround is to use a directive on a wiki page, pulling
   in the Makefile.
 
   extensions. The workaround is to use a directive on a wiki page, pulling
   in the Makefile.
 
-  > I wonder how hard it would be to make a patch where by a file with
+  > I wonder how hard it would be to make a patch whereby a file with
   > no `.` in the name, and a name that matches a filetype, and where
   > that filetype was registered `keepextension`, then the file is just
   > no `.` in the name, and a name that matches a filetype, and where
   > that filetype was registered `keepextension`, then the file is just
-  > chosen as the appropriate type...
+  > chosen as the appropriate type.  This would allow `Makefile` to
+  > work.
+
+like this:
+
+    diff --git a/IkiWiki.pm b/IkiWiki.pm
+    index 8d728c9..1bd46a9 100644
+    --- a/IkiWiki.pm
+    +++ b/IkiWiki.pm
+    @@ -618,6 +618,8 @@ sub pagetype ($) { #{{{
+       
+       if ($page =~ /\.([^.]+)$/) {
+               return $1 if exists $hooks{htmlize}{$1};
+    +  } elsif ($hooks{htmlize}{$page}{keepextension}) {
+    +          return $page;
+       }
+       return;
+     } #}}}
 
 ## format directive
 
 
 ## format directive