Commits

Taylor Venable committed 02ff61f

Add margin tags, create options.

  • Participants
  • Parent commits 04e6e74

Comments (0)

Files changed (1)

File tensile.tnsl

                 sublabel.minor = sublabel.minor + 1
             end
             stream:write("\\sublabel{" .. tostring(sublabel) .. "}")
-            stream:write("\\moddef{" .. v.name .. "~")
-            stream:write("{\\nwtagstyle{}\\subpageref{")
+            if g_opts.show_margin_tags then
+                stream:write("\\nwmargintag{{\\nwtagstyle{}\\subpageref{")
+                stream:write(tostring(sublabel))
+                stream:write("}}}")
+            end
+            stream:write("\\moddef{" .. v.name)
+            if g_opts.show_defn_page then
+                stream:write("~{\\nwtagstyle{}\\subpageref{")
+                local s = tostring(sublabel)
+                s = v.start and s:gsub("-%d+$", "-0") or s
+                stream:write(s .. "}}")
+            end
             if v.start then
-                stream:write((tostring(sublabel):gsub("-%d+$", "-0")))
-                stream:write("}}}\\plusendmoddef\n")
+                stream:write("}\\plusendmoddef\n")
                 GenerateDoc(ir.src[v.name], stream, v.start)
             else
-                stream:write(tostring(sublabel))
-                stream:write("}}}\\endmoddef\n")
+                stream:write("}\\endmoddef\n")
                 GenerateDoc(ir.src[v.name], stream)
             end
             stream:write("\\nwendcode{}\n")
 -- Where to write the TeX output.
 local weave_output = nil
 
+g_opts = {
+    show_margin_tags = true,
+    show_defn_page = true
+}
+
 for i,v in ipairs(arg) do
     if v:match("^-R") then
         units[#units + 1] = v:sub(3)