erbook 7.1.0 → 7.1.1

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.
data/doc/intro.erb CHANGED
@@ -5,8 +5,8 @@
5
5
 
6
6
  % eruby_url = "http://en.wikipedia.org/wiki/ERuby"
7
7
  % api_url = './api/index.html'
8
- % repo_url = 'http://github.com/sunaku/' + $program
9
- % repo_scm = '[Git](http://git-scm.com)'
8
+ % src_url = 'http://github.com/sunaku/' + $program
9
+ % src_scm = '[Git](http://git-scm.com)'
10
10
 
11
11
 
12
12
  %|chapter "Introduction"
@@ -14,9 +14,16 @@
14
14
 
15
15
  %|project
16
16
 
17
- <%= $project %> is an extensible document processor that emits <%= xref "HelloWorld", "any document you can imagine" %> from [eRuby templates](<%= eruby_url %>) which allow scripting and dynamic content generation.
17
+ <%= $project %> is an extensible document processor that emits <%= xref "HelloWorld", "any document you can imagine" %> from [eRuby templates](<%= eruby_url %>), which allow scripting and dynamic content generation.
18
18
 
19
- A working <%= xref "xhtml", "XHTML (web page)" %> format is provided, while <%= xref "latex", "LaTeX (PDF)" %>, <%= xref "man", "UNIX manual page" %>, and <%= xref "text", "plain text" %> formats are planned... <%= xref "License", "patches are welcome" %>!
19
+
20
+ * <%= xref "History", "What's new?" %> --- history of project releases.
21
+ * [Source code](<%= src_url %>) --- obtain via <%= src_scm %> or browse online.
22
+ * [API reference](<%= api_url %>) --- documentation for source code.
23
+ * [Project home](<%= $website %>) --- the <%= $project %> project home page.
24
+
25
+ To get help or provide feedback, simply
26
+ <%= xref "License", "contact the author(s)" %>.
20
27
 
21
28
 
22
29
  %|section "Features"
@@ -24,68 +31,13 @@
24
31
  <%= $project %> is exciting because:
25
32
  * Its documents are scriptable [eRuby templates](<%= eruby_url %>).
26
33
  * It lets you <%= xref "HelloWorld", "define your own document formats" %>.
27
- * Its core contains less than 400 lines of code.
34
+ * It emits beautiful <%= xref "xhtml", "XHTML (web page)" %> documents.
35
+ * It consists of a mere <%= `sloccount .`[/^Total.+=\s*(\d+)$/, 1] %> lines of code.
28
36
 
