aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2007-10-07 14:09:03 +0100
committerRalph Amissah <ralph@amissah.com>2007-10-07 14:09:03 +0100
commit3804f096e2dd3c82ace274463df6b9b0767fbb60 (patch)
tree316e764d44a64ff5ac4cea661f72963127c0a4c8
parentdal, fix shortcult for listing available generated output (without source); h... (diff)
cleaning, and make sure in xml &#160; rather than &nbsp; is used
-rw-r--r--CHANGELOG2
-rw-r--r--lib/sisu/v0/html_segments.rb10
-rw-r--r--lib/sisu/v0/html_tune.rb7
-rw-r--r--lib/sisu/v0/shared_html_lite.rb10
-rw-r--r--lib/sisu/v0/shared_xml.rb26
-rw-r--r--lib/sisu/v0/texpdf_format.rb7
-rw-r--r--lib/sisu/v0/xhtml.rb19
-rw-r--r--lib/sisu/v0/xml.rb21
8 files changed, 20 insertions, 82 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 1fb7284b..732a1076 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -16,6 +16,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.60.1.orig.tar.gz
* html, where no ocn selected, keep ocn id, just remove visible reference to
ocn, as search result links will continue to function
+ * xml, make sure &#160; is used instead of &nbsp;
+
* sisu_manual, link to markup and book examples updated/corrected
%% sisu_0.60.0.orig.tar.gz (2007-10-03:40/3)
diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb
index fe2966df..18ed11ec 100644
--- a/lib/sisu/v0/html_segments.rb
+++ b/lib/sisu/v0/html_segments.rb
@@ -178,10 +178,10 @@ module SiSU_HTML_seg
markup(pg)
end
end
- Seg.new(para,@md).txt
+ #Seg.new(para,@md).txt
if testforartnum[tracking-1] =~/endnote/
if printed_endnote_seg == 'n'
- Seg.new(para,@md).endnote
+ #Seg.new(para,@md).endnote
printed_endnote_seg='y'
end
end
@@ -344,15 +344,11 @@ module SiSU_HTML_seg
end
end
end
- def txt
- end
- def endnote
- end
def tail
format_head_seg=SiSU_HTML_Format_type::Head_seg.new(@md)
if @md.flag_auto_endnotes
@@seg[:tail] << format_head_seg.endnote_mark
- @@seg[:tail] << @@seg_endnotes[@@get_hash_fn] #endnotes deposited at end of individual segments||@|EXTRACTION OF ENDNOTES|
+ @@seg[:tail] << @@seg_endnotes[@@get_hash_fn] #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES|
end
@@seg[:tail] << '<table summary="whitespace"><tr><td>&nbsp;</td></tr></table>'
ads=SiSU_HTML_promo::Ad.new(@md)
diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb
index 0b861526..b98f19d8 100644
--- a/lib/sisu/v0/html_tune.rb
+++ b/lib/sisu/v0/html_tune.rb
@@ -278,7 +278,7 @@ module SiSU_Tune
end
word
end
- @words
+ @words=@words.join(' ')
end
def url_markup
data=@data
@@ -306,9 +306,8 @@ module SiSU_Tune
end
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)
+ words=urls(@word_mode)
+ para.gsub!(/.+/m,words)
end
if (para !~/^0~|^<:code>/)
para.gsub!(/\\copyright/i,%{<sup>&copy;</sup>})
diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb
index f258f0a9..85368a28 100644
--- a/lib/sisu/v0/shared_html_lite.rb
+++ b/lib/sisu/v0/shared_html_lite.rb
@@ -93,7 +93,7 @@ module SiSU_Format_Shared
else m,u=/\{(.+?)\}((?:https?|file|ftp)\S+|image)/.match(word).captures
d=''
end
- case m
+ word=case m
when /\.png|\.jpg|\.gif|c=|\d+x\d+/
w,h=/(\d+)x(\d+)/.match(m).captures if m =~/\d+x\d+/
w=%{width="#{w}"} if w
@@ -117,20 +117,18 @@ module SiSU_Format_Shared
#ins=%{#{link} <a href="#{u}">[link]</a>#{d}}
word.gsub!(/\{.+?\}(?:https?|file|ftp)\S+/,ins)
end
- word
else word
end
word
end
- @words
+ @words=@words.join(' ')
end
def markup(para)
if para !~/^<:code>/
if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/
wm=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|\S+/)
- word_mode=urls(wm)
- words=word_mode.join(' ')
- para.gsub!(/.+/,words)
+ words=urls(wm)
+ para.gsub!(/.+/m,words)
end
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
diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb
index 135f368e..4b9ccb12 100644
--- a/lib/sisu/v0/shared_xml.rb
+++ b/lib/sisu/v0/shared_xml.rb
@@ -355,22 +355,18 @@ module SiSU_XML_munge
para.gsub!(/<0;\w\d+;[um]\d+><#@dp:#@dp>/,'')
if para !~/^<:code>/
#embeds a red-bullet image -->
- #para.gsub!(/^(<:i[1-9]>\s*_\*)\s+/,'\1 <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="/usr/share/sisu/image/bullet_09.png" width="12" height="12" alt="*" /> ')
- #para.gsub!(/^_\*\s+/,'<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="/usr/share/sisu/image/bullet_09.png" width="12" height="12" alt="*" /> ')
para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\2" width="\\3" height="\\4" />[\\2] \\5})
para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\2"/>\\2})
para.gsub!(/(^|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/,
'\1<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\3">\2</link>\4') #watch, compare html_tune
- #para.gsub!(/\B\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/,
- # '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>\3') #watch, compare html_tune
para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,
%{\\1#{@url_brace.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\2">\\2</link>#{@url_brace.xml_close}\\3})
- #para.gsub!(/\b((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/, #also works
- #%{#{@url_brace.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\1">\\1</link>#{@url_brace.xml_close}\\2})
para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>\2') #escaped urls not linked, deal with later
- #para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\2</link>\3') #escaped urls not linked, deal with later
- para.gsub!(/&nbsp;/,' ') #clean
- else para.gsub!(/_</m,'&lt;'); para.gsub!(/_>/m,'&gt;') #code-block: angle brackets special characters
+ para.gsub!(/&nbsp;/,'&#160;')
+ #para.gsub!(/&nbsp;/,' ') #clean
+ else
+ para.gsub!(/_</m,'&lt;'); para.gsub!(/_>/m,'&gt;') #code-block: angle brackets special characters
+ para.gsub!(/&nbsp;/,'&#160;')
end
para
end
@@ -386,7 +382,8 @@ module SiSU_XML_munge
para.gsub!(/&([^;]{1,5})/,'&amp;\1') #sort, rough estimate, revisit #WATCH found in node not sax
para.gsub!(/\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/,
"<image.path>#{@dir.url.images_local}\/\\1</image.path>")
- para.gsub!(/&nbsp;/,' ')
+ para.gsub!(/&nbsp;/,'&#160;')
+ #para.gsub!(/&nbsp;/,' ') #clean
wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17
para=tidywords(wordlist).join(' ').strip
para
@@ -412,15 +409,6 @@ module SiSU_XML_tags #Format
if @md.dc_title # DublinCore 1 - title
@rdf_title=%{ dc.title="#{seg_name}#{@md.dc_title}"\n}
@dc_title=%{ <meta name="dc.title" content="#{seg_name}#{@md.dc_title}" />\n}
- #if @md.subtitle
- # @rdf_title=%{ dc.title="#{seg_name}#{@md.title} - #{@md.subtitle}"\n}
- # @title=%{<meta name="dc.title" } +
- # %{content="#{seg_name}#{@md.title} - #{@md.subtitle}" />\n}
- #else
- # @rdf_title=%{ dc.title="#{seg_name}#{@md.title}"\n}
- # @title=%{<meta name="dc.title" } +
- # %{content="#{seg_name}#{@md.title}" />\n}
- #end
end
if @md.dc_creator # DublinCore 2 - creator/author (author)
@rdf_creator=%{ dc.creator="#{@md.dc_creator}"\n}
diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb
index 55f1e19a..51681ce7 100644
--- a/lib/sisu/v0/texpdf_format.rb
+++ b/lib/sisu/v0/texpdf_format.rb
@@ -798,9 +798,6 @@ WOK
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?|file|ftp):\S+)/
d=''
@@ -820,8 +817,6 @@ WOK
when /a5/; @tx.a5
else @tx.a4
end
- ##dm=SiSU_Env::Get_init.instance.tex(@md.papersize).dimensions #test!
- #dm=SiSU_Viz::TeX.new(@md.papersize).dimensions
width=if orientation =~/portrait/ #value is not currently passed
width=if width.to_i > dm.portrait.img_px; dm.portrait.img_px
else width
@@ -875,7 +870,7 @@ WOK
@words.join
end
def http(orientation)
- wm=@string.dup.scan(/\\\{.+?\\\}(?:(?:https?|file|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)
@string=SiSU_TeX_Pdf::Format_text_object.new(@md,wm).http_word_mode(orientation)
end
def language
diff --git a/lib/sisu/v0/xhtml.rb b/lib/sisu/v0/xhtml.rb
index 1d7d63d1..6b91f34f 100644
--- a/lib/sisu/v0/xhtml.rb
+++ b/lib/sisu/v0/xhtml.rb
@@ -190,25 +190,6 @@ WOK
else ''
end
end
- def xml_structure_ee(para='',lv='',ocn='',hname='') #embedded endnotes
- lv=lv.to_i
- n=lv - 1
- n3=lv + 2
- lv=nil if lv == 0
- embedded_endnotes(para)
- if para[@regx]
- paragraph="#{para[@regx,2]}"
- util=SiSU_text_utils::Wrap.new(paragraph,70)
- wrapped=util.line_wrap
- end
- @@xml[:body] << "#{@tab*0}<object>" << "\n" if para[@regx]
- @@xml[:body] << "#{@tab*1}<ocn>#{para[@regx,3]}</ocn>" << "\n" if para[@regx,3]
- @@xml[:body] << if lv; %{#{@tab*1}<text class="h#{lv}">#{wrapped}</text>\n} << "\n"
- else %{#{@tab*1}<text class="norm">#{wrapped}</text>\n} # main text, contents, body KEEP
- end
- ##@@xml[:body] << "#{@tab*1}<text>#{para[@regx,2]}</text>\n" if para[@regx,2] # old unwrapped main text, contents, body KEEP
- @@xml[:body] << "#{@tab*0}</object>" << "\n" if para[@regx]
- end
def xml_structure(para='',lv='',ocn='',hname='',type='norm') #extracted endnotes
lv=lv.to_i
n=lv - 1
diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb
index 2dd25491..b230ec9f 100644
--- a/lib/sisu/v0/xml.rb
+++ b/lib/sisu/v0/xml.rb
@@ -214,26 +214,6 @@ WOK
end
@@xml[:sc]=sc
end
- def xml_structure_ee(para='',lv='',ocn='',hname='') #embedded endnotes
- lv=lv.to_i
- n=lv - 1
- n3=lv + 2
- lv=nil if lv == 0
- embedded_endnotes(para)
- if para[@regx]
- paragraph="#{para[@regx,2]}"
- util=SiSU_text_utils::Wrap.new(paragraph,70)
- wrapped=util.line_wrap
- end
- @@xml[:body] << "#{@tab*0}<object>" << "\n" if para[@regx]
- @@xml[:body] << "#{@tab*1}<ocn>#{para[@regx,3]}</ocn>" << "\n" if para[@regx,3]
- @@xml[:body] << if lv; %{#{@tab*1}<text class="h#{lv}">#{wrapped}</text>\n} << "\n"
- else %{#{@tab*1}<text class="norm">#{wrapped}</text>\n} # main text, contents, body KEEP
- end
- #@@xml[:body] << "#{@tab*1}<text>#{wrapped}</text>\n" # main text, contents, body KEEP
- ##@@xml[:body] << "#{@tab*1}<text>#{para[@regx,2]}</text>\n" if para[@regx,2] # old unwrapped main text, contents, body KEEP
- @@xml[:body] << "#{@tab*0}</object>" << "\n" if para[@regx]
- end
def xml_structure(para='',lv='',ocn='',hname='',type='norm') #extracted endnotes
lv=lv.to_i
n=lv - 1
@@ -249,7 +229,6 @@ WOK
@@xml[:body] << if para[@regx,3]; %{#{@tab*0}<object id="#{para[@regx,3]}">} << "\n"
else "#{@tab*0}<object>" << "\n" if para[@regx]
end
- #@@xml[:body] << "#{@tab*1}<heading>#{lv}</heading>" << "\n" if lv
@@xml[:body] << "#{@tab*1}<ocn>#{para[@regx,3]}</ocn>" << "\n" if para[@regx,3]
@@xml[:body] << if lv; %{#{@tab*1}<text class="h#{lv}">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} << "\n"
else %{#{@tab*1}<text class="#{type}">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} # main text, contents, body KEEP