review-peg 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +36 -0
  3. data/.rubocop.yml +47 -0
  4. data/.rubocop_todo.yml +605 -0
  5. data/.travis.yml +18 -0
  6. data/COPYING +515 -0
  7. data/ChangeLog +2449 -0
  8. data/Dockerfile +22 -0
  9. data/Gemfile +6 -0
  10. data/README.rdoc +81 -0
  11. data/Rakefile +51 -0
  12. data/bin/review-catalog-converter-peg +129 -0
  13. data/bin/review-check-peg +169 -0
  14. data/bin/review-checkdep-peg +63 -0
  15. data/bin/review-compile-peg +202 -0
  16. data/bin/review-epubmaker-legacy-peg +1024 -0
  17. data/bin/review-epubmaker-peg +44 -0
  18. data/bin/review-index-peg +110 -0
  19. data/bin/review-init-peg +151 -0
  20. data/bin/review-pdfmaker-peg +18 -0
  21. data/bin/review-preproc-peg +131 -0
  22. data/bin/review-validate-peg +51 -0
  23. data/bin/review-vol-peg +100 -0
  24. data/debian/README.Debian +12 -0
  25. data/debian/README.source +5 -0
  26. data/debian/changelog +5 -0
  27. data/debian/compat +1 -0
  28. data/debian/control +22 -0
  29. data/debian/copyright +62 -0
  30. data/debian/docs +6 -0
  31. data/debian/manpage.1.ex +59 -0
  32. data/debian/patches/path.diff +91 -0
  33. data/debian/patches/series +1 -0
  34. data/debian/review.install +13 -0
  35. data/debian/review.links +4 -0
  36. data/debian/rules +13 -0
  37. data/debian/source/format +1 -0
  38. data/doc/NEWS.ja.md +350 -0
  39. data/doc/NEWS.md +354 -0
  40. data/doc/catalog.ja.md +53 -0
  41. data/doc/catalog.md +52 -0
  42. data/doc/format.ja.md +734 -0
  43. data/doc/format.md +746 -0
  44. data/doc/format_idg.ja.md +203 -0
  45. data/doc/quickstart.ja.md +222 -0
  46. data/doc/quickstart.md +252 -0
  47. data/doc/ruby-uuid/README +11 -0
  48. data/doc/ruby-uuid/README.ja +34 -0
  49. data/doc/sample.css +108 -0
  50. data/doc/sample.yml +238 -0
  51. data/lib/epubmaker.rb +24 -0
  52. data/lib/epubmaker/content.rb +93 -0
  53. data/lib/epubmaker/epubcommon.rb +424 -0
  54. data/lib/epubmaker/epubv2.rb +139 -0
  55. data/lib/epubmaker/epubv3.rb +222 -0
  56. data/lib/epubmaker/producer.rb +330 -0
  57. data/lib/lineinput.rb +107 -0
  58. data/lib/review.rb +3 -0
  59. data/lib/review/book.rb +43 -0
  60. data/lib/review/book/base.rb +401 -0
  61. data/lib/review/book/chapter.rb +100 -0
  62. data/lib/review/book/compilable.rb +184 -0
  63. data/lib/review/book/image_finder.rb +71 -0
  64. data/lib/review/book/index.rb +413 -0
  65. data/lib/review/book/page_metric.rb +47 -0
  66. data/lib/review/book/part.rb +54 -0
  67. data/lib/review/book/volume.rb +67 -0
  68. data/lib/review/builder.rb +452 -0
  69. data/lib/review/catalog.rb +52 -0
  70. data/lib/review/compiler.rb +5183 -0
  71. data/lib/review/compiler/literals_1_9.kpeg +22 -0
  72. data/lib/review/compiler/literals_1_9.rb +435 -0
  73. data/lib/review/configure.rb +64 -0
  74. data/lib/review/epubbuilder.rb +18 -0
  75. data/lib/review/epubmaker.rb +480 -0
  76. data/lib/review/ewbbuilder.rb +381 -0
  77. data/lib/review/exception.rb +21 -0
  78. data/lib/review/extentions.rb +4 -0
  79. data/lib/review/extentions/array.rb +25 -0
  80. data/lib/review/extentions/object.rb +9 -0
  81. data/lib/review/extentions/string.rb +33 -0
  82. data/lib/review/htmlbuilder.rb +1166 -0
  83. data/lib/review/htmllayout.rb +41 -0
  84. data/lib/review/htmltoc.rb +45 -0
  85. data/lib/review/htmlutils.rb +90 -0
  86. data/lib/review/i18n.rb +96 -0
  87. data/lib/review/i18n.yml +169 -0
  88. data/lib/review/idgxmlbuilder.rb +1233 -0
  89. data/lib/review/inaobuilder.rb +357 -0
  90. data/lib/review/latexbuilder.rb +941 -0
  91. data/lib/review/latexindex.rb +35 -0
  92. data/lib/review/latexutils.rb +95 -0
  93. data/lib/review/layout.tex.erb +340 -0
  94. data/lib/review/lineinput.rb +17 -0
  95. data/lib/review/location.rb +24 -0
  96. data/lib/review/makerhelper.rb +67 -0
  97. data/lib/review/markdownbuilder.rb +339 -0
  98. data/lib/review/node.rb +288 -0
  99. data/lib/review/pdfmaker.rb +332 -0
  100. data/lib/review/preprocessor.rb +530 -0
  101. data/lib/review/review.kpeg +745 -0
  102. data/lib/review/sec_counter.rb +69 -0
  103. data/lib/review/template.rb +21 -0
  104. data/lib/review/textbuilder.rb +17 -0
  105. data/lib/review/textutils.rb +16 -0
  106. data/lib/review/tocparser.rb +348 -0
  107. data/lib/review/tocprinter.rb +205 -0
  108. data/lib/review/topbuilder.rb +796 -0
  109. data/lib/review/unfold.rb +138 -0
  110. data/lib/review/version.rb +3 -0
  111. data/lib/uuid.rb +312 -0
  112. data/review.gemspec +32 -0
  113. data/templates/html/layout-html5.html.erb +17 -0
  114. data/templates/html/layout-xhtml1.html.erb +20 -0
  115. data/templates/ncx/epubv2.ncx.erb +11 -0
  116. data/templates/opf/epubv2.opf.erb +21 -0
  117. data/templates/opf/epubv3.opf.erb +18 -0
  118. data/templates/xml/container.xml.erb +6 -0
  119. data/test/CHAPS +2 -0
  120. data/test/assets/test.xml.erb +3 -0
  121. data/test/assets/test_template.tex +255 -0
  122. data/test/assets/test_template_backmatter.tex +32 -0
  123. data/test/bib.re +13 -0
  124. data/test/book_test_helper.rb +35 -0
  125. data/test/sample-book/README.md +7 -0
  126. data/test/sample-book/src/Rakefile +58 -0
  127. data/test/sample-book/src/_cover.html +3 -0
  128. data/test/sample-book/src/catalog.yml +10 -0
  129. data/test/sample-book/src/ch01.re +71 -0
  130. data/test/sample-book/src/ch02.re +3 -0
  131. data/test/sample-book/src/config.yml +186 -0
  132. data/test/sample-book/src/images/ch01-imgsample.jpg +0 -0
  133. data/test/sample-book/src/images/cover.jpg +0 -0
  134. data/test/sample-book/src/preface.re +15 -0
  135. data/test/sample-book/src/sty/jumoline.sty +310 -0
  136. data/test/sample-book/src/sty/reviewmacro.sty +39 -0
  137. data/test/sample-book/src/style.css +251 -0
  138. data/test/sample-book/src/vendor/jumoline/README +29 -0
  139. data/test/sample-book/src/vendor/jumoline/jumoline.dtx +2988 -0
  140. data/test/sample-book/src/vendor/jumoline/jumoline.ins +6 -0
  141. data/test/test.re +43 -0
  142. data/test/test_book.rb +556 -0
  143. data/test/test_book_chapter.rb +280 -0
  144. data/test/test_book_part.rb +54 -0
  145. data/test/test_builder.rb +80 -0
  146. data/test/test_catalog.rb +119 -0
  147. data/test/test_catalog_converter_cmd.rb +73 -0
  148. data/test/test_compiler.rb +92 -0
  149. data/test/test_configure.rb +50 -0
  150. data/test/test_epub3maker.rb +529 -0
  151. data/test/test_epubmaker.rb +569 -0
  152. data/test/test_epubmaker_cmd.rb +40 -0
  153. data/test/test_helper.rb +92 -0
  154. data/test/test_htmlbuilder.rb +1114 -0
  155. data/test/test_htmltoc.rb +32 -0
  156. data/test/test_htmlutils.rb +50 -0
  157. data/test/test_i18n.rb +180 -0
  158. data/test/test_idgxmlbuilder.rb +608 -0
  159. data/test/test_image_finder.rb +82 -0
  160. data/test/test_inaobuilder.rb +245 -0
  161. data/test/test_index.rb +174 -0
  162. data/test/test_latexbuilder.rb +732 -0
  163. data/test/test_lineinput.rb +182 -0
  164. data/test/test_makerhelper.rb +66 -0
  165. data/test/test_markdownbuilder.rb +125 -0
  166. data/test/test_pdfmaker.rb +171 -0
  167. data/test/test_pdfmaker_cmd.rb +40 -0
  168. data/test/test_preprocessor.rb +23 -0
  169. data/test/test_review_ext.rb +31 -0
  170. data/test/test_template.rb +26 -0
  171. data/test/test_textutils.rb +32 -0
  172. data/test/test_topbuilder.rb +291 -0
  173. data/test/test_uuid.rb +157 -0
  174. metadata +357 -0
