erbook 6.1.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/bin/erbook +29 -25
  2. data/doc/HelloWorld.spec +3 -1
  3. data/doc/api/classes/ERBook.html +86 -0
  4. data/doc/api/classes/ERBook/Document.html +399 -0
  5. data/doc/api/classes/ERBook/Document/Node.html +110 -0
  6. data/doc/api/classes/ERBook/Template.html +309 -0
  7. data/doc/api/classes/ERBook/Template/Sandbox.html +134 -0
  8. data/doc/api/classes/RDoc.html +69 -0
  9. data/doc/api/classes/RDoc/AnyMethod.html +249 -0
  10. data/doc/api/classes/RDoc/DummyMarkup.html +60 -0
  11. data/doc/api/classes/RDoc/DummyMixin.html +54 -0
  12. data/doc/api/classes/RDoc/DummyOptions.html +60 -0
  13. data/doc/api/classes/RDoc/TopLevel.html +344 -0
  14. data/doc/api/classes/String.html +212 -0
  15. data/doc/api/created.rid +1 -0
  16. data/doc/api/css/main.css +263 -0
  17. data/doc/api/css/panel.css +383 -0
  18. data/doc/api/css/reset.css +53 -0
  19. data/doc/api/files/ANN_eml.html +276 -0
  20. data/doc/api/files/ANN_html.html +407 -0
  21. data/doc/api/files/ANN_txt.html +271 -0
  22. data/doc/api/files/LICENSE.html +76 -0
  23. data/doc/api/files/lib/erbook/document_rb.html +74 -0
  24. data/doc/api/files/lib/erbook/rdoc_rb.html +77 -0
  25. data/doc/api/files/lib/erbook/template_rb.html +66 -0
  26. data/doc/api/files/lib/erbook/to_xhtml_rb.html +89 -0
  27. data/doc/api/files/lib/erbook_rb.html +70 -0
  28. data/doc/api/i/arrows.png +0 -0
  29. data/doc/api/i/results_bg.png +0 -0
  30. data/doc/api/i/tree_bg.png +0 -0
  31. data/doc/api/index.html +14 -18
  32. data/doc/api/js/jquery-1.3.2.min.js +19 -0
  33. data/doc/api/js/jquery-effect.js +593 -0
  34. data/doc/api/js/main.js +22 -0
  35. data/doc/api/js/searchdoc.js +605 -0
  36. data/doc/api/panel/index.html +63 -0
  37. data/doc/api/panel/search_index.js +1 -0
  38. data/doc/api/panel/tree.js +1 -0
  39. data/doc/formats.erb +63 -115
  40. data/doc/history.erb +125 -92
  41. data/doc/index.erb +12 -7
  42. data/doc/index.xhtml +1020 -1347
  43. data/doc/intro.erb +42 -40
  44. data/doc/setup.erb +18 -18
  45. data/doc/theory.erb +24 -31
  46. data/doc/usage.erb +14 -24
  47. data/fmt/xhtml.icons/index.yaml +16 -14
  48. data/fmt/xhtml.icons/rakefile +33 -0
  49. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/16x16/places/start-here.png +0 -0
  50. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/32x32/actions/go-down.png +0 -0
  51. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/32x32/actions/go-up.png +0 -0
  52. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/32x32/places/start-here.png +0 -0
  53. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/32x32/status/software-update-available.png +0 -0
  54. data/fmt/xhtml.icons/{tango-icon-theme-0.8.1 → tango-icon-theme-0.8.90}/48x48/apps/accessories-text-editor.png +0 -0
  55. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/48x48/apps/internet-group-chat.png +0 -0
  56. data/fmt/xhtml.icons/{tango-icon-theme-0.8.1 → tango-icon-theme-0.8.90}/48x48/emblems/emblem-important.png +0 -0
  57. data/fmt/xhtml.icons/{tango-icon-theme-0.8.1 → tango-icon-theme-0.8.90}/48x48/status/dialog-error.png +0 -0
  58. data/fmt/xhtml.icons/{tango-icon-theme-0.8.1 → tango-icon-theme-0.8.90}/48x48/status/dialog-information.png +0 -0
  59. data/fmt/xhtml.icons/{tango-icon-theme-0.8.1 → tango-icon-theme-0.8.90}/48x48/status/dialog-warning.png +0 -0
  60. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/COPYING +1 -0
  61. data/fmt/xhtml.icons/{tango-icon-theme-0.8.1 → tango-icon-theme-0.8.90}/README +0 -0
  62. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/actions/bookmark-new.svg +672 -0
  63. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/actions/go-down.svg +200 -0
  64. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/actions/go-home.svg +445 -0
  65. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/actions/go-up.svg +196 -0
  66. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/actions/view-refresh.svg +393 -0
  67. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/apps/accessories-text-editor.svg +554 -0
  68. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/apps/internet-group-chat.svg +312 -0
  69. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/emblems/emblem-favorite.svg +242 -0
  70. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/emblems/emblem-important.svg +164 -0
  71. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/mimetypes/application-certificate.svg +443 -0
  72. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/places/start-here.svg +492 -0
  73. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/status/dialog-error.svg +330 -0
  74. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/status/dialog-information.svg +1159 -0
  75. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/status/dialog-warning.svg +373 -0
  76. data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/status/software-update-available.svg +209 -0
  77. data/fmt/xhtml.scripts/jquery-1.3.2.min.js +19 -0
  78. data/fmt/xhtml.scripts/jquery.localscroll-1.2.7-min.js +9 -0
  79. data/fmt/xhtml.scripts/jquery.scrollTo-1.4.1-min.js +11 -0
  80. data/fmt/xhtml.yaml +470 -454
  81. data/lang/de.yaml +5 -5
  82. data/lang/el.yaml +4 -4
  83. data/lang/es.yaml +5 -5
  84. data/lang/fr.yaml +5 -5
  85. data/lang/it.yaml +5 -5
  86. data/lang/ja.yaml +4 -4
  87. data/lang/ko.yaml +4 -4
  88. data/lang/nl.yaml +4 -4
  89. data/lang/phrases.yaml +4 -4
  90. data/lang/pt.yaml +5 -5
  91. data/lang/ru.yaml +5 -5
  92. data/lang/zh.yaml +5 -5
  93. data/lang/zt.yaml +5 -5
  94. data/lib/erbook.rb +12 -5
  95. data/lib/erbook/document.rb +127 -107
  96. data/lib/erbook/rdoc.rb +18 -11
  97. data/lib/erbook/template.rb +86 -176
  98. data/lib/erbook/to_xhtml.rb +98 -25
  99. data/{Rakefile → rakefile} +1 -0
  100. metadata +106 -53
  101. data/doc/api/ERBook.html +0 -35
  102. data/doc/api/ERBook/Document.html +0 -669
  103. data/doc/api/ERBook/Document/Node.html +0 -102
  104. data/doc/api/ERBook/Template.html +0 -670
  105. data/doc/api/RDoc.html +0 -23
  106. data/doc/api/RDoc/AnyMethod.html +0 -302
  107. data/doc/api/RDoc/DummyMarkup.html +0 -73
  108. data/doc/api/RDoc/DummyMixin.html +0 -23
  109. data/doc/api/RDoc/DummyOptions.html +0 -140
  110. data/doc/api/RDoc/TopLevel.html +0 -465
  111. data/doc/api/String.html +0 -372
  112. data/doc/api/all-methods.html +0 -253
  113. data/doc/api/all-namespaces.html +0 -42
  114. data/doc/api/app.js +0 -18
  115. data/doc/api/jquery.js +0 -11
  116. data/doc/api/readme.html +0 -38
  117. data/doc/api/style.css +0 -68
  118. data/doc/api/syntax_highlight.css +0 -21
  119. data/fmt/xhtml.icons/tango-icon-theme-0.8.1/48x48/README +0 -2
  120. data/fmt/xhtml.icons/tango-icon-theme-0.8.1/48x48/apps/internet-group-chat.png +0 -0
  121. data/fmt/xhtml.icons/tango-icon-theme-0.8.1/COPYING +0 -67
