也许显而易见,但C预处理器可以完成这项工作.
index._html
#define _em(a) a
#define _image(a, b)
#define _list(a, b, c)
a
\- \
- b \
- c \
#define _theTile The Bar Title
#include "head._html"
_list(foo, bar, bean)
This is really _em(great)
_image(media/cat.jpg, )
_image(media/dog.jpg, width="25%" height="10px")
是head._html
_theTile然后,
cpp -P index._html > index.html
生产:
The Bar Titlefoo
- bar
- bean
This is really great