summaryrefslogtreecommitdiff
path: root/gtkdoc-fixxref.in
diff options
context:
space:
mode:
authorDexter Chua <dalcde@yahoo.com.hk>2015-05-25 08:48:06 +0100
committerStefan Sauer <ensonic@users.sf.net>2015-05-29 18:50:36 +0200
commitd5b16edb73d4609b33bc7833991026bea7f0236d (patch)
tree8c55e4e383c2cbe3424e41c1565f51ee98deaf3f /gtkdoc-fixxref.in
parent263b2084530d9e79574274273e49a04102214bdb (diff)
downloadgtk-doc-d5b16edb73d4609b33bc7833991026bea7f0236d.tar.gz
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. https://bugzilla.gnome.org/show_bug.cgi?id=749816
Diffstat (limited to 'gtkdoc-fixxref.in')
-rwxr-xr-xgtkdoc-fixxref.in15
1 files changed, 12 insertions, 3 deletions
diff --git a/gtkdoc-fixxref.in b/gtkdoc-fixxref.in
index a6256dd..774970c 100755
--- a/gtkdoc-fixxref.in
+++ b/gtkdoc-fixxref.in
@@ -40,15 +40,17 @@ my $HTML_DIR = "";
my @EXTRA_DIRS;
my $PRINT_VERSION;
my $PRINT_HELP;
+my $SRC_LANG;
my %optctl = ('module' => \$MODULE,
'module-dir' => \$MODULE_DIR,
'html-dir' => \$HTML_DIR,
'extra-dir' => \@EXTRA_DIRS,
'version' => \$PRINT_VERSION,
- 'help' => \$PRINT_HELP);
+ 'help' => \$PRINT_HELP,
+ 'src-lang' => \$SRC_LANG);
GetOptions(\%optctl, "module=s", "module-dir=s", "html-dir:s", "extra-dir=s@",
- "version", "help");
+ "src-lang=s", "version", "help");
if ($PRINT_VERSION) {
print "@VERSION@\n";
@@ -66,12 +68,19 @@ gtkdoc-fixxref version @VERSION@ - fix cross references in html files
--extra-dir=EXTRA_DIR Directories to recursively scan for indices (index.sgml)
in addition to HTML_DIR
May be used more than once for multiple directories
+--src-lang=SRC_LANG Programing language used for syntax highlighting. The
+ available languages depend on the source source
+ highlighter you use.
--version Print the version of this program
--help Print this help
EOF
exit 0;
}
+if (!$SRC_LANG) {
+ $SRC_LANG="c"
+}
+
# This contains all the entities and their relative URLs.
my %Links;
@@ -467,7 +476,7 @@ sub HighlightSourceVim {
close (NEWFILE);
# format source
- system "echo 'let html_number_lines=0|let html_use_css=1|let html_use_xhtml=1|syn on|e $temp_source_file|run! syntax/2html.vim|w! $temp_source_file.html|qa!' | @HIGHLIGHT@ -n -e -u NONE -T xterm >/dev/null";
+ system "echo 'let html_number_lines=0|let html_use_css=1|let html_use_xhtml=1|e $temp_source_file|syn on|set syntax=$SRC_LANG|run! syntax/2html.vim|w! $temp_source_file.html|qa!' | @HIGHLIGHT@ -n -e -u NONE -T xterm >/dev/null";
my $highlighted_source;
{