data/lang/de.yaml CHANGED
@@ -9,20 +9,20 @@ Example: Beispiel
9
9
  Examples: Beispiele
10
10
  Figure: Abbildung
11
11
  Figures: Abbildungen
12
+ Focus next segment: Folgendes Segment des Fokus
13
+ Focus previous segment: Vorhergehendes Segment des Fokus
14
+ Focus this segment: Fokussieren Sie dieses Segment
12
15
  Generated by %s on %s.: Erzeugt durch %s auf %s.
13
16
  Important: Wichtig
14
17
  Importants: Importants
15
- Jump to next segment: Springen Sie, um zunächst zu segmentieren
16
- Jump to previous segment: Springen Sie zum vorhergehenden Segment
17
- Jump to this segment: Springen Sie zu diesem Segment
18
- Note: Merken Sie
18
+ Note: Anmerkung
19
19
  Notes: Anmerkungen
20
20
  Part: Teil
21
21
  Procedure: Verfahren
22
22
  Procedures: Verfahren
23
23
  Reference: Hinweis
24
24
  References: Hinweise
25
- Reverse jump to listing: Rücksprung zur Auflistung
25
+ Return to listing: Gehen Sie zur Auflistung zurück
26
26
  Section: Abschnitt
27
27
  Table: Tabelle
