aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/html_tune.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/html_tune.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/html_tune.rb')
-rw-r--r--lib/sisu/v0/html_tune.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb
index 639ecd26..0b861526 100644
--- a/lib/sisu/v0/html_tune.rb
+++ b/lib/sisu/v0/html_tune.rb
@@ -244,10 +244,10 @@ module SiSU_Tune
def urls(data)
@words=[]
data.each do |word|
- @words << if word=~/\{(.+?)\}((?:https?|ftp)\S+|image)/
- if word =~/\{(.+?)\}((?:https?|ftp)\S+|image)([;.,]?(?:\s|$))/
- m,u,d=/\{(.+?)\}((?:https?|ftp)\S+|image)([;.,]?(?:\s|$))/.match(word).captures
- else m,u=/\{(.+?)\}((?:https?|ftp)\S+|image)/.match(word).captures
+ @words << if word=~/\{(.+?)\}((?:https?|file|ftp)\S+|image)/
+ if word =~/\{.+?\}(?:(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)[;.,]?(?:\s|$)/
+ m,u,d=/\{(.+?)\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)([;.,]?(?:\s|$))/.match(word).captures
+ else m,u=/\{(.+?)\}((?:https?|file|ftp)\S+|image)/.match(word).captures
d=''
end
case m
@@ -265,13 +265,13 @@ module SiSU_Tune
%{<a href="#{u}"><img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0"></a>#{caption}}
else %{<img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0">#{caption}}
end
- word.gsub!(/\{.+?\}((?:https?|ftp)\S+|image)/,ins)
+ word.gsub!(/\{.+?\}((?:https?|file|ftp)\S+|image)/,ins)
else
link=m[/(.+)/m]
png=m.scan(/\S+/)[0].strip
link=link.strip
ins=%{<a href="#{u}">#{link}</a>#{d}}
- word.gsub!(/\{.+?\}(?:https?|ftp)\S+/,ins)
+ word.gsub!(/\{.+?\}(?:https?|file|ftp)\S+/,ins)
end
word
else word
@@ -304,8 +304,8 @@ module SiSU_Tune
para.gsub!(/<:image\s+(\S+)\s+>/,
%{<img src="#{@env.url.images_local}/\\1" naturalsizeflag="0" align="bottom" border="0">})
end
- if para =~/\{.+?\}((?:http|ftp)\S+|image)/
- @word_mode=para.scan(/\{.+?\}(?:(?:https?|ftp)\S+|image)|\S+/)
+ if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/
+ @word_mode=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|\S+/)
word_mode=urls(@word_mode)
words=word_mode.join(' ')
para.gsub!(/.+/,words)
@@ -326,9 +326,9 @@ module SiSU_Tune
if (para =~/\b\S+\@\S+?\.\S+/ and para !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/)
para.gsub!(/\b(\S+\@\S+?\.\S+)(\s)/,'&lt;<a href="mailto:\1">\1</a>&gt;\2')
end
- para.gsub!(/\b[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration
- para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url
- para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration
+ para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration
+ para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url
+ para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration
if (para =~/..\/\S+/ and para !~/(\"..\/\S+?\"|>\s*..\/\S+<)/)
para.gsub!(/(\.\.\/\S+)/,'<a href="\1">\1</a>')
end