FooBarWidget-mizuho 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +20 -0
- data/README.markdown +68 -0
- data/Rakefile +9 -0
- data/asciidoc/BUGS +34 -0
- data/asciidoc/BUGS.txt +28 -0
- data/asciidoc/CHANGELOG +1585 -0
- data/asciidoc/CHANGELOG.txt +1595 -0
- data/asciidoc/COPYING +339 -0
- data/asciidoc/COPYRIGHT +18 -0
- data/asciidoc/INSTALL +82 -0
- data/asciidoc/INSTALL.txt +71 -0
- data/asciidoc/README +46 -0
- data/asciidoc/README.txt +36 -0
- data/asciidoc/a2x +641 -0
- data/asciidoc/asciidoc.conf +404 -0
- data/asciidoc/asciidoc.py +4255 -0
- data/asciidoc/common.aap +9 -0
- data/asciidoc/dblatex/asciidoc-dblatex.sty +18 -0
- data/asciidoc/dblatex/asciidoc-dblatex.xsl +17 -0
- data/asciidoc/dblatex/dblatex-readme.txt +22 -0
- data/asciidoc/doc/a2x.1 +246 -0
- data/asciidoc/doc/a2x.1.txt +195 -0
- data/asciidoc/doc/article.css-embedded.html +579 -0
- data/asciidoc/doc/article.html +62 -0
- data/asciidoc/doc/article.pdf +0 -0
- data/asciidoc/doc/article.txt +124 -0
- data/asciidoc/doc/asciidoc-revhistory.xml +27 -0
- data/asciidoc/doc/asciidoc.1 +161 -0
- data/asciidoc/doc/asciidoc.1.css-embedded.html +562 -0
- data/asciidoc/doc/asciidoc.1.css.html +212 -0
- data/asciidoc/doc/asciidoc.1.html +190 -0
- data/asciidoc/doc/asciidoc.1.txt +118 -0
- data/asciidoc/doc/asciidoc.conf +8 -0
- data/asciidoc/doc/asciidoc.css-embedded.html +7954 -0
- data/asciidoc/doc/asciidoc.css.html +7553 -0
- data/asciidoc/doc/asciidoc.dict +673 -0
- data/asciidoc/doc/asciidoc.html +3502 -0
- data/asciidoc/doc/asciidoc.txt +4757 -0
- data/asciidoc/doc/asciimath.txt +47 -0
- data/asciidoc/doc/book-multi.css-embedded.html +575 -0
- data/asciidoc/doc/book-multi.html +72 -0
- data/asciidoc/doc/book-multi.txt +159 -0
- data/asciidoc/doc/book.css-embedded.html +585 -0
- data/asciidoc/doc/book.html +60 -0
- data/asciidoc/doc/book.txt +133 -0
- data/asciidoc/doc/customers.csv +18 -0
- data/asciidoc/doc/faq.txt +262 -0
- data/asciidoc/doc/latex-backend.html +224 -0
- data/asciidoc/doc/latex-backend.txt +193 -0
- data/asciidoc/doc/latexmath.txt +35 -0
- data/asciidoc/doc/main.aap +293 -0
- data/asciidoc/doc/music-filter.html +513 -0
- data/asciidoc/doc/music-filter.pdf +0 -0
- data/asciidoc/doc/music-filter.txt +158 -0
- data/asciidoc/doc/source-highlight-filter.html +183 -0
- data/asciidoc/doc/source-highlight-filter.pdf +0 -0
- data/asciidoc/doc/source-highlight-filter.txt +174 -0
- data/asciidoc/docbook-xsl/asciidoc-docbook-xsl.txt +71 -0
- data/asciidoc/docbook-xsl/chunked.xsl +19 -0
- data/asciidoc/docbook-xsl/common.xsl +67 -0
- data/asciidoc/docbook-xsl/fo.xsl +117 -0
- data/asciidoc/docbook-xsl/htmlhelp.xsl +17 -0
- data/asciidoc/docbook-xsl/manpage.xsl +28 -0
- data/asciidoc/docbook-xsl/shaded-literallayout.patch +32 -0
- data/asciidoc/docbook-xsl/xhtml.xsl +14 -0
- data/asciidoc/docbook.conf +606 -0
- data/asciidoc/examples/website/CHANGELOG.html +3828 -0
- data/asciidoc/examples/website/INSTALL.html +163 -0
- data/asciidoc/examples/website/README-website.html +129 -0
- data/asciidoc/examples/website/README-website.txt +29 -0
- data/asciidoc/examples/website/README.html +125 -0
- data/asciidoc/examples/website/a2x.1.html +395 -0
- data/asciidoc/examples/website/asciidoc-docbook-xsl.html +165 -0
- data/asciidoc/examples/website/asciimath.html +157 -0
- data/asciidoc/examples/website/build-website.sh +25 -0
- data/asciidoc/examples/website/downloads.html +219 -0
- data/asciidoc/examples/website/downloads.txt +98 -0
- data/asciidoc/examples/website/faq.html +372 -0
- data/asciidoc/examples/website/index.html +398 -0
- data/asciidoc/examples/website/index.txt +222 -0
- data/asciidoc/examples/website/latex-backend.html +640 -0
- data/asciidoc/examples/website/latexmath.html +119 -0
- data/asciidoc/examples/website/layout1.conf +161 -0
- data/asciidoc/examples/website/layout1.css +65 -0
- data/asciidoc/examples/website/layout2.conf +158 -0
- data/asciidoc/examples/website/layout2.css +93 -0
- data/asciidoc/examples/website/manpage.html +266 -0
- data/asciidoc/examples/website/music-filter.html +242 -0
- data/asciidoc/examples/website/music1.abc +12 -0
- data/asciidoc/examples/website/music1.png +0 -0
- data/asciidoc/examples/website/music2.ly +9 -0
- data/asciidoc/examples/website/music2.png +0 -0
- data/asciidoc/examples/website/source-highlight-filter.html +251 -0
- data/asciidoc/examples/website/support.html +78 -0
- data/asciidoc/examples/website/support.txt +5 -0
- data/asciidoc/examples/website/userguide.html +7597 -0
- data/asciidoc/examples/website/version9.html +143 -0
- data/asciidoc/examples/website/version9.txt +48 -0
- data/asciidoc/filters/code-filter-readme.txt +37 -0
- data/asciidoc/filters/code-filter-test-c++.txt +7 -0
- data/asciidoc/filters/code-filter-test.txt +15 -0
- data/asciidoc/filters/code-filter.conf +8 -0
- data/asciidoc/filters/code-filter.py +239 -0
- data/asciidoc/filters/music-filter-test.txt +40 -0
- data/asciidoc/filters/music-filter.conf +40 -0
- data/asciidoc/filters/music2png.py +189 -0
- data/asciidoc/filters/source-highlight-filter-test.txt +19 -0
- data/asciidoc/filters/source-highlight-filter.conf +100 -0
- data/asciidoc/help.conf +213 -0
- data/asciidoc/html4.conf +363 -0
- data/asciidoc/images/highlighter.png +0 -0
- data/asciidoc/images/icons/README +5 -0
- data/asciidoc/images/icons/callouts/1.png +0 -0
- data/asciidoc/images/icons/callouts/10.png +0 -0
- data/asciidoc/images/icons/callouts/11.png +0 -0
- data/asciidoc/images/icons/callouts/12.png +0 -0
- data/asciidoc/images/icons/callouts/13.png +0 -0
- data/asciidoc/images/icons/callouts/14.png +0 -0
- data/asciidoc/images/icons/callouts/15.png +0 -0
- data/asciidoc/images/icons/callouts/2.png +0 -0
- data/asciidoc/images/icons/callouts/3.png +0 -0
- data/asciidoc/images/icons/callouts/4.png +0 -0
- data/asciidoc/images/icons/callouts/5.png +0 -0
- data/asciidoc/images/icons/callouts/6.png +0 -0
- data/asciidoc/images/icons/callouts/7.png +0 -0
- data/asciidoc/images/icons/callouts/8.png +0 -0
- data/asciidoc/images/icons/callouts/9.png +0 -0
- data/asciidoc/images/icons/caution.png +0 -0
- data/asciidoc/images/icons/example.png +0 -0
- data/asciidoc/images/icons/home.png +0 -0
- data/asciidoc/images/icons/important.png +0 -0
- data/asciidoc/images/icons/next.png +0 -0
- data/asciidoc/images/icons/note.png +0 -0
- data/asciidoc/images/icons/prev.png +0 -0
- data/asciidoc/images/icons/tip.png +0 -0
- data/asciidoc/images/icons/up.png +0 -0
- data/asciidoc/images/icons/warning.png +0 -0
- data/asciidoc/images/smallnew.png +0 -0
- data/asciidoc/images/tiger.png +0 -0
- data/asciidoc/install.sh +55 -0
- data/asciidoc/javascripts/ASCIIMathML.js +938 -0
- data/asciidoc/javascripts/LaTeXMathML.js +1223 -0
- data/asciidoc/javascripts/toc.js +69 -0
- data/asciidoc/lang-es.conf +15 -0
- data/asciidoc/latex.conf +663 -0
- data/asciidoc/linuxdoc.conf +285 -0
- data/asciidoc/math.conf +50 -0
- data/asciidoc/stylesheets/docbook-xsl.css +271 -0
- data/asciidoc/stylesheets/xhtml-deprecated-manpage.css +21 -0
- data/asciidoc/stylesheets/xhtml-deprecated.css +247 -0
- data/asciidoc/stylesheets/xhtml11-manpage.css +18 -0
- data/asciidoc/stylesheets/xhtml11-quirks.css +49 -0
- data/asciidoc/stylesheets/xhtml11.css +284 -0
- data/asciidoc/t.conf +20 -0
- data/asciidoc/text.conf +16 -0
- data/asciidoc/vim/ftdetect/asciidoc_filetype.vim +53 -0
- data/asciidoc/vim/syntax/asciidoc.vim +139 -0
- data/asciidoc/xhtml-deprecated-css.conf +235 -0
- data/asciidoc/xhtml-deprecated.conf +351 -0
- data/asciidoc/xhtml11-quirks.conf +57 -0
- data/asciidoc/xhtml11.conf +514 -0
- data/bin/mizuho +40 -0
- data/lib/mizuho/chapter.rb +54 -0
- data/lib/mizuho/generator.rb +106 -0
- data/lib/mizuho/heading.rb +46 -0
- data/lib/mizuho/parser.rb +99 -0
- data/lib/mizuho/template.rb +50 -0
- data/mizuho.gemspec +34 -0
- data/templates/asciidoc.css +358 -0
- data/templates/asciidoc.html.erb +86 -0
- data/templates/manualsonrails.css +165 -0
- data/templates/manualsonrails.html.erb +97 -0
- data/test/parser_spec.rb +190 -0
- data/test/spec_helper.rb +43 -0
- metadata +234 -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 %>">« 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 %>">« <%= 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 %> »</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 %>">« <%= 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 %> »</a>
|
90
|
+
</div>
|
91
|
+
<%- end -%>
|
92
|
+
</div>
|
93
|
+
<%- end -%>
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
</body>
|
97
|
+
</html>
|
data/test/parser_spec.rb
ADDED
@@ -0,0 +1,190 @@
|
|
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(<i>hurray</i>)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "HTML-escapes non-HTML special characters in the title" do
|
24
|
+
@html_chapter.title.should =~ %r(<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(<i>hurray</i>)
|
110
|
+
end
|
111
|
+
|
112
|
+
it "HTML-escapes non-HTML special characters in the title" do
|
113
|
+
@toc[2].title.should =~ %r(<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
|
+
it "fixes cross-chapter references when in multi-page output mode"
|
190
|
+
end
|