28
28
  Tables: Tabellen
data/lang/el.yaml CHANGED
@@ -9,12 +9,12 @@ Example: Παράδειγμα
9
9
  Examples: Παραδείγματα
10
10
  Figure: Αριθμός
11
11
  Figures: Αριθμοί
12
+ Focus next segment: Επόμενο τμήμα εστίασης
13
+ Focus previous segment: Προηγούμενο τμήμα εστίασης
14
+ Focus this segment: Στρέψτε αυτό το τμήμα
12
15
  Generated by %s on %s.: Παραγμένος από %s %s.
13
16
  Important: Σημαντικός
14
17
  Importants: Importants
15
- Jump to next segment: Άλμα στο επόμενο τμήμα
16
- Jump to previous segment: Άλμα στο προηγούμενο τμήμα
17
- Jump to this segment: Άλμα σε αυτό το τμήμα
18
18
  Note: Σημείωση
19
19
  Notes: Σημειώσεις
20
20
  Part: Μέρος
@@ -22,7 +22,7 @@ Procedure: Διαδικασία
22
22
  Procedures: Διαδικασίες
23
23
  Reference: Αναφορά
24
24
  References: Αναφορές
25
- Reverse jump to listing: Αντίστροφο άλμα στη λίστα
25
+ Return to listing: Επιστροφή στη λίστα
26
26
  Section: Τμήμα
27
27
  Table: Πίνακας
28
28
  Tables: Πίνακες
data/lang/es.yaml CHANGED
@@ -9,20 +9,20 @@ Example: Ejemplo
9
9
  Examples: Ejemplos
10
10
  Figure: Figura
11
11
  Figures: Figuras
12
+ Focus next segment: Segmento siguiente del foco
13
+ Focus previous segment: Segmento anterior del foco
14
+ Focus this segment: Enfoque este segmento
12
15
  Generated by %s on %s.: Generado por %s en %s.
13
16
  Important: Importante
14
17
  Importants: Importants
15
- Jump to next segment: Salte para dividir en segmentos después
16
- Jump to previous segment: Salte al segmento anterior
17
- Jump to this segment: Salte a este segmento
18
- Note: Observe
18
+ Note: Nota
19
19
  Notes: Notas
20
20
  Part: Parte
21
21
  Procedure: Procedimiento
22
22
  Procedures: Procedimientos
23
23
  Reference: Referencia
24
24
  References: Referencias
25
- Reverse jump to listing: Salto reverso al listado
25
+ Return to listing: Vuelva al listado
26
26
  Section: Sección
27
27
  Table: Tabla
28
28
  Tables: Tablas
data/lang/fr.yaml CHANGED
@@ -9,20 +9,20 @@ Example: Exemple
9
9
  Examples: Exemples
10
10
  Figure: Figure
11
11
  Figures: Figures
12
+ Focus next segment: Prochain segment de foyer
13
+ Focus previous segment: Segment précédent de foyer
14
+ Focus this segment: Focalisez ce segment
12
15
  Generated by %s on %s.: Produit par %s sur %s.
13
16
  Important: Important
14
17
  Importants: Importants
15
- Jump to next segment: Sautez pour segmenter après
16
- Jump to previous segment: Sautez au segment précédent
17
- Jump to this segment: Sautez à ce segment
18
- Note: Notez
18
+ Note: Note
19
19
  Notes: Notes
20
20
  Part: Partie
21
21
  Procedure: Procédé
22
22
  Procedures: Procédures
23
23
  Reference: Référence
24
24
  References: Références
25
- Reverse jump to listing: Saut renversé à la liste
25
+ Return to listing: Revenez à la liste
26
26
  Section: Section
27
27
  Table: Tableau
28
28
  Tables: Tableaux
data/lang/it.yaml CHANGED
@@ -9,20 +9,20 @@ Example: Esempio
9
9
  Examples: Esempi
10
10
  Figure: Figura
11
11
  Figures: Figure
12
+ Focus next segment: Segmento seguente del fuoco
13
+ Focus previous segment: Segmento precedente del fuoco
14
+ Focus this segment: Metta a fuoco questo segmento
12
15
  Generated by %s on %s.: Generato da %s su %s.
