From 4c11eebf5ea1ce4abaeb8dc555ec1bf2cb27947e Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Thu, 14 Jun 2007 10:16:51 +0100
Subject: sisu-0.54.0 (minor additions to syntax, indent range extended)
* indent levels (1-9) added [previously two levels] done for plaintext, html,
xml, odf, latex/pdf [minor syntax addition (_3 - _9), version number
change]
* bullet indent levels (1-9) added [previously two levels] done for
plaintext, html, odf, latex/pdf [minor syntax addition (_3* - _9*), version
number change]
* url decoration, open close, default angle brackets
* fixes, some line-breaking for plaintext (and text groups for) odf and xml
* css, modifications for extended indents in html and xml [sisu -CC (for
update)]
* vim syntax highlighter updated to take account of extended indent range
* rant installer minor changes for future ruby
* conversion script in data/sisu/conf/convert/sisu_convert
---
lib/sisu/v0/css.rb | 141 ++++++++++++++++++++++++++++++++
lib/sisu/v0/dal_syntax.rb | 37 ++++-----
lib/sisu/v0/db_import.rb | 3 +-
lib/sisu/v0/defaults.rb | 21 +++++
lib/sisu/v0/html.rb | 6 +-
lib/sisu/v0/html_format.rb | 38 +++++----
lib/sisu/v0/html_scroll.rb | 172 ++++++++++++----------------------------
lib/sisu/v0/html_segments.rb | 15 ++--
lib/sisu/v0/html_tune.rb | 98 +++++++++++------------
lib/sisu/v0/odf.rb | 81 +++++++++----------
lib/sisu/v0/plaintext.rb | 44 +++++-----
lib/sisu/v0/shared_html_lite.rb | 68 ++++++++++++++++
lib/sisu/v0/shared_xml.rb | 20 +++--
lib/sisu/v0/texpdf.rb | 3 +-
lib/sisu/v0/texpdf_format.rb | 22 +++--
lib/sisu/v0/xhtml.rb | 26 +++---
lib/sisu/v0/xml.rb | 22 +++--
lib/sisu/v0/xml_dom.rb | 26 +++---
18 files changed, 494 insertions(+), 349 deletions(-)
(limited to 'lib')
diff --git a/lib/sisu/v0/css.rb b/lib/sisu/v0/css.rb
index f8c7d25b..e2035d95 100644
--- a/lib/sisu/v0/css.rb
+++ b/lib/sisu/v0/css.rb
@@ -387,6 +387,9 @@ WOK
p.i4 {margin-left: 35mm;}
p.i5 {margin-left: 40mm;}
p.i6 {margin-left: 45mm;}
+ p.i7 {margin-left: 50mm;}
+ p.i8 {margin-left: 55mm;}
+ p.i9 {margin-left: 60mm;}
table { }
tr { }
@@ -452,11 +455,53 @@ WOK
margin-bottom: 3px;
}
li.i2 {
+ margin-left: 25mm;
+ line-height: 150%;
+ margin-top: 3px;
+ margin-bottom: 3px;
+ }
+ li.i3 {
margin-left: 30mm;
line-height: 150%;
margin-top: 3px;
margin-bottom: 3px;
}
+ li.i4 {
+ margin-left: 35mm;
+ line-height: 150%;
+ margin-top: 3px;
+ margin-bottom: 3px;
+ }
+ li.i5 {
+ margin-left: 40mm;
+ line-height: 150%;
+ margin-top: 3px;
+ margin-bottom: 3px;
+ }
+ li.i6 {
+ margin-left: 45mm;
+ line-height: 150%;
+ margin-top: 3px;
+ margin-bottom: 3px;
+ }
+ li.i7 {
+ margin-left: 50mm;
+ line-height: 150%;
+ margin-top: 3px;
+ margin-bottom: 3px;
+ }
+ li.i8 {
+ margin-left: 55mm;
+ line-height: 150%;
+ margin-top: 3px;
+ margin-bottom: 3px;
+ }
+ li.i9 {
+ margin-left: 60mm;
+ line-height: 150%;
+ margin-top: 3px;
+ margin-bottom: 3px;
+ }
#horizontal_links {
background: #eeeeee;
margin-left: 5%;
@@ -1338,6 +1383,54 @@ WOK
text[class|="indent2"] {
margin-left: 15%;
}
+ text[class|="indent3"] {
+ margin-left: 20%;
+ }
+ text[class|="indent4"] {
+ margin-left: 25%;
+ }
+ text[class|="indent5"] {
+ margin-left: 30%;
+ }
+ text[class|="indent6"] {
+ margin-left: 35%;
+ }
+ text[class|="indent7"] {
+ margin-left: 40%;
+ }
+ text[class|="indent8"] {
+ margin-left: 45%;
+ }
+ text[class|="indent9"] {
+ margin-left: 50%;
+ }
+ text[class|="indent_bullet1"] {
+ margin-left: 10%;
+ }
+ text[class|="indent_bullet2"] {
+ margin-left: 15%;
+ }
+ text[class|="indent_bullet3"] {
+ margin-left: 20%;
+ }
+ text[class|="indent_bullet4"] {
+ margin-left: 25%;
+ }
+ text[class|="indent_bullet5"] {
+ margin-left: 30%;
+ }
+ text[class|="indent_bullet6"] {
+ margin-left: 35%;
+ }
+ text[class|="indent_bullet7"] {
+ margin-left: 40%;
+ }
+ text[class|="indent_bullet8"] {
+ margin-left: 45%;
+ }
+ text[class|="indent_bullet9"] {
+ margin-left: 50%;
+ }
text[class|="verse"], text[class|="group"], text[class|="code"] {
text-align: left;
}
@@ -1550,6 +1643,54 @@ WOK
text[class|="indent2"] {
margin-left: 15%;
}
+ text[class|="indent3"] {
+ margin-left: 20%;
+ }
+ text[class|="indent4"] {
+ margin-left: 25%;
+ }
+ text[class|="indent5"] {
+ margin-left: 30%;
+ }
+ text[class|="indent6"] {
+ margin-left: 35%;
+ }
+ text[class|="indent7"] {
+ margin-left: 40%;
+ }
+ text[class|="indent8"] {
+ margin-left: 45%;
+ }
+ text[class|="indent9"] {
+ margin-left: 50%;
+ }
+ text[class|="indent_bullet1"] {
+ margin-left: 10%;
+ }
+ text[class|="indent_bullet2"] {
+ margin-left: 15%;
+ }
+ text[class|="indent_bullet3"] {
+ margin-left: 20%;
+ }
+ text[class|="indent_bullet4"] {
+ margin-left: 25%;
+ }
+ text[class|="indent_bullet5"] {
+ margin-left: 30%;
+ }
+ text[class|="indent_bullet6"] {
+ margin-left: 35%;
+ }
+ text[class|="indent_bullet7"] {
+ margin-left: 40%;
+ }
+ text[class|="indent_bullet8"] {
+ margin-left: 45%;
+ }
+ text[class|="indent_bullet9"] {
+ margin-left: 50%;
+ }
text[class|="verse"], text[class|="group"], text[class|="code"] {
text-align: left;
}
diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb
index 513dc721..d0014ad6 100644
--- a/lib/sisu/v0/dal_syntax.rb
+++ b/lib/sisu/v0/dal_syntax.rb
@@ -61,7 +61,7 @@ module Syntax
@manmkp_ital='[i/]\\{.+?\\}[i/]'
tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)}
tail_m_bold=%q{(?:(?:<\/i>)?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?}
- bold_line=%q{^!_\s.+?(?:\n|$)}
+ bold_line=%q{^!_\s.+?(?: |\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
#{@vz.margin_num_css}
+#{@vz.table_close}}
+ end
+ def bold_header
+ @one.gsub!(/[1-9]~(\S+)/,' ')
+ @one.gsub!(/[1-9]~/,'')
+ @one.gsub!(/<~0;[um]\d+;[um]\d+><#@dp:#@dp>\s*$/i,'') #watch & do differently
+ %{
+ #@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,'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 (.*)/.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,'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 (.*)/.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(/ /)
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=%{
#{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$/
+ %{ #{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$/
- %{ #{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
- end
end
__END__
diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb
index caf86a39..feac2d03 100644
--- a/lib/sisu/v0/odf.rb
+++ b/lib/sisu/v0/odf.rb
@@ -140,6 +140,7 @@ module SiSU_ODF
end
end
class Scroll [],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[],:endnotes=>[] }
@@ -153,13 +154,14 @@ module SiSU_ODF
@regx=/^(?:(?:<:p[bn]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
@serial=/\s*<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>\s*/
@tab="\t"
+ @url_brace=SiSU_Viz::Skin.new.url_decoration
@br=if @md.cmd =~/M/; "\n"
else ''
end
end
def songsheet
pre
- @data=markup
+ @data=markup(@data)
post
publish
end
@@ -169,8 +171,8 @@ module SiSU_ODF
@n=[]
notes.each do |n| #high cost to deal with appropriately within odf, consider
n=n.dup.to_s
- if n =~/ /
- fix=n.split(/ /) #watch #added
+ if n =~/<:?br(?: \/)?>/
+ fix=n.split(/<:?br(?: \/)?>/) #watch #added
fix.each do |x|
if x =~/\S+/; @n << x
end
@@ -282,16 +284,16 @@ module SiSU_ODF
end
def normal(para) #P1 - P3
para.gsub!(@serial,'')
- para.gsub!(/(^|\s)(https?:\/\/[^'">< ]+)/,'\1\2 ')
- para.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,'\1 ')
- par=case para
- when /^<:i1>\s/m; para.gsub!(/^<:i1>\s/m,'')
- %{#{para} }
- when /^<:i2>\s/m; para.gsub!(/^<:i2>\s/m,'')
- %{#{para} }
- else %{#{para} } #%{#{para} }
+ para.gsub!(/(^|\s)(https?:\/\/[^'">< ]+)/,%{\\1#{@url_brace.xml_open}\\2 #{@url_brace.xml_close}})
+ para.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,%{#{@url_brace.xml_open}\\1 #{@url_brace.xml_close}})
+ para=case para
+ when /^<:i([1-9])>\s/m
+ m=$1
+ para.gsub!(/^<:i#{m}>\s/m,'')
+ %{#{para} }
+ else %{#{para} }
end
- para=par #+ %{ }
+ para
end
def fontface(para)
#para=para.gsub(/(.+?)<\/b>/,%{\\1 })
@@ -300,7 +302,7 @@ module SiSU_ODF
def footnote(para)
@astx||=10000
para.gsub!(/<#@dp>([}\]]~)/,'\1')
- para.gsub!(/ <:i1>/,' ')
+ #para.gsub!(/ <:i[1-9]>/,' ')
if para =~/~\{\d+\s+/
para=para.gsub(/~\{(\d+)\s+(.+?)\}~/,'\1 \2 ')
end
@@ -324,9 +326,7 @@ module SiSU_ODF
end
def group_clean(para)
para.gsub!(/ | /,' ')
- para.gsub!(/,'<')
- para.gsub!(/>/,'>')
- #para.gsub!(/ /,' ')
+ para.gsub!(/,'<'); para.gsub!(/>/,'>')
para.gsub!(/<br(?:\s+\/)?>/,' ')
#para.gsub!(/\s\s/,' ')
para
@@ -334,9 +334,9 @@ module SiSU_ODF
def poem(para) #P4 #same as group
para.gsub!(@serial,'')
para.gsub!(/<:verse(?:-end)?>\s*/m,'')
- para=group_clean(para)
parray=[]
- para.split(/ /).each do |parablock|
+ para.split(/<:?br(?: \/)?>/).each do |parablock|
+ parablock=group_clean(parablock)
parray << %{#{parablock} } if parablock =~/\S+/
end
para=parray.join + ' '
@@ -344,9 +344,9 @@ module SiSU_ODF
def group(para) #P4 #same as verse
para.gsub!(@serial,'')
para.gsub!(/<:group(?:-end)?>\s*/m,'')
- para=group_clean(para)
parray=[]
- para.split(/ /).each do |parablock|
+ para.split(/<:?br(?: \/)?>/).each do |parablock|
+ parablock=group_clean(parablock)
parray << %{#{parablock} } if parablock =~/\S+/
end
para=parray.join + ' '
@@ -354,10 +354,10 @@ module SiSU_ODF
def code(para) #P5
para.gsub!(@serial,'')
para.gsub!(/<:code(?:-end)?>\s*/m,'')
- para=group_clean(para)
para.gsub!(/\s\s/,' ')
parray=[]
- para.split(/<:br>/).each do |parablock|
+ para.split(/<:?br(?: \/)?>/).each do |parablock|
+ parablock=group_clean(parablock)
parray << %{#{parablock} } if parablock =~/\S+/
end
para=parray.join + ' '
@@ -414,8 +414,7 @@ module SiSU_ODF
#end
wordlist
end
- def markup # Used for major markup instructions
- data=@data
+ def markup(data) # Used for major markup instructions
safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`¡]/
dir=SiSU_Env::Info_env.new(@md.fns)
@data_mod,@endnotes,@level,@cont,@copen,@odf_contents_close=Array.new(6){[]}
@@ -443,9 +442,11 @@ module SiSU_ODF
para=para_array.join(' ')
para=para.strip
end
- para.gsub!(/^(<:i[12]>\s+)?_\*\s+/,'\\1 ') # bullet_red.png
+ para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\\1 ') # bullet_red.png
#para.gsub!(/^_\*\s+/,'· ') #bullet
- para.gsub!(/^(<:i[12]>)\s+_\*\s+/,'\1 · ') #bullet
+ para.gsub!(/^(<:i[1-9]>)\s+_\*\s+/,'\1 · ') #bullet
+ #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\\1 ') # bullet_red.png
+ #para.gsub!(/^(<:i[1-9]>)\s+_\*\s+/,'\1 · ') #bullet
para.gsub!(/ /,' ')
para.gsub!(/<:p[bn]>/,' ')
para.gsub!(/©/,'©') #too arbitrary
@@ -542,18 +543,6 @@ module SiSU_ODF
para=format_text.seg_no_paranum
end
para='' if para =~// and para =~/^(-\{{2}~\d+|)/ # -endnote
- case para #remove
- when /<:i1>/
- if para =~/.*<:#>.*$/
- format_text=OD_format::Format_text_object.new(para,'')
- para=format_text.scr_indent_one_no_paranum
- end
- when /<:i2>/
- if para =~/.*<:#>.*$/
- format_text=OD_format::Format_text_object.new(para,'')
- para=format_text.scr_indent_one_no_paranum
- end
- end
if (para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/)
# i don't get the condition for no paranum
end
@@ -613,14 +602,26 @@ module SiSU_ODF
%{#@br} +
%{#{table}#@br} +
%{ #@br} +
- %{ #@br} +
- %{ #@br} +
+ %{ #@br} + # P1
+ %{ #@br} + # P1
%{ #@br} +
%{ #@br} +
%{ #@br} +
%{ #@br} +
%{ #@br} +
%{ #@br} +
+ %{ #@br} + # P1
+
+ %{ #@br} +
+ %{ #@br} +
+ %{ #@br} +
+ %{ #@br} +
+ %{ #@br} +
+ %{ #@br} +
+ %{ #@br} +
+ %{ #@br} +
+ %{ #@br} +
+
%{ #@br} +
%{ #@br} +
%{ #@br} +
diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb
index c39cba14..8728741a 100644
--- a/lib/sisu/v0/plaintext.rb
+++ b/lib/sisu/v0/plaintext.rb
@@ -143,6 +143,7 @@ module SiSU_Plaintext
end
end
class Scroll \s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ #m # 2004w18 pb pn removal added
@@ -171,7 +173,7 @@ module SiSU_Plaintext
end
end
def songsheet
- markup
+ @data=markup(@data)
publish
#@data.each { |x| puts x.inspect if x =~/\[table/ }
end
@@ -264,9 +266,10 @@ WOK
para.gsub!(/~[{\[]([\d*+]+)\s+(?:.+?)[}\]]~/,'[^\1]') # endnote marker marked up
wrapped=if para[@regx]
paragraph=para[@regx,2]
- if paragraph.include? '<:i1>'
- paragraph.gsub!(/<:i1>/,'')
- util=SiSU_text_utils::Wrap.new(paragraph,70,2)
+ if paragraph =~/<:i([1-9])>/
+ m=$1.to_i
+ paragraph.gsub!(/<:i#{m}>/,'')
+ util=SiSU_text_utils::Wrap.new(paragraph,70,m*2)
else util=SiSU_text_utils::Wrap.new(paragraph,70,0)
end
util.line_wrap
@@ -291,8 +294,7 @@ WOK
end
@@endnotes_para=[]
end
- def markup # Used for major markup instructions
- data=@data
+ def markup(data) # Used for major markup instructions
dir=SiSU_Env::Info_env.new(@md.fns)
@data_mod,@endnotes,@level,@cont,@copen,@plaintext_contents_close=Array.new(6){[]}
(0..6).each { |x| @cont[x]=@level[x]=false }
@@ -303,17 +305,22 @@ WOK
data.each do |para|
para.gsub!(//,'') # remove dummy headings (used by html) #check
- para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down
+ para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down
+ #para.gsub!(/ /,"\n") # introduces a bug
para.gsub!(/©/,'©') # bullet markup, marked down
- para.gsub!(/&/,'&') # bullet markup, marked down
+ para.gsub!(/&/,'&') # bullet markup, marked down
para.gsub!(/(.+?)<\/sup>/,'^\1^')
para.gsub!(/(.+?)<\/sub>/,'[\1]')
para.gsub!(/(.+?)<\/i>/,'/\1/')
para.gsub!(/(.+?)<\/b>/,'*\1*')
para.gsub!(/(.+?)<\/u>/,'_\1_')
- para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,'')
+ if para =~/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/
+ para.gsub!(/ /,"\n") # watch
+ para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,'')
+ end
para.gsub!(/<:p[bn]>/,'') # remove page breaks
para.gsub!(/^\s*<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,'') # remove empty lines - check
+ para.gsub!(/(^|\s)(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3")
para.gsub!(/(.+?)<\/a>/m,'\1')
para.gsub!(/<:name#\S+?>/,'') # remove name links
para.gsub!(/ /,' ') # decide on
@@ -394,13 +401,8 @@ WOK
end
para='' if (para =~/ / and para =~/^(-\{{2}~\d+|)/) # -endnote
case para
- when /<:i1>/
- if para =~/.*<:#>.*$/
- format_text=Format_text_object.new(para,'')
- para=format_text.scr_indent_one_no_paranum
- end
- when /<:i2>/
- if para =~/.*<:#>.*$/
+ when /<:i[1-9]>/
+ if para =~/.*<:#>.*$/m
format_text=Format_text_object.new(para,'')
para=format_text.scr_indent_one_no_paranum
end
@@ -421,7 +423,6 @@ WOK
def publish
divider="="
content=[]
- data=@data
content << @@plaintext[:open]
content << @@plaintext[:head]
content << @@plaintext[:body]
@@ -446,11 +447,12 @@ WOK
filename_plaintext=SiSU_Env::SiSU_file.new(@md,@md.fn[:plain]).mkfile
@sisu=[]
@content.each do |para| # this is a hack
- if para =~/^\S/
- if para !~/^([*=-]|\.){5}/; filename_plaintext.puts para #unix plaintext
- else filename_plaintext.puts para #unix plaintext
+ if para.class == Array and para.length > 0
+ para.each do |line|
+ line.gsub!(/\s+$/m,'')
+ filename_plaintext.puts line #unix plaintext
end
- else filename_plaintext.puts para # if para =~/^\s/
+ else filename_plaintext.puts para #unix plaintext # /^([*=-]|\.){5}/
end
end
end
diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb
index 93e77db7..3c0e9ce1 100644
--- a/lib/sisu/v0/shared_html_lite.rb
+++ b/lib/sisu/v0/shared_html_lite.rb
@@ -50,6 +50,7 @@ module SiSU_Format_Shared
require "#{SiSU_lib}/defaults"
include SiSU_Viz
class CSS_Format
+ require "#{SiSU_lib}/defaults"
def initialize(content=nil,id=nil,ocnd='',ocns='',lv='',hname=nil)
content.gsub!(/<:i[12]>/,'')
@content=content
@@ -58,14 +59,78 @@ module SiSU_Format_Shared
@lv=@notenumber=lv.to_s
@hname=hname.to_s
@tab="\t"
+ @url_brace=SiSU_Viz::Skin.new.url_decoration
# lots introduced to do html tables in db
@@tablehead,@@tablefoot=[],[]
@vz=SiSU_Env::Get_init.instance.skin
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=%{#{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)
<
#{@tab*2}#@notenumber. #@content
@@ -88,12 +153,15 @@ GSUB
%{#{@tab*1}\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 ')
- para.gsub!(/^_\*\s+/,' ')
+ #embeds a red-bullet image -->
+ #para.gsub!(/^(<:i[1-9]>\s*_\*)\s+/,'\1 ')
+ #para.gsub!(/^_\*\s+/,' ')
para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1 [\\2] \\5})
para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1 \\2})
para.gsub!(/(^|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/,'\1 \2\4')
- para.gsub!(/(^|\s)(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/,'\1 \2\3')
+ para.gsub!(/(^|\s)(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/,%{\\1#{@url_brace.xml_open} \\2#{@url_brace.xml_close}\\3})
para.gsub!(/ /,' ') #clean
para
end
@@ -363,9 +372,8 @@ module SiSU_XML_munge
para
end
def markup_group(para='')
- para.gsub!(/,'<')
- para.gsub!(/>/,'>')
- para.gsub!(/<br(?:\s+\/)?>/,' ')
+ para.gsub!(/,'<'); para.gsub!(/>/,'>')
+ para.gsub!(/<:?br(?:\s+\/)?>/,' ')
para
end
end
diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb
index 7440289d..aec45b58 100644
--- a/lib/sisu/v0/texpdf.rb
+++ b/lib/sisu/v0/texpdf.rb
@@ -472,8 +472,7 @@ WOK
when /^4#{@@tilde}/; mono.level4
when /^5#{@@tilde}/; mono.level5
when /^6#{@@tilde}/; mono.level6
- when /^<:i1>/; mono.indent1
- when /^<:i2>/; mono.indent2
+ when /^<:i([1-9])>/; mono.indent($1)
when /<:=/; mono.symbol_graphic #watch
when /^\s*<:image\s+/; mono.image
when /\}image/; mono.png
diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb
index ea418dd2..b981ca15 100644
--- a/lib/sisu/v0/texpdf_format.rb
+++ b/lib/sisu/v0/texpdf_format.rb
@@ -250,6 +250,7 @@ WOK
end
class Format_text_object
require 'iconv'
+ require "#{SiSU_lib}/defaults"
attr_accessor :string,:string1,:string,:orientation,:url,:dir,:tex
@@sys=SiSU_Env::System_call.new
@@tex_backslash="\\\\"
@@ -268,6 +269,7 @@ WOK
@start_table=''
@dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
@tx=SiSU_Env::Get_init.instance.tex
+ @url_brace=SiSU_Viz::Skin.new.url_decoration
end
def longtable_landscape
@end_table='\end{longtable}'
@@ -493,7 +495,7 @@ WOK
@string.gsub!(/[^\}>]((?:https?|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{ \1 } \end{scriptsize}\2')
else # regular urls !! http:// href
if @string=~/(?:https?|ftp):\/\/\S+?[,.]? /
- @string.gsub!(/(?:^|[^\}>])((?:https?|ftp):\/\/\S+?)([,.])? /,' \begin{scriptsize}\href{\1}{ \1}\end{scriptsize}\2 ')
+ @string.gsub!(/(?:^|[^\}>])((?:https?|ftp):\/\/\S+?)([,.])? /," #{@url_brace.tex_open}\\begin{scriptsize}\\href{\\1}{ \\1}\\end{scriptsize}#{@url_brace.tex_close}\\2 ") #tamper
else @string.gsub!(/(?:^|[^\}>])((?:https?|ftp):\/\/\S+)/,' \begin{scriptsize}\href{ \1 }{\1} \end{scriptsize}') #should not be necessary, not checked
end
end
@@ -526,7 +528,7 @@ WOK
@string.gsub!(/\s+'/,' `') # open '
@string.gsub!(/^([1-6-]#{@@tilde}\S*|<.+?>)?\s*'/,'\1`') # open '
end
- @string.gsub!(/^(<:i[12]>)?\s*\\_\*\s*/,'\\1 \begin{math} \bullet \end{math}~~') #bullets - added 2004w17 watch \\_
+ @string.gsub!(/^(<:i[1-9]>)?\s*\\_\*\s*/,'\1 \begin{math} \bullet \end{math}~~') #bullets - added 2004w17 watch \\_
@string.gsub!(/(|<\/font>)/,'')
@string.gsub!(/\s*(\S+?)<\/sup>/,'^\1')
@string.gsub!(/(|<\/sup>)/,'')
@@ -692,17 +694,11 @@ WOK
@string.gsub!(/#{@md.lv6}\s*(.marginpar)/m,'\1')
#end BUGWATCH
end
- def indent1
- @string.gsub!(/<:i1>(.*)/m,
- '\begin{ParagraphIndent}{0.01\columnwidth} \1
-\end{ParagraphIndent}
-')
- end
- def indent2
- @string.gsub!(/<:i2>(.*)/m,
- '\begin{ParagraphIndent}{0.02\columnwidth} \1
-\end{ParagraphIndent}
-')
+ def indent(lev)
+ @string.gsub!(/<:i#{lev}>(.*)/m,
+ "\\begin{ParagraphIndent}{0.0#{lev}\\columnwidth} \\1
+\\end{ParagraphIndent}
+")
end
def symbol_graphic
dir=SiSU_Env::Info_env.new(@md.fns)
diff --git a/lib/sisu/v0/xhtml.rb b/lib/sisu/v0/xhtml.rb
index 44293919..8d9e2764 100644
--- a/lib/sisu/v0/xhtml.rb
+++ b/lib/sisu/v0/xhtml.rb
@@ -120,7 +120,7 @@ module SiSU_XHTML
end
def songsheet
pre
- markup
+ @data=markup(@data)
post
publish
end
@@ -269,8 +269,7 @@ WOK
@@xml[:body] << "#{@tab*0}" << "\n" #if para[@regx]
@endnotes=[]
end
- def markup
- data=@data
+ def markup(data)
@endnotes=[]
@rcdc=false
@level,@cont,@copen,@xml_contents_close=[],[],[],[]
@@ -331,12 +330,13 @@ WOK
table=SiSU_Tables::Table_xml.new(para,ocn)
para=table.table_split
table_structure(para,ocn)
- elsif para =~ /<:i1>/
- xml_structure(para,nil,nil,nil,'indent1')
- elsif para =~ /<:i2>/
- xml_structure(para,nil,nil,nil,'indent2')
- else
- xml_structure(para,nil,nil,nil)
+ elsif para =~ /^\s*(?:<:i([1-9])> )?_\*/
+ m=$1
+ para.gsub!(/^(\s*(?:<:i[1-9]> )?)_\*/,'\1')
+ xml_structure(para,nil,nil,nil,"indent_bullet#{m}")
+ elsif para =~ /<:i([1-9])>/
+ xml_structure(para,nil,nil,nil,"indent#{$1}")
+ else xml_structure(para,nil,nil,nil)
end
#@@xml[:body] << "#{@tab*6}" << "\n" if para[@regx]
#@@xml[:body] << "#{@tab*7}#{para[@regx,3]} " << "\n" if para[@regx,3]
@@ -358,12 +358,7 @@ WOK
end
para='' if (para =~// and para =~/^(-\{{2}~\d+|)/) # -endnote
para=case para
- when /<:i1>/
- if para =~/.*<:#>.*$/
- format_text=Format_text_object.new(para,'')
- format_text.scr_inden_ocn_e_no_paranum
- end
- when /<:i2>/
+ when /<:i[1-9]>/
if para =~/.*<:#>.*$/
format_text=Format_text_object.new(para,'')
format_text.scr_inden_ocn_e_no_paranum
@@ -419,7 +414,6 @@ WOK
end
def publish
content=[]
- data=@data
content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
content << @@xml[:owner_details] if @md.stmp =~/\w\w/
content << @@xml[:tail] << @@xml[:close]
diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb
index 20c5f80e..7edbb8ea 100644
--- a/lib/sisu/v0/xml.rb
+++ b/lib/sisu/v0/xml.rb
@@ -120,7 +120,7 @@ module SiSU_XML_SAX
end
def songsheet
pre
- markup
+ @data=markup(@data)
post
publish
end
@@ -293,8 +293,7 @@ WOK
@@xml[:body] << "#{@tab*0} " << "\n" #if para[@regx]
@endnotes=[]
end
- def markup
- data=@data
+ def markup(data)
xml_sc(@md)
@endnotes,@level,@cont,@copen,@xml_contents_close=[],[],[],[],[]
@rcdc=false
@@ -355,10 +354,12 @@ WOK
table=SiSU_Tables::Table_xml.new(para,ocn)
para=table.table_split
table_structure(para)
- elsif para =~ /<:i1>/
- xml_structure(para,nil,nil,nil,'indent1')
- elsif para =~ /<:i2>/
- xml_structure(para,nil,nil,nil,'indent2')
+ elsif para =~ /^\s*(?:<:i([1-9])> )?_\*/ #uncomment
+ m=$1
+ para.gsub!(/^(\s*(?:<:i[1-9]> )?)_\*/,'\1')
+ xml_structure(para,nil,nil,nil,"indent_bullet#{m}")
+ elsif para =~ /<:i([1-9])>/
+ xml_structure(para,nil,nil,nil,"indent#{$1}")
else xml_structure(para,nil,nil,nil)
end
#@@xml[:body] << "#{@tab*6}" << "\n" if para[@regx]
@@ -381,11 +382,7 @@ WOK
end
para='' if para =~// and para =~/^(-\{{2}~\d+|)/ # -endnote
if para =~/.*<:#>.*$/
- para=case para
- when /<:i1>/
- format_text=Format_text_object.new(para,'')
- format_text.scr_inden_ocn_e_no_paranum
- when /<:i2>/
+ para=if para =~ /<:i[1-9]>/
format_text=Format_text_object.new(para,'')
format_text.scr_inden_ocn_e_no_paranum
end
@@ -438,7 +435,6 @@ WOK
end
def publish
content=[]
- data=@data
content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
content << @@xml[:owner_details] if @md.stmp =~/\w\w/
content << @@xml[:tail] << @@xml[:close]
diff --git a/lib/sisu/v0/xml_dom.rb b/lib/sisu/v0/xml_dom.rb
index 9c13dcc1..4225a276 100644
--- a/lib/sisu/v0/xml_dom.rb
+++ b/lib/sisu/v0/xml_dom.rb
@@ -118,7 +118,7 @@ module SiSU_XML_DOM
end
def songsheet
pre
- markup
+ @data=markup(@data)
post
publish
end
@@ -225,13 +225,13 @@ WOK
@cont[2]=false if @cont[2]
@cont[3]=false if @cont[3]
####### attempt to close contents
- if @copen[3] # 6{
+ if @copen[3] # 6~
[3,2,1].each { |v| @@xml[:body] << "#{@tab*n}\n" }
@copen[1]=@copen[2]=@copen[3]=false
- elsif @copen[2] # 5{
+ elsif @copen[2] # 5~
[2,1].each { |v| @@xml[:body] << "#{@tab*n}\n" }
@copen[1]=@copen[2]=@copen[3]=false
- elsif @copen[1] # 4{
+ elsif @copen[1] # 4~
[1].each { |v| @@xml[:body] << "#{@tab*n}\n" }
@copen[1]=@copen[2]=@copen[3]=false
end
@@ -318,8 +318,7 @@ WOK
@@xml[:body] << "#{@tab*0} " << "\n" #if para[@regx]
@endnotes=[]
end
- def markup
- data=@data
+ def markup(data)
xml_sc(@md)
@rcdc=false
@level,@cont,@copen,@xml_contents_close=[],[],[],[]
@@ -388,9 +387,12 @@ WOK
@@xml[:body] << table_structure(para,ocn)
else #xml_structure(para, nil, nil, nil)
type=case para
- when /^\s*<:i1>/; 'indent1'
- when /^\s*<:i2>/; 'indent2'
- else 'norm'
+ when /^\s*(?:<:i([1-9])> )?_\*/
+ m=$1
+ para.gsub!(/^(\s*(?:<:i[1-9]> )?)_\*/,'\1')
+ "indent_bullet#{m}"
+ when /^\s*<:i([1-9])>/; "indent#{$1}"
+ else 'norm'
end
xml_markup(para)
@@xml[:body] << %{#{@tab*6}} << "\n" if para[@regx] and para[@regx,3]
@@ -417,10 +419,7 @@ WOK
para='' if para =~// and para =~/^(-\{{2}~\d+|)/ # -endnote
if para =~/.*<:#>.*$/
para=case para
- when /<:i1>/
- format_text=Format_text_object.new(para,'')
- format_text.scr_inden_ocn_e_no_paranum
- when /<:i2>/
+ when /<:i[1-9]>/
format_text=Format_text_object.new(para,'')
format_text.scr_inden_ocn_e_no_paranum
end
@@ -481,7 +480,6 @@ WOK
end
def publish
content=[]
- data=@data
content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]
content << @@xml[:owner_details] if @md.stmp =~/\w\w/
content << @@xml[:tail] << @@xml[:close]
--
cgit v1.2.3