erbook 5.0.0 → 6.0.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 (68) hide show
  1. data/LICENSE +1 -1
  2. data/Rakefile +6 -79
  3. data/bin/erbook +25 -319
  4. data/doc/HelloWorld.spec +23 -21
  5. data/doc/README +4 -3
  6. data/doc/api/ERBook.html +35 -0
  7. data/doc/api/ERBook/Document.html +673 -0
  8. data/doc/api/ERBook/Document/Node.html +102 -0
  9. data/doc/api/ERBook/Template.html +670 -0
  10. data/doc/api/RDoc.html +23 -0
  11. data/doc/api/RDoc/AnyMethod.html +302 -0
  12. data/doc/api/RDoc/DummyMarkup.html +73 -0
  13. data/doc/api/RDoc/DummyMixin.html +23 -0
  14. data/doc/api/RDoc/DummyOptions.html +140 -0
  15. data/doc/api/RDoc/TopLevel.html +465 -0
  16. data/doc/api/String.html +372 -0
  17. data/doc/api/all-methods.html +253 -0
  18. data/doc/api/all-namespaces.html +42 -0
  19. data/doc/api/app.js +18 -0
  20. data/doc/api/index.html +16 -22
  21. data/doc/api/jquery.js +11 -0
  22. data/doc/api/readme.html +35 -0
  23. data/doc/api/style.css +68 -0
  24. data/doc/api/syntax_highlight.css +21 -0
  25. data/doc/erbook.png +0 -0
  26. data/doc/erbook.svg +150 -88
  27. data/doc/formats.erb +387 -0
  28. data/doc/history.erb +62 -0
  29. data/doc/index.erb +8 -0
  30. data/doc/index.xhtml +846 -654
  31. data/doc/intro.erb +97 -0
  32. data/doc/setup.erb +62 -0
  33. data/doc/theory.erb +187 -0
  34. data/doc/usage.erb +39 -0
  35. data/fmt/xhtml.yaml +497 -372
  36. data/lib/erbook.rb +18 -10
  37. data/lib/erbook/document.rb +233 -0
  38. data/lib/erbook/template.rb +210 -0
  39. data/lib/erbook/to_xhtml.rb +25 -17
  40. metadata +39 -45
  41. data/README +0 -14
  42. data/doc/api/classes/ERBook.html +0 -164
  43. data/doc/api/classes/RDoc.html +0 -112
  44. data/doc/api/classes/RDoc/AnyMethod.html +0 -195
  45. data/doc/api/classes/RDoc/AnyMethod.src/M000003.html +0 -18
  46. data/doc/api/classes/RDoc/AnyMethod.src/M000004.html +0 -23
  47. data/doc/api/classes/RDoc/AnyMethod.src/M000005.html +0 -18
  48. data/doc/api/classes/RDoc/AnyMethod.src/M000006.html +0 -22
  49. data/doc/api/classes/RDoc/TopLevel.html +0 -250
  50. data/doc/api/classes/RDoc/TopLevel.src/M000007.html +0 -18
  51. data/doc/api/classes/RDoc/TopLevel.src/M000008.html +0 -18
  52. data/doc/api/classes/RDoc/TopLevel.src/M000009.html +0 -18
  53. data/doc/api/classes/RDoc/TopLevel.src/M000010.html +0 -29
  54. data/doc/api/classes/RDoc/TopLevel.src/M000011.html +0 -25
  55. data/doc/api/classes/RDoc/TopLevel.src/M000012.html +0 -18
  56. data/doc/api/classes/String.html +0 -196
  57. data/doc/api/classes/String.src/M000001.html +0 -18
  58. data/doc/api/classes/String.src/M000002.html +0 -31
  59. data/doc/api/created.rid +0 -1
  60. data/doc/api/files/lib/erbook/rdoc_rb.html +0 -116
  61. data/doc/api/files/lib/erbook/to_xhtml_rb.html +0 -125
  62. data/doc/api/files/lib/erbook_rb.html +0 -107
  63. data/doc/api/fr_class_index.html +0 -31
  64. data/doc/api/fr_file_index.html +0 -29
  65. data/doc/api/fr_method_index.html +0 -38
  66. data/doc/api/rdoc-style.css +0 -208
  67. data/doc/feed-icon-28x28.png +0 -0
  68. data/doc/manual.erb +0 -812
