mizuho 0.9.10 → 0.9.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/README.markdown +18 -2
  2. data/asciidoc/BUGS +3 -6
  3. data/asciidoc/BUGS.txt +0 -3
  4. data/asciidoc/CHANGELOG +660 -397
  5. data/asciidoc/CHANGELOG.txt +237 -2
  6. data/asciidoc/INSTALL +14 -14
  7. data/asciidoc/MANIFEST +2 -0
  8. data/asciidoc/Makefile.in +9 -1
  9. data/asciidoc/README +2 -2
  10. data/asciidoc/a2x.py +101 -43
  11. data/asciidoc/asciidoc.conf +18 -11
  12. data/asciidoc/asciidoc.py +615 -260
  13. data/asciidoc/common.aap +2 -2
  14. data/asciidoc/configure +9 -9
  15. data/asciidoc/configure.ac +1 -1
  16. data/asciidoc/doc/a2x.1 +34 -4
  17. data/asciidoc/doc/a2x.1.txt +12 -0
  18. data/asciidoc/doc/article.pdf +0 -0
  19. data/asciidoc/doc/asciidoc.1 +73 -29
  20. data/asciidoc/doc/asciidoc.1.txt +56 -30
  21. data/asciidoc/doc/asciidoc.dict +23 -2
  22. data/asciidoc/doc/asciidoc.txt +468 -327
  23. data/asciidoc/doc/book.epub +0 -0
  24. data/asciidoc/doc/faq.txt +201 -25
  25. data/asciidoc/doc/latex-filter.pdf +0 -0
  26. data/asciidoc/doc/music-filter.pdf +0 -0
  27. data/asciidoc/doc/publishing-ebooks-with-asciidoc.txt +1 -1
  28. data/asciidoc/doc/source-highlight-filter.pdf +0 -0
  29. data/asciidoc/doc/source-highlight-filter.txt +48 -37
  30. data/asciidoc/docbook45.conf +4 -4
  31. data/asciidoc/examples/website/ASCIIMathML.js +938 -0
  32. data/asciidoc/examples/website/CHANGELOG.txt +3056 -0
  33. data/asciidoc/examples/website/INSTALL.txt +227 -0
  34. data/asciidoc/examples/website/LaTeXMathML.js +1223 -0
  35. data/asciidoc/examples/website/README-website.txt +29 -0
  36. data/asciidoc/examples/website/README.txt +35 -0
  37. data/asciidoc/examples/website/a2x.1.txt +358 -0
  38. data/asciidoc/examples/website/asciidoc-docbook-xsl.txt +65 -0
  39. data/asciidoc/examples/website/asciidoc-graphviz-sample.txt +170 -0
  40. data/asciidoc/examples/website/asciidoc.css +533 -0
  41. data/asciidoc/examples/website/asciidoc.js +189 -0
  42. data/asciidoc/examples/website/asciidocapi.txt +189 -0
  43. data/asciidoc/examples/website/asciimathml.txt +61 -0
  44. data/asciidoc/examples/website/build-website.sh +25 -0
  45. data/asciidoc/examples/website/customers.csv +18 -0
  46. data/asciidoc/examples/website/epub-notes.txt +210 -0
  47. data/asciidoc/examples/website/faq.txt +1298 -0
  48. data/asciidoc/examples/website/index.txt +502 -0
  49. data/asciidoc/examples/website/latex-backend.txt +192 -0
  50. data/asciidoc/examples/website/latex-bugs.txt +134 -0
  51. data/asciidoc/examples/website/latex-filter.txt +196 -0
  52. data/asciidoc/examples/website/latexmathml.txt +41 -0
  53. data/asciidoc/examples/website/layout1.conf +153 -0
  54. data/asciidoc/examples/website/layout1.css +65 -0
  55. data/asciidoc/examples/website/layout2.conf +153 -0
  56. data/asciidoc/examples/website/layout2.css +83 -0
  57. data/asciidoc/examples/website/main.aap +159 -0
  58. data/asciidoc/examples/website/manpage.txt +197 -0
  59. data/asciidoc/examples/website/music-filter.txt +148 -0
  60. data/asciidoc/examples/website/newlists.txt +40 -0
  61. data/asciidoc/examples/website/newtables.txt +743 -0
  62. data/asciidoc/examples/website/plugins.txt +91 -0
  63. data/asciidoc/examples/website/publishing-ebooks-with-asciidoc.txt +398 -0
  64. data/asciidoc/examples/website/slidy-example.txt +167 -0
  65. data/asciidoc/examples/website/slidy.txt +113 -0
  66. data/asciidoc/examples/website/source-highlight-filter.txt +239 -0
  67. data/asciidoc/examples/website/support.txt +5 -0
  68. data/asciidoc/examples/website/testasciidoc.txt +231 -0
  69. data/asciidoc/examples/website/userguide.txt +5991 -0
  70. data/asciidoc/examples/website/version83.txt +37 -0
  71. data/asciidoc/examples/website/xhtml11-quirks.css +43 -0
  72. data/asciidoc/filters/latex/latex2png.py +28 -12
  73. data/asciidoc/filters/music/music2png.py +22 -6
  74. data/asciidoc/filters/source/source-highlight-filter.conf +7 -5
  75. data/asciidoc/help.conf +147 -131
  76. data/asciidoc/html4.conf +1 -0
  77. data/asciidoc/html5.conf +37 -39
  78. data/asciidoc/javascripts/asciidoc.js +3 -3
  79. data/asciidoc/lang-de.conf +4 -0
  80. data/asciidoc/lang-es.conf +2 -0
  81. data/asciidoc/lang-fr.conf +1 -1
  82. data/asciidoc/lang-hu.conf +2 -0
  83. data/asciidoc/lang-it.conf +2 -0
  84. data/asciidoc/lang-nl.conf +5 -0
  85. data/asciidoc/lang-pt-BR.conf +2 -0
  86. data/asciidoc/lang-ru.conf +2 -3
  87. data/asciidoc/latex.conf +2 -2
  88. data/asciidoc/slidy.conf +4 -2
  89. data/asciidoc/stylesheets/asciidoc.css +29 -4
  90. data/asciidoc/stylesheets/docbook-xsl.css +12 -5
  91. data/asciidoc/stylesheets/toc2.css +1 -0
  92. data/asciidoc/stylesheets/xhtml11-quirks.css +1 -1
  93. data/asciidoc/tests/data/lang-de-man-test.txt +21 -0
  94. data/asciidoc/tests/data/lang-en-man-test.txt +21 -0
  95. data/asciidoc/tests/data/lang-es-man-test.txt +21 -0
  96. data/asciidoc/tests/data/lang-fr-man-test.txt +21 -0
  97. data/asciidoc/tests/data/lang-hu-man-test.txt +21 -0
  98. data/asciidoc/tests/data/lang-it-man-test.txt +21 -0
  99. data/asciidoc/tests/data/lang-it-test.txt +106 -0
  100. data/asciidoc/tests/data/lang-nl-man-test.txt +21 -0
  101. data/asciidoc/tests/data/lang-pt-BR-man-test.txt +21 -0
  102. data/asciidoc/tests/data/lang-ru-man-test.txt +21 -0
  103. data/asciidoc/tests/data/lang-uk-man-test.txt +21 -0
  104. data/asciidoc/tests/data/testcases.conf +10 -0
  105. data/asciidoc/tests/data/testcases.txt +40 -0
  106. data/asciidoc/tests/testasciidoc.conf +143 -17
  107. data/asciidoc/tests/testasciidoc.py +11 -2
  108. data/asciidoc/{stylesheets → themes/flask}/flask.css +0 -0
  109. data/asciidoc/{stylesheets → themes/volnitsky}/volnitsky.css +1 -1
  110. data/asciidoc/vim/ftdetect/asciidoc_filetype.vim +1 -1
  111. data/asciidoc/vim/syntax/asciidoc.vim +1 -1
  112. data/asciidoc/xhtml11-quirks.conf +2 -2
  113. data/asciidoc/xhtml11.conf +35 -37
  114. data/lib/mizuho.rb +1 -1
  115. data/lib/mizuho/generator.rb +3 -1
  116. data/source-highlight/darwin/source-highlight +0 -0
  117. data/templates/juvia.js +30 -5
  118. metadata +58 -9
  119. data/asciidoc/stylesheets/asciidoc-manpage.css +0 -18
  120. data/asciidoc/stylesheets/flask-manpage.css +0 -1
  121. data/asciidoc/stylesheets/volnitsky-manpage.css +0 -1
