1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
|
=begin
* Name: SiSU information Structuring Universe - Structured information, Serialized Units
* Author: Ralph Amissah
* http://www.jus.uio.no/sisu
* http://www.jus.uio.no/sisu/SiSU/download.html
* Description: texinfo formatting template
* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Ralph Amissah
* License: GPL 2 or later
Summary of GPL 2
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
If you have Internet connection, the latest version of the GPL should be
available at these locations:
http://www.fsf.org/licenses/gpl.html
http://www.gnu.org/copyleft/gpl.html
http://www.jus.uio.no/sisu/gpl2.fsf
SiSU was first released to the public on January 4th 2005
SiSU uses:
* Standard SiSU markup syntax,
* Standard SiSU meta-markup syntax, and the
* Standard SiSU object citation numbering and system
© Ralph Amissah 1997, current 2007.
All Rights Reserved.
* Ralph Amissah: ralph@amissah.com
ralph.amissah@gmail.com
=end
module TexInfoFormat
@@table_pg_break_counter=1
require SiSU_lib + '/param'
include SiSU_Param
include SiSU_Viz
class Texinfo
@@tex_backslash="\\\\"
@@tex_1='\\\\~' #?? debug
@@tabular="{tabular}"
@@tex_pattern_margin_number="\\\\marginpar.+?\s+"
@@dp=nil
def initialize(data=nil,md=nil,three=nil)
@para=@one=data
@md=md
@vz=SiSU_Env::Get_init.instance.skin
@dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
end
def head
t=Time.now
year = t.year
filename=%{#{@md.fns}}[/(.+?)\.\w\w\d\d$/,1]
title=Texinfo.new(@md.title).spec_char
title=title.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ")
title.gsub!(/\$/,"\\$")
title.gsub!(/[,]\s*/,' - ')
if @md.subtitle
subtitle=Texinfo.new(@md.subtitle).spec_char
subtitle=subtitle.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ")
subtitle.gsub!(/\$/,"\\$")
subtitle.gsub!(/[,]\s*/,' - ')
subtitle="@subtitle @value{VERSION}, @value{UPDATED}\n" #bugwatch
end
subtitle ||=''
author=@md.dc_creator if @md.dc_creator
author ||=''
author.gsub!(/[\*]/,'') #if author
head =<<WOK
\\input texinfo @c -*-texinfo-*-
@comment $Id$
@comment %**start of header
@setfilename #{@md.fnb}.info
@settitle #{title} @value{VERSION}
@syncodeindex pg cp
@comment %**end of header
@c {{{ 2
@copying
SiSU in texinfo version of #{title}
(version @value{VERSION}, @value{UPDATED})
Copyright @copyright{} #{year} #{author}.
@quotation
Copyright #{author}, generated by ``SiSU''
@end quotation
@end copying
@dircategory SiSU Texinfo
@direntry
* sisu: SiSU texinfo file.
@end direntry
WOK
if @md.subtitle
titlepage=<<WOK
@c {{{ 3
@titlepage
@title #{title} #{subtitle}
@author #{author}
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage
@contents
WOK
else
titlepage=<<WOK
@c {{{ 3
@titlepage
@title #{title}
@value{VERSION}, @value{UPDATED}
@author #{author}
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage
@contents
WOK
end
"#{head}#{titlepage}"
end
def topnode
@one=Texinfo.new(@one).spec_char
@one=@one.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ")
@one.gsub!(/\$/,"\\$")
@one.gsub!(/[,]\s*/,' - ')
"@c {{{ 4\n" +
"@ifnottex\n" +
"@node Top\n" +
"@top #@one\n\n" +
"@insertcopying\n" +
"@end ifnottex\n\n" +
"@menu\n"
end
def dublincore
title=Texinfo.new(@md.title).spec_char if @md.title
subtitle=Texinfo.new(@md.subtitle).spec_char if @md.subtitle
dc_title="#{title} - #{subtitle}"
dc_creator=Texinfo.new(@md.dc_creator).spec_char if @md.dc_creator
dc_subject=Texinfo.new(@md.dc_subject).spec_char if @md.dc_subject
dc_description=Texinfo.new(@md.dc_description).spec_char if @md.dc_description
dc_publisher=Texinfo.new(@md.dc_publisher).spec_char if @md.dc_publisher
dc_contributor=Texinfo.new(@md.dc_contributor).spec_char if @md.dc_contributor
dc_date=Texinfo.new(@md.dc_date).spec_char if @md.dc_date
dc_date_created=Texinfo.new(@md.dc_date_created).spec_char if @md.dc_date_created
dc_date_issued=Texinfo.new(@md.dc_date_issued).spec_char if @md.dc_date_issued
dc_date_available=Texinfo.new(@md.dc_date_available).spec_char if @md.dc_date_available
dc_date_valid=Texinfo.new(@md.dc_date_valid).spec_char if @md.dc_date_valid
dc_date_modified=Texinfo.new(@md.dc_date_modified).spec_char if @md.dc_date_modified
dc_type=Texinfo.new(@md.dc_type).spec_char if @md.dc_type
dc_format=Texinfo.new(@md.dc_format).spec_char if @md.dc_format
dc_identifier=Texinfo.new(@md.dc_identifier).spec_char if @md.dc_identifier
dc_source=Texinfo.new(@md.dc_source).spec_char if @md.dc_source
dc_language=Texinfo.new(@md.dc_language[:name]).spec_char if @md.dc_language[:name]
#language_original=Texinfo.new(@md.language_original[:name]).spec_char if @md.language_original[:name]
dc_relation=Texinfo.new(@md.dc_relation).spec_char if @md.dc_relation
dc_coverage=Texinfo.new(@md.dc_coverage).spec_char if @md.dc_coverage
dc_rights=Texinfo.new(@md.dc_rights).spec_char if @md.dc_rights
dc_title="Title: #{dc_title}\n\n" if dc_title
dc_creator="Creator: #{dc_creator}\n\n" if dc_creator
dc_subject="Subject: #{dc_subject}\n\n" if dc_subject
dc_description="Description: #{dc_description}\n\n" if dc_description
dc_publisher="Publisher: #{dc_publisher}\n\n" if dc_publisher
dc_contributor="Contributor: #{dc_contributor}\n\n" if dc_contributor
dc_date="Date: #{dc_date}\n\n" if dc_date
dc_date_created="Date Created: #{dc_date_created}\n\n" if dc_date_created
dc_date_issued="Date Issued: #{dc_date_issued}\n\n" if dc_date_issued
dc_date_available="Date Available: #{dc_date_available}\n\n" if dc_date_available
dc_date_valid="Date Valid: #{dc_date_valid}\n\n" if dc_date_valid
dc_date_modified="Date Modified: #{dc_date_modified}\n\n" if dc_date_modified
dc_format="Format: #{dc_format}\n\n" if dc_format
dc_identifier="Identifier: #{dc_identifier}\n\n" if dc_identifier #watch
dc_source="Source: #{dc_source}\n\n" if dc_source
dc_language="Language: #{dc_language}\n\n" if dc_language
dc_relation="Relation: #{dc_relation}\n\n" if dc_relation
dc_coverage="Coverage: #{dc_coverage}\n\n" if dc_coverage
dc_rights="Rights: #{dc_rights}\n\n" if dc_rights
"@node Dublin Core\n" +
"@chapter Dublin Core\n" +
"@cindex chapter, Dublin Core\n\n" +
"#{dc_title}" +
"#{dc_creator}" +
"#{dc_subject}" +
"#{dc_description}" +
"#{dc_publisher}" +
"#{dc_contributor}" +
"#{dc_date}" +
"#{dc_date_created}" +
"#{dc_date_issued}" +
"#{dc_date_available}" +
"#{dc_date_valid}" +
"#{dc_date_modified}" +
"#{dc_format}" +
"#{dc_identifier}" +
"#{dc_source}" +
"#{dc_language}" +
"#{dc_relation}" +
"#{dc_coverage}" +
"#{dc_rights}" +
"\n\n"
end
def tail
"@c {{{ 6\n" +
"@node Index\n" +
"@unnumbered Index\n" +
"@printindex cp\n\n" +
"@bye"
end
def menu
@para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>$/,'~[\1]')
@para.gsub!(/\s*[,:]\s*/,' - ')
@para.gsub!(/<:#>/,'')
@para.strip!
"* #@para::"
end
def level1
@para.gsub!(/[1]\\+~/,'')
@para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>$/,'~[\1]')
@para.gsub!(/\s*[,:]\s*/,' - ')
@para.gsub!(/<:#>/,'')
@para.strip!
para="@node #@para\n@chapter #@para\n@cindex chapter, #@para\n"
@para.gsub!(/.+/,"#{para}")
end
def level2
@para.gsub!(/[2]\\+~/,'')
@para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>$/,'~[\1]')
@para.gsub!(/\s*[,:]\s*/,' - ')
@para.gsub!(/<:#>/,'')
@para.strip!
para="@node #@para\n@chapter #@para\n@cindex chapter, #@para\n"
@para.gsub!(/.+/,"#{para}")
end
def level3
@para.gsub!(/[3]\\+\~/,'')
@para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>$/,'~[\1]')
@para.gsub!(/\s*[,:]\s*/,' - ')
@para.gsub!(/<:#>/,'')
@para.strip!
para="@node #@para\n@chapter #@para\n@cindex chapter, #@para\n"
@para.gsub!(/.+/,"#{para}")
end
def level4
@para.gsub!(/[4]\\+~\S+/,'')
@para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>$/,'~[\1]')
@para.gsub!(/\s*[,:]\s*/,' - ')
@para.gsub!(/<:#>/,'')
@para.strip!
para="@node #@para\n@chapter #@para\n@cindex chapter, #@para\n"
@para.gsub!(/.+/,"#{para}")
end
def level5
@para.gsub!(/[5]\\+~\S+/,'')
@para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>$/,'~[\1]')
@para.gsub!(/\s*[,:]\s*/,' - ')
@para.gsub!(/<:#>/,'')
@para.strip!
para="@node #@para\n@chapter #@para\n@cindex chapter, #@para\n"
@para.gsub!(/.+/,"#{para}")
end
def level6
@para.gsub!(/[6]\\+~\S+/,'')
@para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>$/,'~[\1]')
@para.gsub!(/\s*[,:]\s*/,' - ')
@para.gsub!(/<:#>/,'')
@para.strip!
para="@node #@para\n@chapter #@para\n@cindex chapter, #@para\n"
@para.gsub!(/.+/,"#{para}")
end
def submenu
@para=@para.join("\n")
@para.gsub!(/[5]\\+~\S+/,'')
@para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>$/,'~[\1]')
@para.gsub!(/\s*[,]\s*/,' - ')
@para.gsub!(/<:#>/,'')
@para.strip!
para="@menu\n#@para\n@end menu\n\n"
@para.gsub!(/.+/m,"#{para}")
end
def subsubmenu
@para=@para.join("\n")
@para.gsub!(/[6]\\+~\S+/,'')
@para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>$/,'~[\1]')
@para.gsub!(/\s*[,]\s*/,' - ')
@para.gsub!(/<:#>/,'')
@para.strip!
para="@menu\n#@para\n@menu\n\n"
@para.gsub!(/.+/m,"#{para}")
end
def indent1
@para.gsub!(/<:i1>(.*)/,'\1')
end
def indent2
@para.gsub!(/<:i2>(.*)/,'\1')
end
def spec_char # special characters
@para.gsub!(/<EOF>/i,'')
@para.gsub!(/@/i,'@@')
@para.gsub!(/&(lt|#060);/,'\< ')
@para.gsub!(/&(gt|#062);/,' \>')
@para.gsub!(/{/,'\{ ')
@para.gsub!(/}/,'\} ')
@para.gsub!(/&#(126|152);/i,'~ ')
@para.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ')
@para.gsub!(/\\/,'\\backslash ')
@para.gsub!(/<:pb>/,'\\newpage')
@para.gsub!(/\\backslash copyright/,'\\copyright ')
@para.gsub!(/\^/,'\\wedge ')
@para.gsub!(/(\$)/,"\\$")
@para.gsub!(/\~/,'\\~')
@para.gsub!(/%/,"\\%")
if @para !~ /^\s*<:image|\}:image\s/
@para.gsub!(/_/,'\_')
end
@para.gsub!(/\{/,"\\{")
@para.gsub!(/\}/,"\\}")
@para.gsub!(/ /,' ') # ~ character for hardspace
@para.gsub!(/ /,' ') # ~ character for hardspace
@para.gsub!(/&(\S+?);/,'')
@para.gsub!(/(\s+&\s+)/,' and ')
@para.gsub!(/(\&)/,"\\&")
@para.gsub!(/§/i,'\S')
@para.gsub!(/£/i,'\pounds')
@para.gsub!(/å/i,'\aa')
@para.gsub!(/æ/i,'\ae')
@para.gsub!(/ø/i,'\o')
@para.gsub!(/Å/i,'\AA')
@para.gsub!(/Æ/i,'\AE')
@para.gsub!(/Ø/i,'\O')
@para.gsub!(/&(.+?);/i,' ')
@para.gsub!(/<a href=".+?">/i,' ')
@para.gsub!(/<\/a>/i,' ')
@para.gsub!(/<:ee>/i,'')
@para.gsub!(/<!>/i,' ')
@para.gsub!(/<b>(.+?)<\/b>/,'\*\1\*')
@para.gsub!(/<i>(.+?)<\/i>/,'\/\1\/')
@para.gsub!(/<u>(.+?)<\/u>/,'\_\1\_')
@para.gsub!(/"(.+?)"/,"`\\1'") # open & close "
@para.gsub!(/\s+"/," `") # open "
@para.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*"/,'\1`') # open "
@para.gsub!(/"(\s|\.|,|:|;)/,"'\\1") # close "
@para.gsub!(/"([1-6-]\\+(?:~\S+)?|<.+?>)?\s*$/,"'\\1") # close "
@para.gsub!(/"(\.|,)/,"'") # close "
@para.gsub!(/\s+'/," `") # open '
@para.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*'/,'\1`') # open '
#if @para=~/#{@@tex_1}/
#end
#@para.gsub!(/^([1-6-](?:#{@@tex_2}|#{@@tex_1})(?:\\~\S+)?|<.+?>)?\s*"/i,"\\1`") # open "
#@para.gsub!(/"([1-6-](?:#{@@tex_2}|#{@@tex_1})(?:\\~\S+)?|<.+?>)?\s*$/i,"'\\1") # close "
#@para.gsub!(/^([1-6-](?:#{@@tex_2}|#{@@tex_1})(?:\\~\S+)?|<.+?>)?\s*'/i,"\\1`") # open '
@para.gsub!(/(<font.*?>|<\/font>)/,'')
@para.gsub!(/\s*<sup>(\S+?)<\/sup>/,'^\1')
@para.gsub!(/(<sup>|<\/sup>)/,'')
@para
end
def longtable
@end_table="\\end{longtable}"
@row_break='\\\\\\'
if @para[/<!Th?¡\s+c(\d+);(.+?)!>/i]
no_of_cols,cols_width=$1,$2
@@tableheader=1 if @para =~ /<!Th/i
@w=cols_width.split(/;\s+/)
@@number_of_cols=no_of_cols
@colW=[]
@colW << '{'
@w.each do |x|
col_w=x.gsub(/.+/,'l\|') #unless x.nil?
@colW << "#{col_w}" if col_w
end
@colW << '}'
@colW=@colW.join
@@start_table="\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" +
"\\begin{longtable}[hb]#@colW\n"
@para.gsub!(/<!Th?¡\s+c\d+?;.+!>/,"#{@@start_table}")
end
if @para =~/<!TZ!>/
@para.gsub!(/<!TZ!>/," #@end_table")
end
@para.gsub!(/<!¡/,'')
if @@tableheader==1
if @para =~/¡\d+?¡(.+?)(?:¡|!)/
tablefoot=para[/\<!f(.+?)!\>/,1]
@para.gsub!(/\<!f(.+?)!\>/,'')
@para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,
"{\\begin{tiny} {\\bfseries \\1}\\end{tiny}}&")
@para.gsub!(/&>\s*$/,
" #@row_break \\hline\\endhead #@row_break")
@para="#@para \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot
@@tableheader=0
@@number_of_cols=0
end
else
if @para =~/¡\d+?¡(.+?)(?:¡|!)/
@para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,"\\begin{tiny}\\1\\end{tiny}&")
@para.gsub!(/&>\s*$/," #@row_break")
end
end
@para
end
def scopedtable
# some features related to headers have been incorporated in longtable
# that are not included yet here, so until synced is broken on some
# input files, work needs to be done if is to work as before
@end_table="\\end{tabular}"
@row_break='\\\\\\\\'
@break_page="#@row_break\n#@row_break \n"
if @para[/<!Th?¡\s+c(\d+);(.+?)!>/i]
no_of_cols,cols_width=$1,$2
@w=cols_width.split(/;\s+/)
@colW=[]
@w.each do |x|
col_w=((x.to_i*12)/100.00).to_s #unless x.nil?
@colW << "p{#{col_w}cm}" if col_w
end
@@start_table="\\begin{tabular}{#@colW}\n"
@para.gsub!(/<!Th?¡\s+c\d+?;.+!>/,"#{@@start_table}")
end
if @para =~/<!TZ!>/
@para.gsub!(/<!TZ!>/,"#@end_table")
@@table_pg_break_counter=1
end
if @para =~/<!¡/
if @@table_pg_break_counter==28 # taken from 34 ideal for portrait to 28 which suits landscape
@para =
"\n\n#@end_table \n" +
"#@break_page" +
"#{@@start_table}\n"
@@table_pg_break_counter=1
else
@para.gsub!(/<!¡/,'')
@@table_pg_break_counter+=1
tablefoot=@para[/\<!f(.+?)!\>/]
@para.gsub!(/\<!f(.+?)!\>/,'')
end
end
if @para =~/¡\d+?¡(.+?)(?:¡|!)/
@para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,"\\begin{tiny}\\1\\end{tiny}&")
@para.gsub!(/&>\s*$/,"#@row_break")
end
@para
end
def graphics
dir=SiSU_Env::Info_env.new(@md.fns)
@para.gsub!(/<::\s+(\S+?)\s+>/i, #watch
"\\includegraphics*[width=11pt]{#{dir.path.image_source_tex}/c_\\1.png}")
end
def image
dir=SiSU_Env::Info_env.new(@md.fns)
width="100"
width=@para[/<:image.+?width=``(\d+)''.+?>/im,1]
width=width.to_i*0.4
@para.gsub!(/<:image\s+((?:https?|ftp)\S+)\s+(\S+)\s+.+\s+?>/i,
"\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/\\2}}")
@para.gsub!(/<:image\s+(\S+)\s+.+\s+?>/i,
"\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/\\1}")
end
def png
# very messy clean up ! - work area, testing
z=@para[/\\\{(.+?)\}(?:image|png)/,1] # match operator for z \\ fragile !
image,w,x,y=z.scan(/\S+/)
image.gsub!(/\\/,'')
@para.gsub!(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,"<image #{image} not available>") # fragile match operator\\ fragile !
end
def http
# very messy clean up ! - work area, testing
z=@para[/\\\{(.+?)\}(?:https?|ftp):\/\//,1] # match operator for z \\ fragile !
url=@para[/((?:https?|ftp):\S+)/im,1]
if @para =~/\.(png|jpg|gif)/
image,w,x,y=z.scan(/\S+/)
image.gsub!(/\\/,'')
width=200
width=z[/w=(\d+)/im,1] if z =~/w=(\d+)/
width=width.to_i*0.8
width=400 if width > 400
c=z[/``(.+?)''/im,1]
caption="{\\\\\\\ \n\\begin{scriptsize}#{c}\\end{scriptsize}&}" if c
end
if image
dir=SiSU_Env::Info_env.new(@md.fns)
@para.gsub!(/\{\S+\.(png|jpg|gif).+?\}(?:https?|ftp):\/\/\S+/, # fragile match operator\\ fragile !
"\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/#{image}}}#{caption}")
else
link=z[/(.+?)\\/im,1]
@para.gsub!(/\{.+?\}(?:https?|ftp):\/\/\S+/,"\n\\noindent\\href{#{url}}{#{link}}") # fragile match operator\\ fragile !
end
end
end
end
__END__
|