mizuho 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. data/LICENSE.txt +20 -0
  2. data/README.markdown +61 -0
  3. data/Rakefile +41 -0
  4. data/asciidoc/BUGS +39 -0
  5. data/asciidoc/BUGS.txt +32 -0
  6. data/asciidoc/CHANGELOG +1796 -0
  7. data/asciidoc/CHANGELOG.txt +1810 -0
  8. data/asciidoc/COPYING +339 -0
  9. data/asciidoc/COPYRIGHT +18 -0
  10. data/asciidoc/INSTALL +76 -0
  11. data/asciidoc/INSTALL.txt +71 -0
  12. data/asciidoc/Makefile.in +161 -0
  13. data/asciidoc/README +46 -0
  14. data/asciidoc/README.txt +36 -0
  15. data/asciidoc/a2x +674 -0
  16. data/asciidoc/asciidoc.conf +455 -0
  17. data/asciidoc/asciidoc.py +4998 -0
  18. data/asciidoc/common.aap +9 -0
  19. data/asciidoc/configure +2840 -0
  20. data/asciidoc/configure.ac +11 -0
  21. data/asciidoc/dblatex/asciidoc-dblatex.sty +20 -0
  22. data/asciidoc/dblatex/asciidoc-dblatex.xsl +32 -0
  23. data/asciidoc/dblatex/dblatex-readme.txt +39 -0
  24. data/asciidoc/doc/a2x.1 +257 -0
  25. data/asciidoc/doc/a2x.1.txt +204 -0
  26. data/asciidoc/doc/article.css-embedded.html +602 -0
  27. data/asciidoc/doc/article.html +46 -0
  28. data/asciidoc/doc/article.pdf +0 -0
  29. data/asciidoc/doc/article.txt +122 -0
  30. data/asciidoc/doc/asciidoc-revhistory.xml +27 -0
  31. data/asciidoc/doc/asciidoc.1 +155 -0
  32. data/asciidoc/doc/asciidoc.1.css-embedded.html +598 -0
  33. data/asciidoc/doc/asciidoc.1.css.html +212 -0
  34. data/asciidoc/doc/asciidoc.1.html +190 -0
  35. data/asciidoc/doc/asciidoc.1.txt +118 -0
  36. data/asciidoc/doc/asciidoc.conf +8 -0
  37. data/asciidoc/doc/asciidoc.css-embedded.html +7853 -0
  38. data/asciidoc/doc/asciidoc.css.html +7416 -0
  39. data/asciidoc/doc/asciidoc.dict +733 -0
  40. data/asciidoc/doc/asciidoc.html +3339 -0
  41. data/asciidoc/doc/asciidoc.txt +4979 -0
  42. data/asciidoc/doc/asciimathml.txt +64 -0
  43. data/asciidoc/doc/book-multi.css-embedded.html +575 -0
  44. data/asciidoc/doc/book-multi.html +55 -0
  45. data/asciidoc/doc/book-multi.txt +155 -0
  46. data/asciidoc/doc/book.css-embedded.html +607 -0
  47. data/asciidoc/doc/book.html +43 -0
  48. data/asciidoc/doc/book.txt +131 -0
  49. data/asciidoc/doc/customers.csv +18 -0
  50. data/asciidoc/doc/docbook-xsl.css +272 -0
  51. data/asciidoc/doc/faq.txt +547 -0
  52. data/asciidoc/doc/latex-backend.html +117 -0
  53. data/asciidoc/doc/latex-backend.txt +191 -0
  54. data/asciidoc/doc/latexmath.txt +244 -0
  55. data/asciidoc/doc/latexmathml.txt +41 -0
  56. data/asciidoc/doc/main.aap +297 -0
  57. data/asciidoc/doc/music-filter.html +566 -0
  58. data/asciidoc/doc/music-filter.pdf +0 -0
  59. data/asciidoc/doc/music-filter.txt +158 -0
  60. data/asciidoc/doc/source-highlight-filter.html +214 -0
  61. data/asciidoc/doc/source-highlight-filter.pdf +0 -0
  62. data/asciidoc/doc/source-highlight-filter.txt +203 -0
  63. data/asciidoc/docbook-xsl/asciidoc-docbook-xsl.txt +43 -0
  64. data/asciidoc/docbook-xsl/chunked.xsl +19 -0
  65. data/asciidoc/docbook-xsl/common.xsl +67 -0
  66. data/asciidoc/docbook-xsl/fo.xsl +149 -0
  67. data/asciidoc/docbook-xsl/htmlhelp.xsl +17 -0
  68. data/asciidoc/docbook-xsl/manpage.xsl +31 -0
  69. data/asciidoc/docbook-xsl/text.xsl +50 -0
  70. data/asciidoc/docbook-xsl/xhtml.xsl +14 -0
  71. data/asciidoc/docbook.conf +721 -0
  72. data/asciidoc/examples/website/ASCIIMathML.js +938 -0
  73. data/asciidoc/examples/website/CHANGELOG.html +4389 -0
  74. data/asciidoc/examples/website/CHANGELOG.txt +1810 -0
  75. data/asciidoc/examples/website/INSTALL.html +161 -0
  76. data/asciidoc/examples/website/INSTALL.txt +71 -0
  77. data/asciidoc/examples/website/LaTeXMathML.js +1223 -0
  78. data/asciidoc/examples/website/README-website.html +118 -0
  79. data/asciidoc/examples/website/README-website.txt +29 -0
  80. data/asciidoc/examples/website/README.html +125 -0
  81. data/asciidoc/examples/website/README.txt +36 -0
  82. data/asciidoc/examples/website/a2x.1.html +419 -0
  83. data/asciidoc/examples/website/a2x.1.txt +204 -0
  84. data/asciidoc/examples/website/asciidoc-docbook-xsl.html +130 -0
  85. data/asciidoc/examples/website/asciidoc-docbook-xsl.txt +43 -0
  86. data/asciidoc/examples/website/asciidoc-graphviz-sample.txt +130 -0
  87. data/asciidoc/examples/website/asciimathml.txt +64 -0
  88. data/asciidoc/examples/website/build-website.sh +25 -0
  89. data/asciidoc/examples/website/customers.csv +18 -0
  90. data/asciidoc/examples/website/downloads.html +257 -0
  91. data/asciidoc/examples/website/downloads.txt +121 -0
  92. data/asciidoc/examples/website/faq.html +673 -0
  93. data/asciidoc/examples/website/faq.txt +547 -0
  94. data/asciidoc/examples/website/index.html +419 -0
  95. data/asciidoc/examples/website/index.txt +245 -0
  96. data/asciidoc/examples/website/latex-backend.html +535 -0
  97. data/asciidoc/examples/website/latex-backend.txt +191 -0
  98. data/asciidoc/examples/website/latexmathml.txt +41 -0
  99. data/asciidoc/examples/website/layout1.conf +161 -0
  100. data/asciidoc/examples/website/layout1.css +65 -0
  101. data/asciidoc/examples/website/layout2.conf +158 -0
  102. data/asciidoc/examples/website/layout2.css +93 -0
  103. data/asciidoc/examples/website/manpage.html +266 -0
  104. data/asciidoc/examples/website/manpage.txt +118 -0
  105. data/asciidoc/examples/website/music-filter.html +242 -0
  106. data/asciidoc/examples/website/music-filter.txt +158 -0
  107. data/asciidoc/examples/website/music1.abc +12 -0
  108. data/asciidoc/examples/website/music1.png +0 -0
  109. data/asciidoc/examples/website/music2.ly +9 -0
  110. data/asciidoc/examples/website/music2.png +0 -0
  111. data/asciidoc/examples/website/newlists.txt +40 -0
  112. data/asciidoc/examples/website/newtables.txt +397 -0
  113. data/asciidoc/examples/website/sample1.png +0 -0
  114. data/asciidoc/examples/website/sample3.png +0 -0
  115. data/asciidoc/examples/website/sample4.png +0 -0
  116. data/asciidoc/examples/website/source-highlight-filter.html +286 -0
  117. data/asciidoc/examples/website/source-highlight-filter.txt +203 -0
  118. data/asciidoc/examples/website/support.html +78 -0
  119. data/asciidoc/examples/website/support.txt +5 -0
  120. data/asciidoc/examples/website/toc.js +69 -0
  121. data/asciidoc/examples/website/userguide.html +7460 -0
  122. data/asciidoc/examples/website/userguide.txt +4979 -0
  123. data/asciidoc/examples/website/version83.txt +37 -0
  124. data/asciidoc/examples/website/version9.html +143 -0
  125. data/asciidoc/examples/website/version9.txt +48 -0
  126. data/asciidoc/examples/website/xhtml11-manpage.css +18 -0
  127. data/asciidoc/examples/website/xhtml11-quirks.css +41 -0
  128. data/asciidoc/examples/website/xhtml11.css +328 -0
  129. data/asciidoc/filters/code/code-filter-readme.txt +37 -0
  130. data/asciidoc/filters/code/code-filter-test.txt +15 -0
  131. data/asciidoc/filters/code/code-filter.conf +8 -0
  132. data/asciidoc/filters/code/code-filter.py +239 -0
  133. data/asciidoc/filters/graphviz/asciidoc-graphviz-sample.txt +130 -0
  134. data/asciidoc/filters/graphviz/graphviz-filter.conf +39 -0
  135. data/asciidoc/filters/graphviz/graphviz2png.py +154 -0
  136. data/asciidoc/filters/music/music-filter-test.txt +40 -0
  137. data/asciidoc/filters/music/music-filter.conf +40 -0
  138. data/asciidoc/filters/music/music2png.py +189 -0
  139. data/asciidoc/filters/source/source-highlight-filter-test.txt +19 -0
  140. data/asciidoc/filters/source/source-highlight-filter.conf +108 -0
  141. data/asciidoc/help.conf +213 -0
  142. data/asciidoc/html4.conf +460 -0
  143. data/asciidoc/images/highlighter.png +0 -0
  144. data/asciidoc/images/icons/README +5 -0
  145. data/asciidoc/images/icons/callouts/1.png +0 -0
  146. data/asciidoc/images/icons/callouts/10.png +0 -0
  147. data/asciidoc/images/icons/callouts/11.png +0 -0
  148. data/asciidoc/images/icons/callouts/12.png +0 -0
  149. data/asciidoc/images/icons/callouts/13.png +0 -0
  150. data/asciidoc/images/icons/callouts/14.png +0 -0
  151. data/asciidoc/images/icons/callouts/15.png +0 -0
  152. data/asciidoc/images/icons/callouts/2.png +0 -0
  153. data/asciidoc/images/icons/callouts/3.png +0 -0
  154. data/asciidoc/images/icons/callouts/4.png +0 -0
  155. data/asciidoc/images/icons/callouts/5.png +0 -0
  156. data/asciidoc/images/icons/callouts/6.png +0 -0
  157. data/asciidoc/images/icons/callouts/7.png +0 -0
  158. data/asciidoc/images/icons/callouts/8.png +0 -0
  159. data/asciidoc/images/icons/callouts/9.png +0 -0
  160. data/asciidoc/images/icons/caution.png +0 -0
  161. data/asciidoc/images/icons/example.png +0 -0
  162. data/asciidoc/images/icons/home.png +0 -0
  163. data/asciidoc/images/icons/important.png +0 -0
  164. data/asciidoc/images/icons/next.png +0 -0
  165. data/asciidoc/images/icons/note.png +0 -0
  166. data/asciidoc/images/icons/prev.png +0 -0
  167. data/asciidoc/images/icons/tip.png +0 -0
  168. data/asciidoc/images/icons/up.png +0 -0
  169. data/asciidoc/images/icons/warning.png +0 -0
  170. data/asciidoc/images/smallnew.png +0 -0
  171. data/asciidoc/images/tiger.png +0 -0
  172. data/asciidoc/install-sh +201 -0
  173. data/asciidoc/javascripts/ASCIIMathML.js +938 -0
  174. data/asciidoc/javascripts/LaTeXMathML.js +1223 -0
  175. data/asciidoc/javascripts/toc.js +69 -0
  176. data/asciidoc/lang-es.conf +15 -0
  177. data/asciidoc/latex.conf +663 -0
  178. data/asciidoc/stylesheets/docbook-xsl.css +272 -0
  179. data/asciidoc/stylesheets/xhtml11-manpage.css +18 -0
  180. data/asciidoc/stylesheets/xhtml11-quirks.css +41 -0
  181. data/asciidoc/stylesheets/xhtml11.css +328 -0
  182. data/asciidoc/text.conf +16 -0
  183. data/asciidoc/vim/ftdetect/asciidoc_filetype.vim +53 -0
  184. data/asciidoc/vim/syntax/asciidoc.vim +165 -0
  185. data/asciidoc/wordpress.conf +48 -0
  186. data/asciidoc/xhtml11-quirks.conf +57 -0
  187. data/asciidoc/xhtml11.conf +645 -0
  188. data/bin/mizuho +47 -0
  189. data/bin/mizuho-asciidoc +4 -0
  190. data/lib/mizuho.rb +10 -0
  191. data/lib/mizuho/chapter.rb +54 -0
  192. data/lib/mizuho/generator.rb +134 -0
  193. data/lib/mizuho/heading.rb +46 -0
  194. data/lib/mizuho/parser.rb +103 -0
  195. data/lib/mizuho/source_highlight.rb +2 -0
  196. data/lib/mizuho/template.rb +50 -0
  197. data/source-highlight/ada.lang +38 -0
  198. data/source-highlight/bib.lang +6 -0
  199. data/source-highlight/bison.lang +3 -0
  200. data/source-highlight/c.lang +41 -0
  201. data/source-highlight/c_comment.lang +27 -0
  202. data/source-highlight/c_string.lang +9 -0
  203. data/source-highlight/caml.lang +16 -0
  204. data/source-highlight/changelog.lang +8 -0
  205. data/source-highlight/clike_vardeclaration.lang +4 -0
  206. data/source-highlight/cpp.lang +15 -0
  207. data/source-highlight/csharp.lang +36 -0
  208. data/source-highlight/css.lang +14 -0
  209. data/source-highlight/css_common.outlang +26 -0
  210. data/source-highlight/darwin/source-highlight +0 -0
  211. data/source-highlight/default.css +51 -0
  212. data/source-highlight/default.lang +8 -0
  213. data/source-highlight/default.style +57 -0
  214. data/source-highlight/desktop.lang +7 -0
  215. data/source-highlight/diff.lang +32 -0
  216. data/source-highlight/docbook.outlang +36 -0
  217. data/source-highlight/esc.outlang +46 -0
  218. data/source-highlight/esc.style +35 -0
  219. data/source-highlight/extreme_comment.lang +5 -0
  220. data/source-highlight/extreme_comment2.lang +5 -0
  221. data/source-highlight/extreme_comment3.lang +15 -0
  222. data/source-highlight/fixed-fortran.lang +5 -0
  223. data/source-highlight/flex.lang +37 -0
  224. data/source-highlight/fortran.lang +57 -0
  225. data/source-highlight/function.lang +2 -0
  226. data/source-highlight/glsl.lang +86 -0
  227. data/source-highlight/haxe.lang +7 -0
  228. data/source-highlight/html.lang +7 -0
  229. data/source-highlight/html.outlang +25 -0
  230. data/source-highlight/html_common.outlang +35 -0
  231. data/source-highlight/html_notfixed.outlang +22 -0
  232. data/source-highlight/html_ref.outlang +6 -0
  233. data/source-highlight/htmlcss.outlang +28 -0
  234. data/source-highlight/htmltable.outlang +14 -0
  235. data/source-highlight/htmltablelinenum.outlang +26 -0
  236. data/source-highlight/java.lang +26 -0
  237. data/source-highlight/javadoc.outlang +24 -0
  238. data/source-highlight/javascript.lang +27 -0
  239. data/source-highlight/key_string.lang +4 -0
  240. data/source-highlight/lang.map +108 -0
  241. data/source-highlight/langdef.lang +21 -0
  242. data/source-highlight/latex.lang +52 -0
  243. data/source-highlight/latex.outlang +59 -0
  244. data/source-highlight/latexcolor.outlang +44 -0
  245. data/source-highlight/ldap.lang +10 -0
  246. data/source-highlight/log.lang +53 -0
  247. data/source-highlight/logtalk.lang +85 -0
  248. data/source-highlight/lsm.lang +7 -0
  249. data/source-highlight/lua.lang +27 -0
  250. data/source-highlight/m4.lang +27 -0
  251. data/source-highlight/makefile.lang +42 -0
  252. data/source-highlight/nohilite.lang +2 -0
  253. data/source-highlight/number.lang +3 -0
  254. data/source-highlight/outlang.lang +16 -0
  255. data/source-highlight/outlang.map +12 -0
  256. data/source-highlight/pascal.lang +20 -0
  257. data/source-highlight/perl.lang +134 -0
  258. data/source-highlight/php.lang +25 -0
  259. data/source-highlight/postscript.lang +42 -0
  260. data/source-highlight/prolog.lang +37 -0
  261. data/source-highlight/properties.lang +7 -0
  262. data/source-highlight/python.lang +26 -0
  263. data/source-highlight/ruby.lang +32 -0
  264. data/source-highlight/scala.lang +31 -0
  265. data/source-highlight/script_comment.lang +3 -0
  266. data/source-highlight/sh.lang +38 -0
  267. data/source-highlight/slang.lang +25 -0
  268. data/source-highlight/sml.lang +5 -0
  269. data/source-highlight/source-highlight +24 -0
  270. data/source-highlight/spec.lang +12 -0
  271. data/source-highlight/sql.lang +46 -0
  272. data/source-highlight/style.defaults +15 -0
  273. data/source-highlight/style.lang +16 -0
  274. data/source-highlight/style2.style +10 -0
  275. data/source-highlight/style3.style +10 -0
  276. data/source-highlight/symbols.lang +2 -0
  277. data/source-highlight/tcl.lang +35 -0
  278. data/source-highlight/texinfo.outlang +34 -0
  279. data/source-highlight/texinfo.style +20 -0
  280. data/source-highlight/url.lang +3 -0
  281. data/source-highlight/xhtml.outlang +25 -0
  282. data/source-highlight/xhtml_common.outlang +8 -0
  283. data/source-highlight/xhtml_notfixed.outlang +16 -0
  284. data/source-highlight/xhtmlcss.outlang +19 -0
  285. data/source-highlight/xhtmltable.outlang +7 -0
  286. data/source-highlight/xml.lang +17 -0
  287. data/source-highlight/xorg.lang +10 -0
  288. data/templates/asciidoc.css +358 -0
  289. data/templates/asciidoc.html.erb +86 -0
  290. data/templates/manualsonrails.css +165 -0
  291. data/templates/manualsonrails.html.erb +97 -0
  292. data/test/generator_spec.rb +60 -0
  293. data/test/parser_spec.rb +239 -0
  294. data/test/spec_helper.rb +51 -0
  295. metadata +358 -0