13
16
  Important: Importante
14
17
  Importants: Importants
15
- Jump to next segment: Salti dopo per suddividersi
16
- Jump to previous segment: Salti al segmento precedente
17
- Jump to this segment: Salti a questo segmento
18
- Note: Noti
18
+ Note: Nota
19
19
  Notes: Note
20
20
  Part: Parte
21
21
  Procedure: Procedura
22
22
  Procedures: Procedure
23
23
  Reference: Riferimento
24
24
  References: Riferimenti
25
- Reverse jump to listing: Salto d'inversione all'elenco
25
+ Return to listing: Rinvii all'elenco
26
26
  Section: Sezione
27
27
  Table: Tabella
28
28
  Tables: Tabelle
data/lang/ja.yaml CHANGED
@@ -9,12 +9,12 @@ Example: 例
9
9
  Examples: 例
10
10
  Figure: 図
11
11
  Figures: 図
12
+ Focus next segment: 焦点の次の区分
13
+ Focus previous segment: 焦点の前の区分
14
+ Focus this segment: この区分を集中しなさい
12
15
  Generated by %s on %s.: %s.で%sによって発生させる。
13
16
  Important: 重要
14
17
  Importants: Importants
15
- Jump to next segment: 次の区分へのジャンプ
16
- Jump to previous segment: 前の区分へのジャンプ
17
- Jump to this segment: この区分へのジャンプ
18
18
  Note: ノート
19
19
  Notes: ノート
20
20
  Part: 部分
@@ -22,7 +22,7 @@ Procedure: プロシージャ
22
22
  Procedures: プロシージャ
23
23
  Reference: 参照
24
24
  References: 参照
25
- Reverse jump to listing: リストへの逆のジャンプ
25
+ Return to listing: リストへのリターン
26
26
  Section: セクション
27
27
  Table: テーブル
28
28
  Tables: テーブル
data/lang/ko.yaml CHANGED
@@ -9,12 +9,12 @@ Example: 보기
9
9
  Examples: 보기
10
10
  Figure: 숫자
11
11
  Figures: 숫자
12
+ Focus next segment: 초점 다음 세그먼트
13
+ Focus previous segment: 초점 이전 세그먼트
14
+ Focus this segment: 이 세그먼트를 집중시키십시오
12
15
  Generated by %s on %s.: %s.에 %s에 의해 생성하는.
13
16
  Important: 중요한
14
17
  Importants: Importants
15
- Jump to next segment: 다음 세그먼트에 점프
16
- Jump to previous segment: 이전 세그먼트에 점프
17
- Jump to this segment: 이 세그먼트에 점프
18
18
  Note: 주
19
19
  Notes: 주
20
20
  Part: 부분
@@ -22,7 +22,7 @@ Procedure: 절차
22
22
  Procedures: 절차
23
23
  Reference: 참고
24
24
  References: 참고
25
- Reverse jump to listing: 명부작성에 반전 점프
25
+ Return to listing: 명부작성에 반환
26
26
  Section: 단면도
27
27
  Table: 테이블
28
28
  Tables: 테이블
data/lang/nl.yaml CHANGED
@@ -9,12 +9,12 @@ Example: Voorbeeld
9
9
  Examples: Voorbeelden
10
10
  Figure: Cijfer
11
11
  Figures: Cijfers
12
+ Focus next segment: Het volgende segment van de nadruk
13
+ Focus previous segment: Het vorige segment van de nadruk
14
+ Focus this segment: Concentreer dit segment
12
15
  Generated by %s on %s.: Geproduceerd door %s op %s.
13
16
  Important: Belangrijk
14
17
  Importants: Importants
15
- Jump to next segment: Sprong aan volgende segment
16
- Jump to previous segment: Sprong aan vorig segment
17
- Jump to this segment: Sprong aan dit segment
18
18
  Note: Nota
19
19
  Notes: Nota's
20
20
  Part: Deel
@@ -22,7 +22,7 @@ Procedure: Procedure
22
22
  Procedures: Procedures
23
23
  Reference: Verwijzing
24
24
  References: Verwijzingen
25
- Reverse jump to listing: Omgekeerde sprong aan lijst
25
+ Return to listing: Terugkeer naar lijst
26
26
  Section: Sectie
27
27
  Table: Lijst
28
28
  Tables: Lijsten
data/lang/phrases.yaml CHANGED
@@ -11,9 +11,9 @@ Figures:
11
11
  Generated by %s on %s.:
