From 31bd1dd91c8d803a6c45ef9192b4ba11c7224501 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 20 Sep 2010 15:01:10 +0200 Subject: removed enforced spacing preceding inline literals --- rst_context.lua | 13 +++++++++++-- rst_helpers.lua | 5 +++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/rst_context.lua b/rst_context.lua index 34f4594..12c6817 100644 --- a/rst_context.lua +++ b/rst_context.lua @@ -118,6 +118,7 @@ function rst_context.strong_emphasis (str) end function rst_context.literal (str) + print(str) str = str:gsub([[\]], [[\\]]) -- evade escaping of backslashes return [[\\type{]] .. str .. [[}]] --return [[\\starttyping ]] .. str .. [[\\stoptyping]] @@ -270,6 +271,7 @@ local inline_parser = P{ + P"โ€ž", -- not in standard Murkin reST succede_inline = V"spacing" + + V"eol" + S[['")]}>-/:.,;!?\]] + P"โ€™" + P"โ€" + P"ยป" + V"inline_delimiter" @@ -468,11 +470,18 @@ function rst_context.paragraph (data) local str if not data then return "" + --elseif type(data) == "table" then + --str = #data > 1 and helpers.string.wrapat(inline_parser:match(table.concat(data, " ")), 65) or data[1] elseif type(data) == "table" then - str = #data > 1 and helpers.string.wrapat(inline_parser:match(table.concat(data, " ")), 65) or data[1] + str = table.concat(data, " ") + str = inline_parser:match(str) + str = helpers.string.wrapat(str) + print(str) + --str = #data > 1 and helpers.string.wrapat(inline_parser:match(table.concat(data, " ")), 65) or data[1] else str = data end + --print(str) return string.format([[ \\startparagraph @@ -1587,7 +1596,7 @@ function optional_setups.danger () \def\startRSTdanger{% \startparagraph -\lettrine[Lines=2,Raise=.5,Findent=1em,Nindent=0pt]{\symbol[dbend]\symbol[dbend]}{}% +\lettrine[Lines=2,Raise=.5,Findent=1em,Nindent=0pt]{\symbol[dbend]\kern 1pt\symbol[dbend]}{}% } \let\stopRSTdanger\stopparagraph diff --git a/rst_helpers.lua b/rst_helpers.lua index 49014f4..92f41a2 100644 --- a/rst_helpers.lua +++ b/rst_helpers.lua @@ -593,13 +593,14 @@ do wrapper = Cs(V"nowhitespace"^0 * (Cs(V"wrapme") + V"other")^1), whitespace = S" \t\v" + P"\n" / function() linelength = 0 end, nowhitespace = 1 - V"whitespace", - ignore = P"\\type{" * (1 - P"}")^1 * P"}", - other = Cmt(V"whitespace"^1 * (V"ignore" + (1 - V"whitespace")^1), function(s,i,w) + ignore = P[[\\type{]] * (1 - P"}")^0 * P"}", + other = Cmt(V"whitespace"^0 * (V"ignore" + (1 - V"whitespace")^1), function(s,i,w) linelength = linelength + ulen(w) return true end), wrapme = Cmt(V"whitespace"^1 * (1 - V"whitespace" - V"ignore")^1, function(s,i,w) local lw = ulen(w) + print(w) if linelength + lw > width then linelength = lw return true -- cgit v1.2.3