src/c2html.c

changeset 27
53fd8595378c
parent 25
f82aa7afe872
child 30
0bfd4d6f086a
--- a/src/c2html.c	Tue Apr 21 09:53:01 2015 +0200
+++ b/src/c2html.c	Tue Apr 21 10:11:37 2015 +0200
@@ -168,10 +168,16 @@
         // write line number
         if (showln) {
             WRITECONST(stream, out, "<span class=\"c2html-lineno\">");
-            char lnbuf[16];
-            int len = snprintf(lnbuf, 16, "%*d ", lnw, i+1);
+            char lnbuf[128];
+            int len;
+            // line number link
+            len = snprintf(lnbuf, 128, "<a name=\"l%d\" href=\"#l%d\">",
+                i+1, i+1);
             out(lnbuf, 1, len, stream);
-            WRITECONST(stream, out, "</span> ");
+            // justified line number
+            len = snprintf(lnbuf, 128, "%*d ", lnw, i+1);
+            out(lnbuf, 1, len, stream);
+            WRITECONST(stream, out, "</a></span> ");
         }
         
         // write formated (or plain) code line

mercurial