]> mj.ucw.cz Git - libucw.git/commitdiff
Doc. system: use better anchors
authorMichal Vaner <vorner@ucw.cz>
Sat, 13 Sep 2008 11:36:32 +0000 (13:36 +0200)
committerMichal Vaner <vorner@ucw.cz>
Sat, 13 Sep 2008 11:36:32 +0000 (13:36 +0200)
The anchor names are based on the name and type of identifier, not a
dull nothing telling number.

build/asciidoc-xhtml.conf
build/doc-defs
build/doc-extract

index 0ccac3f13c0978cf37ef1d33741fce33b83d8ad2..8eba6d28674618666e2924230dce4c6968a3deb2 100644 (file)
@@ -20,7 +20,7 @@ NULL=<tt>NULL</tt>
 <a href='{filename}.html'>{caption=<tt>[{filename}]</tt>}</a>
 
 [func_anchor-inlinemacro]
-<div class="literalblock" id="fun_{name}"><div class="content"><pre><tt>{prefix}:!:{params}</tt></pre></div></div>
+<div class="literalblock"><div class="content"><pre><tt>{prefix}:!:{params}</tt></pre></div></div>
 
 [func_auto_ref-inlinemacro]
 <a href='#fun_{name}'><tt>{all}</tt></a>
index c69885837ffba39524782df9b0cb56ecaee910c3..140cb2ed39c46e3d94cda9bfed8fdadea27ffe83 100755 (executable)
@@ -26,13 +26,13 @@ while( defined( my $line = <> ) ) {
 my %groups = (
        'enum' => 1,
        'struct' => 1,
-       'function' => 2,
-       'variable' => 3,
-       'define' => 4
+       'fun' => 2,
+       'var' => 3,
+       'def' => 4
 );
 
 foreach( sort { ( $groups{$a->[2]} <=> $groups{$b->[2]} ) or ( $a->[3] cmp $b->[3] ); } @dump ) {
-       my( $file, $num, $type, $name, $text ) = @{$_};
+       my( $file, $anchor, $type, $name, $text ) = @{$_};
        my $dircp = $dir;
        while( shift @{[ $dircp =~ /([^\/]+)/, "//" ]} eq shift @{[ $file =~ /([^\/]+)/, "///" ]} ) {
                $dircp =~ s/[^\/]+\/?//;
@@ -44,7 +44,7 @@ foreach( sort { ( $groups{$a->[2]} <=> $groups{$b->[2]} ) or ( $a->[3] cmp $b->[
        $file =~ s/\.[^.]+$//;
        $text =~ s/\(/!!PARENT_OPEN!!/g;
        $text =~ s/(\.\.\.)/\\$1/g;
-       print OUT "- <<$file:auto_$num,`$text`>>\n";
+       print OUT "- <<$file:$anchor,`$text`>>\n";
 }
 
 close OUT;
index 072b9237c1ba0b1125e47aa08a93e1cc10184f00..bfa93da89e60c4354248cf51daf1a38f9b83211a 100755 (executable)
@@ -34,9 +34,9 @@ sub detect( $ ) {
                 warn( "Unknown statement $_\n" );
                 return( '', 0, $_, $_ );
         }
-        return( 'define', 0, $1, $_ ) if( /#define\s+(\w+)/ );
-        return( 'function', 1, $1, $_ ) if( /(\w+)\(.*\)/ );
-        return( 'variable', 1, $1, $_ ) if( /\s(\w+);/ );
+        return( 'def', 0, $1, $_ ) if( /#define\s+(\w+)/ );
+        return( 'fun', 1, $1, $_ ) if( /(\w+)\(.*\)/ );
+        return( 'var', 1, $1, $_ ) if( /\s(\w+);/ );
         warn( "Unknown statement $_\n" );
         return( '', 0, $_, $_ );
 }
@@ -50,12 +50,12 @@ sub formatNote( $$ ) {
        print OUT "\n";
        print OUT "''''\n";
        chomp $head;
-       print OUT "[[auto_$id]]\n";
         my( $type, $semicolon, $name, $oneline ) = detect( $head );
        $oneline =~ s/\s+$//;
         $head =~ s/;?\s*$/;/ if( $semicolon );
        $head =~ s/(\.\.\.)/\\$1/g;
-       if( $type eq 'function' ) {
+       print OUT "[[${type}_$name]]\n";
+       if( $type eq 'fun' ) {
                print OUT "!!f!$head!!!\n\n";
        } else {
                print OUT "..................\n";
@@ -63,7 +63,7 @@ sub formatNote( $$ ) {
                print OUT "..................\n\n";
        }
        if( $hasdump ) {
-               print DUMP "$outname,$id,$type,$name,$oneline\n";
+               print DUMP "$outname,${type}_$name,$type,$name,$oneline\n";
                $id ++;
        }
        print OUT "$comment\n\n";