![Pandoc/LaTeX/Docx 中的条件样式](https://linux22.com/image/409459/Pandoc%2FLaTeX%2FDocx%20%E4%B8%AD%E7%9A%84%E6%9D%A1%E4%BB%B6%E6%A0%B7%E5%BC%8F.png)
我有一个使用 pandoc 和 make 构建的文档(在本例中是简历)。我根据传递给 make 的参数生成文档的不同版本。简历的内容由 Markdown 片段拼凑而成,这些片段在转换为 PDF 的过程中经过处理生成 LaTeX。
我希望能够以某种方式注释我的片段,以便当它们的类型与我想要强调的内容相匹配时,它们能够得到强调。有没有办法以某种方式有条件地控制文档的样式?
以下是 Makefile 的要点,以提供一些背景信息:
build_type ?= shortarch
role_type ?= arch
LONGCOMBINED = ./work/9999.work.combined.md ./work/2019.sportsbet.md ./work/2018.telstra.md ./work/2017.liberty.md <a bunch more files>
SHORTCOMBINED = ./work/9999.work.combined.md ./work/2019.sportsbet.md ./work/2018.telstra.md ./work/2017.liberty.md <a bunch more files>
<snip . . .>
ifeq ($(build_type),shortarch)
work = $(SHORTARCH)
role_type = arch
else ifeq ($(build_type),shorteng)
work = $(SHORTENG)
role_type = eng
else ifeq ($(build_type),longarch)
<snip . . .>
else
@echo 'wuuhhhh?'
endif
edu = $(shell ls ./edu/* | sort -r | head -n 6)
summary=./summary.$(role_type).md
src= metadata.yaml $(summary) $(work) $(edu) ./memberships.md ./pub.md ./skills.$(role_type).md ./interests.md
date=$(shell date --iso-8601)
output=./build/andrew_matthews.$(build_type).$(date)
pandoc_args=-f markdown+smart+yaml_metadata_block --pdf-engine=xelatex
.PHONY: all prep clean
all: prep $(output).pdf $(output).docx $(output).txt
prep:
@echo "building a $(build_type) resume"
mkdir -p build
clean:
rm -f ./build/*
$(output).docx: $(src)
pandoc -o $@ $(pandoc_args) $^
$(output).pdf: $(src)
pandoc -o $@ $(pandoc_args) $^
$(output).txt: $(src)
pandoc -o $@ $(pandoc_args) $^
letters:
pandoc --template=letters/template-letter.tex $(pandoc_args) letters/letter1.md -o build/letter1.pdf
条目如下所示:
### [UniSuper](http://www.unisuper.com.au)
_Technology Architect and Strategist_ - 2011 to 2017
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pellentesque vehicula orci ornare fringilla. Aenean sagittis congue sapien. Vestibulum tortor nulla, blandit viverra neque luctus, finibus dapibus mauris. Proin egestas quam ex, ac rutrum nibh iaculis eu. Praesent euismod sagittis odio ac convallis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin semper, erat venenatis consectetur blandit, arcu ex auctor purus, et porta nisi nulla in magna. Donec lobortis tempus ligula ac eleifend. Phasellus purus ipsum, hendrerit vel massa et, commodo suscipit tortor. Aenean sed tristique ligula. Fusce sit amet auctor ex, ut suscipit nulla. Fusce auctor turpis in arcu luctus eleifend vitae non augue.
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
- Donec gravida ante vitae leo vestibulum, ac condimentum erat venenatis.
- Sed rutrum augue vitae nunc rhoncus egestas.
- Suspendisse dapibus tellus eget turpis posuere, et tempor metus efficitur.
- Phasellus interdum odio quis dolor scelerisque mattis.
Skills: _Technical Leadership, Enterprise Architecture, Governance, Strategy, Digital Transformation, etc . . . _
因此,根据我是否要制作一份强调此类角色的简历,我可能希望将其变灰,或以某种方式缩小或缩进。问题是,虽然一些 Pandoc 方法可以与 docx 配合使用,但我主要针对的是 LaTeX,所以我更喜欢可以与任何输出格式配合使用的方法。