From b130d967b295b548d837ea5f603a6b0fec7a08a8 Mon Sep 17 00:00:00 2001
From: Ralph Amissah
|\n|$)}
@line_scan_ital=if defined? @md.make_italic[:str] and defined? @vz.markup_make_italic[:str]
/#@http_m|#{bold_line}|#@manmkp_ital#{tail_m_ital}|(?:#{@md.make_italic[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/
elsif defined? @md.make_italic[:str]
@@ -120,9 +120,10 @@ module Syntax
line
end
def embolden(given)
- given.gsub!(/(?:^!_|^[789]~)\s+(.+?)\s+((?:[*]~\S+\s*)+)/,'\1 \2')
- given.gsub!(/(?:^!_|^[789]~)\s+(.+?)\s*([~-]#)$/,'\1 \2')
- given.gsub!(/(?:^!_\s+|^[789]~\s+)(.*)?\s*$/,'\1')
+ given.gsub!(/(?:^!_|^[7-9]~)\s+(.+?)(
)/,'\1\2')
+ given.gsub!(/(?:^!_|^[7-9]~)\s+(.+?)\s+((?:[*]~\S+\s*)+)/,'\1 \2')
+ given.gsub!(/(?:^!_|^[7-9]~)\s+(.+?)\s*([~-]#)$/,'\1 \2')
+ given.gsub!(/(?:^!_\s+|^[7-9]~\s+)(.*)?\s*$/,'\1')
end
def wordlist_bold(line)
line=line.dup
@@ -140,7 +141,7 @@ module Syntax
w.gsub!(@vz.markup_make_bold,'\1')
end
else
- if w =~ /(?:^!_|^[789]~)\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
+ if w =~ /(?:^!_|^[7-9]~)\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
end
end
line_array << w
@@ -149,7 +150,7 @@ module Syntax
else line
end
else
- if line !~/^(?:[0-9]~|%+\s)/ and line =~ /(?:^!_|^[789]~)\s+/; embolden(line)
+ if line !~/^(?:[0-9]~|%+\s)/ and line =~ /(?:^!_|^[7-9]~)\s+/; embolden(line)
end
end
line
@@ -172,8 +173,10 @@ module Syntax
# ~{endnote}~
# !_ #bold/emphasise paragraph
# _" #blockquote paragraph
- # _1 #indent paragraph 1 step
- # _2 #indent paragraph 2 steps
+ # _1 <:i1> #indent paragraph 1 step
+ # _2 <:i2> #indent paragraph 2 steps
+ # _3 <:i3> #indent paragraph 3 steps
+ # _4 <:i4> #indent paragraph 4 steps
# _* #bullet (list)
# _1* #bullet (list) indented
# _1* #bullet (list) indented
@@ -255,17 +258,15 @@ module Syntax
line.gsub!(/(^|\s+)-([^{]\S+?)-( |$)/,'\1\2\3') #underscore single word, watch
line.gsub!(/(^|\s+|['"]| |\(|\>|\d+)\^(\S+?)\^/,'\1\2') #superscript single word, watch digit added
line.gsub!(/<[:e]\s+(.+?)!?>/,'~{ \1 }~') # not tested
- line.gsub!(/^\s*_([12])(\*+)\s*/,'<:i\1> _* ') #bullets, shortcut
- line.gsub!(/^\s*_([12])\s+/,'<:i\1> ') #indent
+ line.gsub!(/^\s*_([1-9])(\*+)\s*/,'<:i\1> _* ') #bullets, shortcut
+ line.gsub!(/^\s*_([1-9])\s+/,'<:i\1> ') #indent
line.gsub!(/(?:
|
)\s*_[12]\s+/,'
') #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ')
- #line.gsub!(/^\s*_([12])\s+/,"<:i\\1> ")
- #line.gsu!b!(/^\s*_([12])\s+/," ") #indent line
line.gsub!(/<:?br>/,'
') #adjustment 2004w41, from # line.gsub!(/
/,'
')
##added
- #line.gsub!(/(?:^!_\s+|^[78]~\s+|<:b>)(.*)?([~-]#)$/i,"\\1 \\2") #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
- #line.gsub!(/(?:^!_\s+|^[78]~\s+|<:b>)(.*)?\s*$/i,"\\1") #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
- #line.gsub!(/(?:(?:^| )!_ |^[78]~ |<:b>)(.*)\n/mi,"\\1 ") #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
- #line.gsub!(/^_" (.*)\n/i,"\\1
") #blockquotes #introduce KEEP
+ #line.gsub!(/(?:^!_\s+|^[7-9]~\s+|<:b>)(.*)?([~-]#)$/i,'\1 \2') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
+ #line.gsub!(/(?:^!_\s+|^[7-9]~\s+|<:b>)(.*)?\s*$/i,'\1') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
+ #line.gsub!(/(?:(?:^| )!_ |^[7-9]~ |<:b>)(.*)\n/mi,'\1 ') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
+ #line.gsub!(/^_" (.*)\n/i,'\1
') #blockquotes #introduce KEEP
line.gsub!(/<:hi>/,'') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200)
line.gsub!(/<:\/hi>/,'')
line.gsub!(/(<:verse>.+)/m,"\\1\n")
@@ -319,8 +320,8 @@ module Syntax
line.gsub!(/(^|\s+|['"]|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/,'\1\2\3') #italics single word, watch
line.gsub!(/(^|\s+|['"]|\(|\>)_(\S+?)_/,'\1\2') #underscore single word, watch
line.gsub!(/(^|\s+|['"]|\(|\>|\d+)\^(\S+?)\^/,'\1\2') #superscript single word, watch digit added
- line.gsub!(/^\s*_([12])(\*+)\s*/,"<:i\\1> _* ") # bullets, shortcut
- line.gsub!(/^\s*_([12])\s+/,'<:i\1> ')
+ line.gsub!(/^\s*_([1-9])(\*+)\s*/,'<:i\1> _* ') # bullets, shortcut
+ line.gsub!(/^\s*_([1-9])\s+/,'<:i\1> ')
line.gsub!(/<:?br>/,'
')
end
@data
diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb
index 3e1c72cc..459cb806 100644
--- a/lib/sisu/v0/db_import.rb
+++ b/lib/sisu/v0/db_import.rb
@@ -85,7 +85,6 @@ module SiSU_DB_import
def marshal_load
require "#{SiSU_lib}/dal"
@dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- #@dal_array.each { |x| puts x.inspect; sleep 1 }
tell=SiSU_Screen::Ansi.new(@opt.cmd,"#{@db.db_psql}::#{@opt.fns}")
tell.puts_blue unless @opt.cmd =~/q/
tell=SiSU_Screen::Ansi.new(@opt.cmd,'Marshal Load',@fnm)
@@ -111,7 +110,7 @@ module SiSU_DB_import
end
end
def special_character_escape(string)
- string.gsub!(/'/,"''")
+ string.gsub!(/'/,"''") #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'")
string.gsub!(/<:br>/,"
\n")
string.gsub!(/<:(?:code|alt|group|verse)(?:-end)?>/,'')
string.gsub!(/<:name#\S+?>/,'')
diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb
index c81b91d2..3713acae 100644
--- a/lib/sisu/v0/defaults.rb
+++ b/lib/sisu/v0/defaults.rb
@@ -206,6 +206,27 @@ module SiSU_Viz
def url_promo_home
''
end
+ def url_decoration
+ def tex_open
+ '{\UseTextSymbol{OML}{<}}'
+ end
+ def tex_close
+ '{\UseTextSymbol{OML}{>}}'
+ end
+ def xml_open
+ '<'
+ end
+ def xml_close
+ '>'
+ end
+ def txt_open
+ '<'
+ end
+ def txt_close
+ '>'
+ end
+ self
+ end
#% color
def color_shadow
'"4"'
diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb
index 1d9491dd..9af0f758 100644
--- a/lib/sisu/v0/html.rb
+++ b/lib/sisu/v0/html.rb
@@ -199,11 +199,11 @@ module SiSU_HTML
@format,@text,@ocn=$1,$2,$3
end
else
- if @para[/^(?:_1\*|<:i[12]>\s*_\*)\s+(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m]
- @format,@text,@ocn='_1*',$1,$2,$3
+ if @para[/^(?:<:i([1-9])>\s*_\*)\s+(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m]
+ @format,@text,@ocn="_#{$1}\*",$2,$3,$4
elsif @para[/^(_\*)\s+(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m]
@format,@text,@ocn=$1,$2,$3
- elsif @para[/<:(i[12])>\s*(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m]
+ elsif @para[/<:(i[1-9])>\s*(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m]
@format,@text,@ocn=$1,$2,$3
elsif @para[/<:(code|alt|verse|group)>(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m]
@format,@text,@ocn=$1,$2,$3
diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb
index 73c97358..0899447e 100644
--- a/lib/sisu/v0/html_format.rb
+++ b/lib/sisu/v0/html_format.rb
@@ -917,7 +917,6 @@ WOK
@@dp=nil
attr_accessor :md,:one,:two,:three,:parablock,:table,:link,:linkname,:format,:paranum,:p_num,:para_id,:headname,:margin,:paragraph,:table,:banner,:url,:icon,:font,:one_stripped
def initialize(md='',*txt)
- #txt[0].gsub!(/\.(html|pdf|php)/,'') if txt[0] =~/\.\.\/\S+/
@md,@one,@two,@three=md,txt[0],txt[1],txt[2]
rgx=/^[1-6-]~/
@one_stripped=@one.gsub(rgx,'') if @one =~rgx
@@ -927,7 +926,7 @@ WOK
@link,@linkname=txt[0],txt[1]
@format,parablock=txt[0],txt[1]
@parablock=parablock
- ##speed hit does not justify action:
+ ##performance hit does not justify action:
#@parablock=if parablock=~/\S+/ and parablock !~/\s*)?\((i+|iv|v|vi+|ix|x|xi+)\)/
+ when /^(?:<:i[1-9]>\s*)?\((i+|iv|v|vi+|ix|x|xi+)\)/
@one.gsub!(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'(\1)')
- @one.gsub!(/^(<:i[12]>)\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1(\2)')
- when /^(?:<:i[12]>\s*)?\(?(\d|[a-z])+\)/
+ @one.gsub!(/^(<:i[1-9]>)\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1(\2)')
+ when /^(?:<:i[1-9]>\s*)?\(?(\d|[a-z])+\)/
@one.gsub!(/^\((\d+|[a-z])+\)/,'(\1)')
- @one.gsub!(/^(<:i[12]>)\s*\((\d+|[a-z])+\)/,'\1(\2)')
+ @one.gsub!(/^(<:i[1-9]>)\s*\((\d+|[a-z])+\)/,'\1(\2)')
when /^\s*\d{1,3}\.\s/
@one.gsub!(/^\s*(\d+\.)/,'\1')
when /^\s*[A-Z]\.\s/
@@ -1032,6 +1019,17 @@ WOK
+ #@one +
+#{@vz.margin_num_css} + #{@vz.table_close}} end def toc_head_copy_at diff --git a/lib/sisu/v0/html_scroll.rb b/lib/sisu/v0/html_scroll.rb index bc03fc7d..1774fb3f 100644 --- a/lib/sisu/v0/html_scroll.rb +++ b/lib/sisu/v0/html_scroll.rb @@ -86,136 +86,68 @@ module SiSU_HTML_scroll @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) end @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).lev_segname_para_ocn - unless @rcdc - m=/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - if para =~m - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/[12]|_1?\*|\s*_\*|null/ - case @sto.format - when /^1~\S*/; para=@sto.scroll_lev_para_ocn.heading_body1 - when /^2~\S*/; para=@sto.scroll_lev_para_ocn.heading_body2 - when /^3~\S*/; para=@sto.scroll_lev_para_ocn.heading_body3 - when /^4~\S+/; para=@sto.scroll_lev_para_ocn.heading_body4 # work on see Split_text_object4 - when /^5~\S*/; para=@sto.scroll_lev_para_ocn.heading_body5 - when /^6~\S*/; para=@sto.scroll_lev_para_ocn.heading_body6 - when /^_\*$/; para=@sto.scroll_lev_para_ocn.bullet - when /^_1\*$/ + m=/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + if para =~m + format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|_[1-9]?\*|<:i[1-9]>\s*_\*|null/ + case @sto.format + when /^1~\S*/; para=@sto.scroll_lev_para_ocn.heading_body1 + when /^2~\S*/; para=@sto.scroll_lev_para_ocn.heading_body2 + when /^3~\S*/; para=@sto.scroll_lev_para_ocn.heading_body3 + when /^4~\S+/; para=@sto.scroll_lev_para_ocn.heading_body4 # work on see Split_text_object4 + when /^5~\S*/; para=@sto.scroll_lev_para_ocn.heading_body5 + when /^6~\S*/; para=@sto.scroll_lev_para_ocn.heading_body6 + when /^_\*$/; para=@sto.scroll_lev_para_ocn.bullet + when /^_([1-9])\*$/ #indent with bullet + format_txt_obj.gsub_body + para=@sto.scroll_lev_para_ocn.format('li',"i#{$1}") + when /^i([1-9])$/ #indent + format_txt_obj.gsub_body + para=@sto.scroll_lev_para_ocn.format('p',"i#{$1}") + when /^center$/; para=@sto.scroll_lev_para_ocn.center + when /^(?:b|bold)$/; para=@sto.scroll_lev_para_ocn.bold + when /^(?:verse|group|alt)$/; para=@sto.scroll_lev_para_ocn.para + when /^code$/; para=@sto.scroll_lev_para_ocn.code + when /null/ # see whether u can improve + if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ format_txt_obj.gsub_body - para=@sto.scroll_lev_para_ocn.bullet_indent1 - when /^_2\*$/ - format_txt_obj.gsub_body - para=@sto.scroll_lev_para_ocn.bullet_indent2 - when /^i1$/ - format_txt_obj.gsub_body - para=@sto.scroll_lev_para_ocn.indent1 - when /^i2$/ - format_txt_obj.gsub_body - para=@sto.scroll_lev_para_ocn.indent2 - when /^center$/; para=@sto.scroll_lev_para_ocn.center - when /^(?:b|bold)$/; para=@sto.scroll_lev_para_ocn.bold - when /^(?:verse|group|alt)$/; para=@sto.scroll_lev_para_ocn.para - when /^code$/; para=@sto.scroll_lev_para_ocn.code - when /null/ # see whether u can improve - if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ - format_txt_obj.gsub_body - para=@sto.scroll_lev_para_ocn.para - if para =~/<#@dp:#@dp>$/ - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'(.*)/.match(para).captures
- format_scroll=SiSU_HTML_Format_type::Format_scroll.new(@md,one,two)
- end
- else # this is crazy rethink and redo later with some form of inject
- m=/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
- if para =~m
- format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/[12]|null/
- meta=case @sto.format
- when /^1~/; @sto.scroll_lev_para_ocn.heading_body1
- when /^2~/; @sto.scroll_lev_para_ocn.heading_body2
- when /^3~/; @sto.scroll_lev_para_ocn.heading_body3
- when /^4~\S+/; @sto.scroll_lev_para_ocn.heading_body4 # work on see Split_text_object
- when /^5~/; @sto.scroll_lev_para_ocn.heading_body5
- when /^6~/; @sto.scroll_lev_para_ocn.heading_body6
- when /^i1$/
- format_txt_obj.gsub_body
- @sto.scroll_lev_para_ocn.indent1
- when /^i2$/
- format_txt_obj.gsub_body
- @sto.scroll_lev_para_ocn.indent2
- when /^center$/; @sto.scroll_lev_para_ocn.center
- when /^(b|bold)$/; @sto.scroll_lev_para_ocn.bold
- when /null/ # see whether u can improve
- if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/
- format_txt_obj.gsub_body
- @sto.scroll_lev_para_ocn.para
- if para =~/<#@dp:#@dp>$/
- format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,' (.*)/.match(para).captures
+ format_scroll=SiSU_HTML_Format_type::Format_scroll.new(@md,one,two)
end
para.gsub!(//,' ')
para.gsub!(/^<:\S?>/,'')
para.gsub!(/<:\S?>/,' ')
para.strip!
- unless meta; @scr[:body] << para unless para =~/\A\s*\Z/
- else @scr[:metadata] << meta
+ unless @rcdc; @scr[:body] << para unless para =~/\A\s*\Z/
+ else @scr[:metadata] << para
end
+ #unless meta; @scr[:body] << para unless para =~/\A\s*\Z/
+ #else @scr[:metadata] << meta
+ #end
end
end
@scr
diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb
index 96b9a970..8f8f7b53 100644
--- a/lib/sisu/v0/html_segments.rb
+++ b/lib/sisu/v0/html_segments.rb
@@ -279,21 +279,18 @@ module SiSU_HTML_seg
end
if para[/<~(\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+><#@dp:#@dp)>$/]
@sto=SiSU_HTML::Source::Split_text_object.new(@md,para).lev_segname_para_ocn
- format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[12]|_1?\*|<:i[12]>\s*_\*|null/
+ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|_[1-9]?\*|<:i[1-9]>\s*_\*|null/
para=case @sto.format # work area 2003w29 ||@|def lev_segname_para_ocn|
when /^4~\S+/; @sto.seg_lev_para_ocn.header4 # work on see Split_text_object
when /^5~(?:~\S+)?/; @sto.seg_lev_para_ocn.header5
when /^6~(?:~\S+)?/; @sto.seg_lev_para_ocn.header6
when /^_\*$/; @sto.seg_lev_para_ocn.bullet
- when /^_1\*$/
+ when /^_([1-9])\*$/ #indent levels 1-9 with bullet
format_txt_obj.gsub_body
- @sto.seg_lev_para_ocn.bullet_indent1
- when /^i1$/
+ para=@sto.seg_lev_para_ocn.format('li',"i#{$1}")
+ when /^i([1-9])$/ #indent levels 1-9
format_txt_obj.gsub_body
- @sto.seg_lev_para_ocn.indent1
- when /^i2$/
- format_txt_obj.gsub_body
- @sto.seg_lev_para_ocn.indent2
+ para=@sto.seg_lev_para_ocn.format('p',"i#{$1}")
when /^(?:verse|group|alt)$/
@sto.seg_lev_para_ocn.para
when /^code$/
@@ -439,7 +436,7 @@ module SiSU_HTML_seg
try=e_n.split(/ #{c}
Note')
- meta=format_txt_obj.bold_para
- elsif para =~/MetaData/ and para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info
- format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'
MetaData')
- meta=format_txt_obj.bold_para
- elsif para =~/Owner Details/ and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
- format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'
Owner Details')
- @scr[:owner_details]=format_txt_obj.bold_para
- meta=''
- elsif para =~/(¡|<#@dp:#@dp>(.*)/ #ok - bug in equiv for seg 2004w46
- one,two=$1,$2
- format_scroll=SiSU_HTML_Format_type::Format_scroll.new(@md,one,two) #watch #fix
- meta=format_scroll.no_paranum
- end
- meta='' if para =~// and para =~/^(\^~\d+ |)/ # -endnote
- if para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
- case para
- when /<:i1>/
- gsub(/<:i1>/,'')
- format_scroll=SiSU_HTML_Format_type::Format_scroll.new(@md,para)
- meta=format_scroll.indent_one_no_paranum
- when /<:i2>/
- gsub(/<:i2>/,'')
- format_scroll=SiSU_HTML_Format_type::Format_scroll.new(@md,para)
- meta=format_scroll.indent_one_no_paranum
- end
- end
- if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/
- end
- if para =~/<:center>/
- one,two=/(.*)<:center>(.*)/.match(para).captures
- format_scroll=SiSU_HTML_Format_type::Format_scroll.new(@md,one,two)
end
+ elsif para =~/^[1-9]~\S*/ and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
+ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,para)
+ para=format_txt_obj.bold_header
+ elsif para =~/Endnotes?/ and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
+ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'
Note')
+ para=format_txt_obj.bold_para
+ elsif para =~/Owner Details/ and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
+ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'
Owner Details')
+ @scr[:owner_details]=format_txt_obj.bold_para
+ para=''
+ elsif para =~/(.*)<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>(.*)/ #watch
+ one,two=$1,$2
+ format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two)
+ para=format_seg.no_paranum
+ end
+ #para=para.gsub(/ [2-6]~\S+ /,'') #and @md.cmd =~/[VM]/ #arbitrary, watch problematic as too general
+ para='' if (para =~// and para =~/^(?:\^~\d+\s|)/) # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though
+ if para =~/<:center>/ #rules changed now a
/)
try.each do |e|
format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,e)
- note_match=if e =~/<:i[12]>/
+ note_match=if e =~/<:i[1-9]>/
format_seg.endnote_body_seg_tail_indent
else format_seg.endnote_body_seg_tail
end
diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb
index 2d295a6c..749f5180 100644
--- a/lib/sisu/v0/html_tune.rb
+++ b/lib/sisu/v0/html_tune.rb
@@ -187,6 +187,7 @@ module SiSU_Tune
@env=SiSU_Env::Info_env.new(@md.fns)
@sys=SiSU_Env::System_call.new
@dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
+ @env=SiSU_Env::Info_env.new(@md.fns)
#@utf8=SiSU_character_encode::UTF8 #.new
end
def songsheet
@@ -231,6 +232,45 @@ module SiSU_Tune
@tuned_file << para
end
end
+ 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
+ d=''
+ end
+ 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
+ h=%{height="#{h}"} if h
+ c=m[/"(.+?)"/m,1]
+ caption=%{#{caption}}
+ else %{
#{caption}}
+ end
+ word.gsub!(/\{.+?\}((?:https?|ftp)\S+|image)/,ins)
+ else
+ link=m[/(.+)/m]
+ png=m.scan(/\S+/)[0].strip
+ link=link.strip
+ ins=%{#{link}#{d}}
+ word.gsub!(/\{.+?\}(?:https?|ftp)\S+/,ins)
+ end
+ word
+ else word
+ end
+ word
+ end
+ @words
+ end
def url_markup
data=@data
@tuned_file=[]
@@ -256,7 +296,7 @@ module SiSU_Tune
end
if para =~/\{.+?\}((?:http|ftp)\S+|image)/
@word_mode=para.scan(/\{.+?\}(?:(?:https?|ftp)\S+|image)|\S+/)
- word_mode=SiSU_Tune::Tune_urls.new(@word_mode,@md).urls
+ word_mode=urls(@word_mode)
words=word_mode.join(' ')
para.gsub!(/.+/,words)
end
@@ -274,20 +314,20 @@ module SiSU_Tune
para.gsub!(/<:h(.{1,7}?)>/,'\1')
para.gsub!(/<:to(\d{1,7}?)>/,'to { \1 } ')
if (para =~/\b\S+\@\S+?\.\S+/ and para !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/)
- para.gsub!(/\b(\S+\@\S+?\.\S+)(\s)/,'\1\\2')
+ para.gsub!(/\b(\S+\@\S+?\.\S+)(\s)/,'<\1>\2')
end
if (para !~/(\"\w+:\/\/\S+?\"|>\s*\w+:\/\/\w+?\S*<)/) #url markup http etc.
if para=~/\w+:\/\/\S+?\.\S+?[.,] /
- para.gsub!(/(\w+:\/\/\S+?\.\S+?)([.,] )/,'\1\2') #full stops ! have been a bother
+ para.gsub!(/(\w+:\/\/\S+?\.\S+?)([.,] )/,'<\1>\2') #full stops ! have been a bother
else
- para.gsub!(/(\w+:\/\/\S+?\.\S+)/, '\1')
+ para.gsub!(/(\w+:\/\/\S+?\.\S+)/, '<\1>')
end
end
if (para =~/[ ^](?:https?|ftp):\/\/\S+/) #url markup http leftovers watch carefully may accept too much 2004w46
if para=~/([ ^])((?:https?|ftp):\/\/\S+?)([\.,] )/
- para.gsub!(/([ ^])((?:https?|ftp):\/\/\S+?)([\.,] )/,'\1\2\3') #full stops ! have been a bother
+ para.gsub!(/([ ^])((?:https?|ftp):\/\/\S+?)([\.,] )/,'\1<\2>\3') #full stops ! have been a bother
else
- para.gsub!(/([ ^])((?:https?|ftp):\/\/\S+)/,'\1\2')
+ para.gsub!(/([ ^])((?:https?|ftp):\/\/\S+)/,'\1<\2>')
end
end
if (para =~/..\/\S+/ and para !~/(\"..\/\S+?\"|>\s*..\/\S+<)/)
@@ -326,51 +366,5 @@ module SiSU_Tune
@tuned_file
end
end
- class Tune_urls
- def initialize(data,md)
- @data,@md=data,md
- @vz=SiSU_Env::Get_init.instance.skin
- @env=SiSU_Env::Info_env.new(@md.fns)
- end
- def urls
- @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
- d=''
- end
- 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
- h=%{height="#{h}"} if h
- c=m[/"(.+?)"/m,1]
- caption=%{
#{c}
} if c - png=m.scan(/\S+/)[0] - image_path=if @md.fns =~/\.-ss[tm]$/; @env.url.images_external - else @env.url.images_local - end - ins=if u and u.strip !~/^image$/ - %{#{c}
} if c + png=m.scan(/\S+/)[0] + #image_path=if @md.fns =~/\.-ss[tm]$/; @env.url.images_external + #else @env.url.images_local + #end + ins=if u and u.strip !~/^image$/ + %{[#{png}]#{caption}} + else %{[#{png}] #{caption}} + end + word.gsub!(/\{.+?\}((?:https?|ftp)\S+|image)/,ins) + else + link=m[/(.+)/m] + png=m.scan(/\S+/)[0].strip + link=link.strip + ins=%{#{link}#{d}} + word.gsub!(/\{.+?\}(?:https?|ftp)\S+/,ins) + end + word + else word + end + word + end + @words + end + def markup(para) + if para =~/\{.+?\}((?:http|ftp)\S+|image)/ + @word_mode=para.scan(/\{.+?\}(?:(?:https?|ftp)\S+|image)|\S+/) + word_mode=urls(para) + words=word_mode.join(' ') + para.gsub!(/.+/,words) + end + if (para !~/(\"\w+:\/\/\S+?\"|>\s*\w+:\/\/\w+?\S*<)/) #url markup http etc. + if para=~/\w+:\/\/\S+?\.\S+?[.,] / + para.gsub!(/(\w+:\/\/\S+?\.\S+?)([.,] )/,%{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}\\2}) #full stops ! have been a bother + else + para.gsub!(/(\w+:\/\/\S+?\.\S+)/,%{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}}) + end + end + if (para =~/[ ^](?:https?|ftp):\/\/\S+/) #url markup http leftovers watch carefully may accept too much 2004w46 + if para=~/([ ^])((?:https?|ftp):\/\/\S+?)([\.,] )/ + para.gsub!(/([ ^])((?:https?|ftp):\/\/\S+?)([\.,] )/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) #full stops ! have been a bother + else + para.gsub!(/([ ^])((?:https?|ftp):\/\/\S+)/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}}) + end + end + para + end def paragraph %{#{@tab*1}\n#{@tab*2}#@content\n#{@tab*1}
\n} << "\n" end def endnote + @content=markup(@content) <\n#{@tab*2}#@content\n#{@tab*1}
\n} end def norm + @content=markup(@content) %{#{@tab*1}\n#{@tab*2}#@content\n#{@tab*1}
\n} end def indent1 + @content=markup(@content) %{#{@tab*1}\n#{@tab*2}#@content\n#{@tab*1}
\n} end def indent2 + @content=markup(@content) %{#{@tab*1}\n#{@tab*2}#@content\n#{@tab*1}
\n} end def para_table diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 6cb6f991..69b47d01 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -77,6 +77,12 @@ module SiSU_text_parts elsif /^([1-6]~)\s+(\S.+?)<~(0);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) @@alt_id_count+=1 @format,@text,@ocn=$1,$2,"x#{@@alt_id_count}" + elsif /^(?:<:i([1-9])>\s*_\*)\s+(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) + @format,@text,@ocn="_#{$1}\*",$2,$3,$4 + elsif /^(_\*)\s+(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) + @format,@text,@ocn=$1,$2,$3 + elsif /<:(i[1-9])>\s*(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) + @format,@text,@ocn=$1,$2,$3 end else if /(.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) @@ -135,10 +141,12 @@ module SiSU_text_parts end module SiSU_XML_munge class Trans + require "#{SiSU_lib}/defaults" def initialize(md) @sys=SiSU_Env::System_call.new @dir=SiSU_Env::Info_env.new(md.fns) @dp=SiSU_Env::Info_env.new.digest.pattern + @url_brace=SiSU_Viz::Skin.new.url_decoration end def char_enc #character encode def utf8(para='') @@ -336,12 +344,13 @@ module SiSU_XML_munge para.gsub!(/<:pb>\s*/,'') para.gsub!(/<+[-~]#>+/,'') para.gsub!(/<0;\w\d+;[um]\d+><#@dp:#@dp>/,'') - para.gsub!(/^(<:i[12]>\s*)_\*\s+/,'\1