gtk-doc r652 - trunk



Author: stefkost
Date: Wed Jan 21 13:34:31 2009
New Revision: 652
URL: http://svn.gnome.org/viewvc/gtk-doc?rev=652&view=rev

Log:
	* TODO:
	* configure.in:
	* gtkdoc-fixxref.in:
	* style.css:
	  Match css of highlight with source-highlight. Handle line numbering by
	  our-selfs. Still stupid browsers copy '#' chars for each line number.



Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/configure.in
   trunk/gtkdoc-fixxref.in
   trunk/style.css

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Wed Jan 21 13:34:31 2009
@@ -192,18 +192,13 @@
 http://bugzilla.gnome.org/show_bug.cgi?id=536928
 We could also run a postprocessing script in gtkdoc-mkhtml/gtkdoc-fixxref
 
-perl modules:
-  http://search.cpan.org/~palant/Syntax-Highlight-Universal-0.4/Universal.pm
-  http://search.cpan.org/~jamadam/Syntax-Highlight-Engine-Simple-0.08/lib/Syntax/Highlight/Engine/Simple.pm
-  http://search.cpan.org/~hanje/Syntax-Highlight-Engine-Kate-0.04/lib/Syntax/Highlight/Engine/Kate.pod
-    - not packaged for ubuntu
 tools:
   source-highlight (/usr/bin/source-highlight)
-  source-highlight -i./tests/gobject/examples/gobject.c -o$HOME/temp/gobject.html -n -t4 -sc
-  source-highlight -i./tests/gobject/examples/gobject.c -o$HOME/temp/gobject.html -n -t4 -sc -cstyle.css --no-doc
-  source-highlight -i./tests/gobject/examples/gobject.c -o$HOME/temp/gobject.xml -n -t4 -sc -f docbook
+  source-highlight -itests/gobject/examples/gobject.c -o$HOME/temp/gobject.html -n -t4 -sc
+  source-highlight -itests/gobject/examples/gobject.c -o$HOME/temp/gobject.html -n -t4 -sc -cstyle.css --no-doc
+  source-highlight -itests/gobject/examples/gobject.c -o$HOME/temp/gobject.xml -n -t4 -sc -f docbook
 
-  highlight -itests/gobject/examples/gobject.c -o$HOME/temp/gobject.xml -l -H -f -j2
+  highlight -itests/gobject/examples/gobject.c -o$HOME/temp/gobject.xml -l -X -f -j2
 
 some tips about styling code listings in html
 http://www.tjkdesign.com/articles/how_to_style_a_code_listing.asp

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Wed Jan 21 13:34:31 2009
@@ -86,11 +86,11 @@
 HIGHLIGHT_OPTIONS=""
 AC_PATH_PROG([HIGHLIGHT], [source-highlight])
 if test -n "$HIGHLIGHT"; then
-  HIGHLIGHT_OPTIONS="-n -t4 -sc -cstyle.css --no-doc -i"
+  HIGHLIGHT_OPTIONS="-t4 -sc -cstyle.css --no-doc -i"
 else
   AC_PATH_PROG([HIGHLIGHT], [highlight])
   if test -n "$HIGHLIGHT"; then
-    HIGHLIGHT_OPTIONS="-l -H -f -j2"
+    HIGHLIGHT_OPTIONS="-X -f"
   fi
 fi
 AC_SUBST([HIGHLIGHT_OPTIONS])

Modified: trunk/gtkdoc-fixxref.in
==============================================================================
--- trunk/gtkdoc-fixxref.in	(original)
+++ trunk/gtkdoc-fixxref.in	Wed Jan 21 13:34:31 2009
@@ -313,13 +313,27 @@
     }
     elsif ("@HIGHLIGHT@" =~ m%/highlight%) {
         # need to rewrite the stylesheet classes
+        $highlighted_source =~ s%<span class="com">%<span class="comment">%gs;
+        $highlighted_source =~ s%<span class="dir">%<span class="preproc">%gs;
+        $highlighted_source =~ s%<span class="kwd">%<span class="function">%gs;
+        $highlighted_source =~ s%<span class="kwa">%<span class="keyword">%gs;
+        $highlighted_source =~ s%<span class="line">%<span class="linenum">%gs;
+        $highlighted_source =~ s%<span class="num">%<span class="number">%gs;
+        $highlighted_source =~ s%<span class="str">%<span class="string">%gs;
+        $highlighted_source =~ s%<span class="sym">%<span class="symbol">%gs;
     }
+    # chop of leading and trailing empty lines
+    $highlighted_source =~ s/^[\s\n]+//gs;
+    $highlighted_source =~ s/[\s\n]+$//gs;
+    # we should do own line-numbering
+    $highlighted_source =~ s%^(.*)$%<li>$1</li>%gm;
+    $highlighted_source =~ s%<li></li>%<li>&nbsp;</li>%gm;
     
     # remove temp file
     unlink ($temp_source_file)
 	|| die "Can't delete $temp_source_file: $!";
 
-    return "<div class=\"$type\"><pre class=\"programlisting\">$highlighted_source</pre></div>";
+    return "<div class=\"$type\"><ol class=\"code\">$highlighted_source</ol></div>";
 }
 
 

Modified: trunk/style.css
==============================================================================
--- trunk/style.css	(original)
+++ trunk/style.css	Wed Jan 21 13:34:31 2009
@@ -7,7 +7,7 @@
 }
 .programlisting
 {
-  /* tango:sk blue 0/1 */
+  /* tango:sky blue 0/1 */
   background: #e6f3ff;
   border: solid 1px #729fcf;
   padding: 0.5em;
@@ -197,16 +197,39 @@
 
 /* code listings */
 
-pre .cbracket   { color: #a40000; } /* tango: scarlet red 3 */
-pre .comment    { color: #a1a39d; } /* tango: aluminium 4 */
-pre .function   { color: #000000; font-weight: bold; }
-pre .function a { color: #11326b; font-weight: bold; } /* tango: sky blue 4 */
-pre .keyword    { color: #4e9a06; } /* tango: chameleon 3  */
-pre .linenum    { color: #babdb6; } /* tango: aluminium 3 */
-pre .normal     { color: #000000; }
-pre .number     { color: #75507b; } /* tango: plum 2 */
-pre .preproc    { color: #204a87; } /* tango: sky blue 3  */
-pre .string     { color: #c17d11; } /* tango: chocolate 2 */
-pre .type       { color: #000000; }
-pre .type a     { color: #11326b; } /* tango: sky blue 4 */
-pre .symbol     { color: #ce5c00; } /* tango: orange 3 */
+.code .cbracket   { color: #a40000; } /* tango: scarlet red 3 */
+.code .comment    { color: #a1a39d; } /* tango: aluminium 4 */
+.code .function   { color: #000000; font-weight: bold; }
+.code .function a { color: #11326b; font-weight: bold; } /* tango: sky blue 4 */
+.code .keyword    { color: #4e9a06; } /* tango: chameleon 3  */
+.code .linenum    { color: #babdb6; } /* tango: aluminium 3 */
+.code .normal     { color: #000000; }
+.code .number     { color: #75507b; } /* tango: plum 2 */
+.code .preproc    { color: #204a87; } /* tango: sky blue 3  */
+.code .string     { color: #c17d11; } /* tango: chocolate 2 */
+.code .type       { color: #000000; }
+.code .type a     { color: #11326b; } /* tango: sky blue 4 */
+.code .symbol     { color: #ce5c00; } /* tango: orange 3 */
+
+/* line numbers */
+ol.code
+{
+  margin: 0;
+  padding: 0em 0em 0em 2.5em;
+  font-family: "Courier New", Courier, monospace;
+  /*list-style-position: outside;*/
+  list-style-type: decimal-leading-zero;
+  /* tango:sky blue 0.5 */
+  background: #a6c5e3;
+  border: solid 1px #729fcf;
+  /* tango:aluminium 6 */
+  color: #2e3436;
+}
+ol.code li
+{
+  padding: 0em 0em 0em 0.5em;
+  /* tango:sky blue 0 */
+  background: #e6f3ff;
+  white-space: pre;
+}
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]