我正在使用名为lilypond
. 它能够将自己的类文本符号标记语言编译成各种格式,其中包括png
文件。
附带的另一个命令lilypond
是它的同伴
lilypond-book
,它将编译任何包含<lilypond>
标签的文档,并在该位置放置如下代码片段:
<p>
<a href="10/lily-9f8f7b5d.ly">
<img align="middle" border="0" src="10/lily-9f8f7b5d.png"
alt="[image of music]">
</a>
</p>
所以我的愿望是,作为一个超级粉丝,VIM
使用它的过滤功能并自动化这种工作,例如,当我在这样的文档中时:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>html-with-notation</title>
</head>
<body>
This is some text, before including lilypond notation file
And here is the melody:
<lilypondfile>andantino.ly</lilypondfile>/* <-- TAG THAT WILL BE RECOGNIZED BY LILYPOND-BOOK */
Enjoy!
</body>
</html>
..我想<lilypond>
用生成的输出替换那个标签lilypond-book
用命令但这并不是那么简单,因为lilypond-book
不写入 astdout
而是写入一个名为stdin.html
. (它会自动命名它,识别输入来自那里)
所以在运行这个时:
:.!lilypond-book -f html - 2>/dev/null
// ( with errors redirected to `/dev/null` to prevent polluting my buffer with messages being output.)
我什么也得不到,这当然是意料之中的,因为所有的输出都到了一个文件中。
stdin.html
在从部分完成所有处理后,我现在如何读回该文件lilypond-book
在我的 vim 缓冲区中当然,一气呵成,无需手动操作:r stdin.html
。
另外作为奖励,在我处理文件的情况下,是否可以在将该 stdin.html 读入缓冲区之前对其进行处理pandoc
以将其转换为第一个?markdown
markdown