12
12
  Important:
13
13
  Importants:
14
- Jump to next segment:
15
- Jump to previous segment:
16
- Jump to this segment:
14
+ Focus next segment:
15
+ Focus previous segment:
16
+ Focus this segment:
17
17
  Note:
18
18
  Notes:
19
19
  Part:
@@ -21,7 +21,7 @@ Procedure:
21
21
  Procedures:
22
22
  Reference:
23
23
  References:
24
- Reverse jump to listing:
24
+ Return to listing:
25
25
  Section:
26
26
  Table:
27
27
  Tables:
data/lang/pt.yaml CHANGED
@@ -9,20 +9,20 @@ Example: Exemplo
9
9
  Examples: Exemplos
10
10
  Figure: Figura
11
11
  Figures: Figuras
12
+ Focus next segment: Segmento seguinte do foco
13
+ Focus previous segment: Segmento precedente do foco
14
+ Focus this segment: Focalize este segmento
12
15
  Generated by %s on %s.: Gerado por %s em %s.
13
16
  Important: Importante
14
17
  Importants: Importants
15
- Jump to next segment: Salte para segmentar em seguida
16
- Jump to previous segment: Salte ao segmento precedente
17
- Jump to this segment: Salte a este segmento
18
- Note: Anote
18
+ Note: Nota
19
19
  Notes: Notas
20
20
  Part: Parte
21
21
  Procedure: Procedimento
22
22
  Procedures: Procedimentos
23
23
  Reference: Referência
24
24
  References: Referências
25
- Reverse jump to listing: Salto reverso à lista
25
+ Return to listing: Retorne à lista
26
26
  Section: Seção
27
27
  Table: Tabela
28
28
  Tables: Tabelas
data/lang/ru.yaml CHANGED
@@ -9,20 +9,20 @@ Example: Пример
9
9
  Examples: Примеры
10
10
  Figure: Диаграмма
11
11
  Figures: Диаграммы
12
+ Focus next segment: Этап фокуса следующий
13
+ Focus previous segment: Этап фокуса предыдущий
14
+ Focus this segment: Сфокусируйте этот этап
12
15
  Generated by %s on %s.: Произведено %s на %s.
13
16
  Important: Важно
14
17
  Importants: Importants
15
- Jump to next segment: Поскачите затем для того чтобы поделить на сегменты
16
- Jump to previous segment: Поскачите к предыдущему этапу
17
- Jump to this segment: Поскачите к этому этапу
18
- Note: Заметьте
18
+ Note: Примечание
19
19
  Notes: Примечания
20
20
  Part: Часть
21
21
  Procedure: Процедура
22
22
  Procedures: Процедуры
23
23
  Reference: Справка
24
24
  References: Справки
25
- Reverse jump to listing: Обратная скачка к перечислению
25
+ Return to listing: Возвратите к перечислению
26
26
  Section: Раздел
27
27
  Table: Таблица
28
28
  Tables: Таблицы
data/lang/zh.yaml CHANGED
@@ -9,20 +9,20 @@ Example: 例子
9
9
  Examples: 例子
10
10
  Figure: 图
11
11
  Figures: 图
12
+ Focus next segment: 焦点下段
13
+ Focus previous segment: 焦点早先段
14
+ Focus this segment: 聚焦这段
12
15
  Generated by %s on %s.: 引起由%s在%s。
13
16
  Important: 重要
14
17
  Importants: Importants
15
- Jump to next segment: 跳跃其次分割
16
- Jump to previous segment: 跳跃到早先段
17
- Jump to this segment: 跳跃到这段
18
- Note: 注意
18
+ Note: 笔记
19
19
  Notes: 笔记
20
20
  Part: 部分
21
21
  Procedure: 做法
22
22
  Procedures: 做法
23
23
  Reference: 参考
24
24
  References: 参考
25
- Reverse jump to listing: 对目录的反向跃迁
25
+ Return to listing: 回到目录
26
26
  Section: 部分
27
27
  Table: 表
28
28
  Tables: 表
data/lang/zt.yaml CHANGED
@@ -9,20 +9,20 @@ Example: 例子
9
9
  Examples: 例子
10
10
  Figure: 图
11
11
  Figures: 图
12
+ Focus next segment: 焦點下段
13
+ Focus previous segment: 焦點早先段
14
+ Focus this segment: 聚焦這段
12
15
  Generated by %s on %s.: 引起由%s在%s。
13
16
  Important: 重要
14
17
  Importants: Importants
