From 7dba56835cc4a7a130c1f57b5fb61be446b5cc31 Mon Sep 17 00:00:00 2001 From: Michal Vaner Date: Sat, 13 Sep 2008 13:36:32 +0200 Subject: [PATCH] Doc. system: use better anchors The anchor names are based on the name and type of identifier, not a dull nothing telling number. --- build/asciidoc-xhtml.conf | 2 +- build/doc-defs | 10 +++++----- build/doc-extract | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/build/asciidoc-xhtml.conf b/build/asciidoc-xhtml.conf index 0ccac3f1..8eba6d28 100644 --- a/build/asciidoc-xhtml.conf +++ b/build/asciidoc-xhtml.conf @@ -20,7 +20,7 @@ NULL=NULL {caption=[{filename}]} [func_anchor-inlinemacro] -
{prefix}:!:{params}
+
{prefix}:!:{params}
[func_auto_ref-inlinemacro] {all} diff --git a/build/doc-defs b/build/doc-defs index c6988583..140cb2ed 100755 --- a/build/doc-defs +++ b/build/doc-defs @@ -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; diff --git a/build/doc-extract b/build/doc-extract index 072b9237..bfa93da8 100755 --- a/build/doc-extract +++ b/build/doc-extract @@ -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"; -- 2.39.2