@@ -0,0 +1,167 @@
1
+ Slidy Example Slideshow
2
+ =======================
3
+ :author: Joe Bloggs
4
+ :copyright: Foobar Inc.
5
+ :backend: slidy
6
+ :max-width: 45em
7
+ :data-uri:
8
+ :icons:
9
+
10
+
11
+ This preamble will appear on a separate slide.
12
+
13
+
14
+ AsciiDoc Elements
15
+ -----------------
16
+ Sagittis in vestibulum. Habitasse ante nulla enim bibendum nulla. Odio
17
+ sed pede litora.
18
+
19
+ [float]
20
+ === Titles inside delimited blocks must be floated
21
+ Porta nisl metus. Justo porttitor vel. Cras consequat tincidunt id sed
22
+ conubia. Feugiat felis justo. Nunc amet nulla. Eu ac orci mollis.
23
+
24
+ .Tiger
25
+ image::images/tiger.png[]
26
+
27
+
28
+ Incremental Elements
29
+ --------------------
30
+ The remaining elements on this page are incremental, press the space
31
+ bar to reveal them.
32
+
33
+ [role="incremental"]
34
+ - Rhoncus pede justo.
35
+ - Velit pede dolor.
36
+ - Iaculis commodo et.
37
+ - Volutpat tristique nec.
38
+
39
+ [role="incremental"]
40
+ --
41
+ Sagittis in vestibulum. Habitasse ante nulla enim bibendum nulla. Odio
42
+ sed pede litora.
43
+ --
44
+
45
+ [role="incremental"]
46
+ . Rhoncus pede justo.
47
+ . Velit pede dolor.
48
+ . Iaculis commodo et.
49
+ . Volutpat tristique nec.
50
+
51
+
52
+ Outline Elements
53
+ ----------------
54
+ The following list is a Slidy 'outline' list -- nested bulleted or
55
+ numbered lists are expanded when the enclosing list item (the ones
56
+ with blue bullet points or numbers) are clicked.
57
+
58
+ [role="outline"]
59
+ - Rhoncus pede justo.
60
+ * Rhoncus pede justo.
61
+ * Velit pede dolor.
62
+
63
+ - Velit pede dolor.
64
+ * Iaculis commodo et.
65
+ +
66
+ NOTE: 'Note' admonition paragraph.
67
+
68
+ * Volutpat tristique nec.
69
+ +
70
+ image::images/tiger.png[]
71
+ * Iaculis commodo et.
72
+ * Volutpat tristique nec.
73
+
74
+ - Iaculis commodo et.
75
+ [role="outline"]
76
+ . Rhoncus pede justo.
77
+ ** Velit pede dolor.
78
+ ** Iaculis commodo et.
79
+ . Volutpat tristique nec.
80
+
81
+ - Volutpat tristique nec.
82
+
83
+
84
+ AsciiDoc Elements
85
+ -----------------
86
+ NOTE: 'Note' admonition paragraph.
87
+
88
+ IMPORTANT: 'Important' admonition paragraph.
89
+
90
+ .Sidebar
91
+ *********************************************************************
92
+ Faucibus sagittis commodo sed et eu. Quam nullam ornare. Sed vel est.
93
+ Mauris urna lobortis interdum placerat per id magnis enim.
94
+ *********************************************************************
95
+
96
+
97
+ AsciiDoc Elements
98
+ -----------------
99
+ A quote block:
100
+
101
+ [quote, Bertrand Russell, The World of Mathematics (1956)]
102
+ ____________________________________________________________________
103
+ A good notation has subtlety and suggestiveness which at times makes
104
+ it almost seem like a live teacher.
105
+ ____________________________________________________________________
106
+
107
+ A verse block:
108
+
109
+ [verse, William Blake, from Auguries of Innocence]
110
+ __________________________________________________
111
+ To see a world in a grain of sand,
112
+ And a heaven in a wild flower,
113
+ Hold infinity in the palm of your hand,
114
+ And eternity in an hour.
115
+ __________________________________________________
116
+
117
+
118
+ AsciiDoc Elements
119
+ -----------------
120
+ .Horizontal and vertical source data
121
+ [width="80%",cols="3,^2,^2,10",options="header"]
122
+ |=========================================================
123
+ |Date |Duration |Avg HR |Notes
124
+
125
+ |22-Aug-08 |10:24 | 157 |
126
+ Worked out MSHR (max sustainable heart rate) by going hard
127
+ for this interval.
128
+
129
+ |22-Aug-08 |23:03 | 152 |
130
+ Back-to-back with previous interval.
131
+
132
+ |24-Aug-08 |40:00 | 145 |
133
+ Moderately hard interspersed with 3x 3min intervals (2min
134
+ hard + 1min really hard taking the HR up to 160).
135
+
136
+ |=========================================================
137
+
138
+
139
+ Filters
140
+ -------
141
+ [source,python]
142
+ .Python source
143
+ ---------------------------------------------------------------------
144
+ ''' A multi-line
145
+ comment.'''
146
+ def sub_word(mo):
147
+ ''' Single line comment.'''
148
+ word = mo.group('word') # Inline comment
149
+ if word in keywords[language]:
150
+ return quote + word + quote
151
+ else:
152
+ return word
153
+ ---------------------------------------------------------------------
154
+
155
+ [music]
156
+ .Music
157
+ ---------------------------------------------------------------------
158
+ \version "2.10.0"
159
+ \paper {
160
+ ragged-right = ##t
161
+ }
162
+ {
163
+ \time 3/4
164
+ \clef bass
165
+ c2 e4 g2. f4 e d c2 r4
166
+ }
167
+ ---------------------------------------------------------------------
@@ -0,0 +1,113 @@
1
+ Slidy backend for AsciiDoc
2
+ ==========================
3
+ :author: Stuart Rackham
4
+ :backend: slidy
5
+ :max-width: 45em
6
+ :data-uri:
7
+ :icons:
8
+
9
+
10
+ Use the following command to create this document (`slidy.html`):
11
+
12
+ asciidoc slidy.txt
13
+
14
+ Press the 'Space' key or the 'Left Arrow' key to continue the
15
+ slideshow.
16
+
17
+
18
+ Overview
19
+ --------
20
+ AsciiDoc has a 'slidy' backend for generating self contained 'Slidy'
21
+ HTML slideshows.
22
+
23
+ - An overview of 'Slidy' can be found here:
24
+ http://www.w3.org/Talks/Tools/Slidy2/
25
+ - AsciiDoc ships with the Slidy JavaScript a customised Slidy CSS
26
+ file.
27
+ - Use the 'asciidoc' `--backend slidy` command-line option to generate
28
+ browser viewable HTML slideshow. Example:
29
+
30
+ asciidoc --backend slidy slidy-example.txt
31
+
32
+ - By default, 'asciidoc' creates a self contained distributable HTML
33
+ document which includes all necessary CSS and JavaScripts. Use the
34
+ 'asciidoc' `--attribute linkcss` command-line option if you prefer
35
+ to link (rather than embed) external CSS and JavaScript files.
36
+
37
+
38
+ How Slidy uses AsciiDoc markup
39
+ ------------------------------
40
+ - The document header is displayed as the first page of the slideshow.
41
+ - If the document has a 'preamble' (the content between the header and
42
+ the first section) it will be displayed on the second page.
43
+ - Each top level section is displayed as a separate slide.
44
+ - If the AsciiDoc 'incremental' attribute is defined then all lists
45
+ and OpenBlock elements are treated as 'incremental' i.e. Slidy
46
+ exposes their child elements one at a time as you progress through
47
+ the slideshow.
48
+ - You can explicitly set an element as incremental by setting its
49
+ 'role' attribute to 'incremental'. Example:
50
+
51
+ [role="incremental"]
52
+ Sagittis in vestibulum. Habitasse ante nulla enim bibendum nulla.
53
+ Odio sed pede litora.
54
+
55
+
56
+ Slidy Specific Attributes
57
+ -------------------------
58
+ incremental::
59
+ If this attribute is defined then all lists and OpenBlock elements are
60
+ classed as incremental i.e. Slidy will expose them one at a time as
61
+ you progress through the slideshow. The default behavior is for the
62
+ show to progress a full slide at at time. Elements that have been
63
+ explicitly classed as 'incremental' with the 'role' attribute are
64
+ always displayed incrementally.
65
+
66
+ duration::
67
+ Set this to the estimated number of minutes that your presentation
68
+ will take and Slidy will display a countdown timer at the bottom right
69
+ of the slideshow. For example, this 'asciidoc' command-line option
70
+ `--attribute duration=5` sets the duration to five minutes.
71
+
72
+ copyright::
73
+ If you set the 'copyright' attribute it will be displayed in the Slidy
74
+ menu bar at the bottom of the slide. If the 'copyright' attribute is
75
+ not define then the author name, if it is defined, will be displayed.
76
+
77
+ outline::
78
+ Setting the 'role' attribute to 'outline' in a bulleted or numbered
79
+ list allows nested lists to be expanded and collapsed using the mouse.
80
+ Nested lists are expanded when an enclosing list item (the ones with
81
+ blue bullet points or numbers) is clicked.
82
+
83
+
84
+ Stylesheets
85
+ -----------
86
+ - 'slidy' loads the 'asciidoc.css' stylesheet followed by 'slidy.css':
87
+ * `asciidoc.css` contains content presentational styles.
88
+ * The customized `slidy.css` stylesheet contains Slidy specific
89
+ styles (table of contents, menu and transition related).
90
+ - You can use AsciiDoc CSS themes. For example, the 'asciidoc'
91
+ `--attribute theme=volnitsky` command-line option will substitute
92
+ the `asciidoc.css` stylesheet for the distributed Volnitsky
93
+ `volnitsky.css` stylesheet.
94
+ - An additional stylesheet can be specified by setting the
95
+ 'stylesheet' attribute. For example, the `--attribute
96
+ stylesheet=myslidy.css` will load `myslidy.css` after the standard
97
+ CSS files.
98
+
99
+
100
+ Tips
101
+ ----
102
+ - The Slidy 'help?' and 'contents?' links at the bottom left are your
103
+ friends.
104
+ - Use the AsciiDoc 'data-uri' attribute to embed images in your
105
+ slideshow -- add this attribute entry to your document's header:
106
+
107
+ :data-uri:
108
+
109
+ - Use the AsciiDoc 'max-width' attribute to set the document display
110
+ width. For example, add this attribute entry to your document's
111
+ header:
112
+
113
+ :max-width: 45em
@@ -0,0 +1,239 @@
1
+ Source Code Highlight Filter
2
+ ============================
3
+
4
+ The AsciiDoc distribution includes a source code syntax highlight
5
+ filter (`source-highlight-filter.conf`).
6
+
7
+
8
+ HTML Outputs
9
+ ------------
10
+ The highlighter uses http://www.gnu.org/software/src-highlite/[GNU
11
+ source-highlight] to highlight 'html4' and 'xhtml11' outputs. You also
12
+ have the option of using the http://pygments.org/[Pygments] syntax
13
+ highlighter for 'xhtml11' outputs.
14
+
15
+ - The filter command must reside in the shell search 'PATH'.
16
+ 'pygmentize' command in your 'PATH'.
17
+ - To use Pygments you need to define an AsciiDoc attribute named
18
+ 'pygments'.
19
+ - You can customize Pygments CSS styles by editing
20
+ `./stylesheets/pygments.css`.
21
+ - To make Pygments your default highlighter put the following line
22
+ your `~/.asciidoc/asciidoc.conf` file:
23
+
24
+ pygments=
25
+
26
+ - The AsciiDoc 'encoding' attribute is passed to Pygments as a `-O`
27
+ command-line option.
28
+
29
+
30
+ DocBook Outputs
31
+ ---------------
32
+ AsciiDoc encloses the source code in a DocBook 'programlisting'
33
+ element and leaves source code highlighting to the DocBook toolchain
34
+ (dblatex has a particularly nice programlisting highlighter). The
35
+ DocBook programlisting element is assigned two attributes:
36
+
37
+ . The 'language' attribute is set to the AsciiDoc 'language'
38
+ attribute.
39
+ . The 'linenumbering' attribute is set to the AsciiDoc 'src_numbered'
40
+ attribute ('numbered' or 'unnumbered').
41
+
42
+
43
+ Block attributes
44
+ ----------------
45
+ The following attributes can be included in source code block
46
+ attribute lists.
47
+
48
+ - 'style' and 'language' are mandatory.
49
+ - 'style', 'language' and 'src_numbered' are the first three
50
+ positional attributes in that order.
51
+ - The 'args' attribute allows the inclusion of arbitrary (highlighter
52
+ dependent) command options.
53
+
54
+ //
55
+
56
+ style::
57
+ Set to 'source'.
58
+ language::
59
+ The source code language name.
60
+ src_numbered::
61
+ Set to 'numbered' to include line numbers.
62
+ src_tab::
63
+ Set tab size (GNU source-highlight only).
64
+ args::
65
+ Include this attribute value in the highlighter command-line (GNU
66
+ source-highlight and pygmentize) or in the `programlisting` element
67
+ (DocBook).
68
+
69
+
70
+ Testing
71
+ -------
72
+ Test the filter by converting the test file to HTML with AsciiDoc:
73
+
74
+ $ asciidoc -v ./filters/source/source-highlight-filter-test.txt
75
+ $ firefox ./filters/source/source-highlight-filter-test.html &
76
+
77
+
78
+ Examples
79
+ --------
80
+
81
+ Source code paragraphs
82
+ ~~~~~~~~~~~~~~~~~~~~~~
83
+ The `source` paragraph style will highlight a paragraph of source
84
+ code. These three code paragraphs:
85
+
86
+ ---------------------------------------------------------------------
87
+ [source,python]
88
+ if n < 0: print 'Hello World!'
89
+
90
+ :language: python
91
+
92
+ [source]
93
+ if n < 0: print 'Hello World!'
94
+
95
+ [source,ruby,numbered]
96
+ [true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
97
+ puts "#{a.inspect} => #{b.inspect}"
98
+ ---------------------------------------------------------------------
99
+
100
+ Render this highlighted source code:
101
+
102
+ [source,python]
103
+ if n < 0: print 'Hello World!'
104
+
105
+ :language: python
106
+
107
+ [source]
108
+ if n < 0: print 'Hello World!'
109
+
110
+ [source,ruby,numbered]
111
+ [true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
112
+ puts "#{a.inspect} => #{b.inspect}"
113
+
114
+
115
+ Unnumbered source code listing
116
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
117
+ This source-highlight filtered block:
118
+
119
+ ---------------------------------------------------------------------
120
+ [source,python]
121
+ ---------------------------------------------------------------------
122
+ ''' A multi-line
123
+ comment.'''
124
+ def sub_word(mo):
125
+ ''' Single line comment.'''
126
+ word = mo.group('word') # Inline comment
127
+ if word in keywords[language]:
128
+ return quote + word + quote
129
+ else:
130
+ return word
131
+ ---------------------------------------------------------------------
132
+ ---------------------------------------------------------------------
133
+
134
+ Renders this highlighted source code:
135
+
136
+ [source,python]
137
+ ---------------------------------------------------------------------
138
+ ''' A multi-line
139
+ comment.'''
140
+ def sub_word(mo):
141
+ ''' Single line comment.'''
142
+ word = mo.group('word') # Inline comment
143
+ if word in keywords[language]:
144
+ return quote + word + quote
145
+ else:
146
+ return word
147
+ ---------------------------------------------------------------------
148
+
149
+ Numbered source code listing with callouts
150
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151
+ This source-highlight filtered block:
152
+
153
+ ---------------------------------------------------------------------
154
+ [source,ruby,numbered]
155
+ ---------------------------------------------------------------------
156
+ #
157
+ # Useful Ruby base class extensions.
158
+ #
159
+
160
+ class Array
161
+
162
+ # Execute a block passing it corresponding items in
163
+ # +self+ and +other_array+.
164
+ # If self has less items than other_array it is repeated.
165
+
166
+ def cycle(other_array) # :yields: item, other_item
167
+ other_array.each_with_index do |item, index|
168
+ yield(self[index % self.length], item)
169
+ end
170
+ end
171
+
172
+ end
173
+
174
+ if $0 == __FILE__ \<1>
175
+ # Array#cycle test
176
+ # true => 0
177
+ # false => 1
178
+ # true => 2
179
+ # false => 3
180
+ # true => 4
181
+ puts 'Array#cycle test' \<2>
182
+ [true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
183
+ puts "#{a.inspect} => #{b.inspect}"
184
+ end
185
+ end
186
+ ---------------------------------------------------------------------
187
+
188
+ \<1> First callout.
189
+ \<2> Second callout.
190
+
191
+ ---------------------------------------------------------------------
192
+
193
+ Renders this highlighted source code:
194
+
195
+ [source,ruby,numbered]
196
+ ---------------------------------------------------------------------
197
+ #
198
+ # Useful Ruby base class extensions.
199
+ #
200
+
201
+ class Array
202
+
203
+ # Execute a block passing it corresponding items in
204
+ # +self+ and +other_array+.
205
+ # If self has less items than other_array it is repeated.
206
+
207
+ def cycle(other_array) # :yields: item, other_item
208
+ other_array.each_with_index do |item, index|
209
+ yield(self[index % self.length], item)
210
+ end
211
+ end
212
+
213
+ end
214
+
215
+ if $0 == __FILE__ <1>
216
+ # Array#cycle test
217
+ # true => 0
218
+ # false => 1
219
+ # true => 2
220
+ # false => 3
221
+ # true => 4
222
+ puts 'Array#cycle test' <2>
223
+ [true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
224
+ puts "#{a.inspect} => #{b.inspect}"
225
+ end
226
+ end
227
+ ---------------------------------------------------------------------
228
+
229
+ <1> First callout.
230
+ <2> Second callout.
231
+
232
+ [TIP]
233
+ =====
234
+ - If the source 'language' attribute has been set (using an
235
+ 'AttributeEntry' or from the command-line) you don't have to specify
236
+ it in each source code block.
237
+ - You may need to place callout markers inside source code comments to
238
+ ensure they are not misinterpreted and mangled by the highlighter.
239
+ =====