data/doc/format.md ADDED
@@ -0,0 +1,746 @@
1
+ # Re:VIEW Format Guide
2
+
3
+ The document is a brief guide for Re:VIEW markup syntax.
4
+
5
+ Re:VIEW is based on EWB of ASCII, influenced RD and other Wiki system's syntax.
6
+
7
+ ## Paragraph
8
+
9
+ Paragraphs are separated by an empty line.
10
+
11
+ Usage:
12
+
13
+ ```
14
+ This is a paragraph, paragraph,
15
+ and paragraph.
16
+
17
+ Next paragraph here is ...
18
+ ```
19
+
20
+ Two empty lines or more are same as one empty line.
21
+
22
+ ## Chapter, Section, Subsection (headings)
23
+
24
+ Chapters, sections, subsections, subsubsections use `=`, `==`, `===`, `====`, `=====`.
25
+
26
+ Usage:
27
+
28
+ ```review
29
+ = 1st level (chapter)
30
+
31
+ == 2nd level (section)
32
+
33
+ === 3rd level (subsection)
34
+
35
+ ==== 4th level
36
+
37
+ ===== 5th level
38
+ ```
39
+
40
+ Headings should not have any spaces before title; if line head has space, it is as paragraph.
41
+
42
+ ## Column
43
+
44
+ `[column]` in heading are column's caption.
45
+
46
+ Usage:
47
+
48
+ ```review
49
+ ===[column] Compiler-compiler
50
+ ```
51
+
52
+ `=` and `[column]` should be closed to. Any spaces are not permitted.
53
+
54
+ Columns are closed with next headings.
55
+
56
+ ```
57
+ == head 01
58
+
59
+ ===[column] a column
60
+
61
+ == head 02 and the end of 'a column'
62
+ ```
63
+
64
+ If you want to close column without headings, you can use `===[/column]`
65
+
66
+ Usage:
67
+
68
+ ```review
69
+ ===[column] Compiler-compiler
70
+
71
+ Compiler-compiler is ...
72
+
73
+ ===[/column]
74
+
75
+ blah, blah, blah (this is paragraphs outside of the column)
76
+ ```
77
+
78
+ ## Itemize
79
+
80
+ Itemize (ul in HTML) use ` *` (one space char and asterisk).
81
+
82
+ Nested itemize is like ` **`, ` ***`.
83
+
84
+ Usage:
85
+
86
+ ```
87
+ * 1st item
88
+ ** nested 1st item
89
+ * 2nd item
90
+ ** nested 2nd item
91
+ * 3rd item
92
+ ```
93
+
94
+ In itemize, you must write one more space character at line head.
95
+ When you use `*` without spaces in line head, it's just paragraph.
96
+
97
+ ## Ordered itemize
98
+
99
+ Ordered itemize (ol in HTML) use ` 1. ...`, ` 2. ...`, ` 3. ...`.
100
+ They aren't nested.
101
+
102
+ Usage:
103
+
104
+
105
+ ```
106
+ 1. 1st condition
107
+ 2. 2nd condition
108
+ 3. 3rd condition
109
+ ```
110
+
111
+ The value of Number is ignored.
112
+
113
+ ```
114
+ 1. 1st condition
115
+ 1. 2nd condition
116
+ 1. 3rd condition
117
+ ```
118
+
119
+ You must write one more space character at line head like itemize.
120
+
121
+ ## Definition List
122
+
123
+ Definition list (dl in HTML) use `:` and indented lines.
124
+
125
+ Usage:
126
+
127
+ ```review
128
+ : Alpha
129
+ RISC CPU made by DEC.
130
+ : POWER
131
+ RSIC CPU made by IBM and Motolora.
132
+ POWER PC is delivered from this.
133
+ : SPARC
134
+ RISC CPU made by SUN.
135
+ ```
136
+
137
+ `:` in line head is not used as a text.
138
+ The text after `:` is as the term (dt in HTML).
139
+
140
+ In definition list, `:` at line head allow space characters.
141
+ After dt line, space-indented lines are descriptions(dd in HTML).
142
+
143
+ You can use inline markup in texts of lists.
144
+
145
+ ## Code list
146
+
147
+ Code list like source codes is `//list`. If you don't need numbers, you can use ``em`` prefix (as embedded). If you need line numbers, you can use ``num`` postfix. So you can use four types of lists.
148
+
149
+ * ``//list[ID][caption][language]{ ... //}``
150
+ * normal list. language is optional.
151
+ * ``//listnum[ID][caption][language]{ ... //}``
152
+ * normal list with line numbers. language is optional.
153
+ * ``//emlist[caption][language]{ ... //}``
154
+ * list without caption counters. caption and language are optional.
155
+ * ``//emlistnum[caption][language]{ ... //}``
156
+ * list with line numbers without caption counters. caption and language are optional.
157
+
158
+ Usage:
159
+
160
+ ```review
161
+ //list[main][main()][c]{ ←ID is `main`, caption is `main()`
162
+ int
163
+ main(int argc, char **argv)
164
+ {
165
+ puts("OK");
166
+ return 0;
167
+ }
168
+ //}
169
+ ```
170
+
171
+ Usage:
172
+
173
+ ```review
174
+ //listnum[hello][hello world][ruby]{
175
+ puts "hello world!"
176
+ //}
177
+ ```
178
+
179
+ Usage:
180
+
181
+ ```review
182
+ //emlist[][ruby]{
183
+ printf("hello");
184
+ //}
185
+ ```
186
+
187
+ Usage:
188
+
189
+ ```review
190
+ //emlistnum[][ruby]{
191
+ puts "hello world!"
192
+ //}
193
+ ```
194
+
195
+
196
+ You can use inline markup in blocks.
197
+
198
+ When you refer a list like `see list X`, you can use an ID in `//list`
199
+ such as `@<list>{main}`.
200
+
201
+
202
+ ### Quoting source code
203
+
204
+ `//source` is for quoting source code. filename is mandatory.
205
+
206
+ Usage:
207
+
208
+ ```review
209
+ //source[/hello/world.rb]{
210
+ puts "hello world!"
211
+ //}
212
+ ```
213
+
214
+ `//source` and `//emlist` with caption is not so different.
215
+ You can use them with different style with CSS (in HTML) and style file (in LaTeX).
216
+
217
+ `//source` can be referred same as the list.
218
+
219
+ Usage:
220
+
221
+ ```
222
+ When you ..., see @<list>{hello}.
223
+ ```
224
+
225
+ ## Inline source code
226
+
227
+ You can use `@<code>{...}` in inline context.
228
+
229
+ Usage:
230
+
231
+ ```review
232
+ @<code>{p = obj.ref_cnt}
233
+ ```
234
+
235
+ ## Shell session
236
+
237
+ When you want to show command line operation, you can use `//cmd{ ... //}`.
238
+
239
+ Usage:
240
+
241
+ ```
242
+ //cmd{
243
+ $ ls /
244
+ //}
245
+ ```
246
+
247
+ You can use inline markup in `//cmd` blocks.
248
+
249
+ ## Figure
250
+
251
+ You can use `//image{ ... //}` for figures.
252
+ You can write comments or Ascii art in the block as an alternative description.
253
+ When publishing, it's simply ignored.
254
+
255
+
256
+ Usage:
257
+
258
+ ```
259
+ //image[unixhistory][a brief history of UNIX-like OS]{
260
+ System V
261
+ +----------- SVr4 --> Commercial UNIX(Solaris, AIX, HP-UX, ...)
262
+ V1 --> V6 --|
263
+ +--------- 4.4BSD --> FreeBSD, NetBSD, OpenBSD, ...
264
+ BSD
265
+
266
+ --------------> Linux
267
+ //}
268
+ ```
269
+
270
+ When you want to refer images such as "see figure 1.", you can use
271
+ inline reference markup like `@<img>{unixhistory}`.
272
+
273
+ When you want to use images in paragraph or other inline context, you can use `@<icon>`.
274
+
275
+ ### Finding image pathes
276
+
277
+ The order of finding image is as follows. The first matched one is used.
278
+
279
+ ```
280
+ 1. <imgdir>/<builder>/<chapid>/<id>.<ext>
281
+ 2. <imgdir>/<builder>/<chapid>-<id>.<ext>
282
+ 3. <imgdir>/<builder>/<id>.<ext>
283
+ 4. <imgdir>/<chapid>/<id>.<ext>
284
+ 5. <imgdir>/<chapid>-<id>.<ext>
285
+ 6. <imgdir>/<id>.<ext>
286
+ ```
287
+
288
+ * ``<imgdir>`` is `images` as default.
289
+ * ``<builder>`` is a builder (target) name to use. When you use review-comile commmand with ``--target=html``, `<imagedir>/<builder>` is `images/html`.
290
+ * ``<chapid>`` is basename of *.re file. If the filename is `ch01.re`, chapid is `ch01`.
291
+ * ``<id>`` is the ID of the first argument of `//image`. You should use only printable ASCII characters as ID.
292
+ * ``<ext>`` is file extensions of Re:VIEW. They are different by the builder you use.
293
+
294
+ ## Images without caption counter
295
+
296
+ `//indepimage[filename][caption]` makes images without caption counter.
297
+ caption is optional.
298
+
299
+ Usage:
300
+
301
+ ```
302
+ //indepimage[unixhistory2]
303
+ ```
304
+
305
+ Note that there are similar markup `//numberlessimage`, but it is deprecated.
306
+
307
+
308
+ ## Figures with graph tools
309
+
310
+ Re:VIEW generates image files using graph tool with command `//graph[filename][commandname][caption]`. The caption is optional.
311
+
312
+ Usage: using with Gnuplot
313
+
314
+ ```
315
+ //graph[sin_x][gnuplot]{
316
+ plot sin(x)
317
+ //}
318
+ ```
319
+
320
+ You can use `graphviz`, `gnuplot`, `blockdiag`, `aafigure` as the command name.
321
+ Before using these tools, you should installed them.
322
+
323
+ ## Tables
324
+
325
+ The markup of table is `//table[ID][caption]{ ... //}`
326
+ You can separate header and content with `------------`.
327
+
328
+ The columns are splitted by TAB character. When the first character in the column is `.`, the character is removed. If you want to write `.` at the first, you should write `..`.
329
+
330
+ When you want to use an empty column, you write `.`.
331
+
332
+ Usage:
333
+
334
+ ```
335
+ //table[envvars][Important environment varialbes]{
336
+ Name Comment
337
+ -------------------------------------------------------------
338
+ PATH Directories where commands exist
339
+ TERM Terminal. ex: linux, kterm, vt100
340
+ LANG default local of users. ja_JP.eucJP and ja_JP.utf8 are popular in Japan
341
+ LOGNAME login name of the user
342
+ TEMP temporary directory. ex: /tmp
343
+ PAGER text viewer on man command. ex: less, more
344
+ EDITOR default editor. ex: vi, emacs
345
+ MANPATH Directories where sources of man exist
346
+ DISPLAY default display of X Window System
347
+ //}
348
+ ```
349
+
350
+ When you want to write "see table X", you can write `@<table>{envvars}`.
351
+
352
+ You can use inline markup in the tables.
353
+
354
+ ## Quoting text
355
+
356
+ You can use `//quote{ 〜 //}` as quotations.
357
+
358
+ Usage:
359
+
360
+ ```
361
+ //quote{
362
+ Seeing is believing.
363
+ //}
364
+ ```
365
+
366
+ You can use inline markup in quotations.
367
+
368
+
369
+ ## Footnotes
370
+
371
+ You can use `//footnote` to write footnotes.
372
+
373
+ Usage:
374
+
375
+ ```
376
+ You can get the packages from support site for the book.@<fn>{site}
377
+ You should get and install it before reading the book.
378
+ //footnote[site][support site of the book: http://i.loveruby.net/ja/stdcompiler ]
379
+ ```
380
+
381
+ `@<fn>{site}` in source are replaced by footnote marks, and the phrase "support site of .."
382
+ is in footnotes.
383
+
384
+ Note that In LATEXBuilder, you should use `footnotetext` option to use `@<fn>{...}` in columns and tables.
385
+
386
+ ### --footnotetext option
387
+
388
+ When you want to use `footnotetext` option, you can add `--footnotetext` with `params` in config.yml.
389
+ With this option, you can use footnote in tables and short notes.
390
+
391
+ Note that there are some constraints that (because of normal footnote )
392
+
393
+ And you cannot use footnote and footnotemark/footnotetext at the same time.
394
+
395
+ Note that with this option, Re:VIEW use footnotemark and footnotetext instead of normal footnote.
396
+ There are some constraints to use this option.
397
+ You cannot use footnote and footnotemark/footnotetext at the same time.
398
+
399
+ ## Bibliography
400
+
401
+ When you want to use a bibliography, you should write them in the file `bib.re`.
402
+
403
+ ```
404
+ //bibpaper[cite][caption]{..comment..}
405
+ ```
406
+
407
+ The comment is optional.
408
+
409
+ ```
410
+ //bibpaper[cite][caption]
411
+ ```
412
+
413
+ Usage:
414
+
415
+ ```
416
+ //bibpaper[lins][Lins, 1991]{
417
+ Refael D. Lins. A shared memory architecture for parallel study of
418
+ algorithums for cyclic reference_counting. Technical Report 92,
419
+ Computing Laboratory, The University of Kent at Canterbury , August
420
+ 1991
421
+ //}
422
+ ```
423
+
424
+ When you want to refer some references, You should write as:
425
+
426
+ Usage:
427
+
428
+ ```
429
+ … is the well-known project.(@<bib>{lins})
430
+ ```
431
+
432
+ ## Lead sentences
433
+
434
+ lead sentences are `//lead{ ... //}`.
435
+ You can write as `//read{ ... //}`.
436
+
437
+ Usage:
438
+
439
+ ```
440
+ //lead{
441
+ In the chapter, I introduce brief summary of the book,
442
+ and I show the way how to write a program in Linux.
443
+ //}
444
+ ```
445
+
446
+ ## TeX equations
447
+
448
+ You can use `//texequation{ ... //}` to insert mathematical equations of LaTeX.
449
+
450
+ Usage:
451
+
452
+ ```
453
+ //texequation{
454
+ \sum_{i=1}^nf_n(x)
455
+ //}
456
+ ```
457
+
458
+ ## Spacing
459
+
460
+ `//noindent` is a tag for spacing.
461
+
462
+
463
+ * `//noindent` : ingore indentation immediately following line. (in HTML, use noindent class)
464
+
465
+
466
+ `//linebreak` and `//pagebreak` will be obsoleted.
467
+
468
+ ## Comments
469
+
470
+ If you want to write some comments that do not output in the document, you can use comment notation `#@#`.
471
+
472
+ Usage:
473
+
474
+ ```
475
+ #@# Must one empty line
476
+ ```
477
+
478
+ If you want to write some warnings, use `#@warn(...)`.
479
+
480
+ Usage:
481
+
482
+ ```
483
+ #@warn(TBD)
484
+ ```
485
+
486
+ When you want to write comments in the output document, use `//comment` and `@<comment>` with the option `--draft` of review-compile command.
487
+
488
+ Usage:
489
+
490
+ ```
491
+ @<comment>{TODO}
492
+ ```
493
+
494
+ ## Raw data block
495
+
496
+ When you want to write non-Re:VIEW line, use `//raw`.
497
+
498
+ Usage:
499
+
500
+ ```
501
+ //raw[|html|<div class="special">\nthis is a special line.\n</div>]
502
+ ```
503
+
504
+ In above line, `html` is a builder name that handle raw data.
505
+ You can use `html`, `latex`, `idgxml` and `top` as builder name.
506
+ You can specify multiple builder names with separator `,`.
507
+ `\n` is translated into newline(U+000A).
508
+
509
+ Output:
510
+
511
+ (In HTML:)
512
+
513
+ ```
514
+ <div class="special">
515
+ this is a special line.
516
+ </div>
517
+ ```
518
+
519
+ (In other formats, it is just ignored.)
520
+
521
+ Note: `//raw` and `@<raw>` may break structured document easily.
522
+
523
+ ## Other syntax
524
+
525
+ In Re:VIEW, you can add your customized blocks. So you can define
526
+ special block for some books.
527
+
528
+ * `//prototype` : function prototype. It's used in the book `Futu no Linux programming`.
529
+ * `//type` : type definition. It's used in the book `Futu no Haskell programming`.
530
+
531
+ You can define customized block in the file `review-ext.rb`.
532
+
533
+ Usage:
534
+
535
+ ```ruby
536
+ # review-ext.rb
537
+ ReVIEW::Compiler.defblock :foo, 0..1
538
+ class ReVIEW::HTMLBuilder
539
+ def foo(lines, caption = nil)
540
+ puts lines.join(",")
541
+ end
542
+ end
543
+ ```
544
+
545
+ You can add the syntax as below:
546
+
547
+ ```
548
+ //foo{
549
+ A
550
+ B
551
+ C
552
+ //}
553
+ ```
554
+
555
+ ```
556
+ # Result
557
+ A,B,C
558
+ ```
559
+
560
+
561
+ ## Syntax in paragraph (Inline Markups)
562
+
563
+ ```
564
+ @<list>{program}:: `List 1.5`
565
+ @<img>{unixhistory}:: `Figure 1.3`
566
+ @<table>{ascii}:: `Table 1.2`
567
+ @<fn>{site}:: footnote number
568
+ @<kw>{Credential, credential}:: keyword.
569
+ @<chap>{advanced}:: chapter number like `Chapter 17`
570
+ @<title>{advanced}:: title of the chapter
571
+ @<chapref>{advanced}:: a chapter number and chapter title like `Chapter 17. advanced topic`
572
+ @<bou>{appropriate}:: bou-ten.
573
+ @<ruby>{Matsumoto, Matz}:: ruby
574
+ @<ami>{point}:: ami-kake (shaded text)
575
+ @<b>{Please}:: bold
576
+ @<i>{Please}:: italic
577
+ @<strong>{Please}:: strong(emphasis)
578
+ @<em>{Please}:: another emphasis
579
+ @<tt>{foo($bar)}:: teletype (monospaced font)
580
+ @<tti>{FooClass}:: teletype (monospaced font) and italic
581
+ @<ttb>{BarClass}:: teletype (monospaced font) and bold
582
+ @<u>{AB}:: underline
583
+ @<br>{}:: linebreak in paragraph
584
+ @<m>{a + \alpha}:: TeX inline equation
585
+ @<icon>{samplephoto}:: inline image
586
+ @<uchar>{2460}:: Unicode code point
587
+ @<href>{http://www.google.com/, google}:: hyper link(URL)
588
+ @<raw>{|html|<span>ABC</span>}:: inline raw data inline. `\}` is `}` and `\\` is `\`.
589
+ ```
590
+
591
+ ## Tags for Authors (pre-processor commands)
592
+
593
+ These tags are used in the output document. In contrast,
594
+ tags as below are not used in the output document, used
595
+ by the author.
596
+
597
+ ```
598
+ #@#:: Comments. All texts in this line are ignored.
599
+ #@warn(...):: Warning messages. The messages are showed when pre-process.
600
+ #@require, #@provide:: Define dependency with keywords.
601
+ #@mapfile(filename) ... #@end:: Insert all content of files.
602
+ #@maprange(filename, range name) ... #@end:: Insert some area in content of files.
603
+ #@mapoutput(command) ... #@end:: Execute command and insert their output.
604
+ ```
605
+
606
+ ## HTML/LaTeX layout
607
+
608
+ `layouts/layout.html.erb` and `layouts/layout.tex.erb` are used as layout file.
609
+ You can use ERb tags in the layout files.
610
+
611
+
612
+ Sample layout file(layout.html.erb):
613
+
614
+ ```html
615
+ <html>
616
+ <head>
617
+ <title><%= title %></title>
618
+ </head>
619
+ <body>
620
+ <%= body %>
621
+ <hr/>
622
+ </body>
623
+ </html>
624
+ ```
625
+
626
+ ## Part title (in TOC)
627
+
628
+ In version 1.2 or before, you can define the parts in PART file.
629
+ PART file correspond with chapters in CHAPS file.
630
+
631
+ Usage:
632
+
633
+ ```
634
+ CHAPS:
635
+ intro.re
636
+
637
+ start.re
638
+
639
+ end.re
640
+ ```
641
+
642
+ ```
643
+ PART:
644
+ (empty line)
645
+ start section
646
+ last section
647
+ ```
648
+
649
+ In version 1.3 or after, you can use catalog.yml file.
650
+ For more information of catalog.yml, see Re:VIEW catalog file guide(catalog.md).
651
+
652
+ ## Referring headings
653
+
654
+ `@<hd>` generate referred section title and section number.
655
+ You can use deeper section with separator `|`.
656
+
657
+ Usage:
658
+
659
+ ```
660
+ @<hd>{intro|first section}
661
+ ```
662
+
663
+ If section title is unique, `|` is not needed.
664
+
665
+ ```
666
+ @<hd>{first section}
667
+ ```
668
+
669
+ If you want to refer another chapter (file), you should add the ID of chapter.
670
+
671
+ Usage:
672
+
673
+ ```
674
+ @<hd>{preface|Introduction|first section}
675
+ ```
676
+
677
+ When section has the label, you can use the label.
678
+
679
+ ```
680
+ =={intro} Introduction
681
+ :
682
+ === first section
683
+ :
684
+ @<hd>{intro|first section}
685
+ ```
686
+
687
+
688
+ ### Heading of columns
689
+
690
+ You can refer the heading of a column with `@<column>`.
691
+
692
+ Usage:
693
+
694
+ ```
695
+ @<column>{The usage of Re:VIEW}
696
+ ```
697
+
698
+ You can refer labels.
699
+
700
+ ```
701
+ ==[column]{review-application} The application of Re:VIEW
702
+ :
703
+ @<column>{review-application}
704
+ ```
705
+
706
+ ## Links
707
+
708
+ You can add a hyperlink with `@<href>` and `//label`.
709
+ Notation of the markup is `@<href>{URL, anchor}`. If you can use URL itself
710
+ as anchor, use `@<href>{URL}`.
711
+ If you want to use `,` in URL, use `\,`.
712
+
713
+ Usage:
714
+
715
+ ```
716
+ @<href>{http://github.com/, GitHub}
717
+ @<href>{http://www.google.com/}
718
+ @<href>{#point1, point1 in document}
719
+ @<href>{chap1.html#point1, point1 in document}
720
+ //label[point1]
721
+ ```
722
+
723
+ ## Internationalization (i18n)
724
+
725
+ Re:VIEW support I18N of some text like `Chapter`, `Figure`, and `Table`.
726
+ Current default language is Japanese.
727
+
728
+
729
+ You add the file locale.yml in the project directory.
730
+
731
+ Sample local.yml file:
732
+
733
+ ```yaml
734
+ locale: ja
735
+ ```
736
+
737
+ If you want to customize texts, overwrite items.
738
+ Default locale configuration file is in lib/review/i18n.yml.
739
+
740
+ Sample local.yml file:
741
+
742
+ ```yaml
743
+ locale: en
744
+ image: Fig.
745
+ table: Tbl.
746
+ ```