added links for line numbers

Tue, 21 Apr 2015 10:11:37 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 21 Apr 2015 10:11:37 +0200
changeset 27
53fd8595378c
parent 26
05c3c6842aef
child 28
1be8ea902ef4

added links for line numbers

src/c2html.c file | annotate | diff | comparison | revisions
test/header.html file | annotate | diff | comparison | revisions
test/jheader.html file | annotate | diff | comparison | revisions
     1.1 --- a/src/c2html.c	Tue Apr 21 09:53:01 2015 +0200
     1.2 +++ b/src/c2html.c	Tue Apr 21 10:11:37 2015 +0200
     1.3 @@ -168,10 +168,16 @@
     1.4          // write line number
     1.5          if (showln) {
     1.6              WRITECONST(stream, out, "<span class=\"c2html-lineno\">");
     1.7 -            char lnbuf[16];
     1.8 -            int len = snprintf(lnbuf, 16, "%*d ", lnw, i+1);
     1.9 +            char lnbuf[128];
    1.10 +            int len;
    1.11 +            // line number link
    1.12 +            len = snprintf(lnbuf, 128, "<a name=\"l%d\" href=\"#l%d\">",
    1.13 +                i+1, i+1);
    1.14              out(lnbuf, 1, len, stream);
    1.15 -            WRITECONST(stream, out, "</span> ");
    1.16 +            // justified line number
    1.17 +            len = snprintf(lnbuf, 128, "%*d ", lnw, i+1);
    1.18 +            out(lnbuf, 1, len, stream);
    1.19 +            WRITECONST(stream, out, "</a></span> ");
    1.20          }
    1.21          
    1.22          // write formated (or plain) code line
     2.1 --- a/test/header.html	Tue Apr 21 09:53:01 2015 +0200
     2.2 +++ b/test/header.html	Tue Apr 21 10:11:37 2015 +0200
     2.3 @@ -3,8 +3,9 @@
     2.4    <head>
     2.5      <title>c2html</title>
     2.6      <style type="text/css">
     2.7 -      span.c2html-lineno {
     2.8 +      span.c2html-lineno a {
     2.9          font-style: italic;
    2.10 +        text-decoration: none;
    2.11          color: grey;
    2.12        }
    2.13        span.c2html-keyword {
     3.1 --- a/test/jheader.html	Tue Apr 21 09:53:01 2015 +0200
     3.2 +++ b/test/jheader.html	Tue Apr 21 10:11:37 2015 +0200
     3.3 @@ -3,8 +3,9 @@
     3.4    <head>
     3.5      <title>c2html</title>
     3.6      <style type="text/css">
     3.7 -      span.c2html-lineno {
     3.8 +      span.c2html-lineno a {
     3.9          font-style: italic;
    3.10 +        text-decoration: none;
    3.11          color: grey;
    3.12        }
    3.13        span.c2html-keyword {

mercurial