@@ -37,16 +37,23 @@ class String
37
37
  # Transforms this string into XHTML while ensuring that the
38
38
  # result contains one or more block-level elements at the root.
39
39
  #
40
- # If aInline is true, then the resulting XHTML will be an *inline* string.
40
+ # inline:: If true, the resulting XHTML will *not*
41
+ # contain a block-level element at the root.
41
42
  #
42
- def to_xhtml aInline = false
43
- protect(self, VERBATIM_TAGS, true) do |text|
44
- html = protect(text, PROTECTED_TAGS, false) {|s| s.thru_maruku aInline }
43
+ def to_xhtml inline = false
44
+ with_protected_tags(self, VERBATIM_TAGS, true) do |text|
45
+ html = with_protected_tags(text, PROTECTED_TAGS, false) do
46
+ |s| s.thru_maruku inline
47
+ end
45
48
 
46
49
  # Markdown's "code spans" should really be "pre spans"
47
50
  while html.gsub! %r{(<pre>)<code>(.*?)</code>(</pre>)}m, '\1\2\3'
48
51
  end
49
52
 
53
+ # allow user to type <pre> blocks on single lines
54
+ # without affecting the display of their content
55
+ html.gsub! %r{(<pre>)[ \t]*\r?\n|\r?\n[ \t]*(</pre>)}, '\1\2'
56
+
50
57
  # ensure tables have a border: this *greatly* improves
51
58
  # readability in text-based web browsers like w3m and lynx
52
59
  html.gsub! %r/<table\b/, '\& border="1"'
@@ -58,12 +65,12 @@ class String
58
65
 
59
66
  # Returns the result of running this string through Maruku.
60
67
  #
61
- # If aInline is true, then the resulting XHTML will
62
- # *not* be wrapped in a XHTML paragraph element.
68
+ # inline:: If true, the resulting XHTML will *not*
69
+ # be wrapped in a XHTML paragraph element.
63
70
  #
64
- def thru_maruku aInline = false #:nodoc:
71
+ def thru_maruku inline = false #:nodoc:
65
72
  html = Maruku.new(self).to_html
66
- html.sub! %r{\A<p>(.*)</p>\Z}, '\1' if aInline
73
+ html.sub! %r{\A<p>(.*)</p>\Z}, '\1' if inline
67
74
  html
68
75
  end
69
76
 
@@ -73,7 +80,7 @@ class String
73
80
  # applied. Otherwise, the programming language is assumed to be ruby.
74
81
  def thru_coderay #:nodoc:
75
82
  gsub %r{<(code)(.*?)>(.*?)</\1>}m do
