Commits

Taylor Venable  committed 04e6e74

Escape backslashes correctly.

  • Participants
  • Parent commits 3e7cf4f

Comments (0)

Files changed (1)

File tensile.tnsl

 
 function generateDoc(ir, output, start)
     local stream = io.open(output, "w")
-    local texTrans = { ["{"] = "\\{", ["}"] = "\\}", ["_"] = "\\_" }
+    local texTrans = { ["{"] = "\\{", ["}"] = "\\}", ["_"] = "\\_",
+                       ["\\"] = "\\textbackslash{}" }
     local function GenerateDoc(ir, stream, start)
         for i = start or 1, #ir do
             local v = ir[i]
             if v.type == "code" then
-                stream:write((v.text:gsub("[{}_]", texTrans)))
+                stream:write((v.text:gsub("[{}_\\]", texTrans)))
                 stream:write("\n")
             elseif v.type == "ref" then
                 stream:write("\\LA{}" .. v.name .. "\\RA{}\n")