deplate 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/AUTHORS.TXT +2 -1
  2. data/CHANGES.TXT +56 -211
  3. data/NEWS.TXT +15 -38
  4. data/VERSION.TXT +1 -1
  5. data/bin/deplate +0 -0
  6. data/bin/deplate.bat +0 -0
  7. data/etc/deplate.ini +11 -0
  8. data/lib/deplate/commands.rb +8 -3
  9. data/lib/deplate/common.rb +2 -2
  10. data/lib/deplate/core.rb +157 -45
  11. data/lib/deplate/css/article.css +19 -3
  12. data/lib/deplate/css/doc.css +770 -0
  13. data/lib/deplate/elements.rb +7 -7
  14. data/lib/deplate/ents/general-latin1.entities +100 -0
  15. data/lib/deplate/ents/general-utf-8.entities +252 -0
  16. data/lib/deplate/external.rb +3 -2
  17. data/lib/deplate/fmt/html.rb +12 -10
  18. data/lib/deplate/fmt/latex.rb +25 -14
  19. data/lib/deplate/fmt/plain.rb +4 -5
  20. data/lib/deplate/fmt/xhtml11m.rb +25 -0
  21. data/lib/deplate/formatter.rb +106 -32
  22. data/lib/deplate/input.rb +8 -7
  23. data/lib/deplate/lib/Makefile.config +11 -1
  24. data/lib/deplate/locale/de.latin1 +9 -0
  25. data/lib/deplate/macros.rb +23 -18
  26. data/lib/deplate/mod/code-coderay.rb +45 -0
  27. data/lib/deplate/mod/code-gvim.rb +3 -2
  28. data/lib/deplate/mod/code-gvim71.rb +3 -6
  29. data/lib/deplate/mod/code-highlight.rb +3 -2
  30. data/lib/deplate/mod/entities-decode.rb +72 -0
  31. data/lib/deplate/mod/entities-encode.rb +50 -0
  32. data/lib/deplate/mod/guesslanguage.rb +3 -3
  33. data/lib/deplate/mod/html-jsmath.rb +5 -5
  34. data/lib/deplate/mod/html-mathml.rb +40 -0
  35. data/lib/deplate/mod/latex-styles.rb +21 -11
  36. data/lib/deplate/mod/makefile.rb +21 -11
  37. data/lib/deplate/mod/markup-1.rb +3 -3
  38. data/lib/deplate/mod/particle-math.rb +15 -6
  39. data/lib/deplate/particles.rb +2 -2
  40. data/lib/deplate/regions.rb +50 -15
  41. data/lib/deplate/template.rb +7 -2
  42. data/lib/deplate/themes/presentation.html/css/highstep.css +29 -0
  43. data/lib/deplate/themes/presentation.html/css/presentation.css +206 -0
  44. data/lib/deplate/themes/presentation.html/css/website.css +281 -0
  45. data/lib/deplate/themes/presentation.html/prelude.txt +19 -0
  46. data/lib/deplate/themes/presentation.html/resources/spacer.png +0 -0
  47. data/lib/deplate/themes/presentation.html/templates/presentation.html +26 -0
  48. data/lib/deplate/themes/presentation.html/theme.ini +20 -0
  49. data/man/man1/deplate.1 +147 -73
  50. metadata +67 -40
  51. data/bin/deplate.exy +0 -192
