软件需求
以下软件包可用于Windows和Linux系统,并且是完整,有效的解决方案所必需的:
gvim - Used to export syntax highlighted source code to HTML.
moria - Colour scheme for syntax highlighting.
wkhtmltoimage - Used to convert HTML documents to PNG files.
gawk and sed - Text processing tools.
ImageMagick - Used to trim the PNG and add a border.
一般步骤
解决方案的工作原理如下:
Load the source code into an editor that can add splashes of colour.
Export the source code as an HTML document (with embedded FONT tags).
Strip the background attribute from the HTML document (to allow transparency).
Convert the HTML document to a PNG file.
Trim the PNG border.
Add a small, 25 pixel border around the image.
Delete temporary files.
该脚本为包含长度均小于80个字符的行的源文件生成宽度完全相同的图像。行长超过80个字符的源文件会生成足够宽的图像,以保留整行。
安装
将组件安装到以下位置: