summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-02-13 15:17:16 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2017-02-13 15:17:16 -0500
commitaa57e8d6e2c1c286f57bc38832a497abe73dc699 (patch)
tree876d3ca61b179eb994090aa300147b75706004a8 /lib
parent085619b2618638cad3b13121399ca06fbd805044 (diff)
update lib/pandoc.rb for new pandoc version
Diffstat (limited to 'lib')
-rw-r--r--lib/pandoc.rb29
1 files changed, 24 insertions, 5 deletions
diff --git a/lib/pandoc.rb b/lib/pandoc.rb
index 9c12351..8c51cb4 100644
--- a/lib/pandoc.rb
+++ b/lib/pandoc.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
require 'open3'
require 'json'
@@ -37,7 +38,11 @@ module Pandoc
end
def [](key)
- Pandoc::AST::js2sane(@js[0]["unMeta"][key])
+ Pandoc::AST::js2sane(@js["meta"][key])
+ end
+
+ def js
+ @js
end
def to(format)
@@ -61,16 +66,30 @@ module Pandoc
return js
end
case js["t"]
+ when "MetaMap"
+ Hash[js["c"].map{|k,v| [k, js2sane(v)]}]
when "MetaList"
js["c"].map{|c| js2sane(c)}
- when "MetaInlines"
- js["c"].map{|c| js2sane(c)}.join()
- when "Space"
- " "
+ when "MetaBool"
+ js["c"]
when "MetaString"
js["c"]
+ when "MetaInlines"
+ js["c"].map{|c| js2sane(c)}.join()
+ when "MetaBlocks"
+ js["c"].map{|c| js2sane(c)}.join("\n")
when "Str"
js["c"]
+ when "Space"
+ " "
+ when "RawInline"
+ js["c"][1]
+ when "RawBlock"
+ js["c"][1]
+ when "Para"
+ js["c"].map{|c| js2sane(c)}.join()
+ else
+ raise "Unexpected AST node type '#{js["t"]}'"
end
end
end