@@ -11,7 +11,7 @@ Contributors:
11
11
  [[http://odur.let.rug.nl/~kleiweg/postscript/#conversion]]).
12
12
  Fritz Heinrichmeyer :: html-website.rb formatter,
13
13
  htmlslides-navbar-fh module.
14
- Frederik Eaton :: Suggestions concering inline latex support.
14
+ Frederik Eaton :: Suggestions concerning inline latex support.
15
15
  Csaba Henk :: Nested elements in lists (patch).
16
16
  Andrea Rota :: blosxom plugin, generic textpipe perl module.
17
17
  Chen Shuo :: Posted some modifications on
@@ -19,6 +19,7 @@ Contributors:
19
19
  were the basis for several improvements.
20
20
  Lucas Wilcox :: ''dvipng'' support for rendering LaTeX snippets.
21
21
  Jeff Barczewski :: ''linkmap'' module.
22
+ Kelly Hunter :: Patches for the latex formatter.
22
23
 
23
24
  Credits:
24
25
  - The manual-directory contains ASCIIMathML.js by
@@ -1,216 +1,61 @@
1
- This version contains an incompatible change (with respect to 0.8)
2
- concerning the use of arg/ARG and xarg/XARG macros/commands.
3
-
4
1
  Current issues are listed in TODO.TXT.
5
2
 
6
- deplate 0.8.1
7
- * commands.rb: The INCLUDE command takes skip, tail, and head
8
- arguments.
9
- * define.rb: INCOMPATIBLE CHANGE: DefRegion and DefCommand type of
10
- regions are now passed through the template filter by default (as
11
- are other Def* regions); in order to get the old behaviour, set
12
- ''legacyDefine1'' or pass a ''noTemplate'' argument to the region.
13
- * regions.rb: The #Native region now takes a template! argument that
14
- makes it handle the body as a template.
15
- * html.rb: Allow named keys for nextKey variable.
16
- * commands.rb: XARG isn't volatile anymore. (This is due to a
17
- problem with using XARG within ''DefRegion'' that may cause a
18
- previous paragraph never to be closed/finished).
19
- * latex.rb: The priority in task lists wasn't formatted as plain
20
- text.
21
- * bib.rb: sep (separator from text) & mode argument (np) for the
22
- cite macro.
23
- * macros.rb: The list macro inserted 'empty' in the output.
24
- * latex.rb: Don't search for deplate.sty in the current directory if
25
- its the output directory. Display an error message if deplate.sty
26
- wasn't found.
27
- * action_view/helpers/deplate.rb: Bug fix (thanks to skaar)
28
- * commands.rb: #ARG & #XARG didn't handle array variables properly
29
- * template.rb: :master wasn't propagated (did this break
30
- xmlrpc-reuse?)
31
- * guesslanguage.rb: New module: guess a document's language & load
32
- the appropriate module.
33
- * lang-*.rb: Renamed modules de, en, fr, ru*, zh* to lang-*. Also
34
- renamed *zh-cn* to *zh_CN* and *ru_koi* to *ru-koi*.
35
- * de/en/ru*_data: Added GPL translations (de, en, ru) as language
36
- samples for the guesslanguage module.
37
- * core.rb: Fixed problem with clips set in deplate.ini which were
38
- processed twice (thanks to Fran�ois Lagarde).
39
- * core.rb: Display an error for unrecognized lines in deplate.ini.
40
- * bib.rb: cite takes an ip! argument which create citations like
41
- ''NAME \(YEAR)'' -- this option automatically sets np!. If np! is
42
- set, the separator is set to ''.
43
- * html-highstep.rb: New module, define a ''{step}'' macro for
44
- guiding people through a presentation etc. -- it doesn't work
45
- exaclty like this Powerpoint thing but I prefer it this way. PPT
46
- behaviour was already partly emulated before.
47
- * core.rb, formatter.rb: formatter-dependent options are set in
48
- Formatter.set_options_for_file.
49
- * core.rb: Make sure #with_formatter also sets formatter-dependent
50
- options like the suffix etc. to prevent major troubles with
51
- Deplate::Converter#convert_file. (Thanks to CH Swaroop for reporting
52
- this problem.)
53
- * mark-external-url.rb: If markerInFrontOfURL is set, the image is
54
- placed in front of the hyperlink.
55
- * code-highlight.rb: Enable for htmlsite, php*, *-snippet output.
56
- Hopefully, fixed "DBG e should be an Array. Please report." Modified
57
- command line options for highlight > 2.2.9. If the language is
58
- German, add -r to the command line arguments.
59
- * code-gvim.rb: Enable for php*, html-snippet, xhtml output.
60
- * core.rb, formatter.rb: formatter_family_members moved to
61
- Deplate::Formatter.
62
- * core.rb, commands.rb: Abbreviations are now formatter-sensible and
63
- resetted like normal options.
64
- * elements.rb: A whitespace line is a valid region delimiter.
65
- * regions.rb, elements.rb, define.rb: Deprecated the use of @regNote
66
- in regions (use qualified arguments instead). This way we should
67
- sooner or later be able to smoothly unify regions and commands.
68
- Adequately named arguments will be added later on. For the moment,
69
- stick to the old (now deprecated) syntax.
70
- * commands.rb: The #INCLUDE command can now set any variable for the
71
- included document.
72
- * core.rb: The environment variables are accessible from within a
73
- deplate document through the env[] variable (a hash).
74
- * elements.rb: Enabled the use of hashes & arrays in conditional
75
- statements. If '':'' is allowed, options now now take precedence
76
- over variables.
77
- * html.rb: Support for news feed integration via the ''newsFeed''
78
- variable.
79
- * particles.rb: If ''useParentSuffix'' is set, use the source files
80
- extension when expanding wiki references as fallback strategy.
81
- * formatter.rb, external.rb: Applied a patch by Lucas Wilcox for
82
- support of dvipng to render inline LaTeX snippets. (Set ''ltxSfx''
83
- to png to make this the default.)
84
- * screenplay.rb, screenplay.css: Preliminary support for writing
85
- screenplays.
86
- * core.rb, input.rb: Fixed problem with using many input formats
87
- within one document. (Some input classes probably still need some
88
- plumbing.)
89
- * input.rb: Catch malformed arguments (containing ! or =) that could
90
- cause the "parser" to hang.
91
- * regions.rb: The #For region is by default passed through the
92
- template filter too.
93
- * commands.rb: Fixed problem when temporarily setting variables with
94
- #INC.
95
- * elements.rb, input.rb: If commentsShow is set, display comments in
96
- the output.
97
- * elements.rb, particles.rb: Commands, regions, and macros now use
98
- arguments defined globally in the variable args@NAME[] (a hash).
99
- * variables.rb: Variables with upper-case letter names cannot be set
100
- by the user.
101
- * commands.rb: The #INCLUDE command sets the variable INCLUDED to
102
- the command's source file name.
103
- * macros.rb: ''{nop}'' macro (a placeholder).
104
- * elements.rb: FIX: exception when adding a caption with the #OPT
105
- command etc.
106
- * particles.rb: FIX: Error for wiki links referring to an interwiki
107
- per se.
108
- * elements.rb: Accept task lists of the form ''#A'' or ''#3'' for
109
- compatibility with vim's viki plugin.
110
- * screenplay.rb: Set screenplayStyle for different section styles;
111
- currently 2 styles are known, tentatively named: hollywood (which
112
- can be used to get output similar to screenplay.tex), austria (which
113
- formats section headings like "LOCATION AUSSEN/TAG").
114
- * formatter.rb: Improved simple_bibtex_parser().
115
- * macros.rb: New ''~''/''mark1st'' macros: mark a text's first
116
- occurrence, i.e. put the text in upper case letters.
117
- * macros.rb: New macros: downcase, upcase, capitalize
118
- * commands.rb: FIX: Problem with word abbreviations that were
119
- followed by international word characters (eg umlauts).
120
- * input.rb: EXPERIMENTAL: Elements may now have a ''tag''
121
- attribute/option (a comma-separated list). You can thus filter
122
- elements that should be included in the output by setting the
123
- ''efilter'' variable (a comma-separated list). ''any'' matches any
124
- untagged element. If the variable ''styledTags'' is set, tags will
125
- automatically add style attributes (style=''TAG#{tagname}'') too.
126
- * commands.rb: In order to further inconsistent naming conventions,
127
- #PROP, and #PP are now synonyms for #OPT.
128
- * core.rb: Changed the way some string variables are split into a
129
- list. As a general rule, most lists now are comma-separated lists.
130
- One exception is ''KEYWORDS'', which is separated by semi-colons as
131
- many journals follow a ''major, minor'' scheme for keywords.
132
- Separators in list elements can be escaped by backslashes. For the
133
- moment, deplate tries to be smart and detect old-style separators.
134
- * commands.rb: New ''#PUSH'' command, which is basically the same as
135
- ''#VAR add=,: ...''.
136
- * html.rb: INCOMPATIBLE CHANGE: The ''css'' variable now has to be
137
- separated by commas.
138
- * input.rb: Respect tags defined in the global variable ''tag'' --
139
- which, e.g., can be defined as argument to the ''#INCLUDE'' command
140
- what would the tag all elements included with this command with the
141
- specified tag(s).
142
- * common.rb: Arguments for specific types of elements can be stored
143
- in a global hash variable.
144
- E.g. ''#VAR: $ElementHeading[tag]=heading'' will tag all headings as
145
- "heading". The variable name is ''classname.split(/::/)[-2..-1].join''.
146
- * macros.rb: New eprop macro. Set container element properties.
147
- * input.rb: EXPERIMENTAL: The variable ''pfilter'' can be used to
148
- filter particles.
149
- * core.rb: #clean_file_name (renamed to #clean_name) now returns a
150
- properly encoded filename.
151
- * html.rb: FIX: Make sure the labels used in the index are properly
152
- encoded.
153
- * elements.rb: The text of TODO notes (''+++'') is printed out
154
- during conversion.
155
- * core.rb: "mod -MODULE" in a deplate.ini file will remove MODULE
156
- from the list of (previously) required modules.
157
- * regions.rb: ''#Write file=-'' will write/print to STDOUT.
158
- * messages.rb: Don't reset document encoding defined as variable.
159
- * latex.rb: Define 'book', 'memoir', 'scrbook', 'report', 'scrreprt'
160
- as book classes (that use a ''\\chapter{}'' command). Users can use
161
- the bookClass variable to define additional book classes or set the
162
- variable to true.
163
- * screenplay.rb: Dialog lines are automatically tagged with
164
- Name_speaks and can be filtered using the efilter variable.
165
- * formatter.rb: When wrapping text, a space is added to lines that
166
- will be continued on the next line (for compatibility with vim's
167
- :set fo+=w).
168
- * code-gvim71.rb: Modified version of the code-gvim module that
169
- works with newer versions of vim's 2html. (This requires hpricot to
170
- be installed.)
171
- * play.rb, play.css: Renamed ''screenplay.*'' to ''play.*''.
172
- * All files: Changed contact e-mail address.
173
- * rdoc.rb, input.rb, template.rb: Unset input-related options in
174
- template inherited from the master object in order to make sure the
175
- input filter is template.
176
- * rdoc.rb: Fixed description class.
177
- * latex.rb: Clean style names.
178
- * formatter.rb: Load after files for related formatters, too.
179
- * messages.rb: Load messages for related formatters, too.
180
- * latex-dramatist.rb: Output for the dramatist latex package (should
181
- be used with the play input filter).
182
- * regions.rb: Run R with ''q(runLast=FALSE)''.
183
- * latex.rb: Made typeareaDIV a synonym for DIV (because upper-case
184
- variables are considered as constants).
185
- * latex.rb: typeareaDIV_, DIV_ set the DIV parameter as document
186
- class option; typeareaDIV and DIV as package option
187
- * core.rb: Delete excluded elements (via efilter) from listings.
188
- They are unprocessed when formatted. (This still doesn't work yet
189
- with lists though as lists are still excluded when the last item
190
- doesn't match.)
191
- * linkmap.rb: New module contributed by Jeff Barczewski.
192
- * particles.rb: A $ in extended wiki names sets rel=nofollow
193
- \(proposed by by Jeff Barczewski).
194
- * plain.rb: List URLs only once; reuse the index if necessary.
195
- * core.rb: Use level of a container's top heading not of the
196
- container itself. (In some situations, the top heading currently
197
- gets lost, though. As a result, some auto-generated index entries
198
- may get lost.)
199
- * regions.txt: Renamed Deplate::Regions::Doc to
200
- Deplate::Regions::Var.
201
- * regions.txt: Generic regions.
202
- * core.rb, counters.rb, common.rb: When increasing a counter, save a
203
- reference to the current element.
204
- * html.rb: In the index, always use the headings level.
205
- * guesslanguage.rb: Guess only once.
206
- * elements.rb, input.rb: When unifying elements, join tag lists.
207
- Apply efilter before unification, this solved the problem with lists
208
- that were filtered entirely when the last item didn't match.
209
- * latex.rb: Escape & in hrefs.
210
- * linkmap.rb: Format name as plain text; don't patch classes but
211
- replace their entries in the input filter with subclasses.
212
- * html.rb: cssInclude option: The contents of the CSS file will be
213
- included in the output.
3
+ deplate 0.8.2
4
+ * entities-decode.rb: New module that defines &#NNN; entities.
5
+ * entities-encode.rb: New experimental module that encodes special
6
+ characters as entities.
7
+ * latex.rb, core.rb: Enable page! parameter for the #MAKETITLE
8
+ command for latex output (thanks Hunter Kelly)
9
+ * html.rb: Fixed inconsistent handling of the css option (sometimes
10
+ a css suffix was required, sometimes not)
11
+ * latex.rb: Add unicode option to hyperref's package options if
12
+ encoding is utf8 (K Hunter)
13
+ * core.rb (#in_working_dir): If cwd is false, don't change the
14
+ directory.
15
+ * input.rb: The arguments of #parse() have slightly changed.
16
+ * commands.rb: The #CAPTION command takes an optional argument
17
+ "extended!" that will case the caption to be parsed with all defined
18
+ particles. Be aware though that autogenerated index markers and the
19
+ like could break output. Certain other particles don't work either
20
+ which is why this is disabled by default.
21
+ * elements.rb: #set_caption takes an extra argument to define
22
+ whether the text should be parsed with the full set of rules.
23
+ * html.rb, format_table(): table_args() isn't call via
24
+ format_particle().
25
+ * latex-styles.rb: The font size is set inside of the table
26
+ environment (as proposed by retnuh).
27
+ * makefile.rb: Additional OFLAGS option (other flags).
28
+ * formatter.rb: @format_advice_blacklist: Disable advices for
29
+ certain agents/methods.
30
+ * latex-styles.rb: Disable standard-processing of the style property
31
+ for tables.
32
+ * core.rb: ''allow=all'' pseudo state, run in "unsafe" mode and
33
+ allow everything.
34
+ * html-mathml.rb: Experimental support for mathml (requires to use
35
+ xhtml11m output format; you'll have to install the mathml package by
36
+ KURODA Hiraku: http://mathml.rubyforge.org).
37
+ * makefile: Made xhtml a "first-class" :) goal.
38
+ * macros.rb: The math macro takes a block! argument that makes it
39
+ wrap the text in ''\\[latex\\]''.
40
+ * particle-math.rb: Support for ''$$formula$$'' for block formulas.
41
+ * xhtml11m.rb: An uninformed hack on top of xhtml10t to support
42
+ mathml.
43
+ * makefile: xhtml now defaults to xhtml11m.
44
+ * code-coderay.rb: Support for the ruby syntax markup library
45
+ coderay http://coderay.rubychan.de
46
+ * latex.rb: format_quote(): Body gets wrapped twice.
47
+ TBD: Check if this is a more subtle problem. See
48
+ https://sourceforge.net/forum/message.php?msg_id=5041702
49
+ * formatter.rb: New variables ''wrapMargin'' and
50
+ ''wrapMarginInner''.
51
+ * core.rb: Some support for themes (aka collections of an ini file,
52
+ css files, templates, a library, and a prelude)
53
+ * regions.rb: Fixed problem with R & newer version of xtable.
54
+ * core.rb: The rule for creating "clean" file names has slightly
55
+ changed again (_ becomes __ and not _5F)
56
+ * elements.rb: register_heading(): use @id instead of id in order to
57
+ prevent double cleansing.
58
+ * core.rb: Resource files for themes.
214
59
 
215
60
 
216
61
  # vim: ft=changelog:tw=72
data/NEWS.TXT CHANGED
@@ -1,48 +1,25 @@
1
- * deplate 0.8.1
1
+ * deplate 0.8.2
2
2
 
3
- This release incorporates the usual set of bugfixes, some general improvements, and support for dvipng. The way how ARG/XARG commands/macros work has changed.
3
+ This release incorporates the usual set of bugfixes and general improvements.
4
4
 
5
5
  Incompatible changes:
6
- - deplate currently is slightly instable. This is related to a change of how ARG and XARG type of commands/macros work within #Def... regions, which are now passed through the template filter. In order to retain the old behaviour, set the legacyDefine1 variable.
7
- - the locale-related modules were renamed to lang-* (in some cases underscores and dashes were transposed)
8
- - most lists (e.g. css variable) are now comma-separated lists
9
- - many regions (e.g. #For, #Def*) are first processed by the template filter before being actually expanded
10
- - The use of @regNote (the part after the colon) will be deprecated in some future version; deplate currently displays a warning message that isn't always useful/correct and should currently be ignored in certain cases
6
+ * Fixed inconsistent handling of the css option with regard to the suffix
11
7
 
12
8
  Improvements:
13
- - dvipng support (by Lucas Wilcox)
14
- - Preliminary support for writing plays (stage, screen).
15
- - A whitespace line is a valid region delimiter.
16
- - The {step} macro allows to stepwise highlight text on a HTML page, which could be useful for doing HTML-based presentations.
17
- - #INCLUDE is much more versatile now.
18
- - #Native now takes an optional template! argument so that the body gets processed by the template filter.
19
- - The {cite} now knows a few extra arguments.
20
- - The environment variables are accessible from within a deplate document through the env[] variable (a hash).
21
- - ''$ClassName[property]'' variable to set properties for all elements of a certain class.
22
- - Can filter elements or particles according to the ''tag'' property by setting the efilter and/or pfilter variables.
23
- - The #INCLUDE command can set variables for the included document.
24
- - A whitespace line can be a valid region delimiter
25
-
26
- New input format:
27
- - play
28
-
29
- New output format:
30
- - latex-dramatist
31
-
32
- New commands:
33
- - #PUSH
34
- - #PP, #PROP (synonyms for #OPT)
35
-
36
- New macros:
37
- - mark1st, ~
38
- - downcase, upcase, capitalize
39
- - eprop
9
+ * Themes (aka collections of css files, templates etc.)
10
+ * Enable page! parameter for the #MAKETITLE command for latex output
11
+ * The #CAPTION command takes an optional argument "extended!" that
12
+ will case the caption to be parsed with all defined particles.
13
+ * allow=all -> run in "unsafe" mode
14
+ * hackish support for xhtml11/mathml
15
+ * particle-math: Support for ''$$formula$$'' for block formulas.
40
16
 
41
17
  New modules:
42
- - code-gvim71
43
- - guesslanguage (guess the input document's language)
44
- - html-highstep (''step'' macro)
45
- - linkmap (Jeff Barczewski): markdown-like hyperlinks
18
+ * entities-decode.rb: support for &#NNN; entities.
19
+ * entities-encode.rb: Encodes special characters as entities.
20
+ * html-mathml.rb: Experimental support for mathml (requires the
21
+ mathml package by KURODA Hiraku: http://mathml.rubyforge.org).
22
+ * code-coderay.rb: Support for coderay http://coderay.rubychan.de
46
23
 
47
24
  For other changes please see the CHANGES.TXT.
48
25
 
@@ -1 +1 @@
1
- 0.8.1final-2965
1
+ 0.8.2final-3103
File without changes
File without changes
@@ -68,6 +68,8 @@
68
68
  ; class :: The document class; used in LaTeX (= document class) or
69
69
  ; HTML output (= CSS) (STRING)
70
70
 
71
+ ; codeLineNumbers :: Display line numbers (BOOLEAN, default: false)
72
+
71
73
  ; codeStyle :: The default style used for formatting code regions;
72
74
  ; depends on the backend (STRING)
73
75
 
@@ -227,6 +229,11 @@
227
229
 
228
230
  ; verbatimMargin :: Wrap verbatim regions at this width (NUMBER)
229
231
 
232
+ ; wrapMargin :: Outer wrap margin; set to 0 to prevent text wrap
233
+ ; (NUMBER, default: 72)
234
+
235
+ ; wrapMarginInner :: Inner wrap margin (NUMBER, default: 66)
236
+
230
237
 
231
238
  ; *** Output Format
232
239
  ; **** HTML
@@ -425,6 +432,10 @@
425
432
  ; the output (BOOLEAN, default: false)
426
433
 
427
434
 
435
+ ; **** entities
436
+ ; entities :: List of entities names (COMMA-SEPARATED LIST, default:
437
+ ; general)
438
+
428
439
  ; **** html-headings-navbar
429
440
  ; headingsNavbarMaxLevel :: Add heading up to this level to the
430
441
  ; navigation bar (NUMBER)
@@ -3,8 +3,8 @@
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 08-Mai-2004.
6
- # @Last Change: 2007-09-30.
7
- # @Revision: 0.1298
6
+ # @Last Change: 2008-07-06.
7
+ # @Revision: 0.1309
8
8
 
9
9
  # Description:
10
10
  #
@@ -114,7 +114,7 @@ class Deplate::Command::CAP < Deplate::Command
114
114
  Deplate::Core.log("%s: %s" % [cmd, text], :debug, src)
115
115
  last = array.last
116
116
  if last
117
- last.set_caption(Deplate::CaptionDef.new(text, args, src))
117
+ last.set_caption(Deplate::CaptionDef.new(text, args, src), false, args['extended'])
118
118
  else
119
119
  Deplate::Core.log(["Cannot attach caption to", nil], :error, src)
120
120
  end
@@ -529,6 +529,11 @@ end
529
529
  class Deplate::Command::MAKETITLE < Deplate::Command
530
530
  register_as 'MAKETITLE'
531
531
  set_formatter :format_title
532
+ def setup_command
533
+ if @args['page']
534
+ @deplate.variables['classOptions'] = Deplate::Core.push_value(@deplate.variables['classOptions'], 'titlepage')
535
+ end
536
+ end
532
537
  end
533
538
 
534
539
 
@@ -3,8 +3,8 @@
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 02-Aug-2004.
6
- # @Last Change: 2007-09-30.
7
- # @Revision: 0.896
6
+ # @Last Change: 2007-12-27.
7
+ # @Revision: 0.903
8
8
  #
9
9
  # = Description:
10
10
  # Misc classes
@@ -3,7 +3,7 @@
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 24-Feb-2004.
6
- # @Last Change: 2007-10-21.
6
+ # @Last Change: 2008-07-06.
7
7
 
8
8
  require 'uri'
9
9
  require 'optparse'
@@ -26,10 +26,10 @@ module Deplate; end
26
26
  class Deplate::Core
27
27
  extend Forwardable
28
28
 
29
- Version = '0.8.1'
29
+ Version = '0.8.2'
30
30
  # VersionSfx = 'a'
31
31
  VersionSfx = 'final'
32
- MicroRev = '2965'
32
+ MicroRev = '3103'
33
33
 
34
34
  if ENV['HOME']
35
35
  CfgDir = File.join(ENV['HOME'].gsub(/\\/, '/'), '.deplate')
@@ -50,11 +50,13 @@ MESSAGE
50
50
  end
51
51
  LibDir = File.dirname(__FILE__)
52
52
  DataDir = File.join(Config::CONFIG['datadir'], 'deplate')
53
+ EtcDirs = []
53
54
  # FileCache = File.join(CfgDir, 'file_list.dat')
54
55
  FileCache = nil
55
56
 
56
57
  # If true, don't load user configuration files.
57
- @vanilla = false
58
+ @vanilla = false
59
+ @@vanilla = false
58
60
 
59
61
  # see #log_valid_condition?
60
62
  @log_treshhold = 4
@@ -177,11 +179,11 @@ MESSAGE
177
179
  key, val = keyval.split(/\s*=\s*/)
178
180
  case key
179
181
  when 'vanilla'
180
- @vanilla = true
182
+ @@vanilla = @vanilla = true
181
183
  end
182
184
  end
183
185
  end
184
- modules, formatters, csss, templates, input_defs, meta_fmts = collect_standard
186
+ modules, formatters, themes, csss, templates, input_defs, meta_fmts = collect_standard
185
187
 
186
188
  options = deplate_options
187
189
  opts = OptionParser.new do |opts|
@@ -386,7 +388,7 @@ MESSAGE
386
388
  end
387
389
 
388
390
  opts.on('-t', '--template NAME', String, 'Template to use') do |str|
389
- if templates.include?(str) or File.exist?(str)
391
+ if @@templates.has_key?(str) or File.exist?(str)
390
392
  log("options.template = #{@@templates[str]}")
391
393
  options.template = str
392
394
  else
@@ -394,10 +396,14 @@ MESSAGE
394
396
  exit 5
395
397
  end
396
398
  end
397
-
399
+
400
+ opts.on('--theme THEME', String, 'Theme to use') do |value|
401
+ set_theme(options, value)
402
+ end
403
+
398
404
  opts.on('--[no-]vanilla', 'Ignore user configuration') do |bool|
399
405
  log("options.vanilla = #{bool}")
400
- options.vanilla = bool
406
+ @@vanilla = bool
401
407
  end
402
408
 
403
409
  opts.on('-x', '--allow-ruby [RUBY SAFE]', Integer,
@@ -419,8 +425,8 @@ MESSAGE
419
425
  log("options.allow_external = #{bool}")
420
426
  end
421
427
 
422
- opts.separator ""
423
- opts.separator "LaTeX Formatter:"
428
+ opts.separator ' '
429
+ opts.separator 'LaTeX Formatter:'
424
430
 
425
431
  opts.on('--[no-]pdf', 'Prepare for use with pdf(la)tex') do |bool|
426
432
  log("options.pdftex = #{bool}")
@@ -428,31 +434,37 @@ MESSAGE
428
434
  options.variables['pdfOutput'] = true
429
435
  end
430
436
 
431
- opts.separator ''
437
+ opts.separator ' '
432
438
  opts.separator 'Available input defintions:'
433
439
  opts.separator input_defs.join(', ')
434
440
 
435
- opts.separator ''
441
+ opts.separator ' '
436
442
  opts.separator 'Available formatters:'
437
443
  opts.separator formatters.join(', ')
438
444
 
439
- opts.separator ''
445
+ opts.separator ' '
440
446
  opts.separator 'Available metadata formats:'
441
447
  opts.separator meta_fmts.join(', ')
442
448
 
443
- opts.separator ''
449
+ opts.separator ' '
444
450
  opts.separator 'Available modules:'
445
451
  opts.separator modules.join(', ')
446
452
 
447
- opts.separator ''
453
+ if themes
454
+ opts.separator ' '
455
+ opts.separator 'Available themes:'
456
+ opts.separator themes.join(', ')
457
+ end
458
+
459
+ opts.separator ' '
448
460
  opts.separator 'Available css files:'
449
461
  opts.separator csss.join(', ')
450
462
 
451
- opts.separator ''
463
+ opts.separator ' '
452
464
  opts.separator 'Available templates:'
453
465
  opts.separator templates.join(', ')
454
466
 
455
- opts.separator ''
467
+ opts.separator ' '
456
468
  opts.separator 'Other Options:'
457
469
 
458
470
  opts.on('--debug [LEVEL]', Integer, 'Show debug messages') do |v|
@@ -507,10 +519,12 @@ MESSAGE
507
519
  exit 0
508
520
  end
509
521
  end
522
+ options.opts = opts
510
523
 
511
524
  @@command_line_args = args.dup
512
- if options.ini_command_line_arguments
525
+ unless options.ini_command_line_arguments.empty?
513
526
  args += options.ini_command_line_arguments
527
+ options.ini_command_line_arguments = []
514
528
  end
515
529
  options.files = opts.parse!(args)
516
530
 
@@ -567,7 +581,7 @@ MESSAGE
567
581
 
568
582
  # load general user config
569
583
  options.cfg ||= ['config.rb', CfgDir]
570
- unless options.vanilla
584
+ unless @@vanilla
571
585
  user_config(options, *options.cfg)
572
586
  user_setup(options) if defined?(user_setup)
573
587
  end
@@ -600,6 +614,9 @@ MESSAGE
600
614
  # Check whether a certain action is allowed
601
615
  def is_allowed?(options, ids, args={})
602
616
  arr = options.allow
617
+ if arr.include?('all')
618
+ return true
619
+ end
603
620
  case ids
604
621
  when String
605
622
  ids = Deplate::Core.split_list(ids, ',', '; ')
@@ -616,6 +633,32 @@ MESSAGE
616
633
  logger.log(['No permission', ids.join(', ')], :anyway) if logger
617
634
  return false
618
635
  end
636
+
637
+
638
+ def set_theme(options, name)
639
+ theme_dir = @@themes[name]
640
+ if theme_dir
641
+ EtcDirs.unshift(theme_dir)
642
+ collect_theme(@@css, theme_dir, 'css', '.css')
643
+ collect_theme(@@templates, theme_dir, 'templates', '')
644
+ for resource in Dir[File.join(theme_dir, 'resources', '*')]
645
+ options.resources << [resource, false]
646
+ end
647
+ prelude = File.join(theme_dir, 'prelude.txt')
648
+ if File.exist?(prelude)
649
+ options.prelude.concat(File.readlines(prelude).map {|l| l.chomp})
650
+ end
651
+ if is_allowed?(options, 's')
652
+ read_ini_file(options, File.join(theme_dir, 'theme.ini'))
653
+ unless options.ini_command_line_arguments.empty?
654
+ options.opts.parse!(options.ini_command_line_arguments)
655
+ end
656
+ end
657
+ else
658
+ log(['Unknown theme', theme], :error)
659
+ end
660
+ end
661
+
619
662
 
620
663
  # Read CfgDir/deplate.ini
621
664
  #
@@ -650,7 +693,6 @@ MESSAGE
650
693
  # comment
651
694
  next
652
695
  elsif line =~ /^(-\S+)(\s+(.*?)\s*)?$/
653
- options.ini_command_line_arguments ||= []
654
696
  options.ini_command_line_arguments << $1
655
697
  options.ini_command_line_arguments << $3 if $3
656
698
  elsif line =~ /^\s*allow\s+(.+?)\s*$/
@@ -790,7 +832,7 @@ MESSAGE
790
832
  # file:: Either a file name or a directory; if it is a
791
833
  # directory, all ruby files in that directory will be loaded
792
834
  def user_config(options, file, dir=nil)
793
- unless options.vanilla
835
+ unless @@vanilla
794
836
  if dir
795
837
  dirs = [dir]
796
838
  dirs << File.join(current_pwd, 'deplate.rc') if is_allowed?(options, 'r')
@@ -820,7 +862,10 @@ MESSAGE
820
862
  # inherit:: A OpenStruct; if provided, reuse it
821
863
  def deplate_options(inherit=nil)
822
864
  options = inherit || OpenStruct.new
865
+ options.ini_command_line_arguments ||= []
823
866
  options.modules ||= []
867
+ options.resources ||= []
868
+ options.prelude ||= []
824
869
  options.clean ||= true
825
870
  options.force ||= true
826
871
  options.css ||= []
@@ -910,6 +955,7 @@ MESSAGE
910
955
  if data['version'] == Deplate::Core.microversion
911
956
  modules, @@modules = data['modules']
912
957
  formatters, @@formatters = data['formatters']
958
+ themes, @@themes = data['themes']
913
959
  csss, @@css = data['css']
914
960
  templates, @@templates = data['templates']
915
961
  input_defs, @@input_defs = data['input']
@@ -925,6 +971,10 @@ MESSAGE
925
971
  formatters, @@formatters = collect_deplate_options('formatters','fmt')
926
972
  input_defs, @@input_defs = collect_deplate_options('input', 'input')
927
973
  meta_fmts, @@metadata_formats = collect_deplate_options('metadata', 'metadata')
974
+ themes, @@themes = collect_deplate_options('themes', 'themes',
975
+ :directories => true,
976
+ :suffix => '',
977
+ :rc => true)
928
978
  csss, @@css = collect_deplate_options('css', 'css',
929
979
  :suffix => '.css',
930
980
  :rc => true)
@@ -938,6 +988,7 @@ MESSAGE
938
988
  'version' => Deplate::Core.microversion,
939
989
  'modules' => [modules, @@modules],
940
990
  'formatters' => [formatters, @@formatters],
991
+ 'themes' => [themes, @@themes],
941
992
  'css' => [csss, @@css],
942
993
  'templates' => [templates, @@templates],
943
994
  'input' => [input_defs, @@input_defs],
@@ -947,7 +998,7 @@ MESSAGE
947
998
  Deplate::Core.log(['Create file cache', FileCache])
948
999
  end
949
1000
  end
950
- return modules, formatters, csss, templates, input_defs, meta_fmts
1001
+ return modules, formatters, themes, csss, templates, input_defs, meta_fmts
951
1002
  end
952
1003
 
953
1004
  # This is the actual logging method. Every log message should pass
@@ -1051,6 +1102,14 @@ MESSAGE
1051
1102
  end
1052
1103
  end
1053
1104
 
1105
+ def push_value(var, value, sep=',')
1106
+ if var and !var.empty?
1107
+ [var, sep, value].join
1108
+ else
1109
+ value
1110
+ end
1111
+ end
1112
+
1054
1113
  def escape_characters(text, args)
1055
1114
  esc = args[:esc] || args[:escape] || args['esc'] || args['escape'] || ''
1056
1115
  ebs = args[:escapebackslash] || args['escapebackslash'] || args['template'] || 0
@@ -1121,13 +1180,18 @@ MESSAGE
1121
1180
  # Return an encoded name
1122
1181
  def clean_name(text, args={})
1123
1182
  if text
1124
- replacement = args[:replacement] || '_'
1125
- chars = args[:chars] || '_[:cntrl:].+*:"?<>|&\\\/'
1183
+ chars = args[:chars] || '[:cntrl:].+*:"?<>|&\\\/'
1184
+ chars += replacement = args[:replacement] || '_'
1126
1185
  if (extrachars = args[:extra])
1127
1186
  chars += extrachars
1128
1187
  end
1129
1188
  text.gsub(/[#{chars}]/) do |text|
1130
- replacement + "%02X" % text[0]
1189
+ case text
1190
+ when replacement
1191
+ replacement * 2
1192
+ else
1193
+ replacement + "%02X" % text[0]
1194
+ end
1131
1195
  end
1132
1196
  end
1133
1197
  end
@@ -1153,6 +1217,15 @@ MESSAGE
1153
1217
  end
1154
1218
  end
1155
1219
 
1220
+ def ensure_suffix(name, suffix)
1221
+ ext = File.extname(name)
1222
+ if ext != suffix
1223
+ return name + suffix
1224
+ else
1225
+ return name
1226
+ end
1227
+ end
1228
+
1156
1229
  # Return the output directory for +fname+
1157
1230
  def get_out_name_dir(fname, options)
1158
1231
  if options.recurse_hierarchy
@@ -1221,6 +1294,13 @@ MESSAGE
1221
1294
  end
1222
1295
  end
1223
1296
 
1297
+ def collect_theme(hash, theme_dir, subdir, suffix)
1298
+ for f in Dir[File.join(theme_dir, subdir, "*#{suffix}")]
1299
+ name = File.basename(f, suffix)
1300
+ hash[name] = f
1301
+ end
1302
+ end
1303
+
1224
1304
  # Collect all available modules/parts/libraries etc. Check the
1225
1305
  # file system and the "builtin" modules (e.g., when using the
1226
1306
  # win32 exerb distribution).
@@ -1228,27 +1308,28 @@ MESSAGE
1228
1308
  suffix = args[:suffix] || '.rb'
1229
1309
  use_rc = args[:rc] || false
1230
1310
  hash = {}
1231
- for d in library_directories(use_rc, subdir)
1232
- collect_deplate_options_in_hash(hash, suffix, Dir[File.join(d, '*%s' % suffix)])
1311
+ for d in library_directories(@@vanilla, use_rc, [subdir])
1312
+ collect_deplate_options_in_hash(hash, suffix, Dir[File.join(d, '*%s' % suffix)], nil, args)
1233
1313
  end
1234
1314
 
1235
1315
  builtin = "builtin_#{id}"
1236
1316
  if id and respond_to?(builtin)
1237
1317
  files = send(builtin)
1238
1318
  # files.collect! {|f| "#{f}.rb"}
1239
- collect_deplate_options_in_hash(hash, suffix, files, File.join('deplate', subdir))
1319
+ collect_deplate_options_in_hash(hash, suffix, files, File.join('deplate', subdir), args)
1240
1320
  end
1241
1321
 
1242
1322
  return hash.keys.sort, hash
1243
1323
  end
1244
1324
 
1245
- # Return an array of directorys that could contain deplate
1325
+ # Return an array of directories that could contain deplate
1246
1326
  # files.
1247
- def library_directories(use_rc, *subdirs)
1327
+ def library_directories(vanilla, use_rc, subdirs)
1248
1328
  @library_directories ||= {}
1249
1329
  acc = []
1250
1330
  dirs = [DataDir, LibDir]
1251
- dirs.unshift(CfgDir) unless @vanilla
1331
+ dirs.unshift(CfgDir) unless vanilla
1332
+ dirs.unshift(*EtcDirs)
1252
1333
  dirs.unshift(File.join(current_pwd, 'deplate.rc')) if use_rc
1253
1334
  for subdir in subdirs
1254
1335
  unless @library_directories[subdir]
@@ -1307,9 +1388,9 @@ MESSAGE
1307
1388
  end
1308
1389
 
1309
1390
  # Collect files in +array+ in +hash+.
1310
- def collect_deplate_options_in_hash(hash, suffix, array, subdir=nil)
1391
+ def collect_deplate_options_in_hash(hash, suffix, array, subdir=nil, args={})
1311
1392
  for m in array
1312
- unless !subdir and File.directory?(m)
1393
+ unless !subdir and !args[:directories] and File.directory?(m)
1313
1394
  key = File.basename(m, suffix) || m
1314
1395
  hash[key] ||= subdir ? File.join(subdir, m) : m
1315
1396
  hash[key] ||= subdir ? File.join(subdir, m) : m
@@ -1477,6 +1558,8 @@ MESSAGE
1477
1558
  # A open structure that holds this instance's options.
1478
1559
  attr_reader :options
1479
1560
 
1561
+ attr_reader :vanilla
1562
+
1480
1563
  # The formatter this instance of deplate uses.
1481
1564
  attr_reader :formatter
1482
1565
 
@@ -1549,7 +1632,7 @@ MESSAGE
1549
1632
  @options = Deplate::Core.deplate_options(args[:options])
1550
1633
  @sources = args[:sources] || @options.files
1551
1634
  @dest = args[:dest] || @options.out || ''
1552
- @vanilla = args[:vanilla] || false
1635
+ @vanilla = @@vanilla || args[:vanilla] || false
1553
1636
 
1554
1637
  # set_safe
1555
1638
 
@@ -1905,9 +1988,13 @@ MESSAGE
1905
1988
 
1906
1989
  # Read input file, process, write the output if writeFile is true.
1907
1990
  def go(writeFile=true)
1991
+ process_prelude
1908
1992
  read_file
1909
1993
  process_document
1910
- body_write if writeFile
1994
+ if writeFile
1995
+ body_write
1996
+ copy_resources
1997
+ end
1911
1998
  print_endmessages
1912
1999
  end
1913
2000
 
@@ -1927,13 +2014,19 @@ MESSAGE
1927
2014
  # Evaluate block in the working directory; take care
1928
2015
  # of the auxiliaryDirSuffix variable
1929
2016
  def in_working_dir(cwd=nil, &block)
1930
- pwd = Dir.pwd
1931
- cwd ||= auxiliary_dirname(true, true)
1932
- Dir.chdir(cwd) unless cwd.empty?
1933
- begin
2017
+ pwd = Dir.pwd
2018
+ cwd = auxiliary_dirname(true, true) if cwd.nil?
2019
+ if cwd.empty? or cwd == false or pwd == cwd
1934
2020
  block.call
1935
- ensure
1936
- Dir.chdir(pwd)
2021
+ else
2022
+ log(['CHDIR ->', cwd], :debug)
2023
+ Dir.chdir(cwd)
2024
+ begin
2025
+ block.call
2026
+ ensure
2027
+ log(['CHDIR <-', pwd], :debug)
2028
+ Dir.chdir(pwd)
2029
+ end
1937
2030
  end
1938
2031
  end
1939
2032
 
@@ -2024,7 +2117,7 @@ MESSAGE
2024
2117
  end
2025
2118
  end
2026
2119
  files << File.join(args['subdir'] || 'lib', fname)
2027
- files = Deplate::Core.library_directories(true, *files)
2120
+ files = Deplate::Core.library_directories(@vanilla, true, files)
2028
2121
  for fn in files
2029
2122
  if Deplate::Core.is_file?(fn)
2030
2123
  log(['File in lib', fn])
@@ -2610,6 +2703,18 @@ MESSAGE
2610
2703
  rv || @dest
2611
2704
  end
2612
2705
 
2706
+
2707
+ def copy_resources
2708
+ @options.resources.each do |src, anyway|
2709
+ res = File.basename(src)
2710
+ dest = auxiliary_filename(res, true)
2711
+ if anyway or !File.exist?(dest)
2712
+ copy_file(src, dest)
2713
+ end
2714
+ end
2715
+ end
2716
+
2717
+
2613
2718
  # Make sure +dir+ exists (create it if it doesn't).
2614
2719
  def ensure_dir_exists(dir)
2615
2720
  Deplate::Core.ensure_dir_exists(dir, @options)
@@ -2931,8 +3036,8 @@ MESSAGE
2931
3036
  end
2932
3037
 
2933
3038
  # Parse +text+ and return a formatted string.
2934
- def parse_and_format(container, text, alt=true, excluded=[])
2935
- t = parse(container, text, alt, excluded)
3039
+ def parse_and_format(container, text, alt=true, excluded=nil)
3040
+ t = parse(container, text, alt, :excluded => excluded)
2936
3041
  return format_particles(t)
2937
3042
  end
2938
3043
 
@@ -3066,6 +3171,13 @@ MESSAGE
3066
3171
  end
3067
3172
  end
3068
3173
 
3174
+ def process_prelude
3175
+ prelude = @options.prelude
3176
+ unless prelude.empty?
3177
+ include_stringarray(prelude, @accum_elements, nil, "[prelude]")
3178
+ end
3179
+ end
3180
+
3069
3181
  # Read the file
3070
3182
  def read_file(sources=@sources)
3071
3183
  for f in sources