pre2html

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/pre2html.git/
Log | Files | Refs

commit 38583475a74914a4c9ef1012ff23a3fe747e0ae1
parent 5b5cd8decfcae04ceefaa891140a2d47f8c1dfec
Author: Tomas Hlavaty <tom@logand.com>
Date:   Tue,  6 Sep 2011 20:15:05 +0200

implement section anchor

Diffstat:
Mtext2html.c | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/text2html.c b/text2html.c @@ -90,10 +90,19 @@ int main() { printf("<div style=\"color:#080\">"); else if(head("END", b, e)) printf("</div>"); - else if(head("\f\n", b, e)) { + else if(head("\f", b, e)) { if(bold) printf("</div>"); - puts("<div style=\"font-weight:bold\">"); + printf("<div style=\"font-weight:bold\">"); + b++; bold = 1; + if('\n' != *b) { + printf("<a name=\""); + char *n = find('\n', b, e); + attr(b, n); + printf("\"></a>"); + b = n; + } + escape(*b++); } else if(bold && (tail("\n=", b, e) || tail("\n-", b, e))) { rest(b, e);