pandoc:过滤器中的“ RawBlock”

时间:2019-06-15 18:31:32

标签: pandoc pypandoc

在Pandoc过滤器中正确使用RawBlock函数是什么?

#!/usr/bin/env python

from pandocfilters import toJSONFilter, Str, Para, Emph, Header, RawBlock
import re

def replace(key, value, format, meta):
    if key == 'Str':
        if value.startswith('Hello'):
            #return Str("Hi")  # this works
            return RawBlock("opendocument", "Hi")  # this doesn't

if __name__ == '__main__':
    toJSONFilter(replace)

1 个答案:

答案 0 :(得分:2)

您正在尝试将 Inline 值(public static string LastPickValue { get => AppSettings.GetValueOrDefault(nameof(LastPickValue), string.Empty); set => AppSettings.AddOrUpdateValue(nameof(LastPickValue), value); } )替换为 Block 值(/usr/local/bin)。只能用相同类型的元素替换元素。使用Str代替RawBlock