deplate 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. data/CHANGES.TXT +118 -0
  2. data/NEWS.TXT +6 -21
  3. data/VERSION.TXT +1 -1
  4. data/etc/deplate.ini +15 -2
  5. data/lib/action_view/helpers/deplate.rb +0 -0
  6. data/lib/deplate/abstract-class.rb +3 -2
  7. data/lib/deplate/bib.rb +3 -2
  8. data/lib/deplate/builtin.rb +3 -2
  9. data/lib/deplate/cache.rb +3 -2
  10. data/lib/deplate/commands.rb +3 -11
  11. data/lib/deplate/common.rb +7 -2
  12. data/lib/deplate/compat.rb +21 -0
  13. data/lib/deplate/compat/parsedate.rb +24 -0
  14. data/lib/deplate/converter.rb +3 -2
  15. data/lib/deplate/core.rb +135 -103
  16. data/lib/deplate/counters.rb +3 -2
  17. data/lib/deplate/css/article.css +2 -2
  18. data/lib/deplate/css/doc.css +3 -2
  19. data/lib/deplate/css/heading-navbar.css +2 -2
  20. data/lib/deplate/css/highlight.css +0 -0
  21. data/lib/deplate/css/layout-deplate-print.css +2 -2
  22. data/lib/deplate/css/layout-deplate.css +2 -2
  23. data/lib/deplate/css/presentation.css +2 -2
  24. data/lib/deplate/css/sans-serif.css +2 -2
  25. data/lib/deplate/css/screenplay.css +0 -0
  26. data/lib/deplate/css/serif-e.css +2 -2
  27. data/lib/deplate/css/serif-rel.css +3 -2
  28. data/lib/deplate/css/serif.css +2 -2
  29. data/lib/deplate/css/slides.css +3 -2
  30. data/lib/deplate/css/tabbar-top.css +2 -2
  31. data/lib/deplate/css/text-sans-serif.css +3 -2
  32. data/lib/deplate/css/text-serif.css +2 -2
  33. data/lib/deplate/css/website.css +0 -0
  34. data/lib/deplate/define.rb +3 -2
  35. data/lib/deplate/deplate-string.rb +3 -2
  36. data/lib/deplate/docbook.rb +4 -14
  37. data/lib/deplate/elements.rb +37 -4
  38. data/lib/deplate/encoding.rb +57 -0
  39. data/lib/deplate/etc.rb +7 -5
  40. data/lib/deplate/external.rb +5 -13
  41. data/lib/deplate/fmt/dbk-article-4.1.2.rb +3 -2
  42. data/lib/deplate/fmt/dbk-article.rb +3 -2
  43. data/lib/deplate/fmt/dbk-book.rb +3 -2
  44. data/lib/deplate/fmt/dbk-ref.rb +3 -2
  45. data/lib/deplate/fmt/dbk-slides.rb +3 -2
  46. data/lib/deplate/fmt/dbk-snippet.rb +3 -2
  47. data/lib/deplate/fmt/html-snippet.rb +3 -2
  48. data/lib/deplate/fmt/html.rb +40 -27
  49. data/lib/deplate/fmt/htmlsite.rb +3 -2
  50. data/lib/deplate/fmt/htmlslides.rb +3 -2
  51. data/lib/deplate/fmt/htmlwebsite.rb +3 -2
  52. data/lib/deplate/fmt/latex-dramatist.rb +2 -1
  53. data/lib/deplate/fmt/latex-snippet.rb +3 -2
  54. data/lib/deplate/fmt/latex.rb +88 -67
  55. data/lib/deplate/fmt/null.rb +3 -2
  56. data/lib/deplate/fmt/php.rb +3 -2
  57. data/lib/deplate/fmt/phpsite.rb +3 -2
  58. data/lib/deplate/fmt/plain.rb +4 -3
  59. data/lib/deplate/fmt/sweave.rb +104 -0
  60. data/lib/deplate/fmt/template.rb +3 -2
  61. data/lib/deplate/fmt/xhtml10t.rb +82 -2
  62. data/lib/deplate/fmt/xhtml11m.rb +3 -2
  63. data/lib/deplate/formatter-snippet.rb +3 -2
  64. data/lib/deplate/formatter.rb +203 -29
  65. data/lib/deplate/guesslanguage.rb +3 -2
  66. data/lib/deplate/input.rb +9 -8
  67. data/lib/deplate/input/deplate-headings.rb +3 -2
  68. data/lib/deplate/input/deplate-restricted.rb +3 -2
  69. data/lib/deplate/input/deplate.rb +3 -2
  70. data/lib/deplate/input/play.rb +3 -2
  71. data/lib/deplate/input/rdoc.rb +3 -2
  72. data/lib/deplate/input/template.rb +3 -2
  73. data/lib/deplate/lib/Makefile.config +8 -0
  74. data/lib/deplate/locale/de.latin1 +6 -0
  75. data/lib/deplate/macros.rb +4 -2
  76. data/lib/deplate/messages.rb +9 -5
  77. data/lib/deplate/metadata.rb +3 -2
  78. data/lib/deplate/metadata/marshal.rb +3 -2
  79. data/lib/deplate/metadata/xml.rb +3 -2
  80. data/lib/deplate/metadata/yaml.rb +3 -2
  81. data/lib/deplate/mod/anyword.rb +3 -2
  82. data/lib/deplate/mod/babelfish.rb +3 -2
  83. data/lib/deplate/mod/code-coderay.rb +3 -2
  84. data/lib/deplate/mod/code-gvim.rb +3 -2
  85. data/lib/deplate/mod/code-gvim71.rb +3 -2
  86. data/lib/deplate/mod/code-highlight.rb +3 -2
  87. data/lib/deplate/mod/colored-log.rb +3 -2
  88. data/lib/deplate/mod/encode.rb +33 -0
  89. data/lib/deplate/mod/endnotes.rb +3 -2
  90. data/lib/deplate/mod/entities-decode.rb +2 -1
  91. data/lib/deplate/mod/entities-encode.rb +2 -1
  92. data/lib/deplate/mod/guesslanguage.rb +3 -2
  93. data/lib/deplate/mod/html-asciimath.rb +3 -2
  94. data/lib/deplate/mod/html-deplate-button.rb +3 -2
  95. data/lib/deplate/mod/html-headings-navbar.rb +3 -2
  96. data/lib/deplate/mod/html-highstep.rb +3 -2
  97. data/lib/deplate/mod/html-jsmath.rb +3 -2
  98. data/lib/deplate/mod/html-mathml.rb +2 -1
  99. data/lib/deplate/mod/html-obfuscate-email.rb +3 -2
  100. data/lib/deplate/mod/html-sidebar.rb +3 -2
  101. data/lib/deplate/mod/htmlslides-navbar-fh.rb +3 -2
  102. data/lib/deplate/mod/iconv.rb +3 -2
  103. data/lib/deplate/mod/imgurl.rb +4 -3
  104. data/lib/deplate/mod/inlatex-compound.rb +3 -2
  105. data/lib/deplate/mod/koma.rb +3 -2
  106. data/lib/deplate/mod/lang-de.rb +3 -2
  107. data/lib/deplate/mod/lang-en.rb +3 -2
  108. data/lib/deplate/mod/lang-ru-koi8-r.rb +3 -2
  109. data/lib/deplate/mod/lang-ru.rb +3 -2
  110. data/lib/deplate/mod/lang-zh_CN-autospace.rb +3 -2
  111. data/lib/deplate/mod/lang-zh_CN.rb +3 -2
  112. data/lib/deplate/mod/latex-emph-table-head.rb +3 -2
  113. data/lib/deplate/mod/latex-styles.rb +3 -2
  114. data/lib/deplate/mod/latex-verbatim-small.rb +3 -2
  115. data/lib/deplate/mod/linkmap.rb +2 -1
  116. data/lib/deplate/mod/makefile.rb +39 -46
  117. data/lib/deplate/mod/mark-external-urls.rb +3 -2
  118. data/lib/deplate/mod/markup-1-warn.rb +3 -2
  119. data/lib/deplate/mod/markup-1.rb +3 -2
  120. data/lib/deplate/mod/navbar-png.rb +3 -2
  121. data/lib/deplate/mod/noindent.rb +3 -2
  122. data/lib/deplate/mod/numpara.rb +3 -2
  123. data/lib/deplate/mod/particle-math.rb +3 -2
  124. data/lib/deplate/mod/php-extra.rb +3 -2
  125. data/lib/deplate/mod/pstoedit.rb +3 -2
  126. data/lib/deplate/mod/recode.rb +3 -2
  127. data/lib/deplate/mod/smart-dash.rb +3 -2
  128. data/lib/deplate/mod/smiley.rb +3 -2
  129. data/lib/deplate/mod/soffice.rb +3 -2
  130. data/lib/deplate/mod/symbols-latin1.rb +8 -2
  131. data/lib/deplate/mod/symbols-od-utf-8.rb +3 -2
  132. data/lib/deplate/mod/symbols-plain.rb +3 -2
  133. data/lib/deplate/mod/symbols-sgml.rb +6 -5
  134. data/lib/deplate/mod/symbols-utf-8.rb +6 -5
  135. data/lib/deplate/mod/symbols-xml.rb +3 -2
  136. data/lib/deplate/mod/syntax-region-alt.rb +3 -2
  137. data/lib/deplate/mod/utf8.rb +3 -2
  138. data/lib/deplate/mod/validate-html.rb +3 -2
  139. data/lib/deplate/mod/xmlrpc.rb +3 -2
  140. data/lib/deplate/nukumi2.rb +3 -2
  141. data/lib/deplate/once-method.rb +3 -2
  142. data/lib/deplate/output.rb +3 -2
  143. data/lib/deplate/particles.rb +12 -6
  144. data/lib/{ps2ppm.rb → deplate/ps2ppm.rb} +11 -11
  145. data/lib/deplate/regions.rb +75 -52
  146. data/lib/deplate/skeletons.rb +3 -2
  147. data/lib/deplate/structured.rb +8 -24
  148. data/lib/deplate/template.rb +3 -2
  149. data/lib/deplate/themes/presentation.html/css/presentation.css +2 -2
  150. data/lib/deplate/themes/presentation.html/prelude.txt +1 -1
  151. data/lib/deplate/themes/presentation.html/resources/spacer.png +0 -0
  152. data/lib/deplate/themes/s5.xhtml/README.TXT +2 -0
  153. data/lib/deplate/themes/s5.xhtml/templates/s5.xhtml +42 -0
  154. data/lib/deplate/themes/s5.xhtml/theme.ini +11 -0
  155. data/lib/deplate/variables.rb +12 -2
  156. data/lib/deplate/wiki-markup.rb +3 -2
  157. data/lib/deplate/xml.rb +19 -21
  158. data/lib/deplate/zh_CN.rb +3 -2
  159. data/man/man1/deplate.1 +83 -128
  160. metadata +16 -4
