aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/texpdf_format.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2007-09-23 05:16:21 +0100
committerRalph Amissah <ralph@amissah.com>2007-09-23 05:16:21 +0100
commit50d45c6deb0afd2e4222d2e33a45487a9d1fa676 (patch)
tree100c62d678f009139999bf77c26c81653a721eeb /lib/sisu/v0/texpdf_format.rb
parentsisu-0.58.3 + md5s (diff)
primarily todo with sisu documentation, changelog reproduced below:
* start documenting sisu using sisu * sisu markup source files in data/doc/sisu/sisu_markup_samples/sisu_manual/ /usr/share/doc/sisu/sisu_markup_samples/sisu_manual/ * default output [sisu -3] in data/doc/manuals_generated/sisu_manual/ /usr/share/doc/manuals_generated/sisu_manual/ (adds substantially to the size of sisu package!) * help related edits * manpage, work on ability to generate manpages, improved * param, exclude footnote mark count when occurs within code block * plaintext changes made * shared_txt, line wrap visited * file:// link option introduced (in addition to existing https?:// and ftp://) a bit arbitrarily, diff here, [double check changes in sysenv and hub] * minor adjustments * html url match refinement * css added tiny_center * plaintext * endnotes fix * footnote adjustment to make more easily distinguishable from substantive text * flag -a only [flags -A -e -E dropped] controlled by modifiers --unix/msdos --footnote/endnote * defaults, homepage * renamed homepage (instead of index) implications for modifying skins, which need likewise to have any homepage entry renamed * added link to sisu_manual in homepage * css the css for the default homepage is renamed homepage.css (instead of index.css) [consider removing this and relying on html.css] * ruby version < ruby1.9 * place stop on installation and working with for now [ruby String.strip broken in ruby 1.9.0 (2007-09-10 patchlevel 0) [i486-linux], 2007-09-18:38/2] * debian/control restrict use to ruby > 1.8.4 and ruby < 1.9 * debian * debian/control restrict use to ruby > 1.8.4 and ruby < 1.9 * sisu-doc new sub-package for sisu documentation debian/control and sisu-doc.install
Diffstat (limited to 'lib/sisu/v0/texpdf_format.rb')
-rw-r--r--lib/sisu/v0/texpdf_format.rb40
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb
index d86c053a..83fd90a1 100644
--- a/lib/sisu/v0/texpdf_format.rb
+++ b/lib/sisu/v0/texpdf_format.rb
@@ -498,11 +498,11 @@ WOK
@string.gsub!(/&\S+?;/,' ')
@string.gsub!(/<a href=".+?">/,' ')
@string.gsub!(/<\/a>/,' ')
- @string.gsub!(/[^\}>_]((?:https?|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case
- @string.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url
- @string.gsub!(/\B(?:\\_|\\)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration
+ @string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case
+ @string.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url
+ @string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration
unless @@flag_code
- @string.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start
+ @string.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start
else #code-block: angle brackets special characters, note _ already escaped
@string.gsub!(/\\_</,'{\UseTextSymbol{OML}{<}}')
@string.gsub!(/\\_>/,'{\UseTextSymbol{OML}{>}}')
@@ -724,7 +724,7 @@ WOK
else
tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_tex}")
tell.error2 unless @md.cmd =~/q/
- @string.gsub!(/\{\S+\.(png|jpg|gif).+?\}(?:https?|ftp):\/\/\S+/,'') # fragile match operator\\ fragile !
+ @string.gsub!(/\{\S+\.(png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+/,'') # fragile match operator\\ fragile !
end
end
def image
@@ -744,7 +744,7 @@ WOK
nil
end
if image_source
- @string.gsub!(/<:image\s+((?:https?|ftp)\S+)\s+(\S+)\s+.+\s+?>/,
+ @string.gsub!(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/,
@center_begin + "\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{image_source}/\\2}}" + @center_end )
@string.gsub!(/<:image\s+(\S+)\s+.+\s+?>/,
@center_begin + "\\includegraphics*[width=#{width}pt]{#{image_source}/\\1}" + @center_end )
@@ -794,15 +794,15 @@ WOK
dir=SiSU_Env::Info_env.new(@md.fns)
@words=[]
@string.each do |word|
- @words << if word=~/\\\{.+?\\\}(?:https?|ftp):\S+/
- if word =~/\\\{(.+?)\\\}((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/
- r=%r/\\\{(.+?)\\?\}((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/
- d=/\\\{.+?\\?\}(?:https?|ftp):\/\/\S+?\.[^'"><\s]+?([;.,]?(?:\s|$))/.match(word).captures.to_s
-# if word =~/\\\{(.+?)\\\}((?:https?|ftp)\S+?)([;.,]?(?:\s|$))/
-# r=%r/\\\{(.+?)\\?\}((?:https?|ftp):\S+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/
-# d=/\\\{.+?\\?\}(?:https?|ftp):\S+?([;.,]?(?:\s|$))/.match(word).captures.to_s
+ @words << if word=~/\\\{.+?\\\}(?:https?|file|ftp):\S+/
+ if word =~/\\\{(.+?)\\\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/
+ r=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/
+ d=/\\\{.+?\\?\}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?([;.,]?(?:\s|$))/.match(word).captures.to_s
+# if word =~/\\\{(.+?)\\\}((?:https?|file|ftp)\S+?)([;.,]?(?:\s|$))/
+# r=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\S+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/
+# d=/\\\{.+?\\?\}(?:https?|file|ftp):\S+?([;.,]?(?:\s|$))/.match(word).captures.to_s
else
- r=%r/\\\{(.+?)\\?\}((?:https?|ftp):\S+)/
+ r=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\S+)/
d=''
end
z,url=r.match(word).captures if word =~r
@@ -845,29 +845,29 @@ WOK
"{\\includegraphics*[width=#{width}pt]" +
"{#{dir.path.image_source_local_tex}/#{image}}}" +
"#{caption}" +
- @center_end if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|ftp):\/\/\S+)/
+ @center_end if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/
elsif @md.fns =~/\.-ss[tm]$/ and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}")
@center_begin +
"\\\n\\href{#{url}}" + #not satisfactory: \\ added to ^line to mimic reference file output
"{\\includegraphics*[width=#{width}pt]" +
"{#{dir.path.image_source_remote_tex}/#{image}}}" +
"#{caption}" +
- @center_end if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|ftp):\/\/\S+)/
+ @center_end if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/
elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}")
@center_begin +
"\\\n\\href{#{url}}\n" + #not satisfactory: \\ added to ^line to mimic reference file output, mirror above ... not tested
"{\\includegraphics*[width=#{width}pt]" +
"{#{dir.path.image_source_tex}/#{image}}}" +
"#{caption}" +
- @center_end if word =~/(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|ftp):\/\/\S+)/
+ @center_end if word =~/(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/
else
tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}")
tell.error2 unless @md.cmd =~/q/
- '' if word =~ /\{\S+\.(png|jpg|gif).+?\}(?:https?|ftp):\/\/\S+/
+ '' if word =~ /\{\S+\.(png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+/
end
else
link=z.strip #[/(.+?)\\/m,1]
- word="\\href{#{url}}{#{link}}#{d}" if word =~/\\\{.+?\\\}(?:https?|ftp):\/\/\S+/
+ word="\\href{#{url}}{#{link}}#{d}" if word =~/\\\{.+?\\\}(?:https?|file|ftp):\/\/\S+/
end
else word
end
@@ -875,7 +875,7 @@ WOK
@words.join
end
def http(orientation)
- wm=@string.dup.scan(/\\\{.+?\\\}(?:(?:https?|ftp):\S+|image)|\w+\s*|./m) #first match of interest others passed through
+ wm=@string.dup.scan(/\\\{.+?\\\}(?:(?:https?|file|ftp):\S+|image)|\w+\s*|./m) #first match of interest others passed through
@string=SiSU_TeX_Pdf::Format_text_object.new(@md,wm).http_word_mode(orientation)
end
def language