GNOME Bugzilla – Bug 749816
Support syntax highlighting of different languages (patch included)
Last modified: 2015-05-29 16:53:40 UTC
Created attachment 303902 [details] [review] patch This is a patch to allow gtk-doc users to supply a --language option to gtkdoc-fixxref so that the syntax highlight will be performed in the correct language. The option is global, ie. applies to the whole project built, as opposed to individual files. The default option is "c", which is what used to be hardcoded as the language. This only works if syntax highlight is done with source-highlight, instead of vim
Can you also add the options for hightlight: http://www.andre-simon.de/doku/highlight/en/highlight.php#ch2_2
I looked at the options provided and it seems like only the --tab option seems useful, when they are to be applied globally. Is there anything else you want?
Created attachment 303969 [details] [review] patch2 This is an alternative to the "patch" attachment that supports --tabs in addition to --language
for highlight, it should be "--syntax"
There are three different syntax highlighters we could possibly use and they all have different conventions, so we cannot be consistent with all. I guess I'll use --src-lang from synatx-highlight since it seems to be the default highlighter?
I mean source-highlight
Created attachment 304002 [details] [review] patch3 This supports --src-lang for all three highlighters and --tab for source-highlight and vim
Sorry should be --tab for source-highlight and highlight
Review of attachment 304002 [details] [review]: ::: gtkdoc-fixxref.in @@ +76,3 @@ +--tab=TAB Specify tab length (default 4). + This is only useful when source-highighting is done via + source-highlight or highlight Shouldn't the highlighters keep the sources as-is? Or are you using tabs in the code examples in the doc-comments? The --src-lang part definitely makes sense. Maybe you can split out the tab change so that this can be submitted. If we do the tab parameters, we might need a better option name - it is a bit unfortunate that the docbook stylesheets can't do syntax highlighting and we do this post processing. Since users should not need to know too much here, they might be confused with a --tab on a tool that primarily fixes xrefs.
I have absolutely no idea what the --tab parameter does (which is why I didn't implement it for vim). However, --tab=4 is currently hardcoded in the options supplied so I might as well make it customizable.
Created attachment 304274 [details] [review] patch-highlight-only This only implements the "highlight" option.
Created attachment 304277 [details] [review] patch
The following fix has been pushed: d5b16ed Support highlight options
Created attachment 304278 [details] [review] Support highlight options This commit allows gtk-doc users to supply a --src-lang option to gtkdoc-fixxref so that the syntax highlight will be performed in the correct language. The option is global, ie. applies to the whole project built, as opposed to individual files. The default option is "c", which is what used to be hardcoded in the gtkdoc-fixxref, so backwards compatibility is maintained.