15
- Jump to next segment: 跳躍其次分割
16
- Jump to previous segment: 跳躍到早先段
17
- Jump to this segment: 跳躍到這段
18
- Note: 注意
18
+ Note: 筆記
19
19
  Notes: 筆記
20
20
  Part: 部分
21
21
  Procedure: 做法
22
22
  Procedures: 做法
23
23
  Reference: 參考
24
24
  References: 參考
25
- Reverse jump to listing: 對目錄的反向躍遷
25
+ Return to listing: 回到目錄
26
26
  Section: 部分
27
27
  Table: 表
28
28
  Tables: 表
data/lib/erbook.rb CHANGED
@@ -1,16 +1,23 @@
1
+ #--
2
+ # Copyright 2007 Suraj N. Kurapati
3
+ # See the LICENSE file for details.
4
+ #++
5
+
1
6
  require 'rubygems'
7
+ gem 'inochi', '~> 1'
2
8
  require 'inochi'
3
9
 
4
10
  Inochi.init :ERBook,
5
11
  :program => 'erbook',
6
- :version => '6.1.0',
7
- :release => '2009-02-14',
12
+ :version => '7.0.0',
13
+ :release => '2009-05-03',
8
14
  :website => 'http://snk.tuxfamily.org/lib/erbook/',
9
15
  :tagline => 'Extensible document processor based on eRuby',
10
16
  :require => {
11
- # gems needed by the default 'xhtml' format
12
- 'maruku' => '~> 0.5',
13
- 'coderay' => '>= 0.7',
17
+ 'ember' => '~> 0', # for eRuby template processing
18
+ 'maruku' => '~> 0.5', # for Markdown to XHTML conversion
19
+ 'coderay' => '>= 0.8', # for syntax coloring of source code
20
+ 'rainpress' => '~> 1', # for minifying CSS
14
21
  }
15
22
 
16
23
  module ERBook
@@ -1,5 +1,11 @@
1
+ #--
2
+ # Copyright 2008 Suraj N. Kurapati
3
+ # See the LICENSE file for details.
4
+ #++
5
+
1
6
  require 'yaml'
2
7
  require 'erbook/template'
8
+ require 'digest/sha1'
3
9
 
4
10
  module ERBook
5
11
  class Document
@@ -16,25 +22,26 @@ module ERBook
16
22
  attr_reader :nodes_by_type
17
23
 
18
24
  ##
19
- # @param [String] format
25
+ # ==== Parameters
26
+ #
27
+ # [format_name]
20
28
  # Either the short-hand name of a built-in format
21
29
  # or the path to a format specification file.
22
30
  #
23
- # @param [String] input_text
31
+ # [input_text]
24
32
  # The body of the input document.
25
33
  #
26
- # @param [String] input_file
34
+ # [input_file]
27
35
  # Name of the file from which the input document originated.
28
36
  #
29
- # @param [Hash] options
30
- # Additional method parameters:
37
+ # ==== Options
31
38
  #
32
- # [boolean] :unindent =>
39
+ # [:unindent]
33
40
  # If true, all node content is unindented hierarchically.
34
41
  #
35
- def initialize format, input_text, input_file, options = {}
42
+ def initialize format_name, input_text, input_file, options = {}
36
43
  # process format specification
37
- @format_file = format.to_s
44
+ @format_file = format_name.to_s
38
45
 
39
46
  File.file? @format_file or
40
47
  @format_file = File.join(ERBook::FORMATS_DIR, @format_file + '.yaml')
@@ -58,6 +65,7 @@ module ERBook
58
65
  begin
59
66
  # create sandbox for input evaluation
60
67
  template = Template.new(input_file, input_text, options[:unindent])
68
+ sandbox = template.sandbox
61
69
 
