test_highlight: use only local links
authorJean Privat <jean@pryen.org>
Mon, 13 Jun 2016 20:45:39 +0000 (16:45 -0400)
committerJean Privat <jean@pryen.org>
Wed, 15 Jun 2016 23:07:03 +0000 (19:07 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/test_highlight.nit

index 96d0835..13384f6 100644 (file)
@@ -18,9 +18,16 @@ module test_highlight
 import highlight
 import test_phase
 
+class TestHighlightVisitor
+       super HighlightVisitor
+       redef fun hrefto(e) do
+               return "#" + e.c_name
+       end
+end
+
 redef fun do_work(mainmodule, mmodules, mb)
 do
-       var v = new HighlightVisitor
+       var v = new TestHighlightVisitor
        print """<head>
        <meta charset="utf-8">
        <style type="text/css">
@@ -33,9 +40,9 @@ do
        for mm in mmodules do for cd in mm.mclassdefs do for pd in cd.mpropdefs do
                var n = mb.mpropdef2node(pd)
                if not n isa APropdef then continue
-               var hl = new HighlightVisitor
+               var hl = new TestHighlightVisitor
                hl.enter_visit(n)
-               print "<h1>{pd.full_name}</h1>"
+               print "<h1 id=\"{pd.c_name}\">{pd.full_name}</h1>"
                printn "<pre><code>"
                hl.html.write_to(stdout)
                print "</code></pre>"
@@ -61,7 +68,7 @@ class THLVisitor
                if not seen.has(cn) then
                        seen.add cn
 
-                       var hl = new HighlightVisitor
+                       var hl = new TestHighlightVisitor
                        hl.enter_visit(n)
                        print "<h2>AST node: {cn} at {n.location}</h2>"
                        printn "<pre><code>"