docgenerator 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/docgenerator.rb +137 -0
- data/docgenerator_attribute.rb +142 -0
- data/docgenerator_characters.rb +171 -0
- data/docgenerator_css.rb +207 -0
- data/docgenerator_document.rb +374 -0
- data/docgenerator_element.rb +570 -0
- data/docgenerator_elements.rb +554 -0
- data/docgenerator_environments.rb +73 -0
- data/docgenerator_footnote.rb +106 -0
- data/docgenerator_lists.rb +163 -0
- data/docgenerator_sections.rb +88 -0
- data/docgenerator_tabular.rb +376 -0
- data/docgenerator_template.rb +103 -0
- data/examples/docgenerator_example.rb +185 -0
- data/packages/docgenerator_attachfile.rb +71 -0
- data/packages/docgenerator_beamer.rb +250 -0
- data/packages/docgenerator_caption.rb +43 -0
- data/packages/docgenerator_hyperref.rb +109 -0
- data/packages/docgenerator_listings.rb +100 -0
- data/packages/docgenerator_pdfpages.rb +18 -0
- data/packages/docgenerator_scrlettr2.rb +128 -0
- data/packages/docgenerator_scrpage2.rb +172 -0
- data/packages/docgenerator_url.rb +84 -0
- metadata +68 -0
@@ -0,0 +1,71 @@
|
|
1
|
+
#
|
2
|
+
#Support for attachfile.sty.
|
3
|
+
#-
|
4
|
+
#
|
5
|
+
ATTACHFILE_OPTIONS = {
|
6
|
+
:author => Attribute.create( [ :texkeyval], [ String ] ),
|
7
|
+
:description=> Attribute.create( [ :texkeyval], [ String ] ),
|
8
|
+
:subject => Attribute.create( [ :texkeyval], [ String ] ),
|
9
|
+
:icon => Attribute.create( [ :texkeyval], [ 'Graph', 'Paperclip', 'PushPin', 'Tag' ] ),
|
10
|
+
:mimetype=> Attribute.create( [ :texkeyval], [
|
11
|
+
'text/plain',
|
12
|
+
'video/mpeg',
|
13
|
+
] ),
|
14
|
+
}
|
15
|
+
|
16
|
+
# \attachfile [hoptionsi] {hfilenamei}
|
17
|
+
Element.create( [:attachfile], ATTACHFILE_OPTIONS, true, {
|
18
|
+
:latex => '#{linebreak(@crbefore)}\attachfile[#{texkeyval()}]{#{@content}}#{linebreak(@crafter)}',
|
19
|
+
})
|
20
|
+
# \noattachfile [hoptionsi]
|
21
|
+
Element.create( [:noattachfile], ATTACHFILE_OPTIONS, false, {
|
22
|
+
:latex => '#{linebreak(@crbefore)}\noattachfile[#{texkeyval()}]#{linebreak(@crafter)}',
|
23
|
+
})
|
24
|
+
|
25
|
+
# \textattachfile [hoptionsi] {hfilenamei} {htexti}
|
26
|
+
Element.create( [:textattachfile], {
|
27
|
+
:text => Attribute.create( [], [ String ] ),
|
28
|
+
}.update(ATTACHFILE_OPTIONS), true, {
|
29
|
+
:latex => '#{linebreak(@crbefore)}\textattachfile[#{texkeyval()}]{#{@content}}{#{@attr[:text]}}#{linebreak(@crafter)}',
|
30
|
+
})
|
31
|
+
|
32
|
+
# \notextattachfile [hoptionsi] {htexti}
|
33
|
+
Element.create( [:notextattachfile], {
|
34
|
+
:text => Attribute.create( [], [ String ] ),
|
35
|
+
}.update(ATTACHFILE_OPTIONS), false, {
|
36
|
+
:latex => '#{linebreak(@crbefore)}\notextattachfile[#{texkeyval()}]{#{@attr[:text]}}#{linebreak(@crafter)}',
|
37
|
+
})
|
38
|
+
|
39
|
+
__END__
|
40
|
+
doc.body << element(:usepackage,{ }, 'listings').cr
|
41
|
+
\attachfilesetup {hoptionsi}
|
42
|
+
|
43
|
+
==Options==
|
44
|
+
appearance=hbooleani
|
45
|
+
author=htexti
|
46
|
+
color=hredi hgreeni hbluei
|
47
|
+
date=htexti
|
48
|
+
description=htexti
|
49
|
+
subject=htexti
|
50
|
+
icon=hnamei
|
51
|
+
Graph
|
52
|
+
Paperclip
|
53
|
+
PushPin
|
54
|
+
Tag
|
55
|
+
mimetype=htypei
|
56
|
+
print=hbooleani
|
57
|
+
timezone=hoffseti
|
58
|
+
zoom=hbooleani
|
59
|
+
|
60
|
+
Option Default setting
|
61
|
+
appearance true
|
62
|
+
author none
|
63
|
+
color 1 0.9255 0.7765
|
64
|
+
date automatic
|
65
|
+
description none
|
66
|
+
subject none
|
67
|
+
icon PushPin
|
68
|
+
mimetype none
|
69
|
+
print true
|
70
|
+
timezone none
|
71
|
+
zoom true
|
@@ -0,0 +1,250 @@
|
|
1
|
+
#
|
2
|
+
# The text 'Beamer' must be part of this template.
|
3
|
+
# Without it, the title-Class will not use the short version for title.#
|
4
|
+
#
|
5
|
+
DocumentTemplate.add_template(:beamer, :latex, %q|<<prefix>>
|
6
|
+
% ----------------------------------------------------------------
|
7
|
+
% For Usage with Beamer
|
8
|
+
% ----------------------------------------------------------------
|
9
|
+
<<head>>
|
10
|
+
% ----------------------------------------------------------------
|
11
|
+
\begin{document}
|
12
|
+
<<body>>
|
13
|
+
\end{document}
|
14
|
+
% ----------------------------------------------------------------
|
15
|
+
|.gsub(/^\t*/, ''))
|
16
|
+
DocumentTemplate.add_template(:beamerhead, :latex, %q|<<prefix>>
|
17
|
+
\documentclass[<<classoptions>>]{beamer}
|
18
|
+
%<<theme>>
|
19
|
+
\usepackage{babel}
|
20
|
+
\usepackage[ansinew]{inputenc}
|
21
|
+
\usepackage{beamertool}
|
22
|
+
\usepackage{hyperref}
|
23
|
+
% ----------------------------------------------------------------
|
24
|
+
<<head>>
|
25
|
+
|.gsub(/^\t*/, ''))
|
26
|
+
[
|
27
|
+
:beamerthemebars, :beamerthemeboxes, :beamerthemeclassic,
|
28
|
+
:beamerthemelined, :beamerthemeplain, :beamerthemesidebar,
|
29
|
+
:beamerthemesidebardark, :beamerthemesidebardarktab,
|
30
|
+
:beamerthemesidebartab, :beamerthemesplit,
|
31
|
+
:beamerthemesplitcondensed, :beamerthemetree,
|
32
|
+
:beamerthemevcd,
|
33
|
+
].each{ |theme|
|
34
|
+
DocumentTemplate.add_template(theme, :latex, DocumentTemplate[:beamerhead].sub(/%<<theme>>/, "\\usepackage{#{theme}}"))
|
35
|
+
}
|
36
|
+
DocumentTemplate.add_template(:beamerarticle, :latex, %q|<<prefix>>
|
37
|
+
\documentclass[class=scrartcl,<<classoptions>>]{beamer}
|
38
|
+
\usepackage{babel}
|
39
|
+
\usepackage{beamerbasearticle}
|
40
|
+
\usepackage[article]{beamertool}
|
41
|
+
\usepackage[ansinew]{inputenc}
|
42
|
+
\usepackage{hyperref}
|
43
|
+
% ----------------------------------------------------------------
|
44
|
+
<<head>>
|
45
|
+
|.gsub(/^\t*/, ''))
|
46
|
+
|
47
|
+
|
48
|
+
#Define TeX-Kommands
|
49
|
+
|
50
|
+
#frame -- environment.
|
51
|
+
#options
|
52
|
+
#~ Element.create( :frame, {}, true, {
|
53
|
+
#~ :latex => '#{linebreak(@crbefore)}\frame{#{@content}}#{linebreak(@crafter)}'
|
54
|
+
#~ } )
|
55
|
+
|
56
|
+
class Frame < Element
|
57
|
+
add_attributes( {
|
58
|
+
:options => Attribute.create( [ :latex ], [nil, 'fragile', 't', 'b'] ),
|
59
|
+
}.update( HTML_ATTR_ALL ) )
|
60
|
+
Element.add( [:frame], Frame)
|
61
|
+
#Returns a div-element.
|
62
|
+
#The class for the css is set to 'frame' (if not defined before).
|
63
|
+
def htmltag( )
|
64
|
+
if @attr[:class].content.empty?
|
65
|
+
@attr[:class] << :frame
|
66
|
+
end
|
67
|
+
'div'
|
68
|
+
end
|
69
|
+
def to_latex( )
|
70
|
+
option = "[#{@attr[:options].content.join(',')}]"
|
71
|
+
option = nil if option == '[]'
|
72
|
+
#~ return "#{linebreak(@crbefore)}\\frame#{option}{\n#{@content}}#{linebreak(@crafter)}"
|
73
|
+
return "#{linebreak(@crbefore)}\\begin{frame}#{option}\n#{@content}\n\\end{frame}#{linebreak(@crafter)}"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
#
|
78
|
+
#Frametitle.
|
79
|
+
#Can be changed by
|
80
|
+
# Element.get( :frametitle ).class_eval( "def htmltag(); 'h4'; end")
|
81
|
+
Element.create( :frametitle, { }, true, {
|
82
|
+
:latex => '#{linebreak(@crbefore)}\frametitle{#{@content}}#{linebreak(@crafter)}',
|
83
|
+
:htmltag => 'p', #'h4',
|
84
|
+
:html => '#{linebreak(@crbefore)}<#{htmltag} class = "frametitle">#{@content}</#{htmltag}>#{linebreak(@crafter)}',
|
85
|
+
} )
|
86
|
+
|
87
|
+
Element.create( :block, {
|
88
|
+
:title => Attribute.create( [ :latex ] ),
|
89
|
+
}, true, {
|
90
|
+
:latex => '#{linebreak(@crbefore)}' + '\begin{block}{#{@attr[:title]}}' + '#{linebreak(@crmid)}' + '#{@content}\end{block}' + '#{linebreak(@crafter)}'
|
91
|
+
} )
|
92
|
+
|
93
|
+
#
|
94
|
+
# Notes in Beamer.
|
95
|
+
#
|
96
|
+
Element.create( :note, { }, true, {
|
97
|
+
:latex => '#{linebreak(@crbefore)}\note{#{@content}}#{linebreak(@crafter)}',
|
98
|
+
:htmltag => 'p', #'h4',
|
99
|
+
:html => '#{linebreak(@crbefore)}<#{htmltag} class = "note">#{@content}</#{htmltag}>#{linebreak(@crafter)}',
|
100
|
+
} )
|
101
|
+
|
102
|
+
#\framePic{filename}{
|
103
|
+
# description
|
104
|
+
#}
|
105
|
+
#~ Element.create( :framepic, { :file => Attribute.create( [ :required ] ),
|
106
|
+
#~ :link => Attribute.create( )
|
107
|
+
#~ }, true, {
|
108
|
+
#~ :latex => '\framePic{#{@attr[:file]}}{#{@content}}'
|
109
|
+
#~ } )
|
110
|
+
|
111
|
+
Element.create( :institute, {
|
112
|
+
}, true, {
|
113
|
+
:latex => '#{linebreak(@crbefore)}' + '\institute{#{@content}}' + '#{linebreak(@crafter)}'
|
114
|
+
} )
|
115
|
+
|
116
|
+
Element.create( :subtitle, {
|
117
|
+
}, true, {
|
118
|
+
:latex => '#{linebreak(@crbefore)}' + '\subtitle{#{@content}}' + '#{linebreak(@crafter)}'
|
119
|
+
} )
|
120
|
+
|
121
|
+
begin
|
122
|
+
#define Knut::Picture
|
123
|
+
require 'knut_picture'
|
124
|
+
rescue
|
125
|
+
#Define Knut::Picture with reduced functionality
|
126
|
+
module Knut
|
127
|
+
class Picture
|
128
|
+
def initialize( filename )
|
129
|
+
@filename = filename
|
130
|
+
@basename = File.basename(@filename)
|
131
|
+
@dir = File.dirname(@filename)
|
132
|
+
if ! File.exists?( @filename )
|
133
|
+
puts "#{self.class}: #{@filename} not found"
|
134
|
+
else
|
135
|
+
@size = File.size(@filename)
|
136
|
+
@sizekb = @size / 1024
|
137
|
+
end
|
138
|
+
end
|
139
|
+
#Filename including the path
|
140
|
+
attr_reader :filename
|
141
|
+
#Directory of the picture
|
142
|
+
attr_reader :dir
|
143
|
+
attr_reader :basename
|
144
|
+
def tech_description()
|
145
|
+
"#{@basename} (#{@sizekb}KB)"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
class Framepic < Element
|
152
|
+
Element.add( [:framepic], Framepic)
|
153
|
+
add_attributes( {
|
154
|
+
:file => Attribute.create( [ :required ] ),
|
155
|
+
:link => Attribute.create( ),
|
156
|
+
}.update( HTML_ATTR_ALL ) )
|
157
|
+
#container for the picture
|
158
|
+
def picture()
|
159
|
+
@picture = Knut::Picture.new( @attr[:file].content.first ) if ! @picture
|
160
|
+
@picture
|
161
|
+
end
|
162
|
+
attr_accessor :div_css
|
163
|
+
attr_accessor :img_css
|
164
|
+
attr_accessor :div_class
|
165
|
+
attr_accessor :img_class
|
166
|
+
attr_accessor :picwithname
|
167
|
+
def to_html()
|
168
|
+
html = [] #element(:div, {:class => :framepic })
|
169
|
+
#~ if @attr[:link].content.size > 0
|
170
|
+
#~ html << "[#{@attr[:link]}]"
|
171
|
+
#~ end
|
172
|
+
|
173
|
+
html << div_img = element(:div ).CR
|
174
|
+
if self.picture.href
|
175
|
+
div_img << element(:a, { :href => self.picture.href },
|
176
|
+
img = element(:img )
|
177
|
+
)
|
178
|
+
else
|
179
|
+
div_img << img = element(:img )
|
180
|
+
end
|
181
|
+
if self.picture.thumbname and self.picture.usethumb?
|
182
|
+
img[:src] << self.picture.thumbname
|
183
|
+
else
|
184
|
+
img[:src] << self.picture.filename
|
185
|
+
end
|
186
|
+
@div_css = CSS.new() if ! @div_css
|
187
|
+
div_img[:class] << @div_class if @div_class
|
188
|
+
div_img[:style] << @div_css
|
189
|
+
div_img[:align] << 'center' if div_img[:align].content.empty?
|
190
|
+
img[:class] << @img_class if @img_class
|
191
|
+
img[:style] << @img_css if @img_css
|
192
|
+
if picwithname
|
193
|
+
div_img << element(:br ).cr
|
194
|
+
div_img << element(:footnotesize, {}, self.picture.tech_description)
|
195
|
+
end
|
196
|
+
html << @content
|
197
|
+
return html.to_s
|
198
|
+
end
|
199
|
+
def to_latex()
|
200
|
+
result = ""
|
201
|
+
result << "\n" if @crbefore
|
202
|
+
result << "\\framePic"
|
203
|
+
if self.div_css #Check alignment
|
204
|
+
case self.div_css[:float]
|
205
|
+
when nil, 'left' #standard
|
206
|
+
when 'right'
|
207
|
+
result << "[right]"
|
208
|
+
else
|
209
|
+
puts "#{__FILE__}##{__LINE__}: Undefined float '#{self.div_css[:float]}' for TeX"
|
210
|
+
end
|
211
|
+
end
|
212
|
+
result << "{#{self.picture.filename}}"
|
213
|
+
if @attr[:link].content.size > 0
|
214
|
+
result << "[#{@attr[:link]}]"
|
215
|
+
end
|
216
|
+
result << "{"
|
217
|
+
result << "\n" if @crmid
|
218
|
+
result << "#{@content}"
|
219
|
+
result << "\n" if @crmid
|
220
|
+
result << "}"
|
221
|
+
result << "\n" if @crafter
|
222
|
+
return result
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
|
227
|
+
Element.create( :includegraphicsJustified, {}, true, {
|
228
|
+
:latex => '\includegraphicsJustified{#{@content}}',
|
229
|
+
:html => '<img src = "#{@content}" style = "max-width: 80%" />',
|
230
|
+
} )
|
231
|
+
|
232
|
+
#fixme --> docgenerator_color ?
|
233
|
+
class Textcolor < Element
|
234
|
+
Element.add( [:textcolor], Textcolor)
|
235
|
+
add_attributes( { :mode => Attribute.create( [ :required ], [:rgb] ),
|
236
|
+
:color => Attribute.create( [ :required ], [String] ),
|
237
|
+
} )
|
238
|
+
def to_latex()
|
239
|
+
result = ""
|
240
|
+
result << "\n" if @crbefore
|
241
|
+
result << "\\textcolor[#{attr[:mode]}]{#{@attr[:color]}}"
|
242
|
+
result << "\n" if @crmid
|
243
|
+
result << "{"
|
244
|
+
result << "#{@content}"
|
245
|
+
result << "\n" if @crmid
|
246
|
+
result << "}"
|
247
|
+
result << "\n" if @crafter
|
248
|
+
return result
|
249
|
+
end
|
250
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#
|
2
|
+
#Support for caption.sty.
|
3
|
+
#-
|
4
|
+
#
|
5
|
+
|
6
|
+
#~ Element.create( [:captionof], {
|
7
|
+
#~ :float_type => Attribute.create( [ :latex, :required ], [ 'figure', 'table' ] ),
|
8
|
+
#~ :lst_entry => Attribute.create( [ ], [ String ] ),
|
9
|
+
#~ }, true, {
|
10
|
+
#~ :latex => '#{linebreak(@crbefore)}\captionof{#{@attr[:float_type]}}[#{@attr[:lst_entry]}]{#{@content}}#{linebreak(@crafter)}',
|
11
|
+
#~ })
|
12
|
+
|
13
|
+
#
|
14
|
+
#
|
15
|
+
class Captionof < Element
|
16
|
+
#Make the key known to the complete key-list of elements.
|
17
|
+
Element.add( [:captionof], Captionof)
|
18
|
+
#~ add_attributes( HTML_ATTR_ALL )
|
19
|
+
add_attributes( {
|
20
|
+
:float_type => Attribute.create( [ :latex, :required ], [ 'figure', 'table' ] ),
|
21
|
+
:lst_entry => Attribute.create( [ ], [ String ] ),
|
22
|
+
} )
|
23
|
+
|
24
|
+
#Redefine standard output.
|
25
|
+
#Options are given, if an option is avalaible.
|
26
|
+
def to_latex()
|
27
|
+
cmd = linebreak(@crbefore)
|
28
|
+
cmd << "\\captionof{#{@attr[:float_type]}}"
|
29
|
+
#Empty [] would return empty entry for list of figures,
|
30
|
+
cmd << "[#{@attr[:lst_entry]}]" if @attr[:lst_entry].content?
|
31
|
+
cmd << "{#{@content}}"
|
32
|
+
cmd << linebreak(@crafter)
|
33
|
+
return cmd
|
34
|
+
end
|
35
|
+
def htmltag(); 'span'; end #fixme
|
36
|
+
#~ def to_html()
|
37
|
+
#~ return ''
|
38
|
+
#~ end
|
39
|
+
end #Usepackage
|
40
|
+
|
41
|
+
__END__
|
42
|
+
|
43
|
+
C:\proTeXt\texmf\doc\latex\caption
|
@@ -0,0 +1,109 @@
|
|
1
|
+
#
|
2
|
+
# Dynamic PDF-Features
|
3
|
+
#
|
4
|
+
#~\renewcommand{\LayoutCheckField}[2]{\mbox{#2}\,#1}
|
5
|
+
|
6
|
+
class HyperrefForm < Environment
|
7
|
+
add_attributes( {
|
8
|
+
:options => Attribute.create( [ :latex ], [nil] ),
|
9
|
+
} )
|
10
|
+
Element.add( [:Form], HyperrefForm)
|
11
|
+
def to_latex( )
|
12
|
+
option = "[#{@attr[:options].content.join(',')}]"
|
13
|
+
option = nil if option == '[]'
|
14
|
+
#~ puts option.inspect
|
15
|
+
return to_latex_environment( 'Form', option )
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
Element.create( [:Reset], {}, true, {
|
20
|
+
:latex => '#{linebreak(@crbefore)}\Reset{#{@content}}#{linebreak(@crafter)}',
|
21
|
+
})
|
22
|
+
|
23
|
+
Element.create( [:CheckBox], {
|
24
|
+
:name => Attribute.create( [ :texkeyval ] ),
|
25
|
+
:onclick => Attribute.create( [ :texkeyval ] ),
|
26
|
+
:onblur => Attribute.create( [ :texkeyval ] ),
|
27
|
+
}, true, {
|
28
|
+
:latex => '#{linebreak(@crbefore)}\CheckBox[#{texkeyval()}]{#{@content}}#{linebreak(@crafter)}',
|
29
|
+
})
|
30
|
+
|
31
|
+
Element.create( [:PushButton], {
|
32
|
+
:onclick => Attribute.create( [ :texkeyval ] ),
|
33
|
+
#~ :onload => Attribute.create( [ :texkeyval ] ), - niht definiert
|
34
|
+
#~ :onmousemove => Attribute.create( [ :texkeyval ] ), nee, ghet nicht
|
35
|
+
:width => Attribute.create( [ :texkeyval ], nil, 5), #regexp not supported - CSS_WIDTH
|
36
|
+
:height => Attribute.create( [ :texkeyval ], nil, 6), #regexp not supported - CSS_WIDTH
|
37
|
+
:borderstyle => Attribute.create( [ :texkeyval ], ['S', 'D', 'B', 'I', 'U'], 10 ), #S (solid, durchgehend), D (dashed, gestrichelt), B (beveled, erh�ht), I (inset, versenkt), U (unterstrichen)
|
38
|
+
:bordercolor => Attribute.create( [ :texkeyval ], nil, 11 ),
|
39
|
+
:color => Attribute.create( [ :texkeyval ], nil, 15 ),
|
40
|
+
:backgroundcolor => Attribute.create( [ :texkeyval ], nil, 15 ),
|
41
|
+
}, true, {
|
42
|
+
:latex => '#{linebreak(@crbefore)}\PushButton[#{texkeyval()}]{#{@content}}#{linebreak(@crafter)}',
|
43
|
+
})
|
44
|
+
|
45
|
+
Element.create( [:ChoiceMenu], {
|
46
|
+
#~ :onclick => Attribute.create( [ :texkeyval ] ),
|
47
|
+
:name => Attribute.create( [ :required ] ),
|
48
|
+
:onblur => Attribute.create( [ :texkeyval ] ),
|
49
|
+
:default => Attribute.create( [ :texkeyval ] ),
|
50
|
+
:type => Attribute.create( [], ['combo', 'radiobutton'] ),
|
51
|
+
#~ :onload => Attribute.create( [ :texkeyval ] ), - niht definiert
|
52
|
+
#~ :onmousemove => Attribute.create( [ :texkeyval ] ), nee, ghet nicht
|
53
|
+
:width => Attribute.create( [ :texkeyval ], nil, 5), #regexp not supported - CSS_WIDTH
|
54
|
+
:height => Attribute.create( [ :texkeyval ], nil, 6), #regexp not supported - CSS_WIDTH
|
55
|
+
:borderstyle => Attribute.create( [ :texkeyval ], ['S', 'D', 'B', 'I', 'U'], 10 ), #S (solid, durchgehend), D (dashed, gestrichelt), B (beveled, erh�ht), I (inset, versenkt), U (unterstrichen)
|
56
|
+
:bordercolor => Attribute.create( [ :texkeyval ], nil, 11 ),
|
57
|
+
:color => Attribute.create( [ :texkeyval ], nil, 15 ),
|
58
|
+
:backgroundcolor => Attribute.create( [ :texkeyval ], nil, 15 ),
|
59
|
+
}, true, {
|
60
|
+
:latex => '#{linebreak(@crbefore)}\ChoiceMenu[#{@attr[:type]},#{texkeyval()}]{#{@attr[:name]}}{#{@content}}#{linebreak(@crafter)}',
|
61
|
+
})
|
62
|
+
|
63
|
+
Element.create( [:TextField], {
|
64
|
+
:onclick => Attribute.create( [ :texkeyval ] ),
|
65
|
+
:onblur => Attribute.create( [ :texkeyval ] ), #Action, when value changed
|
66
|
+
:name => Attribute.create( [ :texkeyval ], [String, Symbol], 1 ),
|
67
|
+
:password => Attribute.create( [ :texkeyval ], nil, 3), #Ausgabe als *****
|
68
|
+
:width => Attribute.create( [ :texkeyval ], nil, 5), #regexp not supported - CSS_WIDTH
|
69
|
+
:height => Attribute.create( [ :texkeyval ], nil, 6), #regexp not supported - CSS_WIDTH
|
70
|
+
:align => Attribute.create( [ :texkeyval ], [0,1,2], 7), #0=links, 1= center, 2 = right
|
71
|
+
:borderstyle => Attribute.create( [ :texkeyval ], ['S', 'D', 'B', 'I', 'U'], 10 ), #S (solid, durchgehend), D (dashed, gestrichelt), B (beveled, erh�ht), I (inset, versenkt), U (unterstrichen)
|
72
|
+
:bordercolor => Attribute.create( [ :texkeyval ], nil, 11 ),
|
73
|
+
:color => Attribute.create( [ :texkeyval ], nil, 15 ),
|
74
|
+
:backgroundcolor => Attribute.create( [ :texkeyval ], nil, 15 ),
|
75
|
+
:multiline => Attribute.create( [ :texkeyval ], [true,false], 30 ),
|
76
|
+
:readonly => Attribute.create( [ :texkeyval ], [true,false], 31 ),
|
77
|
+
:hidden => Attribute.create( [ :texkeyval ], [true,false], 31 ),
|
78
|
+
:value => Attribute.create( [ :texkeyval ], [String, Array], 40 ),
|
79
|
+
:validate => Attribute.create( [ :texkeyval ], [String, Array], 40 ), #Validation rule
|
80
|
+
:format => Attribute.create( [ :texkeyval ], [String, Array], 40 ), #Format rule
|
81
|
+
}, true, {
|
82
|
+
:latex => '#{linebreak(@crbefore)}\TextField[#{texkeyval()}]{#{@content}}#{linebreak(@crafter)}',
|
83
|
+
})
|
84
|
+
|
85
|
+
__END__
|
86
|
+
\ChoiceMenu[popdown,name=mitlgiedsnr]{Mitgliedsnummer}%
|
87
|
+
{Kein Mitglied=N,}
|
88
|
+
|
89
|
+
Acrobat-Funktionen:
|
90
|
+
|
91
|
+
Zu TextField#validate:
|
92
|
+
AFRange_Validate(b1,w1,b2,w2)
|
93
|
+
|
94
|
+
b1: Testen auf Minimum (true/false)
|
95
|
+
w1: Minimaler wert
|
96
|
+
b2: Testen auf Maximalwert (true/false)
|
97
|
+
w2: Maximaler wert
|
98
|
+
|
99
|
+
Zu TextField#format:
|
100
|
+
AFNumber_Format(nDec,0,0,0,0,"",true)
|
101
|
+
nDec: Anzahl der Nachkommastellen.
|
102
|
+
|
103
|
+
|
104
|
+
Paket insdljs (nach hyperref laden.
|
105
|
+
\begin{insDLJS}{name}{titel}
|
106
|
+
Javascript
|
107
|
+
\end{insDLJS}
|
108
|
+
|
109
|
+
name ergint name.js und bei begin{document} geladen.
|
@@ -0,0 +1,100 @@
|
|
1
|
+
LSTSETTINGS = {
|
2
|
+
:language => Attribute.create( [ :texkeyval] ),
|
3
|
+
:style => Attribute.create( [ :texkeyval] ),
|
4
|
+
:basicstyle => Attribute.create( [ :texkeyval] ),
|
5
|
+
:emph => Attribute.create( [ :texkeyval] ),
|
6
|
+
:emphstyle => Attribute.create( [ :texkeyval] ),
|
7
|
+
:keywordstyle => Attribute.create( [ :texkeyval] ),
|
8
|
+
:commentstyle => Attribute.create( [ :texkeyval] ),
|
9
|
+
:style => Attribute.create( [ :texkeyval] ),
|
10
|
+
:breaklines => Attribute.create( [ :texkeyval], ['true', 'false'] ),
|
11
|
+
:mathescape => Attribute.create( [ :texkeyval], ['true', 'false'] ),
|
12
|
+
:prebreak => Attribute.create( [ :texkeyval] ),
|
13
|
+
:postbreak => Attribute.create( [ :texkeyval] ),
|
14
|
+
:tabsize => Attribute.create( [ :texkeyval], [ Integer ] ),
|
15
|
+
:firstline => Attribute.create( [ :texkeyval], [ Integer ] ),
|
16
|
+
:lastline => Attribute.create( [ :texkeyval], [ Integer ] ),
|
17
|
+
#~ showspaces=true,
|
18
|
+
#~ showtabs=true,
|
19
|
+
#~ tab=\rightarrowfill}
|
20
|
+
:numbers => Attribute.create( [ :texkeyval], [ 'none', 'left', 'right' ] ),
|
21
|
+
:numberstyle => Attribute.create( [ :texkeyval] ),
|
22
|
+
:firstnumber => Attribute.create( [ :texkeyval], [ Integer ] ),
|
23
|
+
:stepnumber => Attribute.create( [ :texkeyval], [ Integer ] ),
|
24
|
+
:numbersep => Attribute.create( [ :texkeyval], [ Integer ] ),
|
25
|
+
#
|
26
|
+
:morekeywords => Attribute.create( [ :texkeyval], [ String ] ),
|
27
|
+
:morecomment => Attribute.create( [ :texkeyval], [ String ] ),
|
28
|
+
}
|
29
|
+
|
30
|
+
Element.create( [:lstlistoflistings], {}, false )
|
31
|
+
Element.create( [:lstloadlanguages], {}, true, {:html => '' } )
|
32
|
+
Element.create( [:lstset], LSTSETTINGS, false, {
|
33
|
+
:latex => '#{linebreak(@crbefore)}\lstset{#{texkeyval()}}#{linebreak(@crafter)}',
|
34
|
+
})
|
35
|
+
Element.create( [:lstdefinestyle], LSTSETTINGS, true, {
|
36
|
+
:latex => '#{linebreak(@crbefore)}\lstdefinestyle{#{@content}}{#{texkeyval()}}#{linebreak(@crafter)}',
|
37
|
+
})
|
38
|
+
|
39
|
+
Element.create( [:lstinputlisting], {
|
40
|
+
:caption => Attribute.create( [ :texkeyval], nil, 1 ),
|
41
|
+
}.update(HTML_ATTR_ALL).update( LSTSETTINGS),
|
42
|
+
true,
|
43
|
+
{ :htmltag => 'pre',
|
44
|
+
:latex => '#{linebreak(@crbefore)}\lstinputlisting[#{texkeyval()}]{#{@content}}#{linebreak(@crafter)}'
|
45
|
+
} )
|
46
|
+
|
47
|
+
#~ lstlisting
|
48
|
+
|
49
|
+
class Lstinline < Element
|
50
|
+
#Make the key known to the complete key-list of elements.
|
51
|
+
Element.add( [:lstinline], Lstinline)
|
52
|
+
#~ add_attributes( HTML_ATTR_ALL )
|
53
|
+
add_attributes( {
|
54
|
+
:caption => Attribute.create( [ :latex ], nil, 1 ),
|
55
|
+
}.update(HTML_ATTR_ALL).update( LSTSETTINGS)
|
56
|
+
)
|
57
|
+
|
58
|
+
def htmltag; 'pre'; end
|
59
|
+
#Redefine standard output.
|
60
|
+
#Options are given, if an option is avalaible.
|
61
|
+
def to_latex()
|
62
|
+
if ! @content.include?( '!' ); sep = '!'
|
63
|
+
elsif ! @content.include?( '?' ); sep = '?'
|
64
|
+
else
|
65
|
+
puts "lstinline: found no sep. for #{content}"
|
66
|
+
end
|
67
|
+
cmd = linebreak(@crbefore)
|
68
|
+
cmd << '\lstinline'
|
69
|
+
cmd << "[#{texkeyval()}]"
|
70
|
+
cmd << sep
|
71
|
+
cmd << "#{@content}"
|
72
|
+
cmd << sep
|
73
|
+
cmd << linebreak(@crafter)
|
74
|
+
return cmd
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
class Lstlisting < Environment
|
79
|
+
#Make the key known to the complete key-list of elements.
|
80
|
+
Element.add( [:lstlisting], Lstlisting)
|
81
|
+
#~ add_attributes( HTML_ATTR_ALL )
|
82
|
+
add_attributes( {
|
83
|
+
:options => Attribute.create( [ :texkeyval], nil, 1 ),
|
84
|
+
}.update(HTML_ATTR_ALL).update( LSTSETTINGS)
|
85
|
+
)
|
86
|
+
|
87
|
+
def htmltag; 'pre'; end
|
88
|
+
#Redefine standard output.
|
89
|
+
#Options are given, if an option is avalaible.
|
90
|
+
def to_latex()
|
91
|
+
option = "[#{texkeyval()}]"
|
92
|
+
option = nil if option == '[]'
|
93
|
+
return to_latex_environment( 'lstlisting', option )
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
__END__
|
98
|
+
doc.head << element(:usepackage,{ }, 'listings').cr
|
99
|
+
doc.head << element(:lstloadlanguages,{}, 'ruby' ).cr
|
100
|
+
doc.head << element(:lstset,{ :language => 'ruby' } ).cr
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
#requires a
|
3
|
+
# doc.head << element(:usepackage,{},'pdfpages')
|
4
|
+
#
|
5
|
+
|
6
|
+
|
7
|
+
#if ! $".include?('docgenerator.rb')
|
8
|
+
if ! defined?( Document )
|
9
|
+
require 'docgenerator'
|
10
|
+
end
|
11
|
+
|
12
|
+
puts "#{__FILE__} fixme: options includepdf: hyperref/addsec.."
|
13
|
+
Element.create( :includepdf, {
|
14
|
+
:pages => Attribute.create( [ :texkeyval], [ String ] ),
|
15
|
+
#~ :pages => Attribute.create( [ :texkeyval], [ String ] ),
|
16
|
+
}, true, {
|
17
|
+
:latex => '#{linebreak(@crbefore)}\includepdf[#{texkeyval()}]{#{@content}}#{linebreak(@crafter)}',
|
18
|
+
})
|