62
70
  @template_vars = {
63
71
  :@format => @format,
@@ -65,96 +73,86 @@ module ERBook
65
73
  :@nodes => @nodes = [], # all nodes in the forest
66
74
  :@nodes_by_type => @nodes_by_type = Hash.new {|h,k| h[k] = [] },
67
75
  :@stack => [], # stack for all nodes
68
- }.each_pair {|k,v| template.instance_variable_set(k, v) }
69
-
70
- class << template
71
- private
72
-
73
- # Handles the method call from a node
74
- # placeholder in the input document.
75
- def __node__ node_type, *node_args, &node_content
76
- node = Node.new(
77
- :type => node_type,
78
- :defn => @format['nodes'][node_type],
79
- :args => node_args,
80
- :children => [],
81
-
82
- # omit erbook internals from the stack trace
83
- :trace => caller.reject {|t|
84
- [$0, ERBook::INSTALL].any? {|f| t.index(f) == 0 }
85
- }
86
- )
87
- @nodes << node
88
- @nodes_by_type[node.type] << node
89
-
90
- # calculate occurrence number for this node
91
- if node.defn['number']
92
- @count ||= Hash.new {|h,k| h[k] = []}
93
- node.number = (@count[node.type] << node).length
94
- end
76
+ }.each_pair {|k,v| sandbox.instance_variable_set(k, v) }
77
+
78
+ # Handles the method call from a node
79
+ # placeholder in the input document.
80
+ def sandbox.__node_impl__ node_type, *node_args, &node_content
81
+ node = Node.new(
82
+ :type => node_type,
83
+ :defn => @format['nodes'][node_type],
84
+ :args => node_args,
85
+ :children => [],
86
+
87
+ # omit erbook internals from the stack trace
88
+ :trace => caller.reject {|t|
89
+ [$0, ERBook::INSTALL].any? {|f| t.index(f) == 0 }
90
+ }
91
+ )
92
+ @nodes << node
93
+ @nodes_by_type[node.type] << node
94
+
95
+ # calculate occurrence number for this node
96
+ if node.defn['number']
97
+ @count ||= Hash.new {|h,k| h[k] = []}
98
+ node.number = (@count[node.type] << node).length
99
+ end
95
100
 
96
- # assign node family
97
- if parent = @stack.last
98
- parent.children << node
99
- node.parent = parent
100
- node.depth = parent.depth
101
- node.depth += 1 if node.defn['depth']
101
+ # assign node family
102
+ if parent = @stack.last
103
+ parent.children << node
104
+ node.parent = parent
105
+ node.depth = parent.depth
106
+ node.depth += 1 if node.defn['depth']
102
107
 
103
- # calculate latex-style index number for this node
104
- if node.defn['index']
105
- ancestry = @stack.reverse.find {|n| n.defn['index'] }.index
106
- branches = node.parent.children.select {|n| n.index }
108
+ # calculate latex-style index number for this node
109
+ if node.defn['index']
110
+ ancestry = @stack.reverse.find {|n| n.defn['index'] }.index
111
+ branches = node.parent.children.select {|n| n.index }
107
112
 
108
- node.index = [ancestry, branches.length + 1].join('.')
109
- end
110
- else
111
- @roots << node
112
- node.parent = nil
113
- node.depth = 0
114
-
115
- # calculate latex-style index number for this node
116
- if node.defn['index']
117
- branches = @roots.select {|n| n.index }
118
- node.index = (branches.length + 1).to_s
119
- end
113
+ node.index = [ancestry, branches.length + 1].join('.')
120
114
  end
121
-
122
- # assign node content
123
- if block_given?
124
- @stack.push node
125
- content = content_from_block(node, &node_content)
126
- @stack.pop
127
-
128
- digest = Document.digest(content)
129
- self.buffer << digest
130
- else
131
- content = nil
132
- digest = Document.digest(node.object_id)
115
+ else
116
+ @roots << node
117
+ node.parent = nil
118
+ node.depth = 0
119
+
120
+ # calculate latex-style index number for this node
121
+ if node.defn['index']
122
+ branches = @roots.select {|n| n.index }
123
+ node.index = (branches.length + 1).to_s
133
124
  end
125
+ end
134
126
 
135
- node.content = content
136
- node.digest = digest
137
-
138
- digest
127
+ # assign node content
128
+ if block_given?
129
+ @stack.push node
130
+ node.content = __block_content__(node, &node_content)
131
+ @stack.pop
139
132
  end
133
+
134
+ @buffer << node
135
+
136
+ nil
140
137
  end
141
138
 
142
139
  @node_defs.each_key do |type|
143
140
  # XXX: using a string because define_method()
144
141
  # does not accept a block until Ruby 1.9
145
- file, line = __FILE__, __LINE__ + 1
146
- template.instance_eval %{
147
- def #{type} *node_args, &node_content
148
- __node__ #{type.inspect}, *node_args, &node_content
142
+ file, line = __FILE__, __LINE__; eval %{
143
+ def sandbox.#{type} *node_args, &node_content
144
+ __node_impl__ #{type.inspect}, *node_args, &node_content
149
145
  end
150
- }, file, line
146
+ }, binding, file, line
151
147
  end
152
148
 
153
149
  # evaluate the input & build the document tree
154
- @processed_document = template.instance_eval { result binding }
150
+ template.render
151
+ @processed_document = template.buffer
155
152
 