@@ -0,0 +1,154 @@
1
+ #!/usr/bin/env python
2
+ import os, sys
3
+ from optparse import *
4
+
5
+ __AUTHOR__ = "Gouichi Iisaka <iisaka51@gmail.com>"
6
+ __VERSION__ = '1.1'
7
+
8
+ class EApp(Exception):
9
+ '''Application specific exception.'''
10
+ pass
11
+
12
+ class Struct:
13
+ '''variable contenor as C `struct'.'''
14
+ pass
15
+
16
+ class Application():
17
+ '''
18
+ NAME
19
+ graphviz2png - Converts textual graphviz notation to PNG file
20
+
21
+ SYNOPSIS
22
+ graphviz2png [options] INFILE
23
+
24
+ DESCRIPTION
25
+ This filter reads Graphviz notation text from the input file
26
+ INFILE (or stdin if INFILE is -), converts it to a PNG image file.
27
+
28
+
29
+ OPTIONS
30
+ -o OUTFILE
31
+ The file name of the output file. If not specified the output file is
32
+ named like INFILE but with a .png file name extension.
33
+
34
+ -v
35
+ Verbosely print processing information to stderr.
36
+
37
+ --help, -h
38
+ Print this documentation.
39
+
40
+ --version
41
+ Print program version number.
42
+
43
+ SEE ALSO
44
+ graphviz(1)
45
+
46
+ AUTHOR
47
+ Written by Gouichi Iisaka, <iisaka51@gmail.com>
48
+
49
+ THANKS
50
+ Stuart Rackham, <srackham@gmail.com>
51
+ This script was inspired by his music2png.py and AsciiDoc
52
+
53
+ LICENSE
54
+ Copyright (C) 2008 Gouichi Iisaka.
55
+ Free use of this software is granted under the terms of
56
+ the GNU General Public License (GPL).
57
+ '''
58
+
59
+ def __init__(self, argv=None):
60
+ if not argv:
61
+ argv = sys.argv
62
+ self.attrs = Struct()
63
+ self.usage_msg = '%prog [options] inputfile\n'
64
+ self.usage_msg += 'Version: %s\n' % __VERSION__
65
+ self.usage_msg += 'Copyright(c) 2008: %s' % __AUTHOR__
66
+
67
+ self.option_list = [
68
+ Option("-o", "--outfile", action="store",
69
+ dest="outfile",
70
+ help="Output file"),
71
+ Option("-L", "--layout", action="store",
72
+ dest="layout", default="dot",
73
+ help="Output file"),
74
+ Option("--debug", action="store_true",
75
+ dest="do_debug",
76
+ help=SUPPRESS_HELP),
77
+ Option("-v", "--verbose", action="store_true",
78
+ dest="do_verbose", default=False,
79
+ help="verbose output"),
80
+ Option("-V", "--version", action="store_true",
81
+ dest="do_version",
82
+ help="Print version"),
83
+ ]
84
+
85
+ self.parser = OptionParser(option_list=self.option_list)
86
+ self.parser.set_usage(self.usage_msg)
87
+ (self.options, self.args) = self.parser.parse_args()
88
+
89
+ if self.options.do_version:
90
+ self.parser.print_usage()
91
+ sys.exit(1)
92
+
93
+ if len(self.args) != 1:
94
+ self.parser.print_help()
95
+ sys.exit(1)
96
+
97
+ self.options.infile = self.args[0]
98
+
99
+ def systemcmd(self, cmd):
100
+ if self.options.do_verbose:
101
+ msg = 'Execute: %s' % cmd
102
+ sys.stderr.write(msg + os.linesep)
103
+ else:
104
+ cmd += ' 2>/dev/null'
105
+ if os.system(cmd):
106
+ raise EApp, 'failed command: %s' % cmd
107
+
108
+ def graphviz2png(self, infile, outfile):
109
+ '''Convert Graphviz notation in file infile to
110
+ PNG file named outfile.'''
111
+
112
+ outfile = os.path.abspath(outfile)
113
+ outdir = os.path.dirname(outfile)
114
+
115
+ if not os.path.isdir(outdir):
116
+ raise EApp, 'directory does not exist: %s' % outdir
117
+
118
+ basefile = os.path.splitext(outfile)[0]
119
+ saved_cwd = os.getcwd()
120
+ os.chdir(outdir)
121
+ try:
122
+ cmd = '%s -Tpng "%s" > "%s"' % (
123
+ self.options.layout, infile, outfile)
124
+ self.systemcmd(cmd)
125
+ os.unlink(infile)
126
+ finally:
127
+ os.chdir(saved_cwd)
128
+
129
+ def run(self):
130
+ if self.options.infile == '-':
131
+ if self.options.outfile is None:
132
+ sys.stderr.write('OUTFILE must be specified')
133
+ sys.exit(1)
134
+ infile = os.path.splitext(self.options.outfile)[0] + '.txt'
135
+ lines = sys.stdin.readlines()
136
+ open(infile, 'w').writelines(lines)
137
+
138
+ if not os.path.isfile(infile):
139
+ raise EApp, 'input file does not exist: %s' % infile
140
+
141
+ if self.options.outfile is None:
142
+ outfile = os.path.splitext(infile)[0] + '.png'
143
+ else:
144
+ outfile = self.options.outfile
145
+
146
+ self.graphviz2png(infile, outfile)
147
+
148
+ # To suppress asciidoc 'no output from filter' warnings.
149
+ if self.options.infile == '-':
150
+ sys.stdout.write(' ')
151
+
152
+ if __name__ == "__main__":
153
+ app = Application()
154
+ app.run()
@@ -0,0 +1,40 @@
1
+ Music Filter Test
2
+ =================
3
+
4
+ Details of the filter can be found in `./doc/music-filter.txt`.
5
+
6
+
7
+ A tune generated from ABC notation
8
+ ----------------------------------
9
+
10
+ [music,music1.png]
11
+ ---------------------------------------------------------------------
12
+ T:The Butterfly
13
+ R:slip jig
14
+ C:Tommy Potts
15
+ H:Fiddle player Tommy Potts made this tune from two older slip jigs,
16
+ H:one of which is called "Skin the Peelers" in Roche's collection.
17
+ D:Bothy Band: 1975.
18
+ M:9/8
19
+ K:Em
20
+ vB2(E G2)(E F3)|B2(E G2)(E F)ED|vB2(E G2)(E F3)|(B2d) d2(uB A)FD:|
21
+ |:(vB2c) (e2f) g3|(uB2d) (g2e) (dBA)|(B2c) (e2f) g2(ua|b2a) (g2e) (dBA):|
22
+ |:~B3 (B2A) G2A|~B3 BA(uB d)BA|~B3 (B2A) G2(A|B2d) (g2e) (dBA):|
23
+ ---------------------------------------------------------------------
24
+
25
+
26
+ A fragment generated from LilyPond source
27
+ ------------------------------------------
28
+
29
+ ["music", "music2.png", "ly", link="music2.ly"]
30
+ ---------------------------------------------------------------------
31
+ \version "2.10.0"
32
+ \paper {
33
+ ragged-right = ##t
34
+ }
35
+ {
36
+ \time 3/4
37
+ \clef bass
38
+ c2 e4 g2. f4 e d c2 r4
39
+ }
40
+ ---------------------------------------------------------------------
@@ -0,0 +1,40 @@
1
+ #
2
+ # AsciiDoc music filter configuration file.
3
+ #
4
+ # Documented in music-filter.txt in AsciiDoc distribution
5
+ # ./examples/website/ directory.
6
+ #
7
+
8
+ [blockdef-listing]
9
+ music-style=template="music-block",subs=(),posattrs=("style","target","format"),filter='music2png.py {verbose?-v} -m -f {format=abc} -o "{outdir}/{target}" -'
10
+
11
+ ifdef::basebackend-html[]
12
+ [music-block]
13
+ <div class="musicblock">
14
+ <a id="{id}"></a>
15
+ <div class="title">{title}</div>
16
+ <div class="content">
17
+ <a href="{link}">
18
+ <img style="border-width: 0;" src="{target}" alt="{target}"{width? width="{width}"}{height? height="{height}"} />
19
+ {link#}</a>
20
+ </div></div>
21
+ endif::basebackend-html[]
22
+
23
+ ifdef::basebackend-docbook[]
24
+ [music-block]
25
+ template::[image-blockmacro]
26
+ endif::basebackend-docbook[]
27
+
28
+
29
+ #
30
+ # DEPRECATED: Pre 8.2.7 filter definition.
31
+ #
32
+ [blockdef-music]
33
+ delimiter=^music~{4,}$
34
+ template=music-block
35
+ presubs=none
36
+ filter=music2png.py {verbose?-v} -m -f {format=abc} -o "{outdir}/{target}" -
37
+ posattrs=target,format
38
+ #
39
+ # DEPRECATED: End
40
+ #
@@ -0,0 +1,189 @@
1
+ #!/usr/bin/env python
2
+ '''
3
+ NAME
4
+ music2png - Converts textual music notation to classically notated PNG file
5
+
6
+ SYNOPSIS
7
+ music2png [options] INFILE
8
+
9
+ DESCRIPTION
10
+ This filter reads LilyPond or ABC music notation text from the input file
11
+ INFILE (or stdin if INFILE is -), converts it to classical music notation
12
+ and writes it to a trimmed PNG image file.
13
+
14
+ This script is a wrapper for LilyPond and ImageMagick commands.
15
+
16
+ OPTIONS
17
+ -f FORMAT
18
+ The INFILE music format. 'abc' for ABC notation, 'ly' for LilyPond
19
+ notation.
20
+
21
+ -o OUTFILE
22
+ The file name of the output file. If not specified the output file is
23
+ named like INFILE but with a .png file name extension.
24
+
25
+ -m
26
+ Skip if the PNG output file is newer that than the INFILE. When
27
+ INFILE is - (stdin) previously retained input is compared.
28
+
29
+ -v
30
+ Verbosely print processing information to stderr.
31
+
32
+ --help, -h
33
+ Print this documentation.
34
+
35
+ --version
36
+ Print program version number.
37
+
38
+ SEE ALSO
39
+ lilypond(1), abc2ly(1), convert(1)
40
+
41
+ AUTHOR
42
+ Written by Stuart Rackham, <srackham@gmail.com>
43
+
44
+ COPYING
45
+ Copyright (C) 2006 Stuart Rackham. Free use of this software is
46
+ granted under the terms of the GNU General Public License (GPL).
47
+ '''
48
+
49
+ import os, sys
50
+
51
+ VERSION = '0.1.0'
52
+
53
+ # Globals.
54
+ verbose = False
55
+
56
+ class EApp(Exception): pass # Application specific exception.
57
+
58
+ def print_stderr(line):
59
+ sys.stderr.write(line + os.linesep)
60
+
61
+ def print_verbose(line):
62
+ if verbose:
63
+ print_stderr(line)
64
+
65
+ def run(cmd):
66
+ global verbose
67
+ if not verbose:
68
+ cmd += ' 2>/dev/null'
69
+ print_verbose('executing: %s' % cmd)
70
+ if os.system(cmd):
71
+ raise EApp, 'failed command: %s' % cmd
72
+
73
+ def music2png(format, infile, outfile, modified):
74
+ '''Convert ABC notation in file infile to cropped PNG file named outfile.'''
75
+ outfile = os.path.abspath(outfile)
76
+ outdir = os.path.dirname(outfile)
77
+ if not os.path.isdir(outdir):
78
+ raise EApp, 'directory does not exist: %s' % outdir
79
+ basefile = os.path.splitext(outfile)[0]
80
+ abc = basefile + '.abc'
81
+ ly = basefile + '.ly'
82
+ temps = [ basefile + ext for ext in ('.abc', '.ly', '.ps', '.midi') ]
83
+ # Don't delete files that already exist.
84
+ temps = [ f for f in temps if not os.path.exists(f) ]
85
+ skip = False
86
+ if infile == '-':
87
+ lines = sys.stdin.readlines()
88
+ if format == 'abc':
89
+ f = abc
90
+ else:
91
+ f = ly
92
+ if modified:
93
+ if f in temps:
94
+ del temps[temps.index(f)] # Don't delete previous source.
95
+ if os.path.isfile(outfile) and os.path.isfile(f):
96
+ old = open(f, 'r').readlines()
97
+ skip = lines == old
98
+ if not skip:
99
+ open(f, 'w').writelines(lines)
100
+ else:
101
+ if not os.path.isfile(infile):
102
+ raise EApp, 'input file does not exist: %s' % infile
103
+ if modified and os.path.isfile(outfile):
104
+ skip = os.path.getmtime(infile) <= os.path.getmtime(outfile)
105
+ if skip:
106
+ print_verbose('skipped: no change: %s' % outfile)
107
+ return
108
+ saved_pwd = os.getcwd()
109
+ os.chdir(outdir)
110
+ try:
111
+ if format == 'abc':
112
+ run('abc2ly --beams=None "%s"' % abc)
113
+ run('lilypond --png "%s"' % ly)
114
+ finally:
115
+ os.chdir(saved_pwd)
116
+ # Chop the bottom 75 pixels off to get rid of the page footer.
117
+ run('convert "%s" -gravity South -crop 1000x10000+0+75 "%s"' % (outfile, outfile))
118
+ # Trim all blank areas from sides, top and bottom.
119
+ run('convert "%s" -trim "%s"' % (outfile, outfile))
120
+ for f in temps:
121
+ if os.path.isfile(f):
122
+ print_verbose('deleting: %s' % f)
123
+ os.remove(f)
124
+
125
+ def usage(msg=''):
126
+ if msg:
127
+ print_stderr(msg)
128
+ print_stderr('\n'
129
+ 'usage:\n'
130
+ ' music2png [options] INFILE\n'
131
+ '\n'
132
+ 'options:\n'
133
+ ' -f FORMAT\n'
134
+ ' -o OUTFILE\n'
135
+ ' -m\n'
136
+ ' -v\n'
137
+ ' --help\n'
138
+ ' --version')
139
+
140
+ def main():
141
+ # Process command line options.
142
+ global verbose
143
+ format = None
144
+ outfile = None
145
+ modified = False
146
+ import getopt
147
+ opts,args = getopt.getopt(sys.argv[1:], 'f:o:mhv', ['help','version'])
148
+ for o,v in opts:
149
+ if o in ('--help','-h'):
150
+ print __doc__
151
+ sys.exit(0)
152
+ if o =='--version':
153
+ print('music2png version %s' % (VERSION,))
154
+ sys.exit(0)
155
+ if o == '-f': format = v
156
+ if o == '-o': outfile = v
157
+ if o == '-m': modified = True
158
+ if o == '-v': verbose = True
159
+ if len(args) != 1:
160
+ usage()
161
+ sys.exit(1)
162
+ infile = args[0]
163
+ if format is None:
164
+ usage('FORMAT must be specified')
165
+ sys.exit(1)
166
+ if format not in ('abc', 'ly'):
167
+ usage('invalid FORMAT')
168
+ sys.exit(1)
169
+ if outfile is None:
170
+ if infile == '-':
171
+ usage('OUTFILE must be specified')
172
+ sys.exit(1)
173
+ outfile = os.path.splitext(infile)[0] + '.png'
174
+ # Do the work.
175
+ music2png(format, infile, outfile, modified)
176
+ # Print something to suppress asciidoc 'no output from filter' warnings.
177
+ if infile == '-':
178
+ sys.stdout.write(' ')
179
+
180
+ if __name__ == "__main__":
181
+ try:
182
+ main()
183
+ except SystemExit:
184
+ raise
185
+ except KeyboardInterrupt:
186
+ sys.exit(1)
187
+ except Exception, e:
188
+ print_stderr("%s: %s" % (os.path.basename(sys.argv[0]), str(e)))
189
+ sys.exit(1)
@@ -0,0 +1,19 @@
1
+ Source Hightlight Filter Test
2
+ =============================
3
+
4
+ Details of the filter can be found in
5
+ `./doc/source-highlight-filter.txt`.
6
+
7
+ [source,python]
8
+ ---------------------------------------------------------------------
9
+ ''' A multi-line
10
+ comment.'''
11
+ def sub_word(mo):
12
+ ''' Single line comment.'''
13
+ word = mo.group('word') # Inline comment
14
+ if word in keywords[language]:
15
+ return quote + word + quote
16
+ else:
17
+ return word
18
+ ---------------------------------------------------------------------
19
+
@@ -0,0 +1,108 @@
1
+ #
2
+ # AsciiDoc source code highlight filter configuration file.
3
+ #
4
+ # Documented in source-hightlight-filter.txt in AsciiDoc distribution
5
+ # ./examples/website/ directory.
6
+ #
7
+ # HTML outputs require GNU source-highlight
8
+ # http://www.gnu.org/software/src-highlite/source-highlight.html
9
+ #
10
+
11
+ ########################
12
+ # Source block templates
13
+ ########################
14
+ [source-highlight-block]
15
+ template::[listingblock]
16
+
17
+ ifdef::backend-html4[]
18
+ [source-highlight-block]
19
+ <a name="{id}"></a>
20
+ <p><b>{title}</b></p>
21
+ <table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td>
22
+ |
23
+ </td></tr></table>
24
+ endif::backend-html4[]
25
+
26
+ # Customized listingblock block for xhtml11 to ensure valid XHTML1.1.
27
+ ifdef::backend-xhtml11[]
28
+ [source-highlight-block]
29
+ <div class="listingblock">
30
+ <a id="{id}"></a>
31
+ <div class="title">{caption=}{title}</div>
32
+ <div class="content">
33
+ |
34
+ </div></div>
35
+ endif::backend-xhtml11[]
36
+
37
+ # Use DocBook programlisting element.
38
+ ifdef::backend-docbook[]
39
+ [source-highlight-block]
40
+ <programlisting language="{language}" linenumbering="{src_numbered=unnumbered}">
41
+ |
42
+ </programlisting>
43
+ endif::backend-docbook[]
44
+
45
+ #########################
46
+ # Source paragraph styles
47
+ #########################
48
+ [paradef-default]
49
+ ifdef::backend-html4[]
50
+ source-style=template="passthroughblock",presubs=(),postsubs=("callouts",),posattrs=("style","language","src_numbered","src_tab"),filter="source-highlight -f html -s {language} {src_numbered?--line-number} {src_tab?--tab={src_tab}}"
51
+ endif::backend-html4[]
52
+
53
+ ifdef::backend-xhtml11[]
54
+ source-style=template="exampleblock",presubs=(),postsubs=("callouts",),posattrs=("style","language","src_numbered","src_tab"),filter="source-highlight -f xhtml -s {language} {src_numbered?--line-number} {src_tab?--tab={src_tab}}"
55
+ endif::backend-xhtml11[]
56
+
57
+ ifdef::backend-docbook[]
58
+ source-style=template="source-highlight-block",presubs=(),postsubs=("specialcharacters","callouts"),posattrs=("style","language","src_numbered","src_tab"),filter=""
59
+ endif::backend-docbook[]
60
+
61
+ #########################
62
+ # Source block styles
63
+ #########################
64
+ [blockdef-listing]
65
+ ifdef::backend-html4[]
66
+ source-style=template="source-highlight-block",presubs=(),postsubs=("callouts",),posattrs=("style","language","src_numbered","src_tab"),filter="source-highlight -f html -s {language} {src_numbered?--line-number} {src_tab?--tab={src_tab}}"
67
+ endif::backend-html4[]
68
+
69
+ ifdef::backend-xhtml11[]
70
+ source-style=template="source-highlight-block",presubs=(),postsubs=("callouts",),posattrs=("style","language","src_numbered","src_tab"),filter="source-highlight -f xhtml -s {language} {src_numbered?--line-number} {src_tab?--tab={src_tab}}"
71
+ endif::backend-xhtml11[]
72
+
73
+ ifdef::backend-docbook[]
74
+ source-style=template="source-highlight-block",presubs=(),postsubs=("specialcharacters","callouts"),posattrs=("style","language","src_numbered","src_tab")
75
+ endif::backend-docbook[]
76
+
77
+
78
+ #
79
+ # DEPRECATED: Pre 8.2.7 filter definition.
80
+ #
81
+
82
+ #########################
83
+ # Source block definition
84
+ #########################
85
+ [blockdef-source-highlight]
86
+ # The old ^ delimiter is for backward compatibility, may be removed from
87
+ # in future versions.
88
+ delimiter=(^source~{4,}$)|(^\^{4,}$)
89
+ template=source-highlight-block
90
+ presubs=none
91
+ posattrs=language,src_numbered,src_tab
92
+
93
+ ifndef::backend-docbook[]
94
+ postsubs=callouts
95
+ # GNU Source Highlight filter.
96
+ filter=source-highlight -f {backend-xhtml11?xhtml}{backend-html4?html}{backend-docbook?docbook} -s {language} {src_numbered?--line-number} {src_tab?--tab={src_tab}}
97
+ endif::backend-docbook[]
98
+
99
+ ifdef::backend-docbook[]
100
+ postsubs=specialcharacters,callouts
101
+ # In the case of DocBook just pass the listing through and let the DocBook
102
+ # toolchain handle it.
103
+ filter=
104
+ endif::backend-docbook[]
105
+
106
+ #
107
+ # DEPRECATED: End
108
+ #