gtk-doc r649 - trunk



Author: stefkost
Date: Tue Jan 20 16:29:59 2009
New Revision: 649
URL: http://svn.gnome.org/viewvc/gtk-doc?rev=649&view=rev

Log:
	* TODO:
	  More ideas.
	* gtkdoc-fixxref.in:
	  Really fix double extension of entities.
	* style.css:
	  Fix link color of xrefs symbols.



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

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Tue Jan 20 16:29:59 2009
@@ -190,7 +190,8 @@
 colored frame and a warning sign /!\.
 == source code examples==
 http://bugzilla.gnome.org/show_bug.cgi?id=536928
-We could also run a postprocessing script in gtkdoc-mkhtml.
+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
@@ -204,10 +205,20 @@
 
   highlight -itests/gobject/examples/gobject.c -o$HOME/temp/gobject.xml -l -H -f -j2
 
+some tips about styling code listings in html
+http://www.tjkdesign.com/articles/how_to_style_a_code_listing.asp
+
+=== process docbook ===
 if we highlight to docbook, we just get emphasis (bold)
-if we hightlight to html we get colors, we need to cehck what tags we should process though:
+=== process html ===
+if we hightlight to html we get colors, we need to check what tags we should process though:
 <pre class="programlisting"> is used for all code boxes.
 <div class="informalexample"><pre class="programlisting"> is used for examples.
+problems:
+* in html we don't know the language anymore
+* with source-highlight, constants and types are not markedup.
+  for types we might need to build an own lang file dynamically and include
+  /usr/share/source-highlight/c.lang
 
 = documentation best practises #518427 =
 * we'd like offer a more complete skelleton

Modified: trunk/gtkdoc-fixxref.in
==============================================================================
--- trunk/gtkdoc-fixxref.in	(original)
+++ trunk/gtkdoc-fixxref.in	Tue Jan 20 16:29:59 2009
@@ -240,9 +240,11 @@
     $entire_file =~ s%<div class=\"(example-contents|informalexample)\"><pre class=\"programlisting\">(.*?)</pre></div>%&HighlightSource($1,$2);%gse;
     # from the highlighter we get all the functions marked up
     # now we could turn them into GTKDOCLINK items
-    $entire_file =~ s%<span class=\"function\">(.*?)</span>%&MakeGtkDocLink($1);%gse;
+    $entire_file =~ s%(<span class=\"function\">)(.*?)(</span>)%&MakeGtkDocLink($1,$2,$3);%gse;
+    # we could also try the first item in stuff marked up as 'normal'
+    #$entire_file =~ s%(<span class=\"normal\">\s*)(.*?)(\s*.*?</span>)%&MakeGtkDocLink($1,$2,$3);%gse;
 
-    $entire_file =~ s%<GTKDOCLINK\s+HREF="([^"]*)"\s*>(.*?)</GTKDOCLINK\s*>% &MakeXRef($1, $2); %gse;
+    $entire_file =~ s%<GTKDOCLINK\s+HREF="([^"]*)"\s*>(.*?)</GTKDOCLINK\s*>% &MakeXRef($1,$2); %gse;
 
     open (NEWFILE, ">$file.new")
 	|| die "Can't open $file: $!";
@@ -276,11 +278,12 @@
 }
 
 sub MakeGtkDocLink {
-    my ($symbol) = @_;
+    my ($pre,$symbol,$post) = @_;
     
     my $id=CreateValidSGMLID($symbol);
     
-    return "<span class=\"function\"><GTKDOCLINK HREF=\"$id\">$symbol</GTKDOCLINK></span>";
+    #return "<span class=\"$type\"><GTKDOCLINK HREF=\"$id\">$symbol</GTKDOCLINK></span>";
+    return "$pre<GTKDOCLINK HREF=\"$id\">$symbol</GTKDOCLINK>$post";
 }
 
 sub HighlightSource {
@@ -289,6 +292,11 @@
     # chop of leading and trailing empty lines
     $source =~ s/^[\s\n]+//gs;
     $source =~ s/[\s\n]+$//gs;
+    # avoid double entity replacement
+    $source =~ s/&lt;/</g;
+    $source =~ s/&gt;/>/g;
+    $source =~ s/&amp;/&/g;
+
     # write source to a temp file
     my $temp_source_file="$MODULE_DIR/_temp_src.$$";
     open (NEWFILE, ">$temp_source_file") || die "Can't open $temp_source_file: $!";
@@ -304,10 +312,6 @@
     elsif ("@HIGHLIGHT@" =~ m%/highlight%) {
         # need to rewrite the stylesheet classes
     }
-    # revert double entity replacement
-    $highlighted_source =~ s/&amp;lt;/&lt;/g;
-    $highlighted_source =~ s/&amp;gt;/&gt;/g;
-    $highlighted_source =~ s/&amp;amp;/&amp;/g;
     
     # remove temp file
     unlink ($temp_source_file)

Modified: trunk/style.css
==============================================================================
--- trunk/style.css	(original)
+++ trunk/style.css	Tue Jan 20 16:29:59 2009
@@ -197,13 +197,16 @@
 
 /* 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 .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 .symbol   { color: #ce5c00; } /* tango: orange 3 */
+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 */



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