]> mj.ucw.cz Git - libucw.git/commitdiff
Documentation system: generate anchors/ids for functions
authorMichal Vaner <vorner@ucw.cz>
Mon, 18 Aug 2008 14:37:40 +0000 (16:37 +0200)
committerMartin Mares <mj@ucw.cz>
Mon, 25 Aug 2008 21:39:25 +0000 (23:39 +0200)
When a function documentation is found, a fun_name_of_the_function
anchor (id html attribute) is added to it so links can jump there.

build/docconfig
build/extract-doc.pl
ucw/fastbuf.h

index a80cdf65938ead4166bd077dbe4d1ae548de42ff..16105434286454e4054dba18f15080d6e417c8e6 100644 (file)
@@ -1,3 +1,5 @@
 [replacements]
 @(\w+)=<i><tt>\1</tt></i>
+!!f!((.*\W|)(\w+))(\([^()]*\).*)!!!=<div class="literalblock" id="fun_\3"><div class="content"><pre><tt>!?\1!?\4!?</tt></pre></div></div>
 ((\w+)\([^()]*\))=<a href='#fun_\2'><tt>\1</tt></a>
+!\?((.*\W|)(\w+))!\?(\([^()]*\).*)!\?=\1\4
index 4b700c14488a3c0bea9c5ef0dc013bf59dd4cbe3..392dd4096c2e5f573548de9ba9fac6d3b88028fd 100755 (executable)
@@ -26,9 +26,14 @@ sub formatNote( $$ ) {
        $head =~ s/(\S)[ ]+/$1 /g;
        print OUT "\n";
        print OUT "''''\n";
-       print OUT "..................\n";
-       print OUT "$head\n";
-       print OUT "..................\n\n";
+       chomp $head;
+       if($head =~ /\w+\([^()]*\)/ && $head !~ /\n/) {
+               print OUT "!!f!$head!!!\n\n";
+       } else {
+               print OUT "..................\n";
+               print OUT "$head\n";
+               print OUT "..................\n\n";
+       }
        print OUT "$comment\n\n";
 }
 
index b912ca004b4fa8c3910dc932f9543b9579b0fb1d..4a17bfdf4d3d38042dab7c14594c336e6784752f 100644 (file)
@@ -551,7 +551,8 @@ bdirect_write_commit(struct fastbuf *f, byte *pos)
 /**
  * printf into a fastbuf.
  **/
-int bprintf(struct fastbuf *b, const char *msg, ...) FORMAT_CHECK(printf,2,3);
+int bprintf(struct fastbuf *b, const char *msg, ...)
+  FORMAT_CHECK(printf,2,3);
 int vbprintf(struct fastbuf *b, const char *msg, va_list args); /** vprintf into a fastbuf. **/
 
 #endif