29
- These features distinguish <%= $project %> from the competition, who offer neither scriptable documents nor definable document formats:
30
- * [DocBook](http://www.docbook.org)
31
- * [Deplate](http://deplate.sourceforge.net)
32
- * [SiSU](http://www.jus.uio.no/sisu/SiSU/)
33
- * [AsciiDoc](http://www.methods.co.nz/asciidoc/)
34
- * [txt2tags](http://txt2tags.sourceforge.net)
35
- * [Grutatxt](http://www.triptico.com/software/grutatxt.html)
36
37
 
38
+ %|note "More document formats are planned"
37
39
 
38
- %|section "Logistics"
39
-
40
- * <%= xref "History", "What's new?" %> --- history of project releases.
41
- * [Source code](<%= repo_url %>) --- obtain via <%= repo_scm %> or browse online.
42
- * [API reference](<%= api_url %>) --- documentation for source code.
43
- * [Project home](<%= $website %>) --- the <%= $project %> project home page.
44
-
45
- To get help or provide feedback, simply
46
- <%= xref "License", "contact the authors" %>.
47
-
48
-
49
- %|paragraph "Version numbers"
50
-
51
- <%= $project %> releases are numbered in *major.minor.patch*
52
- form according to the [RubyGems rational versioning
53
- policy](http://www.rubygems.org/read/chapter/7), which
54
- can be summarized thus:
55
-
56
- <table markdown="1">
57
- <thead>
58
- <tr>
59
- <td rowspan="2">What increased in the version number?</td>
60
- <td colspan="3">The increase indicates that the release:</td>
61
- </tr>
62
- <tr>
63
- <th>Is backward compatible?</th>
64
- <th>Has new features?</th>
65
- <th>Has bug fixes?</th>
66
- </tr>
67
- </thead>
68
- <tbody>
69
- <tr>
70
- <th>major</th>
71
- <td style="background-color: #FFE4E1;">No</td>
72
- <td>Yes</td>
73
- <td>Yes</td>
74
- </tr>
75
- <tr>
76
- <th>minor</th>
77
- <td>Yes</td>
78
- <td>Yes</td>
79
- <td>Yes</td>
80
- </tr>
81
- <tr>
82
- <th>patch</th>
83
- <td>Yes</td>
84
- <td style="background-color: #FFE4E1;">No</td>
85
- <td>Yes</td>
86
- </tr>
87
- </tbody>
88
- </table>
40
+ <%= xref "latex", "LaTeX (PDF)" %>, <%= xref "man", "UNIX manual page" %>, and <%= xref "text", "plain text" %> document formats are planned for future releases... <%= xref "License", "patches are welcome" %>!
89
41
 
90
42
 
91
43
  %|section "License"
@@ -100,7 +52,7 @@
100
52
  %< "README"
101
53
 
102
54
  <%= $project %> is made possible by
103
- <%= xref "History", "contributions" %>
55
+ %= xref "History", "contributions"
104
56
  from users like you:
105
57
 
106
58
  %< "../CREDITS"
@@ -126,3 +78,16 @@
126
78
  Martin DeMello in [ruby-talk](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/283304):
127
79
 
128
80
  > Very nice work indeed!
81
+
82
+
83
+ %|section "Related works"
84
+
85
+ Note that, unlike <%= $project %>, these related works offer *neither* scriptable documents nor definable document formats. I have yet to encounter another project that does. If you happen to know, please enlighten me.
86
+
87
+ * [DocBook](http://www.docbook.org)
88
+ * [Deplate](http://deplate.sourceforge.net)
89
+ * [SiSU](http://www.jus.uio.no/sisu/SiSU/)
90
+ * [AsciiDoc](http://www.methods.co.nz/asciidoc/)
91
+ * [txt2tags](http://txt2tags.sourceforge.net)
92
+ * [Grutatxt](http://www.triptico.com/software/grutatxt.html)
93
+
data/doc/setup.erb CHANGED
@@ -33,7 +33,7 @@
33
33
  Otherwise, you can <%= xref "License", "contact the author" %> for help.
34
34
 
35
35
 
36
- %|section "Manifest"
36
+ %|section "Package contents"
37
37
 
38
38
  You will see the following items inside <%= $project %>'s installation directory, whose path you can determine by running this command:
39
39
 
@@ -46,7 +46,7 @@
46
46
  * <tt>fmt/</tt> --- contains the predefined set of <%= xref "SpecFile", "format specification files" %>. If you ever need to install your custom format specification file globally, then put it inside this directory.
47
47
 
48
48
  %|ERBook::FORMAT_FILES.each do |file|
49
- <%=' '%>* <tt><%= File.basename(file) %></tt> --- <%= YAML.load_file(file)['desc'] %>
49
+ %= ' * <tt>%s</tt> --- %s' % [File.basename(file), YAML.load_file(file)['desc']]
50
50
 
51
51
  * <tt>lib/</tt>
52
52
 
@@ -67,3 +67,46 @@
67
67
  * <tt>api/</tt> --- API reference documentation.
68
68
 
69
69
  * <tt>LICENSE</tt> --- project license and copyright notice.
70
+
71
+
72
+ %|section "Version numbers"
73
+
74
+ <%= $project %> releases are numbered in *major.minor.patch*
75
+ form according to the [RubyGems rational versioning
76
+ policy](http://www.rubygems.org/read/chapter/7), which
77
+ can be summarized as follows:
78
+
79
+ <table markdown="1">
80
+ <thead>
81
+ <tr>
82
+ <td rowspan="2">What increased in the version number?</td>
83
+ <td colspan="3">The increase indicates that the release:</td>
84
+ </tr>
85
+ <tr>
86
+ <th>Is backward compatible?</th>
87
+ <th>Has new features?</th>
88
+ <th>Has bug fixes?</th>
89
+ </tr>
90
+ </thead>
91
+ <tbody>
92
+ <tr>
93
+ <th>major</th>
94
+ <td style="background-color: #FFE4E1;">No</td>
95
+ <td>Yes</td>
96
+ <td>Yes</td>
97
+ </tr>
98
+ <tr>
99
+ <th>minor</th>
100
+ <td>Yes</td>
101
+ <td>Yes</td>
102
+ <td>Yes</td>
103
+ </tr>
104
+ <tr>
105
+ <th>patch</th>
106
+ <td>Yes</td>
107
+ <td style="background-color: #FFE4E1;">No</td>
108
+ <td>Yes</td>
109
+ </tr>
110
+ </tbody>
111
+ </table>
112
+
data/doc/usage.erb CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  The first command-line argument to <%= $project %> is either the name of a predefined format (FormatName) or the path to a <%= xref "SpecFile", "format specification file" %> (FormatFile).
14
14
 
15
- Predefined formats are simply short-hand names of format specification files located in the <tt>fmt/</tt> subdirectory of the <%= $project %> installation directory (see <%= xref "Manifest" %>).
15
+ Predefined formats are simply short-hand names of format specification files located in the <tt>fmt/</tt> subdirectory of the <%= $project %> installation directory (see <%= xref "Package contents" %>).
16
16
 
17
17
 
18
18
  %|section "Saving the output to a file"
@@ -24,11 +24,13 @@
24
24
  In the above example, *YOUR\_PATH\_HERE* is the path of the file in which the output should be saved.
25
25
 
26
26
 
27
- %|important "Save XHTML output as <tt>.xhtml</tt>"
27
+ %|important "Serve XHTML as HTML for Microsoft web browsers"
28
28
 
29
- When you use the XHTML format, ensure that the file extension of your saved output document is either <tt>.xhtml</tt> or <tt>.xml</tt>. Alternatively, ensure that your saved output document is served to web browsers under the <tt>application/xhtml+xml</tt> mime type.
29
+ If you do not care whether people can read your XHTML documents using Microsoft web browsers, please disregard this message. Otherwise, please heed the following instructions.
30
30
 
31
- Otherwise, most web browsers _will not display_ the icons and graphics embedded in the saved XHTML output document because they will treat it as HTML instead of as XML. See [this QuirksMode.org bug report](http://www.quirksmode.org/bugreports/archives/2005/02/custom_dtds_int_1.html) for details.
31
+ When you use the XHTML format, ensure that either (1) your saved output document is served to web browsers under the <tt>text/html</tt> mime type, or (2) the file extension of your saved output document is either <tt>.html</tt> or <tt>.htm</tt>.
32
+
33
+ Otherwise, Microsoft web browsers _will not display_ your XHTML document and will instead prompt the reader to save your XHTML document as a file on their computer. See [this detailed explanation](http://www.howtocreate.co.uk/wrongWithIE/?chapter=XHTML) for details.
32
34
 
33
35
 
34
36
  %|section "Unindenting nodes hierarchically"
@@ -36,3 +38,4 @@
36
38
  When writing <%= $project %> documents, I prefer to indent the content of nodes according to their depth because my [text editor of choice](http://jedit.org) automatically folds blocks of text based on indentation.
37
39
 
38
40
  If you also prefer to write documents in this way, be sure to pass the <tt>--unindent</tt> option to <%= $project %> so that the indentation will not affect the resulting output.
41
+
data/fmt/xhtml.yaml CHANGED
@@ -119,28 +119,11 @@ code: |
119
119
  end
120
120
 
121
121
  ##
122
- # Returns a XML entity reference (to this icon's
123
- # embedded image data) ready for insertion into XML.
124
- #
125
- def entity_xml
126
- "&#{entity_name};"
127
- end
128
-
129
- ##
130
- # Returns the name of the XML entity whose
131
- # value contains embedded image data.
132
- #
133
- def entity_name
134
- "icon_#{name}"
135
- end
136
-
137
- ##
138
- # Returns an <img/> tag that renders the image
139
- # data embedded as an ENTITY in the html DOCTYPE.
122
+ # Returns an <img/> tag that renders an embedded data URI.
140
123
  #
141
124
  def to_xhtml atts = {}
142
125
  atts[:alt] ||= name
143
- atts[:src] = entity_xml
126
+ atts[:src] = data_uri
144
127
  atts[:class] = :icon
145
128
  "<img#{atts.to_xml_atts}/>"
146
129
  end
@@ -338,10 +321,10 @@ code: |
338
321
  NEXT_TEXT = ERBook::PHRASES['Focus next segment']
339
322
  LIST_TEXT = ERBook::PHRASES['Return to listing']
340
323
 
341
- HERE_SIGN = ICON_BY_NAME['nav_here'].to_xhtml(:alt => '&lowast;')
342
- PREV_SIGN = ICON_BY_NAME['nav_prev'].to_xhtml(:alt => '&larr;')
343
- NEXT_SIGN = ICON_BY_NAME['nav_next'].to_xhtml(:alt => '&rarr;')
344
- LIST_SIGN = ICON_BY_NAME['nav_list'].to_xhtml(:alt => '&equiv;')
324
+ HERE_SIGN = ICON_BY_NAME['nav_here'].to_xhtml(:alt => HERE_TEXT)
325
+ PREV_SIGN = ICON_BY_NAME['nav_prev'].to_xhtml(:alt => PREV_TEXT)
326
+ NEXT_SIGN = ICON_BY_NAME['nav_next'].to_xhtml(:alt => NEXT_TEXT)
327
+ LIST_SIGN = ICON_BY_NAME['nav_list'].to_xhtml(:alt => LIST_TEXT)
345
328
 
346
329
  ##
347
330
  # Calculates a local navigation menu containing links
@@ -469,7 +452,7 @@ nodes:
469
452
  index: false
470
453
  number: false
471
454
  silent: true
472
- bypass: true
455
+ bypass: false
473
456
  output: |
474
457
  <div id="<%= @node.type_frag %>">
475
458
  <%= @node.navigation %>
@@ -646,6 +629,8 @@ output: |
646
629
  $subtitle = '$subtitle' unless defined? $subtitle
647
630
  $authors = {'$authors' => nil} unless defined? $authors
648
631
  $date = Time.now.strftime("%d %B %Y") unless defined? $date
632
+ $logo = nil unless defined? $logo
633
+ $feeds = nil unless defined? $feeds
649
634
 
650
635
  abstract = @nodes_by_type['abstract'].first
651
636
 
@@ -700,14 +685,14 @@ output: |
700
685
  end
701
686
  %><?xml version="1.0" encoding="utf-8"?>
702
687
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
703
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
704
- %|ICONS.each |icon|
705
- <!ENTITY <%= icon.entity_name %> "<%= icon.data_uri %>">
706
- ]>
688
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
707
689
  <html xmlns="http://www.w3.org/1999/xhtml">
708
690
  <head>
709
- <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>
710
- <meta name="generator" content="<%= ERBook::DISPLAY %>"/>
691
+ <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
692
+
693
+ <meta name="generator" content="<%=
694
+ [ERBook::DISPLAY, ERBook::WEBSITE].join(' &mdash; ')
695
+ %>"/>
711
696
 
712
697
  % if $title || $subtitle
713
698
  <title><%=
@@ -798,6 +783,10 @@ output: |
798
783
  %< File.join(JQUERY_DIR, 'jquery-ui-1.7.2.custom.min.js')
799
784
 
800
785
  $(function() {
786
+ /*
787
+ %< File.join(ERBook::INSTALL, 'LICENSE')
788
+ */
789
+
801
790
  //
802
791
  // respond to changes in window location
803
792
  //
@@ -822,6 +811,10 @@ output: |
822
811
  // the element corresponding to the given hash.
823
812
  //
824
813
  function set_hash(hash, prevent_jump) {
814
+ if ($last_hash == hash) {
815
+ return;
816
+ }
817
+
825
818
  var set_the_hash = function() {
826
819
  //
827
820
  // XXX: bypass on_hash_change() by setting $last_hash
@@ -872,9 +865,11 @@ output: |
872
865
  // temporarily place a dummy element at the current
873
866
  // screen position and give it the ID of the target
874
867
  //
868
+ var original_screen_position = $(window).scrollTop();
869
+
875
870
  var dummy = $('<span/>').attr('id', target_id).css({
876
871
  position: 'absolute',
877
- top: $(window).scrollTop()
872
+ top: original_screen_position
878
873
  });
879
874
 
880
875
  target.removeAttr('id').before(dummy);
@@ -892,6 +887,12 @@ output: |
892
887
  dummy.remove();
893
888
  target.attr('id', target_id);
894
889
 
890
+ //
891
+ // the above approach does not work for Opera and IE.
892
+ // they ignore the dummy and jump to the actual target
893
+ //
894
+ $(window).scrollTop(original_screen_position);
895
+
895
896
  return;
896
897
  }
897
898
  }
@@ -955,47 +956,35 @@ output: |
955
956
  }
956
957
  }
957
958
 
958
- function scroll_to_target_and_set_hash() {
959
- if (target.is(':hidden')) {
960
- //
961
- // wait before scrolling because the
962
- // tabs.select() calls above may not
963
- // have fully taken effect yet and
964
- // so the target may still be hidden
965
- //
966
- setTimeout(scroll_to_target_and_set_hash, 0);
967
- }
968
- else {
969
- //
970
- // scroll to the tab bar instead of the target
971
- // because it contains the title for the target
972
- //
973
- var scroll_target = target_is_panel ?
974
- target.parent('.ui-tabs') : target;
975
-
976
- var screen_before_scroll = $(window).scrollTop();
977
-
978
- $('html').animate({
979
- scrollTop: Math.floor(scroll_target.offset().top)
980
- }, 'slow', 'swing', function() {
981
- set_hash(hash, target_is_panel);
982
-
983
- if (
984
- !target_initially_hidden &&
985
- $(window).scrollTop() == screen_before_scroll
986
- ) {
987
- //
988
- // nothing changed on the screen.
989
- // the target was already visible.
990
- // highlight it to notify the user.
991
- //
992
- target.effect('highlight', 'slow');
993
- }
994
- });
959
+ //
960
+ // scroll to the tab bar instead of the target
961
+ // because it contains the title for the target
962
+ //
963
+ var scroll_target = target_is_panel ?
964
+ target.parent('.ui-tabs') : target;
965
+
966
+ var screen_before_scroll = $(window).scrollTop();
967
+
968
+ $('html, body').animate(
969
+ { scrollTop: Math.floor(scroll_target.offset().top) },
970
+ 'slow', 'swing', function() {
971
+ var screen_after_scroll = $(window).scrollTop();
972
+
973
+ set_hash(hash, target_is_panel);
974
+
975
+ if (
976
+ !target_initially_hidden &&
977
+ screen_after_scroll == screen_before_scroll
978
+ ) {
979
+ //
980
+ // nothing changed on the screen.
981
+ // the target was already visible.
982
+ // highlight it to notify the user.
983
+ //
984
+ target.effect('highlight', 'slow');
985
+ }
995
986
  }
996
- }
997
-
998
- scroll_to_target_and_set_hash();
987
+ );
999
988
  }
1000
989
  }
1001
990
 
@@ -1277,6 +1266,13 @@ styles: # these are SASS templates
1277
1266
  code.para
1278
1267
  white-space: pre
1279
1268
 
1269
+ ins > pre
1270
+ text-decoration: none
1271
+
1272
+ ins
1273
+ // for IE only, because the above "ins > pre" does not work
1274
+ .text-decoration: none
1275
+
1280
1276
 
1281
1277
  a > img
1282
1278
  border: none
data/lib/erbook.rb CHANGED
@@ -9,10 +9,10 @@ require 'inochi'
9
9
 
10
10
  Inochi.init :ERBook,
11
11
  :program => 'erbook',
12
- :version => '7.1.0',
13
- :release => '2009-08-30',
12
+ :version => '7.1.1',
13
+ :release => '2009-09-06',
14
14
  :website => 'http://snk.tuxfamily.org/lib/erbook/',
15
- :tagline => 'Extensible document processor based on eRuby',
15
+ :tagline => 'Write books, manuals, and documents in eRuby',
16
16
  :require => {
17
17
  'ember' => '~> 0', # for eRuby template processing
18
18
  'maruku' => '~> 0.5', # for Markdown to XHTML conversion