156
153
  # chain block-level nodes together for local navigation
157
- block_nodes = @nodes.reject {|n| @node_defs[n.type]['inline'] }
154
+ block_nodes = @nodes.reject {|n| n.defn['bypass'] ||
155
+ n.defn['inline'] }
158
156
 
159
157
  require 'enumerator'
160
158
  block_nodes.each_cons(2) do |a, b|
@@ -162,25 +160,60 @@ module ERBook
162
160
  b.prev_node = a
163
161
  end
164
162
 
165
- # replace node placeholders with their corresponding output
166
- expander = lambda do |n, buf|
167
- # calculate node output
168
- source = "#{@format_file}:nodes:#{n.type}:output"
169
- n.output = Template.new(
170
- source, @node_defs[n.type]['output'].to_s.chomp
163
+ # calculate output for all nodes
164
+ actual_output_by_node = {}
165
+
166
+ visitor = lambda do |n|
167
+ #
168
+ # allow child nodes to calculate their actual
169
+ # output and to set their identifier as Node#output
170
+ #
171
+ # we do this nodes first because this node's
172
+ # content contains the child nodes' output
173
+ #
174
+ n.children.each {|c| visitor.call c }
175
+
176
+ # calculate the output for this node
177
+ actual_output = Template.new(
178
+ "#{@format_file}:nodes:#{n.type}:output",
179
+ n.defn['output'].to_s.chomp
171
180
  ).render_with(@template_vars.merge(:@node => n))
172
181
 
173
- # expand all child nodes in this node's output
174
- n.children.each {|c| expander[c, n.output] }
182
+ # reveal child nodes' actual output in this node's actual output
183
+ n.children.each do |c|
184
+ if c.defn['inline'] && !c.defn['bypass']
185
+ actual_output[c.output] = actual_output_by_node[c]
186
+
187
+ else
188
+ # pull block-level node out of paragraph tag added by Maruku
189
+ actual_output.sub! %r/(<p>\s*)?#{Regexp.quote c.output}/ do
190
+ actual_output_by_node[c] + $1.to_s
191
+ end
192
+ end
193
+ end
175
194
 
176
- # replace this node's placeholder with its output in the buffer
177
- buf[n.digest] = @node_defs[n.type]['silent'] ? '' : n.output
195
+ actual_output_by_node[n] = actual_output
196
+
197
+ #
198
+ # allow the parent node to calculate its actual
199
+ # output without interference from the output of
200
+ # this node (Node#to_s is aliased to Node#output)
201
+ #
202
+ # this assumes that having this node's string
203
+ # representation be a consecutive sequence of digits
204
+ # will not interfere with the text-to-whatever
205
+ # transformation defined by the format specification
206
+ #
207
+ n.output = Digest::SHA1.digest(n.object_id.to_s).unpack('I*').join
178
208
  end
179
209
 
180
- @roots.each {|n| expander[n, @processed_document] }
210
+ @roots.each {|n| visitor.call n }
211
+
212
+ # replace the temporary identifier with each node's actual output
213
+ @nodes.each {|n| n.output = actual_output_by_node[n] }
181
214
 
182
215
  rescue Exception
183
- puts input_text # so the user can debug line numbers in the stack trace
216
+ puts input_text # so the user can debug line numbers in stack trace
184
217
  error "Could not process input document #{input_file.inspect}"
185
218
  end
186
219
  end
@@ -190,7 +223,7 @@ module ERBook
190
223
  #
191
224
  def to_s
192
225
  Template.new("#{@format_file}:output", @format['output'].to_s).
193
- render_with(@template_vars.merge(:@content => @processed_document))
226
+ render_with(@template_vars.merge(:@content => @processed_document.join))
194
227
  end
195
228
 
196
229
  require 'ostruct'
@@ -201,23 +234,10 @@ module ERBook
201
234
 
202
235
  # Returns the output of this node.
203
236
  def to_s
204
- output
237
+ defn['silent'] ? '' : output
205
238
  end
206
239
  end
207
240
 
208
- require 'digest/sha1'
209
- ##
210
- # Returns a digest of the given string that
211
- # will not be altered by String#to_xhtml.
212
- #
213
- def Document.digest input
214
- Digest::SHA1.hexdigest(input.to_s).
215
-
216
- # XXX: surround all digits with alphabets so
217
- # Maruku doesn't change them into HTML
218
- gsub(/\d/, 'z\&z')
219
- end
220
-
221
241
  private
222
242
 
223
243
  ##