diff options
Diffstat (limited to 'pandoc.rb')
-rw-r--r-- | pandoc.rb | 29 |
1 files changed, 24 insertions, 5 deletions
@@ -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 |