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,86 @@
1
+ <%
2
+ # Template based on Asciidoc's default layout. This isn't
3
+ def visit_heading(heading, max_levels = 2, result = "")
4
+ if multi_page?
5
+ result << %Q{
6
+ <div class="toclevel#{heading.level - 1}">
7
+ <a href="#{h heading.basename}#{h heading.anchor}">#{heading.title}</a>
8
+ </div>
9
+ }.strip
10
+ else
11
+ result << %Q{
12
+ <div class="toclevel#{heading.level - 1}">
13
+ <a href="#{h heading.anchor}">#{heading.title}</a>
14
+ </div>
15
+ }.strip
16
+ end
17
+ if heading.level <= max_levels
18
+ heading.children.each do |h|
19
+ visit_heading(h, max_levels, result)
20
+ end
21
+ end
22
+ return result
23
+ end
24
+
25
+ def current_heading
26
+ return table_of_contents.find do |h|
27
+ h.title == current_chapter.title
28
+ end
29
+ end
30
+ %>
31
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
32
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
33
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
34
+ <head>
35
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
36
+ <meta name="generator" content="AsciiDoc 8.2.7" />
37
+ <style type="text/css">
38
+ <%= include_file('asciidoc.css') %>
39
+ </style>
40
+ <title><% if multi_page? && !is_preamble? %><%=h current_chapter.title_without_numbers %> :: <% end %><%=h title %></title>
41
+ </head>
42
+ <body>
43
+ <h1><%=h title %></h1>
44
+ <% if multi_page? && is_preamble? %>
45
+ <%= contents %>
46
+ <% end %>
47
+ <div id="toc">
48
+ <% if !multi_page? || is_preamble? %>
49
+ <h2>Table of contents</h2>
50
+ <%- for heading in table_of_contents -%>
51
+ <%= visit_heading(heading) %>
52
+ <%- end -%>
53
+ <% else %>
54
+ <div class="toclevel1 return_to_table_of_contents">
55
+ <a href="<%=h chapters.first.basename %>">&laquo; Return to table of contents</a>
56
+ </div>
57
+ <%= visit_heading(current_heading, 3) %>
58
+ <% end %>
59
+ </div>
60
+ <% if !multi_page? || !is_preamble? %>
61
+ <% if multi_page? %><h2><%=h current_chapter.title %></h2><% end %>
62
+ <%= contents %>
63
+ <% end %>
64
+ <%- if multi_page? -%>
65
+ <table id="chapter_navigation">
66
+ <tr>
67
+ <td class="left-floaty">
68
+ <% if prev_chapter %>
69
+ <a href="<%=h prev_chapter.basename %>">&laquo; <%= prev_chapter.title %></a>
70
+ <% end %>
71
+ </td>
72
+ <td class="center">
73
+ <% if !is_preamble? %>
74
+ <a href="<%=h chapters.first.basename %>">Table of contents</a>
75
+ <% end %>
76
+ </td>
77
+ <td class="right-floaty">
78
+ <% if next_chapter %>
79
+ <a href="<%=h next_chapter.basename %>"><%= next_chapter.title %> &raquo;</a>
80
+ <% end %>
81
+ </td>
82
+ </tr>
83
+ </table>
84
+ <%- end -%>
85
+ </body>
86
+ </html>
@@ -0,0 +1,165 @@
1
+ div#container {
2
+ max-width: 900px;
3
+ padding-bottom: 3em;
4
+ }
5
+
6
+ div#content {
7
+ margin-left: 200px;
8
+ }
9
+
10
+ div#container.notoc {
11
+ max-width: 600px;
12
+ }
13
+
14
+ .notoc div#content {
15
+ margin-left: 0;
16
+ }
17
+
18
+ pre {
19
+ line-height: 1.4em;
20
+ }
21
+
22
+ #content p tt {
23
+ background: #eeeeee;
24
+ border: solid 1px #cccccc;
25
+ padding: 3px;
26
+ }
27
+
28
+ dt {
29
+ font-weight: bold;
30
+ }
31
+
32
+ #content dt tt {
33
+ font-size: 10pt;
34
+ }
35
+
36
+ dd {
37
+ margin-left: 3em;
38
+ }
39
+
40
+ #content dt tt, #content pre tt {
41
+ background: none;
42
+ padding: 0;
43
+ border: 0;
44
+ }
45
+
46
+ #content .olist ol {
47
+ margin-left: 2em;
48
+ }
49
+
50
+ #header {
51
+ position: relative;
52
+ max-width: 840px;
53
+ margin-left: auto;
54
+ margin-right: auto;
55
+ }
56
+
57
+ #header.notoc {
58
+ max-width: 580px;
59
+ }
60
+
61
+ #logo {
62
+ position: absolute;
63
+ left: 10px;
64
+ top: 10px;
65
+ width: 110px;
66
+ height: 140px;
67
+ }
68
+
69
+ div#header h1#site_title {
70
+ background: url('http://web.rubyonrails.com/images/ruby_on_rails_by_mike_rundle2.gif') top left no-repeat;
71
+ position: absolute;
72
+ width: 392px;
73
+ height: 55px;
74
+ left: 145px;
75
+ top: 20px;
76
+ margin: 0;
77
+ padding: 0;
78
+ }
79
+
80
+ #site_title span {
81
+ display: none;
82
+ }
83
+
84
+ #site_title_tagline {
85
+ display: none;
86
+ }
87
+
88
+ ul#navMain {
89
+ position: absolute;
90
+ margin: 0;
91
+ padding: 0;
92
+ top: 97px;
93
+ left: 145px;
94
+ }
95
+
96
+ .left-floaty, .right-floaty {
97
+ padding: 15px;
98
+ }
99
+
100
+ .admonitionblock,
101
+ .tableblock {
102
+ margin-left: 1em;
103
+ margin-right: 1em;
104
+ margin-top: 0.25em;
105
+ margin-bottom: 1em;
106
+ }
107
+
108
+ .admonitionblock .icon {
109
+ padding-right: 8px;
110
+ }
111
+
112
+ .admonitionblock .content {
113
+ border: solid 1px #ffda78;
114
+ background: #fffebd;
115
+ padding: 10px;
116
+ padding-top: 8px;
117
+ padding-bottom: 8px;
118
+ }
119
+
120
+ .admonitionblock .title {
121
+ font-size: 140%;
122
+ margin-bottom: 0.5em;
123
+ }
124
+
125
+ .tableblock table {
126
+ border: solid 1px #aaaaff;
127
+ background: #f0f0ff;
128
+ }
129
+
130
+ .tableblock th {
131
+ background: #e0e0e0;
132
+ }
133
+
134
+ .tableblock th,
135
+ .tableblock td {
136
+ padding: 3px;
137
+ padding-left: 5px;
138
+ padding-right: 5px;
139
+ }
140
+
141
+ .sidebarblock {
142
+ margin-top: 0.25em;
143
+ margin: 1em;
144
+ border: solid 1px #ccccbb;
145
+ padding: 8px;
146
+ background: #ffffe0;
147
+ }
148
+
149
+ .sidebarblock .sidebar-title {
150
+ font-size: 140%;
151
+ font-weight: 600;
152
+ margin-bottom: 0.3em;
153
+ }
154
+
155
+ .sidebarblock .sidebar-content > .para:last-child > p {
156
+ margin-bottom: 0;
157
+ }
158
+
159
+ .sidebarblock .sidebar-title a {
160
+ text-decoration: none;
161
+ }
162
+
163
+ .sidebarblock .sidebar-title a:hover {
164
+ text-decoration: underline;
165
+ }
@@ -0,0 +1,97 @@
1
+ <%-
2
+ manuals_index_url = ENV['MANUALSONRAILS_INDEX_URL'] || "http://manuals.rubyonrails.org/"
3
+ show_toc = ENV['MANUALSONRAILS_TOC'] != 'no'
4
+ -%>
5
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
6
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
7
+ <head>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
9
+ <title><%- if multi_page? && !is_preamble? -%><%=h current_chapter.plain_title %> :: <% end %><%=h title %></title>
10
+ <!--[if lt IE 8]>
11
+ <script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
12
+ <![endif]-->
13
+ <link href="http://manuals.rubyonrails.org/stylesheets/base.css" media="screen" rel="Stylesheet" type="text/css" />
14
+ <link href="http://manuals.rubyonrails.org/stylesheets/forms.css" media="screen" rel="Stylesheet" type="text/css" />
15
+ <link href="http://manuals.rubyonrails.org/stylesheets/more.css" media="screen" rel="Stylesheet" type="text/css" />
16
+ <style type="text/css">
17
+ <%= include_file('manualsonrails.css') %>
18
+ </style>
19
+ </head>
20
+ <body>
21
+ <div id="header" <% if !show_toc %> class="notoc"<% end %>>
22
+ <div id="logo">
23
+ <a href="http://www.rubyonrails.org/" title="Ruby on Rails"><img src="http://web.rubyonrails.com/images/rails_logo_remix.gif" alt="Rails" height="140" width="110" /></a>
24
+ </div>
25
+
26
+ <h1 id="site_title"><span>Ruby on Rails</span></h1>
27
+ <h2 id="site_title_tagline">Sustainable productivity for web-application development</h2>
28
+
29
+ <ul id="navMain">
30
+ <li class="first-child"><a href="http://www.rubyonrails.org/" title="Ruby on Rails" class="ruby_on_rails">Ruby on Rails</a></li>
31
+ <li><a class="manuals" href="<%=h manuals_index_url %>" title="Manuals Index">Manuals Index</a></li>
32
+ </ul>
33
+ </div>
34
+
35
+ <div id="container"<% if !show_toc %> class="notoc"<% end %>>
36
+ <% if show_toc %>
37
+ <div id="sidebar">
38
+ <h2>Chapters</h2>
39
+ <%- if multi_page? -%>
40
+ <a href="<%=h chapters.first.basename %>">Preamble</a>
41
+ <%- end -%>
42
+ <ol>
43
+ <%- if multi_page? -%>
44
+ <%- for heading in table_of_contents -%>
45
+ <li>
46
+ <a href="<%=h heading.basename %>"><%= heading.title_without_numbers %></a>
47
+ <%- if !heading.children.empty? -%>
48
+ <ul>
49
+ <% for h in heading.children %>
50
+ <li><a href="<%=h h.basename %><%=h h.anchor %>"><%= h.title_without_numbers %></a></li>
51
+ <% end %>
52
+ </ul>
53
+ <%- end -%>
54
+ </li>
55
+ <%- end -%>
56
+ <%- else -%>
57
+ <%- for heading in table_of_contents -%>
58
+ <li>
59
+ <a href="<%=h heading.anchor %>"><%= heading.title_without_numbers %></a>
60
+ <%- if !heading.children.empty? -%>
61
+ <ul>
62
+ <% for h in heading.children %>
63
+ <li><a href="<%=h h.anchor %>"><%= h.title_without_numbers %></a></li>
64
+ <% end %>
65
+ </ul>
66
+ <%- end -%>
67
+ </li>
68
+ <%- end -%>
69
+ <%- end -%>
70
+ </ol>
71
+ </div>
72
+ <% end %>
73
+ <div id="content">
74
+ <%- if multi_page? && !is_preamble? -%>
75
+ <h2 id="<%=h current_chapter.anchor_id %>"><%= current_chapter.title %></h2>
76
+ <%- else -%>
77
+ <h1><%=h title %></h1>
78
+ <%- end -%>
79
+ <%= contents %>
80
+ <%- if multi_page? -%>
81
+ <div id="chapter_navigation">
82
+ <%- if prev_chapter -%>
83
+ <div class="left-floaty">
84
+ <a href="<%=h prev_chapter.basename %>">&laquo; <%= prev_chapter.title %></a>
85
+ </div>
86
+ <%- end -%>
87
+ <%- if next_chapter -%>
88
+ <div class="right-floaty">
89
+ <a href="<%=h next_chapter.basename %>"><%= next_chapter.title %> &raquo;</a>
90
+ </div>
91
+ <%- end -%>
92
+ </div>
93
+ <%- end -%>
94
+ </div>
95
+ </div>
96
+ </body>
97
+ </html>
@@ -0,0 +1,60 @@
1
+ require File.dirname(__FILE__) + "/spec_helper"
2
+ require 'mizuho/parser'
3
+
4
+ describe Mizuho::Generator do
5
+ describe "#determine_output_filename" do
6
+ before :each do
7
+ @generator = Mizuho::Generator.new("unused argument")
8
+ File.should_receive(:expand_path).with(an_instance_of(String)).any_number_of_times.and_return do |value|
9
+ value
10
+ end
11
+ end
12
+
13
+ describe "if chapter ID is not given" do
14
+ it "changes the input filename's extension to .html, if " <<
15
+ "the output filename is not given and the input " <<
16
+ "filename has an extension" do
17
+ output = @generator.send(:determine_output_filename, "/foo/input.txt")
18
+ output.should == "/foo/input.html"
19
+
20
+ output = @generator.send(:determine_output_filename, "/foo/input.txt.erb")
21
+ output.should == "/foo/input.txt.html"
22
+ end
23
+
24
+ it "appends .html to the input filename, if the output " <<
25
+ "filename is not given and the input filename has no " <<
26
+ "extension" do
27
+ output = @generator.send(:determine_output_filename, "/foo/input.txt.erb/abc")
28
+ output.should == "/foo/input.txt.erb/abc.html"
29
+ end
30
+
31
+ it "uses the given output filename, if given" do
32
+ output = @generator.send(:determine_output_filename, "/foo/input.txt", "/hi.jpg")
33
+ output.should == "/hi.jpg"
34
+ end
35
+ end
36
+
37
+ describe "if chapter ID is given" do
38
+ it "changes the input filename's extension to .html and " <<
39
+ "prepends the chapter ID to the extension, if the " <<
40
+ "output filename is not given" do
41
+ output = @generator.send(:determine_output_filename, "/foo/input.txt", nil, "123")
42
+ output.should == "/foo/input-123.html"
43
+ output = @generator.send(:determine_output_filename, "/foo/input.txt.erb", nil, "123")
44
+ output.should == "/foo/input.txt-123.html"
45
+ end
46
+
47
+ it "it prepends the chapter ID in front of the extension, " <<
48
+ "if the output filename is given and has an extension" do
49
+ value = @generator.send(:determine_output_filename, "/foo/input.txt", "/hi.jpg", "123")
50
+ value.should == "/hi-123.jpg"
51
+ end
52
+
53
+ it "it appends the chapter ID to the filename, if the " <<
54
+ "output filename is given and doesn't have an extension" do
55
+ value = @generator.send(:determine_output_filename, "/foo/input.txt", "/hi", "123")
56
+ value.should == "/hi-123"
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,239 @@
1
+ require File.dirname(__FILE__) + "/spec_helper"
2
+ require 'mizuho/parser'
3
+
4
+ shared_examples_for "an Asciidoc document with 3 chapters" do
5
+ it "extracts the chapter contents" do
6
+ @chapter_one.contents.should =~ /Chapter 1 contents/
7
+ @chapter_two.contents.should =~ /Chapter 2 contents/
8
+ end
9
+
10
+ specify "the extracted chapter contents include (sub)section contents as well" do
11
+ @chapter_two.contents.should =~ /Subsection/
12
+ @chapter_two.contents.should =~ /This is a subsection/
13
+ end
14
+
15
+ it "doesn't HTML-escape auto-generated HTML formatting tags in the title" do
16
+ @html_chapter.title.should =~ %r(<strong>Look</strong>)
17
+ end
18
+
19
+ it "HTML-escapes non-autogenerated HTML tags in the title" do
20
+ @html_chapter.title.should =~ %r(&lt;i&gt;hurray&lt;/i&gt;)
21
+ end
22
+
23
+ it "HTML-escapes non-HTML special characters in the title" do
24
+ @html_chapter.title.should =~ %r(&lt;3)
25
+ end
26
+ end
27
+
28
+ describe Mizuho::Parser do
29
+ it "extracts the title" do
30
+ parser = generate_and_parse(%Q{
31
+ = Hello world
32
+ A sample document.
33
+ })
34
+ parser.title.should == "Hello world"
35
+ end
36
+
37
+ specify "the extracted title is not HTML escaped" do
38
+ parser = generate_and_parse(%Q{
39
+ = *Look at this!* 2 < 1!
40
+ A sample document.
41
+ })
42
+ parser.title.should == "<strong>Look at this!</strong> 2 < 1!"
43
+ end
44
+
45
+ describe "construction of table of contents" do
46
+ before :each do
47
+ @parser = generate_and_parse(%Q{
48
+ = Hello world
49
+ A sample document.
50
+
51
+ == Scientists Erase Specific Memories In Mice
52
+ It sounds like science fiction, but scientists say it might
53
+ one day be possible to erase undesirable memories from the
54
+ brain, selectively and safely.
55
+
56
+ === How it works
57
+ After exposing mice to emotionally powerful stimuli, such
58
+ as a mild shock to their paws, the scientists then observed
59
+ how well or poorly the animals subsequently recalled the
60
+ particular trauma as their brain's expression of CaMKII was
61
+ manipulated up and down. When the brain was made to
62
+ overproduce CaMKII at the exact moment the mouse was prodded
63
+ to retrieve the traumatic memory, the memory wasn't just
64
+ blocked, it appeared to be fully erased.
65
+
66
+ == Researchers Developing Cancer-Fighting Beer
67
+ Ever picked up a cold, frosty beer on a hot summer's day
68
+ and thought that it simply couldn't get any better? Well,
69
+ think again. A team of researchers at Rice University in
70
+ Houston is working on helping Joe Six Pack fight aging and
71
+ cancer with every swill of beer.
72
+
73
+ === Comment by samzenpus
74
+ Thank you science! Now we just need cigarettes that cure baldness.
75
+
76
+ == *Look*, non-HTML special characters <3, <i>hurray</i>
77
+ })
78
+ @toc = @parser.table_of_contents
79
+ end
80
+
81
+ it "contains all headers" do
82
+ @toc.should have(3).items
83
+
84
+ @toc[0].title.should =~ /Scientists Erase Specific Memories In Mice/
85
+ @toc[0].children.should have(1).item
86
+ @toc[0].children[0].title.should =~ /How it works/
87
+
88
+ @toc[1].title.should =~ /Researchers Developing Cancer-Fighting Beer/
89
+ @toc[1].children.should have(1).item
90
+ @toc[1].children[0].title.should =~ /Comment by samzenpus/
91
+
92
+ @toc[2].title.should =~ /Look/
93
+ @toc[2].children.should be_empty
94
+ end
95
+
96
+ it "records the corresponding header levels" do
97
+ @toc[0].level.should == 2
98
+ @toc[0].children[0].level.should == 3
99
+ @toc[1].level.should == 2
100
+ @toc[1].children[0].level.should == 3
101
+ @toc[2].level.should == 2
102
+ end
103
+
104
+ it "doesn't HTML-escape auto-generated HTML formatting tags in the title" do
105
+ @toc[2].title.should =~ %r(<strong>Look</strong>)
106
+ end
107
+
108
+ it "HTML-escapes non-autogenerated HTML tags in the title" do
109
+ @toc[2].title.should =~ %r(&lt;i&gt;hurray&lt;/i&gt;)
110
+ end
111
+
112
+ it "HTML-escapes non-HTML special characters in the title" do
113
+ @toc[2].title.should =~ %r(&lt;3)
114
+ end
115
+
116
+ it "prepends heading titles with a corresponding section number" do
117
+ @toc[0].title.should =~ /^1\. /
118
+ @toc[0].children[0].title.should =~ /^1\.1\. /
119
+
120
+ @toc[1].title.should =~ /^2\. /
121
+ @toc[1].children[0].title.should =~ /^2\.1\. /
122
+
123
+ @toc[2].title.should =~ /^3\. /
124
+ end
125
+ end
126
+
127
+ describe "chapter extraction" do
128
+ def test_input(with_preamble)
129
+ return %Q{
130
+ = Hello world
131
+
132
+ #{"A preamble." if with_preamble}
133
+
134
+ == Chapter 1
135
+ Chapter 1 contents.
136
+
137
+ == Chapter 2
138
+ Chapter 2 contents.
139
+
140
+ === Subsection
141
+ This is a subsection.
142
+
143
+ == *Look*, non-HTML special characters <3, <i>hurray</i>
144
+ }
145
+ end
146
+
147
+
148
+ describe "when there is a premable" do
149
+ before :each do
150
+ @parser = generate_and_parse(test_input(true))
151
+ @chapters = @parser.chapters
152
+ @chapter_one = @chapters[1]
153
+ @chapter_two = @chapters[2]
154
+ @html_chapter = @chapters[3]
155
+ end
156
+
157
+ it "consists of a preamble followed by level 2 headings" do
158
+ @chapters.should have(4).items
159
+ end
160
+
161
+ specify "the preamble chapter has no title" do
162
+ @chapters.first.title.should be_nil
163
+ end
164
+
165
+ it_should_behave_like "an Asciidoc document with 3 chapters"
166
+ end
167
+
168
+ describe "when there is no preamble" do
169
+ def default_test_input
170
+ return test_input(false)
171
+ end
172
+
173
+ before :each do
174
+ @parser = generate_and_parse(test_input(false))
175
+ @chapters = @parser.chapters
176
+ @chapter_one = @chapters[0]
177
+ @chapter_two = @chapters[1]
178
+ @html_chapter = @chapters[2]
179
+ end
180
+
181
+ it "consists of only level 2 headings" do
182
+ @chapters.should have(3).items
183
+ end
184
+
185
+ it_should_behave_like "an Asciidoc document with 3 chapters"
186
+ end
187
+ end
188
+
189
+ describe "content extraction" do
190
+ describe "when there is a preamble" do
191
+ before :each do
192
+ @parser = generate_and_parse(%Q{
193
+ = Ruby Enterprise Edition Features Guide
194
+ Today
195
+
196
+ Hello world
197
+
198
+ == Overview
199
+ Ruby Enterprise Edition (REE) is a
200
+ server-oriented distribution of the
201
+ official Ruby interpreter, and includes
202
+ various additional enhancements.
203
+ })
204
+ end
205
+
206
+ it "extracts the contents" do
207
+ @parser.contents.should include("various additional enhancements.")
208
+ end
209
+
210
+ it "strips away the irrelevant HTML that come before the actual content" do
211
+ @parser.contents.should_not include("<title>")
212
+ end
213
+ end
214
+
215
+ describe "when there is no preamble" do
216
+ before :each do
217
+ @parser = generate_and_parse(%Q{
218
+ = Ruby Enterprise Edition Features Guide
219
+
220
+ == Overview
221
+ Ruby Enterprise Edition (REE) is a
222
+ server-oriented distribution of the
223
+ official Ruby interpreter, and includes
224
+ various additional enhancements.
225
+ })
226
+ end
227
+
228
+ it "extracts the contents" do
229
+ @parser.contents.should include("various additional enhancements.")
230
+ end
231
+
232
+ it "strips away the irrelevant HTML that come before the actual content" do
233
+ @parser.contents.should_not include("<title>")
234
+ end
235
+ end
236
+ end
237
+
238
+ it "fixes cross-chapter references when in multi-page output mode"
239
+ end