使Pandoc从html编写LaTex命令`<;引用>;`纯文本中的标记

使Pandoc从html编写LaTex命令`<;引用>;`纯文本中的标记,pandoc,Pandoc,我试图修改一些代码,允许人们在项目目录中编译可能采用多种格式的代码,例如HTML、LaTex、markdown,使用Pandoc(好的,Pypandoc)。我在HTML文件中有一些代码,如下所示: <h1 data-label="850151" class="ltx_title_section">A heading</h1><h2 data-label="367935" class="ltx_title_subsection">Another heading&

我试图修改一些代码,允许人们在项目目录中编译可能采用多种格式的代码,例如HTML、LaTex、markdown,使用Pandoc(好的,Pypandoc)。我在HTML文件中有一些代码,如下所示:

<h1 data-label="850151" class="ltx_title_section">A heading</h1><h2 data-label="367935" class="ltx_title_subsection">Another heading</h2><div><cite class="ltx_cite raw v1">\cite{ebert_epidemiology_2013}</cite></div><div>Figure <span class="au-ref raw v1">\ref{286335}</span></div><div></div>
当然,期望的输出是

...
\section{A heading}\label{a-heading}

\subsection{Another heading}\label{another-heading}

\cite{ebert_epidemiology_2013}

\ref{286335}
...
我想,如果我能让Pandoc去掉
标记并以纯文本形式编写引用命令,那就行了。我知道Pandoc过滤器是一种东西,但我不确定这是否是我所需要的。

是的,您可以使用a来去除引用标签

如果使用
pandoc-f html+raw_html-t native
,您会看到
bar
被呈现为:

RawInline (Format "html") "<cite>",Str "bar",RawInline (Format "html") "</cite>"

由于原始LaTeX嵌入到纯文本中,使用如下筛选器将字符串重新解释为LaTeX可能会有所帮助:
函数Str(s)返回pandoc.read(s.text,'LaTeX').blocks[1]。内容结束
我无法摆脱
(“”,[“au ref”,“raw”,“v1”],[])
来自我原始输入的AST表单。似乎(对我来说)没有一种明显的方法可以去除
标记。
RawInline (Format "html") "<cite>",Str "bar",RawInline (Format "html") "</cite>"