在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)
答案 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
。