After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 749816 - Support syntax highlighting of different languages (patch included)
Support syntax highlighting of different languages (patch included)
Status: RESOLVED FIXED
Product: gtk-doc
Classification: Platform
Component: general
1.23
Other Linux
: Normal enhancement
: 1.24
Assigned To: gtk-doc maintainers
gtk-doc maintainers
Depends on:
Blocks:
 
 
Reported: 2015-05-25 07:55 UTC by dalcde
Modified: 2015-05-29 16:53 UTC
See Also:
GNOME target: ---
GNOME version: 3.15/3.16


Attachments
patch (2.80 KB, patch)
2015-05-25 07:55 UTC, dalcde
none Details | Review
patch2 (3.18 KB, patch)
2015-05-26 06:55 UTC, dalcde
none Details | Review
patch3 (4.37 KB, patch)
2015-05-26 12:20 UTC, dalcde
none Details | Review
patch-highlight-only (3.94 KB, patch)
2015-05-29 16:11 UTC, dalcde
none Details | Review
patch (3.93 KB, patch)
2015-05-29 16:47 UTC, dalcde
committed Details | Review
Support highlight options (3.99 KB, patch)
2015-05-29 16:53 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
committed Details | Review

Description dalcde 2015-05-25 07:55:09 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
Comment 1 Stefan Sauer (gstreamer, gtkdoc dev) 2015-05-25 17:01:19 UTC
Can you also add the options for hightlight:
http://www.andre-simon.de/doku/highlight/en/highlight.php#ch2_2
Comment 2 dalcde 2015-05-26 05:49:13 UTC
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?
Comment 3 dalcde 2015-05-26 06:55:50 UTC
Created attachment 303969 [details] [review]
patch2

This is an alternative to the "patch" attachment that supports --tabs in addition to --language
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2015-05-26 09:05:06 UTC
for highlight, it should be "--syntax"
Comment 5 dalcde 2015-05-26 11:43:49 UTC
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?
Comment 6 dalcde 2015-05-26 11:45:01 UTC
I mean source-highlight
Comment 7 dalcde 2015-05-26 12:20:15 UTC
Created attachment 304002 [details] [review]
patch3

This supports --src-lang for all three highlighters and --tab for source-highlight and vim
Comment 8 dalcde 2015-05-26 15:14:34 UTC
Sorry should be --tab for source-highlight and highlight
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2015-05-29 12:28:01 UTC
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.
Comment 10 dalcde 2015-05-29 16:06:33 UTC
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.
Comment 11 dalcde 2015-05-29 16:11:16 UTC
Created attachment 304274 [details] [review]
patch-highlight-only

This only implements the "highlight" option.
Comment 12 dalcde 2015-05-29 16:47:05 UTC
Created attachment 304277 [details] [review]
patch
Comment 13 Stefan Sauer (gstreamer, gtkdoc dev) 2015-05-29 16:53:32 UTC
The following fix has been pushed:
d5b16ed Support highlight options
Comment 14 Stefan Sauer (gstreamer, gtkdoc dev) 2015-05-29 16:53:40 UTC
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.