@@ -1,3 +1,121 @@
1
+ 2009-02-05 Thomas Link (micathom at gmail com)
2
+ * formatter.rb (clean_tags): Moved from html.rb and docbook.rb.
3
+ * core.rb (clean_filename): Encode special characters with =
4
+ * makefile.rb (deplate_initialize_makefile): Escape $ characters.
5
+ * core.rb (set_top_heading): Don't escape special characters twice
6
+ when autoFileNames is used.
7
+ * core.rb (parse_and_format): Excluded elements are now passed as
8
+ key arguments.
9
+ * particles.rb (process): Extended wiki names: Don't format URLs as
10
+ plain text -- uniform behaviour with URL links.
11
+ * latex.rb (format_url): Don't escape ''&'' in URLs.
12
+ * messages.rb (initialize): Get ''canonic_enc_name'' from
13
+ ''Deplate::Encoding'' if @deplate.formatter hasn't been set up yet.
14
+
15
+ 2009-02-04 Thomas Link (micathom at gmail com)
16
+ * encoding.rb (ruby_enc_name): Ruby encoding names.
17
+ * variables.rb ([]=): Set Encoding.default_external (ruby19+).
18
+
19
+ 2009-02-02 Thomas Link (micathom at gmail com)
20
+ * html.rb (format_list_item): Removed the "�" character from the
21
+ standard characters for itemized lists.
22
+ * several files: Set script-encoding to ASCII whenever possible.
23
+
24
+ 2009-01-31 Thomas Link (micathom at gmail com)
25
+ * elements.rb (Deplate::List::Itemize): Removed the "�" character
26
+ from the standard characters for itemized lists.
27
+ * several files: The paragraph charachter � was removed from the
28
+ list of special symbols in order to keep most source files in ASCII.
29
+
30
+ 2009-01-28 Thomas Link (micathom at gmail com)
31
+ * messages.rb (initialize): FIX:
32
+ @deplate.formatter.canonic_enc_name()
33
+ * formatter.rb (plain_text): @special_symbols[x] = :identity
34
+
35
+ 2009-01-25 Thomas Link (micathom at gmail com)
36
+ * regions.rb (finish): FIX nil.split
37
+
38
+ 2009-01-22 Thomas Link (micathom at gmail com)
39
+ * compat.rb (Deplate::Compat): check for ruby19
40
+ * parsedate.rb (ParseDate): ruby19 bridge class
41
+ * formatter.rb (wrap_text): Use String#each_line (ruby19
42
+ compatibility)
43
+ * structured.rb (get_cited): flatten (ruby19)
44
+ * core.rb (clean_name): text[0] => unpack (ruby19)
45
+
46
+ 2009-01-17 Thomas Link (micathom at gmail com)
47
+ * sweave.rb (img_R): ''float'' option: If false, don't format the
48
+ image as figure.
49
+ * regions.rb (setup): Don't lose global options defined as
50
+ "$Regions#{NAME}".
51
+ * core.rb (canonic_args): Properly handle boolean hash variables.
52
+
53
+ 2009-01-16 Thomas Link (micathom at gmail com)
54
+ * xhtml10t.rb (include_image_svg): Reference svg files as object.
55
+ * formatter.rb (include_image): Generic method
56
+ * html.rb, latex.rb ... (include_image_general): Default
57
+ include_image method -- if the image type doesn't require special
58
+ handling.
59
+ * xhtml10t.rb (include_image_svg): include! argument (include the
60
+ svg xml)
61
+
62
+ 2009-01-15 Thomas Link (micathom at gmail com)
63
+ * imgurl.rb (Deplate::HyperLink::ImgUrl): AbstractImgUrl -> ImgUrl
64
+
65
+ 2009-01-14 Thomas Link (micathom at gmail com)
66
+ * regions.rb (register_caption): Make sure images (eg when generated
67
+ via sweave) don't lose the caption.
68
+ * regions.rb (finish): imgCmd variable: default command for ''#Img''
69
+ regions.
70
+
71
+ 2008-12-21 Thomas Link (micathom at gmail com)
72
+ * formatter.rb (indent_text): each_line (ruby19)
73
+
74
+ 2008-12-14 Thomas Link (micathom at gmail com)
75
+ * regions.rb: Defined #Latex, #LaTeX as synomyms for #Ltx.
76
+ * regions.rb: Defined latex as synomym for ltx.
77
+ * external.rb, ps2ppm.rb: Moved ps2ppm.rb to deplate/ps2ppm.rb;
78
+ disabled command line usage due to missing getopts library in
79
+ ruby19.
80
+
81
+ 2008-11-30 Thomas Link (micathom at gmail com)
82
+ * core.rb (canonic_args): Strip parentheses from arguments.
83
+ !!! This could cause problems. In earlier versions, the value of foo
84
+ in ''foo=(x y)' was set to "(x y)" but is now set to "x y". In order
85
+ to set it to "(x y)", you'd have to use ''foo=((x y))'' or
86
+ ''foo="(x y)"''.
87
+
88
+ 2008-11-28 Thomas Link (micathom at gmail com)
89
+ * regions.rb (do_R): R regions: swallow as synonym for drop
90
+ * regions.rb (Deplate::Regions::Swallow): #Drop as synonym for
91
+ #Swallow
92
+
93
+ 2008-11-24 Thomas Link (micathom at gmail com)
94
+ * sweave.rb: Sweave/LaTeX output format (Rnw).
95
+
96
+ 2008-11-01 Thomas Link (micathom at gmail com)
97
+ * latex.rb (float_options): If here == H or floatHere == H, use the
98
+ float package to place a float really right here.
99
+
100
+ 2008-10-28 Thomas Link (micathom at gmail com)
101
+ * latex.rb (block_postfix): inlay! parameter also works for lists
102
+ and some more.
103
+
104
+ 2008-10-24 Thomas Link (micathom at gmail com)
105
+ * latex.rb (format_environment): inlay! parameter (don't add a
106
+ newline after the environment; reported by Brett Calcott)
107
+
108
+ 2008-08-27 Thomas Link (micathom at gmail com)
109
+ * html.rb (format_heading): htmlHeading(Pre|Post)
110
+ * formatter.rb (close_headings): moved from structured.rb
111
+
112
+ 2008-07-27 Thomas Link (micathom at gmail com)
113
+ * elements.rb (format_contained): Propagate @postponed_format,
114
+ @postponed_preformat
115
+ * regions.rb (format_compound): Call format_contained instead of
116
+ format_current (footnotes in Abstracts & similar block elements were
117
+ not printed)
118
+
1
119
  2008-07-20 Thomas Link (micathom at gmail com)
