diff --git a/pandoc2review-lib.rb b/pandoc2review-lib.rb
index 996f7ce..662cd39 100644
--- a/pandoc2review-lib.rb
+++ b/pandoc2review-lib.rb
@@ -23,6 +23,10 @@ def main
if @disableeaw
args += ['-M', "softbreak:true"]
end
+
+ if @hideraw
+ args += ['-M', "hideraw:true"]
+ end
end
if @heading
@@ -43,6 +47,7 @@ def main
def parse_args
@heading = nil
@disableeaw = nil
+ @hideraw = nil
opts = OptionParser.new
opts.banner = 'Usage: pandoc2review [option] file [file ...]'
opts.version = '1.0'
@@ -57,6 +62,9 @@ def parse_args
opts.on('--disable-eaw', "Disable compositing a paragraph with Ruby's EAW library.") do
@disableeaw = true
end
+ opts.on('--hideraw', "Hide raw inline/block with no review format specified.") do
+ @hideraw = true
+ end
opts.parse!(ARGV)
if ARGV.size != 1
diff --git a/review.lua b/review.lua
index 3810c55..e5b80d0 100755
--- a/review.lua
+++ b/review.lua
@@ -534,11 +534,35 @@ function Span(s, attr)
end
function RawInline(format, text)
- return text
+ if (format == "review") then
+ return text
+ end
+
+ if (metadata.hideraw) then
+ return ""
+ end
+
+ if (format == "tex") then
+ return format_inline("embed", "|latex|" .. text)
+ else
+ return format_inline("embed", "|" .. format .. "|", text)
+ end
end
function RawBlock(format, text)
- return text
+ if (format == "review") then
+ return text
+ end
+
+ if (metadata.hideraw) then
+ return ""
+ end
+
+ if (format == "tex") then
+ return "//embed[latex]{\n" .. text .. "\n//}"
+ else
+ return "//embed[" .. format .. "]{\n" .. text .. "\n//}"
+ end
end
try_catch {
diff --git a/test/test_reviewlua.rb b/test/test_reviewlua.rb
index c30f160..9e01e36 100644
--- a/test/test_reviewlua.rb
+++ b/test/test_reviewlua.rb
@@ -755,6 +755,140 @@ def test_footnote
assert_equal expected, pandoc(src)
end
+ def test_raw
+ src = <<-EOB
+
+EOB
+
+ expected = <<-EOB
+//embed[html]{
+
+//}
+
+//embed[html]{
+
+//}
+
+//embed[html]{
+
+//}
+
+//embed[html]{
+
+//}
+
+TABLEHEAD
+
+//embed[html]{
+ |
+//}
+
+//embed[html]{
+
+//}
+
+//embed[html]{
+
+//}
+
+//embed[html]{
+
+//}
+
+//embed[html]{
+
+//}
+
+//embed[html]{
+
+//}
+
+Cell1
+
+//embed[html]{
+ |
+//}
+
+//embed[html]{
+
+//}
+
+Cell2
+
+//embed[html]{
+ |
+//}
+
+//embed[html]{
+
+//}
+
+//embed[html]{
+
+//}
+EOB
+ # Bit ugly...
+ assert_equal expected, pandoc(src)
+
+ expected = <<-EOB
+
+
+
+
+
+
+
+
+TABLEHEAD
+
+
+
+
+
+
+
+
+
+
+
+
+
+Cell1
+
+
+
+
+
+Cell2
+
+
+
+
+
+EOB
+ # bit ugly...
+ assert_equal expected, pandoc(src, opts: '-M hideraw')
+
+ src = <<-EOB
+$$ \\alpha = \\beta\\label{eqone}$$
+Refer equation (\\ref{eqone}).
+EOB
+
+ expected = <<-EOB
+@$\\displaystyle{} \\alpha = \\beta\\label{eqone}$ Refer equation (@