76
- atts, code = $2, CGI.unescapeHTML($3)
83
+ atts, code = $2, CGI.unescapeHTML($3).sub(/\A\r?\n/, '')
77
84
  lang = atts[/\blang=('|")(.*?)\1/i, 2] || :ruby
78
85
 
79
86
  html = CodeRay.scan(code, lang).html(:css => :style)
@@ -89,17 +96,18 @@ class String
89
96
  # that protected input to the given block, restores the
90
97
  # given tags in the result of the block and returns it.
91
98
  #
92
- # If aVerbatim is true, the content of the elments having the given tags will
93
- # not be temporarily altered so that process nested elements can be processed.
99
+ # verbatim:: If true, the content of the elments having the
100
+ # given tags will not be temporarily altered so
101
+ # that process nested elements can be processed.
94
102
  #
95
- def protect aInput, aTags, aVerbatim #:nodoc: :yields: aInput
103
+ def with_protected_tags input, tags, verbatim #:nodoc: :yields: input
96
104
  raise ArgumentError unless block_given?
97
105
 
98
- input = aInput.dup
106
+ input = input.dup
99
107
  escapes = {}
100
108
 
101
109
  # protect the given tags by escaping them
102
- aTags.each do |tag|
110
+ tags.each do |tag|
103
111
  input.gsub! %r{(<#{tag}.*?>)(.*?)(</#{tag}>)}m do
104
112
  head, body, tail = $1, $2, $3
105
113
 
@@ -109,13 +117,13 @@ class String
109
117
  body.gsub! %r/\\/, '\&\&'
110
118
 
111
119
  original =
112
- if aVerbatim
120
+ if verbatim
113
121
  body
114
122
  else
115
123
  head << CGI.escapeHTML(CGI.unescapeHTML(body)) << tail
116
124
  end
117
125
 
118
- escaped = ERBook.digest(original)
126
+ escaped = ERBook::Document.digest(original)
119
127
  escapes[escaped] = original
120
128
 
121
129
  escaped
@@ -123,7 +131,7 @@ class String
123
131
  end
124
132
 
125
133
  # invoke the given block with the protected input
126
- output = yield(input)
134
+ output = yield input
127
135
 
128
136
  # restore the protected tags by unescaping them
129
137
  until escapes.empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Suraj N. Kurapati
@@ -9,18 +9,18 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-22 00:00:00 -08:00
12
+ date: 2009-01-19 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: trollop
16
+ name: inochi
17
17
  type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - ~>
21
+ - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: "1.10"
23
+ version: 0.0.0
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: maruku
@@ -42,7 +42,7 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: "0.7"
44
44
  version:
45
- description: Extensible document processor based on eRuby.
45
+ description: Extensible document processor based on eRuby
46
46
  email: sunaku@gmail.com
47
47
  executables:
48
48
  - erbook
@@ -80,60 +80,54 @@ files:
80
80
  - fmt/text.yaml
81
81
  - lib
82
82
  - lib/erbook
83
+ - lib/erbook/template.rb
83
84
  - lib/erbook/to_xhtml.rb
85
+ - lib/erbook/document.rb
84
86
  - lib/erbook/rdoc.rb
85
87
  - lib/erbook.rb
86
88
  - Rakefile
87
89
  - bin
88
90
  - bin/erbook
89
91
  - LICENSE
90
- - README
91
92
  - doc
92
- - doc/manual.erb
93
+ - doc/intro.erb
94
+ - doc/setup.erb
93
95
  - doc/erbook.svg
94
96
  - doc/erbook.png
95
97
  - doc/HelloWorld.input
96
- - doc/feed-icon-28x28.png
97
98
  - doc/HelloWorld.spec
99
+ - doc/theory.erb
98
100
  - doc/index.xhtml
99
101
  - doc/api
100
- - doc/api/classes
101
- - doc/api/classes/RDoc.html
102
- - doc/api/classes/String.src
103
- - doc/api/classes/String.src/M000001.html
104
- - doc/api/classes/String.src/M000002.html
105
- - doc/api/classes/String.html
106
- - doc/api/classes/ERBook.html
107
- - doc/api/classes/RDoc
108
- - doc/api/classes/RDoc/TopLevel.src
109
- - doc/api/classes/RDoc/TopLevel.src/M000010.html
110
- - doc/api/classes/RDoc/TopLevel.src/M000011.html
111
- - doc/api/classes/RDoc/TopLevel.src/M000008.html
112
- - doc/api/classes/RDoc/TopLevel.src/M000007.html
113
- - doc/api/classes/RDoc/TopLevel.src/M000012.html
114
- - doc/api/classes/RDoc/TopLevel.src/M000009.html
115
- - doc/api/classes/RDoc/TopLevel.html
116
- - doc/api/classes/RDoc/AnyMethod.src
117
- - doc/api/classes/RDoc/AnyMethod.src/M000005.html
118
- - doc/api/classes/RDoc/AnyMethod.src/M000004.html
119
- - doc/api/classes/RDoc/AnyMethod.src/M000003.html
120
- - doc/api/classes/RDoc/AnyMethod.src/M000006.html
121
- - doc/api/classes/RDoc/AnyMethod.html
122
- - doc/api/fr_method_index.html
123
- - doc/api/rdoc-style.css
124
- - doc/api/files
125
- - doc/api/files/lib
126
- - doc/api/files/lib/erbook_rb.html
127
- - doc/api/files/lib/erbook
128
- - doc/api/files/lib/erbook/rdoc_rb.html
129
- - doc/api/files/lib/erbook/to_xhtml_rb.html
130
- - doc/api/created.rid
102
+ - doc/api/ERBook
103
+ - doc/api/ERBook/Document.html
104
+ - doc/api/ERBook/Document
105
+ - doc/api/ERBook/Document/Node.html
106
+ - doc/api/ERBook/Template.html
107
+ - doc/api/syntax_highlight.css
108
+ - doc/api/style.css
109
+ - doc/api/RDoc.html
110
+ - doc/api/jquery.js
111
+ - doc/api/all-methods.html
112
+ - doc/api/app.js
113
+ - doc/api/String.html
114
+ - doc/api/readme.html
115
+ - doc/api/all-namespaces.html
131
116
  - doc/api/index.html
132
- - doc/api/fr_file_index.html
133
- - doc/api/fr_class_index.html
117
+ - doc/api/ERBook.html
118
+ - doc/api/RDoc
119
+ - doc/api/RDoc/TopLevel.html
120
+ - doc/api/RDoc/DummyMarkup.html
121
+ - doc/api/RDoc/DummyOptions.html
122
+ - doc/api/RDoc/DummyMixin.html
123
+ - doc/api/RDoc/AnyMethod.html
124
+ - doc/usage.erb
125
+ - doc/history.erb
126
+ - doc/index.erb
134
127
  - doc/README
128
+ - doc/formats.erb
135
129
  has_rdoc: true
136
- homepage: http://snk.tuxfamily.org/lib/erbook
130
+ homepage: http://snk.tuxfamily.org/lib/erbook/
137
131
  post_install_message:
138
132
  rdoc_options: []
139
133
 
@@ -154,9 +148,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
148
  requirements: []
155
149
 
156
150
  rubyforge_project: sunaku
157
- rubygems_version: 1.2.0
151
+ rubygems_version: 1.3.1
158
152
  signing_key:
159
153
  specification_version: 2
160
- summary: Extensible document processor based on eRuby.
154
+ summary: Extensible document processor based on eRuby
161
155
  test_files: []
162
156
 
data/README DELETED
@@ -1,14 +0,0 @@
1
- erbook : write books and documents in eRuby
2
- ===========================================
3
-
4
- erbook is an extensible document processor that emits XHTML
5
- (web page), LaTeX (PDF), man (UNIX manual page), plain text,
6
- and any document format you can imagine from eRuby templates
7
- that allow scripting and dynamic content generation.
8
-
9
- erbook is a light (210 source lines of code), extensible
10
- (create your own document formats), and flexible (your content
11
- is scriptable) alternative to DocBook, Deplate, and SiSU.
12
-
13
- Please see the ./doc/index.xhtml file in your web browser or
14
- visit http://snk.tuxfamily.org/lib/erbook/ for more information.
@@ -1,164 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Module: ERBook</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Module</strong></td>
53
- <td class="class-name-in-header">ERBook</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/erbook_rb.html">
59
- lib/erbook.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- </table>
66
- </div>
67
- <!-- banner header -->
68
-
69
- <div id="bodyContent">
70
-
71
-
72
-
73
- <div id="contextContent">
74
-
75
- <div id="description">
76
- <p>
77
- Project and release information.
78
- </p>
79
-
80
- </div>
81
-
82
-
83
- </div>
84
-
85
-
86
- </div>
87
-
88
-
89
- <!-- if includes -->
90
-
91
- <div id="section">
92
-
93
-
94
- <div id="constants-list">
95
- <h3 class="section-bar">Constants</h3>
96
-
97
- <div class="name-list">
98
- <table summary="Constants">
99
- <tr class="top-aligned-row context-row">
100
- <td class="context-item-name">PROJECT</td>
101
- <td>=</td>
102
- <td class="context-item-value">'erbook'</td>
103
- </tr>
104
- <tr class="top-aligned-row context-row">
105
- <td class="context-item-name">VERSION</td>
106
- <td>=</td>
107
- <td class="context-item-value">'5.0.0'</td>
108
- </tr>
109
- <tr class="top-aligned-row context-row">
110
- <td class="context-item-name">RELEASE</td>
111
- <td>=</td>
112
- <td class="context-item-value">'2008-11-22'</td>
113
- </tr>
114
- <tr class="top-aligned-row context-row">
115
- <td class="context-item-name">WEBSITE</td>
116
- <td>=</td>
117
- <td class="context-item-value">'http://snk.tuxfamily.org/lib/erbook'</td>
118
- </tr>
119
- <tr class="top-aligned-row context-row">
120
- <td class="context-item-name">SUMMARY</td>
121
- <td>=</td>
122
- <td class="context-item-value">'Extensible document processor based on eRuby.'</td>
123
- </tr>
124
- <tr class="top-aligned-row context-row">
125
- <td class="context-item-name">DISPLAY</td>
126
- <td>=</td>
127
- <td class="context-item-value">PROJECT + ' ' + VERSION</td>
128
- </tr>
129
- <tr class="top-aligned-row context-row">
130
- <td class="context-item-name">INSTALL_DIR</td>
131
- <td>=</td>
132
- <td class="context-item-value">File.expand_path File.join(File.dirname(__FILE__), '..')</td>
133
- </tr>
134
- <tr class="top-aligned-row context-row">
135
- <td class="context-item-name">FORMATS_DIR</td>
136
- <td>=</td>
137
- <td class="context-item-value">File.join INSTALL_DIR, 'fmt'</td>
138
- </tr>
139
- <tr class="top-aligned-row context-row">
140
- <td class="context-item-name">FORMAT_FILES</td>
141
- <td>=</td>
142
- <td class="context-item-value">Dir[File.join(FORMATS_DIR, '*.yaml')]</td>
143
- </tr>
144
- </table>
145
- </div>
146
- </div>
147
-
148
-
149
-
150
-
151
-
152
-
153
- <!-- if method_list -->
154
-
155
-
156
- </div>
157
-
158
-
159
- <div id="validator-badges">
160
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
161
- </div>
162
-
163
- </body>
164
- </html>
@@ -1,112 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Module: RDoc</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Module</strong></td>
53
- <td class="class-name-in-header">RDoc</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/erbook/rdoc_rb.html">
59
- lib/erbook/rdoc.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- </table>
66
- </div>
67
- <!-- banner header -->
68
-
69
- <div id="bodyContent">
70
-
71
-
72
-
73
- <div id="contextContent">
74
-
75
-
76
-
77
- </div>
78
-
79
-
80
- </div>
81
-
82
-
83
- <!-- if includes -->
84
-
85
- <div id="section">
86
-
87
- <div id="class-list">
88
- <h3 class="section-bar">Classes and Modules</h3>
89
-
90
- Class <a href="RDoc/AnyMethod.html" class="link">RDoc::AnyMethod</a><br />
91
- Class <a href="RDoc/TopLevel.html" class="link">RDoc::TopLevel</a><br />
92
-
93
- </div>
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
- <!-- if method_list -->
102
-
103
-
104
- </div>
105
-
106
-
107
- <div id="validator-badges">
108
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
109
- </div>
110
-
111
- </body>
112
- </html>