2
120
  * gem, zip: Fixed packaging problem
3
121
 
data/NEWS.TXT CHANGED
@@ -1,4 +1,4 @@
1
- * deplate 0.8.2
1
+ * deplate 0.8.5
2
2
 
3
3
  ''deplate'' is a [[http://www.ruby-lang.org][ruby]] based tool for
4
4
  converting documents written in wiki-like markup to LaTeX, HTML, "HTML
@@ -7,26 +7,11 @@ footnotes, citations, bibliographies, automatic generation of an index,
7
7
  table of contents etc. It can be used to create web pages and (via
8
8
  LaTeX or Docbook) high-quality printouts from the same source.
9
9
 
10
- This release incorporates the usual set of bugfixes and general improvements.
11
-
12
- Incompatible changes:
13
- * Fixed inconsistent handling of the css option with regard to the suffix
14
-
15
- Improvements:
16
- * Themes (aka collections of css files, templates etc.)
17
- * Enable page! parameter for the #MAKETITLE command for latex output
18
- * The #CAPTION command takes an optional argument "extended!" that
19
- will case the caption to be parsed with all defined particles.
20
- * allow=all -> run in "unsafe" mode
21
- * hackish support for xhtml11/mathml
22
- * particle-math: Support for ''$$formula$$'' for block formulas.
23
-
24
- New modules:
25
- * entities-decode.rb: support for &#NNN; entities.
26
- * entities-encode.rb: Encodes special characters as entities.
27
- * html-mathml.rb: Experimental support for mathml (requires the
28
- mathml package by KURODA Hiraku: http://mathml.rubyforge.org).
29
- * code-coderay.rb: Support for coderay http://coderay.rubychan.de
10
+ + Output to sweave (for preparation of R-based statistics reports via LaTeX)
11
+ + XHTML output: Support for SVG images
12
+ - CHANGE: Parentheses are now stripped from arguments
13
+ * FIX: Footnotes in abstracts, quotations etc.
14
+ * preliminary support for ruby 1.9.1 (still needs some work)
30
15
 
31
16
  For other changes please see the CHANGES.TXT.
32
17
 
@@ -1 +1 @@
1
- 0.8.4final-3109
1
+ 0.8.5final-3176
@@ -128,6 +128,8 @@
128
128
  ; hyperHeadingButton :: The text for hyperlinked headings (STRING;
129
129
  ; default: =>)
130
130
 
131
+ ; imgCmd :: The default command for ''#Img'' regions (STRING)
132
+
131
133
  ; imgSfx :: The default suffix for images (STRING, default: png)
132
134
 
133
135
  ; includeVars :: The variables to be used for #INC commands (HASH)
@@ -174,6 +176,8 @@
174
176
  ; For LaTeX output, this make ''deplate'' use proper commands. You
175
177
  ; can set this for single particles too. (STRING)
176
178
 
179
+ ; pdfCompressLevel :: Set ''\\pdfcompresslevel'' (DEFAULT: 9)
180
+
177
181
  ; pdfOutput :: Automatically set when using pdf output (the ''--pdf''
178
182
  ; command line switch) (BOOLEAN)
179
183
 
@@ -364,8 +368,9 @@
364
368
  ; typeareaDIV_, DIV_ (koma) :: Same as the above but the parameter is
365
369
  ; set as a document class option.
366
370
 
367
- ; floatHere :: If true, add a ''h'' flag to floats (BOOLEAN,
368
- ; default: false)
371
+ ; floatHere :: If true, add a ''h'' flag to floats. If H, use the
372
+ ; float package and add the ''H'' flag. (BOOLEAN or
373
+ ; STRING, default: false)
369
374
 
370
375
  ; linespread :: If set, define the ''linespread'' parameter (NUMBER)
371
376
 
@@ -378,6 +383,10 @@
378
383
  ; useBooktabs :: If true, use the booktabs package (BOOLEAN, default: false)
379
384
 
380
385
 
386
+ ; **** LaTeX
387
+ ; sweaveOpts :: Document sweave options (STRING)
388
+
389
+
381
390
  ; **** Docbook
382
391
  ; copyrightYear :: The year field in the copyright section (STRING)
383
392
 
@@ -488,6 +497,10 @@
488
497
  ; smileySfx :: The suffix for smiley image files (STRING, default: png)
489
498
 
490
499
 
500
+ ; **** s5 theme
501
+ ; s5theme :: The theme (default: "default)
502
+ ; s5footer :: Text to be displayed in the footer
503
+
491
504
  ; **** validate-html
492
505
  ; noCssValid :: If true, don't add a button for CSS validation
493
506
  ; (BOOLEAN, default: false)
File without changes
@@ -1,7 +1,8 @@
1
+ # encoding: ASCII
1
2
  # DefAbstract.rb
2
3
  # @Created: 18-M�r-2004.
3
- # @Last Change: 23-Okt-2005.
4
- # @Revision: 0.10
4
+ # @Last Change: 2009-02-02.
5
+ # @Revision: 0.12
5
6
  #
6
7
  # Description:
7
8
  # From: http://groups.google.at/groups?hl=de&lr=&ie=UTF-8&oe=UTF-8&newwindow=1&selm=20030821221909.53f3274a.rpav%40mephle.com&rnum=38
@@ -1,9 +1,10 @@
1
+ # encoding: ASCII
1
2
  # bib.rb
2
3
  # @Author: Thomas Link (micathom AT gmail com)
3
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
4
5
  # @Created: 11-Feb-2006.
5
- # @Last Change: 2007-07-01.
6
- # @Revision: 0.85
6
+ # @Last Change: 2009-02-02.
7
+ # @Revision: 0.89
7
8
  #
8
9
  # = Description
9
10
  # = Usage
@@ -1,10 +1,11 @@
1
+ # encoding: ISO-8859-1
1
2
  # builtin.rb
2
3
  # @Author: Thomas Link (micathom AT gmail com)
3
4
  # @Website: http://deplate.sf.net/
4
5
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
6
  # @Created: 05-Jun-2004.
6
- # @Last Change: 23-Okt-2005.
7
- # @Revision: 0.4
7
+ # @Last Change: 2008-12-04.
8
+ # @Revision: 0.5
8
9
  #
9
10
  # Description:
10
11
  # Dummy file
@@ -1,10 +1,11 @@
1
+ # encoding: ASCII
1
2
  # cache.rb
2
3
  # @Author: Thomas Link (micathom AT gmail com)
3
4
  # @Website: http://deplate.sf.net/
4
5
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
6
  # @Created: 21-Aug-2005.
6
- # @Last Change: 08-Apr-2006.
7
- # @Revision: 0.46
7
+ # @Last Change: 2009-02-02.
8
+ # @Revision: 0.48
8
9
 
9
10
  # = Description
10
11
  # This class provides a cache for dynamically generated classes.
@@ -1,19 +1,11 @@
1
+ # encoding: ASCII
1
2
  # commands.rb
2
3
  # @Author: Thomas Link (micathom AT gmail com)
3
4
  # @Website: http://deplate.sf.net/
4
5
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
6
  # @Created: 08-Mai-2004.
6
- # @Last Change: 2008-07-08.
7
- # @Revision: 0.1310
8
-
9
- # Description:
10
- #
11
- # Usage:
12
- #
13
- # TODO:
14
- #
15
- # CHANGES:
16
- #
7
+ # @Last Change: 2009-02-02.
8
+ # @Revision: 0.1315
17
9
 
18
10
  module Deplate::Names
19
11
  module_function
@@ -1,10 +1,11 @@
1
+ # encoding: ASCII
1
2
  # common.rb -- The base class for deplate building blocks
2
3
  # @Author: Thomas Link (micathom AT gmail com)
3
4
  # @Website: http://deplate.sf.net/
4
5
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
6
  # @Created: 02-Aug-2004.
6
- # @Last Change: 2007-12-27.
7
- # @Revision: 0.903
7
+ # @Last Change: 2009-02-02.
8
+ # @Revision: 0.912
8
9
  #
9
10
  # = Description:
10
11
  # Misc classes
@@ -134,6 +135,10 @@ module Deplate::CommonGround
134
135
  false
135
136
  end
136
137
 
138
+ def inlay?
139
+ args['inlay']
140
+ end
141
+
137
142
  def get_explicit_id(args=@args)
138
143
  args[:id] || args['id']
139
144
  end
@@ -0,0 +1,21 @@
1
+ # compat.rb
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
4
+ # @Created: 2009-01-22.
5
+ # @Last Change: 2009-01-22.
6
+ # @Revision: 0.0.4
7
+
8
+
9
+ module Deplate::Compat
10
+ module_function
11
+
12
+ def isRuby19
13
+ return RUBY_VERSION !~ /^1\.[6-8]/
14
+ end
15
+
16
+ end
17
+
18
+
19
+ # Local Variables:
20
+ # revisionRx: REVISION\s\+=\s\+\'
21
+ # End:
@@ -0,0 +1,24 @@
1
+ # parsedate.rb
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
4
+ # @Created: 2009-01-22.
5
+ # @Last Change: 2009-01-22.
6
+ # @Revision: 0.0.4
7
+
8
+ require 'deplate/compat'
9
+
10
+ if Deplate::Compat.isRuby19
11
+
12
+ require 'date'
13
+ class ParseDate
14
+ def parsedate(date, guess=false)
15
+ Date.parse(date, guess)
16
+ end
17
+ end
18
+
19
+ else
20
+
21
+ require 'parsedate'
22
+
23
+ end
24
+
@@ -1,11 +1,12 @@
1
+ # encoding: ASCII
1
2
  #!/usr/bin/env ruby
2
3
  # converter.rb
3
4
  # @Author: Thomas Link (micathom AT gmail com)
4
5
  # @Website: http://deplate.sf.net/
5
6
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
6
7
  # @Created: 14-Okt-2004.
7
- # @Last Change: 2007-09-01.
8
- # @Revision: 0.145
8
+ # @Last Change: 2009-02-02.
9
+ # @Revision: 0.147
9
10
  #
10
11
  # = Description
11
12
  # = Usage
@@ -1,15 +1,17 @@
1
+ # encoding: ASCII
1
2
  # core.rb -- Convert wiki-like plain text pseudo markup to something else
2
3
  # @Author: Thomas Link (micathom AT gmail com)
3
4
  # @Website: http://deplate.sf.net/
4
5
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
6
  # @Created: 24-Feb-2004.
6
- # @Last Change: 2008-07-20.
7
+ # @Last Change: 2009-02-08.
7
8
 
8
9
  require 'uri'
9
10
  require 'optparse'
10
11
  require 'ostruct'
11
12
  require 'rbconfig'
12
- require 'ftools'
13
+ # require 'ftools'
14
+ require 'fileutils'
13
15
  require 'forwardable'
14
16
  require 'pathname'
15
17
 
@@ -26,10 +28,10 @@ module Deplate; end
26
28
  class Deplate::Core
27
29
  extend Forwardable
28
30
 
29
- Version = '0.8.4'
31
+ Version = '0.8.5'
30
32
  # VersionSfx = 'a'
31
33
  VersionSfx = 'final'
32
- MicroRev = '3109'
34
+ MicroRev = '3176'
33
35
 
34
36
  if ENV['HOME']
35
37
  CfgDir = File.join(ENV['HOME'].gsub(/\\/, '/'), '.deplate')
@@ -75,6 +77,7 @@ MESSAGE
75
77
  # A hash of known css files and their ruby file names
76
78
  @@css = {}
77
79
  # A hash of known templates and their ruby file names
80
+
78
81
  @@templates = {}
79
82
  # A hash of known encodings and the corresponding module
80
83
  @@symbols = {}
@@ -576,7 +579,8 @@ MESSAGE
576
579
  require_module(options, m) if m
577
580
  end
578
581
 
579
- # require 'deplate/mod/en' unless @@messages_last
582
+ # require 'deplate/mod/en' if we haven't loaded any lang
583
+ # module yet.
580
584
  require_module(options, 'lang-en') unless @@messages_last
581
585
 
582
586
  # load general user config
@@ -680,86 +684,90 @@ MESSAGE
680
684
 
681
685
  def read_ini_file(options, inifile)
682
686
  if File.exist?(inifile)
683
- ini = File.open(inifile) {|io| io.read}
684
687
  mode = :normal
685
688
  acc = []
686
689
  endm = nil
687
690
  setter = nil
688
- for line in ini
689
- line.chomp!
690
- case mode
691
- when :normal
692
- if line =~ /^\s*[;#%*]/
693
- # comment
694
- next
695
- elsif line =~ /^(-\S+)(\s+(.*?)\s*)?$/
696
- options.ini_command_line_arguments << $1
697
- options.ini_command_line_arguments << $3 if $3
698
- elsif line =~ /^\s*allow\s+(.+?)\s*$/
699
- allow(options.allow, $1, Deplate::Source.new(inifile))
700
- elsif line =~ /^\s*mod\s+(\S+)/
701
- mod = $1
702
- if mod[0..0] == '-'
703
- options.modules.delete(mod[1..-1])
704
- else
705
- options.modules << $1
706
- end
707
- elsif line =~ /^\s*fmt\s+(\S+)/
708
- options.fmt = $1
709
- elsif line =~ /^\s*clip\s+([^\s=]+)\s*=\s*(.+)/
710
- options.clips[$1] = $2
711
- elsif line =~ /^\s*wiki ([A-Z]+)(\.\w+)?\s*=\s*(.+)/
712
- Deplate::InterWiki.add($1, $3, $2)
713
- elsif line =~ /^\s*wikichars\s*(\S+)\s*(\S+)/
714
- Deplate::HyperLink.setup($1, $2)
715
- elsif line =~ /^\s*app\s*([_\w]+)\s*=\s*(.+)/
716
- Deplate::External.def_app $1, $2
717
- elsif line =~ /^\s*(option\s+|:)([_\w]+)([!~]|\s*([?%])?=\s*(.+))/
718
- case $3
719
- when '!'
720
- val = true
721
- when '~'
722
- val = false
723
- else
724
- case $4
725
- when '?'
726
- case $5
727
- when 'true', 'yes', 'on'
728
- val = true
729
- when 'false', 'no', 'off'
730
- val = false
691
+ File.open(inifile) do |io|
692
+ until io.eof?
693
+ line = io.gets
694
+ line.chomp!
695
+ case mode
696
+ when :normal
697
+ if line =~ /^\s*[;#%*]/
698
+ # comment
699
+ next
700
+ elsif line =~ /^(-\S+)(\s+(.*?)\s*)?$/
701
+ options.ini_command_line_arguments << $1
702
+ options.ini_command_line_arguments << $3 if $3
703
+ elsif line =~ /^\s*allow\s+(.+?)\s*$/
704
+ allow(options.allow, $1, Deplate::Source.new(inifile))
705
+ elsif line =~ /^\s*mod\s+(\S+)/
706
+ mod = $1
707
+ if mod[0..0] == '-'
708
+ options.modules.delete(mod[1..-1])
709
+ else
710
+ options.modules << $1
711
+ end
712
+ elsif line =~ /^\s*fmt\s+(\S+)/
713
+ options.fmt = $1
714
+ elsif line =~ /^\s*clip\s+([^\s=]+)\s*=\s*(.+)/
715
+ options.clips[$1] = $2
716
+ elsif line =~ /^\s*wiki ([A-Z]+)(\.\w+)?\s*=\s*(.+)/
717
+ Deplate::InterWiki.add($1, $3, $2)
718
+ elsif line =~ /^\s*wikichars\s*(\S+)\s*(\S+)/
719
+ Deplate::HyperLink.setup($1, $2)
720
+ elsif line =~ /^\s*encoding\s+(.+)/
721
+ options.variables['encoding'] = $1
722
+ elsif line =~ /^\s*app\s*([_\w]+)\s*=\s*(.+)/
723
+ Deplate::External.def_app $1, $2
724
+ elsif line =~ /^\s*(option\s+|:)([_\w]+)([!~]|\s*([?%])?=\s*(.+))/
725
+ case $3
726
+ when '!'
727
+ val = true
728
+ when '~'
729
+ val = false
730
+ else
731
+ case $4
732
+ when '?'
733
+ case $5
734
+ when 'true', 'yes', 'on'
735
+ val = true
736
+ when 'false', 'no', 'off'
737
+ val = false
738
+ else
739
+ Deplate::Core.log(['Malformed configuration line', line], :error)
740
+ next
741
+ end
742
+ when '%'
743
+ val = $5.to_i
731
744
  else
732
- Deplate::Core.log(['Malformed configuration line', line], :error)
733
- next
745
+ val = $5
734
746
  end
735
- when '%'
736
- val = $5.to_i
737
- else
738
- val = $5
739
747
  end
740
- end
741
748
  options.send("#$2=", val)
742
- elsif line =~ /^\s*\$(\S+)\s*=\s*(.+)/
743
- ENV[$1] = $2
744
- elsif line =~ /^\s*(\S+)\s*=<<(.+)/
745
- mode = :multiline
746
- endm = $2
747
- setter = lambda {|val| canonic_args(options.variables, $1, val)}
748
- elsif line =~ /^\s*(\S+)\s*=\s*(.+)/
749
- canonic_args(options.variables, $1, $2)
750
- elsif !line.empty?
751
- Deplate::Core.log(['Malformed configuration line', line], :error)
752
- end
753
- when :multiline
754
- if line == endm
755
- setter.call(acc)
756
- acc = []
757
- mode = :normal
749
+ elsif line =~ /^\s*\$(\S+)\s*=\s*(.+)/
750
+ ENV[$1] = $2
751
+ elsif line =~ /^\s*(\S+)\s*=<<(.+)/
752
+ mode = :multiline
753
+ endm = $2
754
+ setter = lambda {|val| canonic_args(options.variables, $1, val)}
755
+ elsif line =~ /^\s*(\S+)\s*=\s*(.+)/
756
+ canonic_args(options.variables, $1, $2)
757
+ elsif !line.empty?
758
+ Deplate::Core.log(['Malformed configuration line', line], :error)
759
+ end
760
+ when :multiline
761
+ if line == endm
762
+ setter.call(acc)
763
+ acc = []
764
+ mode = :normal
765
+ else
766
+ acc << line
767
+ end
758
768
  else
759
- acc << line
769
+ raise "Invalid mode"
760
770
  end
761
- else
762
- raise "Invalid mode"
763
771
  end
764
772
  end
765
773
  end
@@ -864,6 +872,7 @@ MESSAGE
864
872
  options = inherit || OpenStruct.new
865
873
  options.ini_command_line_arguments ||= []
866
874
  options.modules ||= []
875
+ options.headings ||= []
867
876
  options.resources ||= []
868
877
  options.prelude ||= []
869
878
  options.clean ||= true
@@ -1040,6 +1049,8 @@ MESSAGE
1040
1049
  type = :string
1041
1050
  if val =~ /^"(.*?)"$/
1042
1051
  val = val[1..-2]
1052
+ elsif val =~ /^\((.*?)\)$/
1053
+ val = val[1..-2]
1043
1054
  else
1044
1055
  # val.scan(/\\\\|\s/).each do |s|
1045
1056
  # if s =~ /\s/
@@ -1056,7 +1067,12 @@ MESSAGE
1056
1067
  end
1057
1068
  case type
1058
1069
  when :bool
1059
- hash["no#{key[0..0].upcase}#{key[1..-1]}"] = !val
1070
+ if key =~ /^\$[^\[]+\[/
1071
+ nokey = key.sub(/\[./) {|t| "[no#{t[1..1].upcase}"}
1072
+ hash[nokey] = !val
1073
+ else
1074
+ hash["no#{key[0..0].upcase}#{key[1..-1]}"] = !val
1075
+ end
1060
1076
  end
1061
1077
  hash[key] = val
1062
1078
  hash
@@ -1163,9 +1179,13 @@ MESSAGE
1163
1179
 
1164
1180
  # Return the canonic file name for +name+. +maj+ and +min+
1165
1181
  # correspond to section numbers.
1166
- def canonic_file_name(name, sfx, maj=nil, min=nil, dir=nil)
1182
+ def canonic_file_name(name, sfx, args={})
1183
+ maj = args[:maj]
1184
+ min = args[:min]
1185
+ dir = args[:dir]
1186
+ raw = args[:raw]
1167
1187
  name = File.basename(name, '.*')
1168
- name = clean_name(name)
1188
+ name = clean_filename(name) unless raw
1169
1189
  if !name or (maj and maj != 0)
1170
1190
  canonic_numbered_file_name(name, sfx, maj, min, dir)
1171
1191
  elsif min and min != 0
@@ -1177,20 +1197,26 @@ MESSAGE
1177
1197
  end
1178
1198
  end
1179
1199
 
1200
+ def clean_filename(text, args={})
1201
+ args[:replacement] ||= '='
1202
+ return clean_name(text, args)
1203
+ end
1204
+
1180
1205
  # Return an encoded name
1181
1206
  def clean_name(text, args={})
1182
1207
  if text
1183
- chars = args[:chars] || '[:cntrl:].+*:"?<>|&\\\/'
1208
+ chars = args[:chars] || '[:cntrl:].+*:"?<>|&\\\/%'
1184
1209
  chars += replacement = args[:replacement] || '_'
1185
1210
  if (extrachars = args[:extra])
1186
1211
  chars += extrachars
1187
1212
  end
1188
- text.gsub(/[#{chars}]/) do |text|
1213
+ text = text.gsub(/[#{chars}]/) do |text|
1189
1214
  case text
1190
1215
  when replacement
1191
1216
  replacement * 2
1192
1217
  else
1193
- replacement + "%02X" % text[0]
1218
+ # replacement + "%02X" % text[0]
1219
+ replacement + text.unpack('H2')[0].upcase
1194
1220
  end
1195
1221
  end
1196
1222
  end
@@ -1252,17 +1278,17 @@ MESSAGE
1252
1278
  # options:: A OpenStruct as returned by Deplate::Core.deplate_options
1253
1279
  # maj:: The major section/page number
1254
1280
  # maj:: The minor section/page number
1255
- def get_out_fullname(fname, suffix, options, *args)
1256
- # File.join(options.dir, get_out_name(fname, suffix, options, *args))
1257
- file_join(options.dir, get_out_name(fname, suffix, options, *args))
1281
+ def get_out_fullname(fname, suffix, options, args={})
1282
+ # File.join(options.dir, get_out_name(fname, suffix, options, args))
1283
+ file_join(options.dir, get_out_name(fname, suffix, options, args))
1258
1284
  end
1259
1285
 
1260
- def get_out_name(fname, suffix, options, maj=nil, min=nil)
1286
+ def get_out_name(fname, suffix, options, args={})
1261
1287
  path = []
1262
1288
  path << get_out_name_dir(fname, options)
1263
1289
  if suffix
1264
1290
  fn = File.basename(fname, '.*')
1265
- path << canonic_file_name(fn, suffix, maj, min)
1291
+ path << canonic_file_name(fn, suffix, args)
1266
1292
  else
1267
1293
  path << fname
1268
1294
  end
@@ -1905,14 +1931,20 @@ MESSAGE
1905
1931
  else
1906
1932
  msg_class = lang
1907
1933
  end
1908
- if msg_class
1909
- @options.messages = msg_class.new(self)
1910
- @@message_object ||= @options.messages
1911
- elsif is_allowed?('l') and require_module("lang-#{lang}")
1912
- set_lang(lang)
1913
- else
1914
- log(["Bad language definition", lang, "(#{@@messages.keys.join(', ')})"],
1915
- :error)
1934
+ begin
1935
+ if msg_class
1936
+ @options.messages = msg_class.new(self)
1937
+ @@message_object ||= @options.messages
1938
+ elsif is_allowed?('l') and require_module("lang-#{lang}")
1939
+ set_lang(lang)
1940
+ else
1941
+ log(["Bad language definition", lang, "(#{@@messages.keys.join(', ')})"],
1942
+ :error)
1943
+ end
1944
+ rescue LoadError => e
1945
+ log(["Unknown language", lang, "(#{@@messages.keys.join(', ')})",
1946
+ 'Please consider contributing a message catalog for your language'],
1947
+ :error)
1916
1948
  end
1917
1949
  end
1918
1950
 
@@ -2038,7 +2070,7 @@ MESSAGE
2038
2070
  else
2039
2071
  prefix = @variables['prefixID']
2040
2072
  if prefix.nil?
2041
- prefix = Deplate::Core.clean_name(File.basename(@dest, '.*'))
2073
+ prefix = Deplate::Core.clean_filename(File.basename(@dest, '.*'))
2042
2074
  end
2043
2075
  fn = [prefix]
2044
2076
  fn << ["_#{type}_#{idx}"]
@@ -2296,13 +2328,13 @@ MESSAGE
2296
2328
  unless text or !@options.multi_file_output
2297
2329
  afn = @variables['autoFileNames']
2298
2330
  if afn
2299
- fname = Deplate::Core.clean_name(heading.get_text)[0..20]
2331
+ fname = Deplate::Core.clean_filename(heading.get_text)[0..20]
2300
2332
  c = auto_numbered(fname)
2301
2333
  if c
2302
- fname = Deplate::Core.canonic_file_name(fname, sfx, c, 0)
2334
+ fname = Deplate::Core.canonic_file_name(fname, sfx, :maj => c, :min => 0, :raw => true)
2303
2335
  auto_numbered(fname, :inc => 1)
2304
2336
  else
2305
- fname = Deplate::Core.canonic_file_name(fname, sfx)
2337
+ fname = Deplate::Core.canonic_file_name(fname, sfx, :raw => true)
2306
2338
  auto_numbered(fname, :set => 0)
2307
2339
  end
2308
2340
  else
@@ -2328,7 +2360,7 @@ MESSAGE
2328
2360
  else
2329
2361
  auto_numbered(fname, :set => 1)
2330
2362
  end
2331
- fname = Deplate::Core.canonic_file_name(fname, sfx, fmaj, 0)
2363
+ fname = Deplate::Core.canonic_file_name(fname, sfx, :maj => fmaj, :min => 0, :raw => true)
2332
2364
  end
2333
2365
  end
2334
2366
  end
@@ -2787,7 +2819,7 @@ MESSAGE
2787
2819
  end
2788
2820
  if ok
2789
2821
  ensure_dir_exists(dir)
2790
- File.copy(from, to)
2822
+ FileUtils.cp_r(from, to)
2791
2823
  log(['Copy file', from, to])
2792
2824
  end
2793
2825
  end
@@ -3036,8 +3068,8 @@ MESSAGE
3036
3068
  end
3037
3069
 
3038
3070
  # Parse +text+ and return a formatted string.
3039
- def parse_and_format(container, text, alt=true, excluded=nil)
3040
- t = parse(container, text, alt, :excluded => excluded)
3071
+ def parse_and_format(container, text, alt=true, args={})
3072
+ t = parse(container, text, alt, args)
3041
3073
  return format_particles(t)
3042
3074
  end
3043
3075
 
@@ -3046,7 +3078,7 @@ MESSAGE
3046
3078
  Deplate::HyperLink::Simple,
3047
3079
  Deplate::HyperLink::Extended,
3048
3080
  ]
3049
- return parse_and_format(container, text, alt, excluded)
3081
+ return parse_and_format(container, text, alt, :excluded => excluded)
3050
3082
  end
3051
3083
 
3052
3084
  # Evaluate block (args: heading, caption) with each heading.