diff options
| author | Ralph Amissah <ralph@amissah.com> | 2008-08-12 23:37:42 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2008-08-12 23:37:42 -0400 | 
| commit | d43865fb6a093625a77e8605d6fb00158546e1e4 (patch) | |
| tree | 5386383af935307af234e4389e8c243ee3368f83 | |
| parent | sisu-0.68.0 + sha256 (diff) | |
html increased use of css; dal, middle layer, url representation, interim commit
28 files changed, 467 insertions, 399 deletions
| @@ -9,6 +9,16 @@ Reverse Chronological:  %% STABLE MANIFEST +%% sisu_0.68.1.orig.tar.gz (2008-08-12:32/2) +http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.1.orig.tar.gz +  sisu_0.68.1.orig.tar.gz +  sisu_0.68.1-1.dsc +  sisu_0.68.1-1.diff.gz + +  * middle layer, url representation + +  * html increased use of css, includes segmented html minitoc +  %% sisu_0.68.0.orig.tar.gz (2008-07-22:29/2)  http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0.orig.tar.gz    cecae8b828aa187b22354f2ee9e8a8b5244dd9f4 1509605 sisu_0.68.0.orig.tar.gz diff --git a/lib/sisu/v0/constants.rb b/lib/sisu/v0/constants.rb index 68093673..2c08bdfa 100644 --- a/lib/sisu/v0/constants.rb +++ b/lib/sisu/v0/constants.rb @@ -97,7 +97,8 @@ Mx[:br_page]=         "#{Mx[:mk_o]}pb#{Mx[:mk_c]}"  Mx[:br_page_new]=     "#{Mx[:mk_o]}pn#{Mx[:mk_c]}"  Mx[:br_endnotes]=     "#{Mx[:mk_o]}ENDNOTES#{Mx[:mk_c]}"  Mx[:br_eof]=          "#{Mx[:mk_o]}EOF#{Mx[:mk_c]}" -Mx[:lnk_o]='「'; Mx[:lnk_c]='」' +Mx[:lnk_o]='◁'; Mx[:lnk_c]='▷' + #‹ ›  Mx[:sm_set_o]='《'; Mx[:sm_set_c]='》'  Mx[:sm_subset_o]='《 '; Mx[:sm_subset_c]='》'  #Mx[:sm_set_o]='∈ '; Mx[:sm_set_c]='∋ ' @@ -166,4 +167,9 @@ check:   ‹ › ∗   '〔lv1〕','〔lv2〕','〔lv3〕','〔lv4〕','〔lv5〕','〔lv6〕','〔lv7〕','〔lv8〕','〔lv9〕'  '〔 Ѳ1〕','〔 Ѳ2〕','〔 Ѳ3〕','〔 Ѳ4〕','〔 Ѳ5〕','〔Ѳ6〕','〔Ѳ7〕','〔Ѳ8〕','〔Ѳ9〕' +◁▷  + +▶this is text or an image◀http:// + +◀this is text or an image▶ http:// diff --git a/lib/sisu/v0/css.rb b/lib/sisu/v0/css.rb index cdd05528..52de3351 100644 --- a/lib/sisu/v0/css.rb +++ b/lib/sisu/v0/css.rb @@ -106,7 +106,7 @@ WOK  /* SiSU css default stylesheet */    body {      color: black; -    background: #{@vz.color_white}; +    background: "#ffffff";    }  /*      table { @@ -121,25 +121,25 @@ WOK      }  */    a:link { -    color: #{@vz.color_blue_ink}; +    color: #003399;      text-decoration: none;    }    a:visited { -    color: #{@vz.color_blue_ink}; +    color: #003399;      text-decoration: none;    }  /*    a:hover { -    color: #{@vz.color_black}; +    color: #000000;      border-bottom: 2px solid #777777; -    background-color: #{@vz.color_yellow_light}; +    background-color: #fff3b6;    }  */    a:hover img { -    background-color: #{@vz.color_white}; +    background-color: "#ffffff";    }    a:active { -    color: #{@vz.color_blue_ink}; +    color: #003399;      text-decoration: underline;    }    div { @@ -197,24 +197,35 @@ WOK      margin-left: 75%;      width: 20%;    } -  p { +  ul, li, p {      display: block; -    font-family: #{fonts}; +    font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;      font-size: 100%;      font-weight: normal;      line-height: 150%; -    text-align: left; -    margin-left: 10mm; +    text-align: justify; +    margin-left: 1em;      text-indent: 0mm;      margin-top: 3px;      margin-bottom: 3px; -    margin-right: 5mm; +    /* margin-bottom:0; */ +    margin-right: 2em; +    /* width: 90%; */    }    p.norm { -    text-align: justify;    } +  p.i1 {margin-left: 2em;} +  p.i2 {margin-left: 3em;} +  p.i3 {margin-left: 4em;} +  p.i4 {margin-left: 5em;} +  p.i5 {margin-left: 6em;} +  p.i6 {margin-left: 7em;} +  p.i7 {margin-left: 8em;} +  p.i8 {margin-left: 9em;} +  p.i9 {margin-left: 10em;}    p.code { -    font-family: monospace; +    font-family: inconsolata, andale mono, courier new, courier, monospace; +    font-size: 90%;      text-align: left;    }    p.caption { @@ -223,24 +234,24 @@ WOK      display: inline;    }    p.endnote { -    font-family: #{fonts}; +    font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;      font-size: 96%;      font-weight: normal;      line-height: 120%;      text-align: left; -    margin-left: 10mm; +    margin-left: 1em;      text-indent: 0mm;      margin-top: 3px;      margin-bottom: 3px;      margin-right: 15mm;    }    p.endnote_indent { -    font-family: #{fonts}; +    font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;      font-size: 96%;      font-weight: normal;      line-height: 120%;      text-align: left; -    margin-left: 15mm; +    margin-left: 2em;      text-indent: 0mm;      margin-top: 3px;      margin-bottom: 3px; @@ -264,6 +275,8 @@ WOK    p.ocn, p.paranum {      font-size: 10px;      margin-top: 0px; +    float: right; +    width: 5%;      margin-bottom: 5px;      color: #777777;      margin-right: 5px; @@ -384,7 +397,7 @@ WOK      margin-top: 1px;      margin-bottom: 3px;    } -  p.quickref{ +  p.quickref {      font-size: 10px;      font-style: italic;      margin-top: 0px; @@ -393,7 +406,7 @@ WOK      margin-right: 5px;      text-align: left;    } -  p.bigref{ +  p.bigref {      font-size: 11px;      font-weight: bold;      margin-top: 0px; @@ -402,19 +415,11 @@ WOK      margin-right: 5px;      text-align: center;    } -  p.i1 {margin-left: 15mm;} -  p.i2 {margin-left: 20mm;} -  p.i3 {margin-left: 25mm;} -  p.i4 {margin-left: 30mm;} -  p.i5 {margin-left: 35mm;} -  p.i6 {margin-left: 40mm;} -  p.i7 {margin-left: 45mm;} -  p.i8 {margin-left: 50mm;} -  p.i9 {margin-left: 55mm;}    table { }    tr { }    th, td { } +    p.left, th.left, td.left {      text-align: left;    } @@ -428,11 +433,11 @@ WOK    h0, h1, h2, h3, h4, h5, h6 {      display: block; -    font-family: #{fonts}; +    font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;      font-weight: bold;      line-height: 120%; -    margin-left: 10mm; -    margin-right: 10mm; +    margin-left: 5mm; +    margin-right: 5mm;      text-align: left;      margin-top: 20px;      margin-bottom: 10px; @@ -440,6 +445,7 @@ WOK    h1.center, h2.center, h3.center, h4.center, h5.center, h6.center {      text-align: center;    } +    ul {      list-style: none;    } @@ -449,52 +455,52 @@ WOK    ul.vertical {      list-style: none;    } +    li {      background: url(../image/bullet_09.png) no-repeat 0px 6px; -    /* list-style-type: disc; */      padding-left: 20px;      display: block; -    font-family: #{fonts}; -    /* font-size: 100%; */ +    font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;      font-weight: normal;      line-height: 150%;      text-align: left; -    margin-left: 10mm; +    margin-left: 1em;      text-indent: 0mm;      margin-top: 3px;      margin-bottom: 3px; -    margin-right: 0mm; +    margin-right: 10mm;    }    li.bullet { -    margin-left: 10mm; +    margin-left: 1em;    }    li.i1 { -    margin-left: 15mm; +    margin-left: 2em;    }    li.i2 { -    margin-left: 20mm; +    margin-left: 3em;    }    li.i3 { -    margin-left: 25mm; +    margin-left: 4em;    }    li.i4 { -    margin-left: 30mm; +    margin-left: 5em;    }    li.i5 { -    margin-left: 35mm; +    margin-left: 6em;    }    li.i6 { -    margin-left: 40mm; +    margin-left: 7em;    }    li.i7 { -    margin-left: 45mm; +    margin-left: 8em;    }    li.i8 { -    margin-left: 50mm; +    margin-left: 9em;    }    li.i9 { -    margin-left: 55mm; +    margin-left: 10em;    } +    #horizontal_links {      background: #eeeeee;      margin-left: 5%; @@ -515,8 +521,6 @@ WOK      background: none;    }    #horizontal a { -    /* font-weight: normal; */ -    /* float: left; */      line-height: 12px;      margin: 0 0 0 0;      text-decoration: none; @@ -525,7 +529,6 @@ WOK    #horizontal a.active, #horizontal a:hover {      border-bottom: 2px solid #777777;      padding-bottom: 2px; -    /* font-weight: bold; */      color: #000077;    }    #horizontal a:hover { @@ -536,7 +539,6 @@ WOK      top: 10mm;      right: 2%;      width: 12%; -    /* background: #ffffff; */      float: right;    }    #vertical_links { @@ -569,7 +571,6 @@ WOK      list-style-type: none;    }    #vertical a { -    /* font-weight: normal; */      line-height: 12px;      text-decoration: none;      color: #000077; @@ -577,13 +578,11 @@ WOK    #vertical a.active, #vertical a:hover {      border-bottom: 2px solid #777777;      padding-bottom: 2px; -    /* font-weight: bold; */      color: #000077;    } +    li.doc {      background: url(../image/bullet_09.png) no-repeat 0px 6px; -    /* background: url(../image/bullet_doc.png) no-repeat 0 0; */ -    /* background: url(../../_sisu/image/bullet_09.png) no-repeat 0px 6px; */      padding-left: 16px;      margin-left: 10px;      margin-top: 0px; @@ -606,7 +605,6 @@ WOK    }    li.refcenter {      background: url(../image/bullet_09.png) no-repeat 0px 6px; -    /* background: url(../image/bullet_doc.png) no-repeat 0 0; */      background: none;      padding-left: 20px;      margin-left: 10%; @@ -618,8 +616,6 @@ WOK    }    li.refbold {      background: url(../image/bullet_09.png) no-repeat 0px 6px; -    /* background: url(../image/bullet_doc.png) no-repeat 0 0; */ -    /* padding-left: 0px; */      padding-left: 16px;      margin-left: 0;      margin-top: 0px; @@ -629,6 +625,7 @@ WOK      font-weight: bold;      text-align: left;    } +    h1 {      font-size: 120%;      margin-top: 20px; @@ -655,7 +652,7 @@ WOK    }    h1.norm, h2.norm, h3.norm {      font-size: 110%; -    margin-left: 10mm; +    margin-left: 1em;      margin-right: 15mm;      text-align: left;      margin-top: 20px; @@ -682,6 +679,7 @@ WOK      margin-right: 0px;      text-align: left;    } +    p.top_band {      display: inline;      text-align: left; @@ -709,6 +707,7 @@ WOK      text-indent: 0mm;      margin-right: 1mm;    } +    h4.norm, h5.norm, h6.norm {      font-size: 100%;      margin-left: 10mm; @@ -717,6 +716,7 @@ WOK      margin-top: 10px;      margin-bottom: 0px;    } +    h1.i {margin-left: 10mm;}    h2.i {margin-left: 15mm;}    h3.i {margin-left: 20mm;} @@ -726,6 +726,7 @@ WOK    h7.i {margin-left: 40mm;}    h8.i {margin-left: 45mm;}    h9.i {margin-left: 50mm;} +    h1.banner {      font-weight: bold;      text-align: center; @@ -779,6 +780,7 @@ WOK    h6.banner {      font-weight: bold;    } +    h1.toc {      margin-left: 10mm;      font-size: 115%; @@ -824,7 +826,7 @@ WOK      margin-bottom: 6px;      line-height: 110%;    } -/* microtoc (for later) --> */ +    h1.microtoc {      margin-left: 0mm;      font-size: 115%; @@ -864,9 +866,8 @@ WOK      margin-top: 2px;      margin-bottom: 2px;    } -/* subtoc --> */    h5.subtoc { -    margin-left: 20mm; +    margin-left: 2em;      margin-right: 34%;      font-weight: normal;      font-size: 80%; @@ -874,13 +875,121 @@ WOK      margin-bottom: 2px;    }    h6.subtoc { -    margin-left: 25mm; +    margin-left: 3em;      margin-right: 34%;      font-weight: normal;      font-size: 75%;      margin-top: 0px;      margin-bottom: 0px;    } + +div.substance { +    width: 100%; +    background-color: #ffffff; +} +div.ocn { +    width: 5%; +    float: right; +    top: 0; +    background-color: #ffffff; +} +div.endnote { +    width: 95%; +    background-color: #fffffff; +} +/* +body { +    font-size: 90%; +    font-family: verdana, arial, sans-serif; +} +*/ +div.toc { +    position: absolute; +    float: left; +    margin: 0; +    padding: 0; +    padding-top: 0.5em; +    border: 0; +    width: 13em; +    background-color: #eeeeee; +    margin-right:1em; +} +div.content { +    margin: 0; +    padding: 0; +    border-left: 13em solid #ffffff; +    padding-left: 1em; +} +div.content:after { +    content:' '; +    clear:both; +    display:block; +    height:0; +    overflow:hidden +} +div.footer { +    clear:left; +    padding: 0.5em; +    font-size: 80%; +    margin: 0; +} +div.toc ul { +    list-style: none; +    padding: 0; +    margin: 0; +} +div.toc li ul a, li ul span.currentlink +{ +    font-weight: normal; +    font-size: 90%; +    padding-left: 2em; +    background-color: #eeeeee; +} +div.toc a, span.currentlink{ +    display:block; +    text-decoration: none; +    padding-left: 0.5em; +    color: #0000aa; +} +span.currentlink { +    text-decoration: none; +    background-color: #aaaaf9; +} +div.toc a:visited { +    color: #0000aa; +} +div.toc a:hover { +    background-color: #f9f9aa; +} +  h1.minitoc, h2.minitoc, h3.minitoc { +    margin-left: 0mm; +    font-weight: bold; +    text-align: left; +    font-size: 90%; +    margin-top: 4px; +    margin-bottom: 4px; +  } +  h4.minitoc { +    margin-left: 0mm; +    font-weight: normal; +    font-size: 90%; +    margin-top: 2px; +    margin-bottom: 2px; +  } +  h5.minitoc { +    margin-left: 2mm; +    font-weight: normal; +    font-size: 85%; +    margin-top: 2px; +    margin-bottom: 2px; +  } +  h6.minitoc { +    margin-left: 4mm; +    font-weight: normal; +    font-size: 85%; +    margin-top: 2px; +    margin-bottom: 2px; +  }    h1.c, h2.c, h3.c, h4.c, h5.c, h6.c, p.c {      text-align: center    } @@ -902,35 +1011,6 @@ WOK      margin-bottom: 20px;      margin-right: 15mm;    } -/* -  table.hidden { -    color: #ffffff; -    text-decoration: none; -  } -  td.hidden { -    color: #ffffff; -    background-color: #000000; -  } -  td.hidden a.active, div.hidden a:hover { -    color: #ffffff; -    background-color: #000000; -  } -  td.hidden a:hover { -    text-decoration: none; -  } -  div.hidden a { -    line-height: 12px; -    margin: 0 0 0 0; -    text-decoration: none; -    color: #000077; -  } -  div.hidden a.active, div.hidden a:hover { -    text-decoration: none; -  } -  div.hidden a:hover { -    text-decoration: none; -  } -*/  WOK      end      def homepage                                  #stylesheet for index, home page diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index cb6d70f8..cf6d8e09 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -257,7 +257,7 @@ module SiSU_DAL            when /\^~/ # endnotes                                                                                   #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+              sub_para=para.dup -            @@endnote_array << sub_para.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/, %{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip +            @@endnote_array << sub_para.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip               endnote_no+=1              para=nil if para =~/\^~ .+/ #removes 'binary' endnote now in endnote array for later insertion            end @@ -275,9 +275,9 @@ module SiSU_DAL        end        data.each do |para|          para.strip! -        if para =~/\{\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?\}(?:(?:https?|file|ftp):\S+|image)/ -          if para !~/\{\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+\s+/ -            m=/\{\s*(\S+\.(?:png|jpg|gif))/ +        if para =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/ +          if para !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+\s+/ +            m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/              if @rmgk                imgs=para.scan(m).flatten                images=imgs.each do |image| @@ -306,7 +306,7 @@ module SiSU_DAL                      end                    end                    para.gsub!(/(#{image})/,"#{image} #{img_col}x#{img_row}") -                else para.gsub!(/\{\s*(\S+)\.(png|jpg|gif).+?\}((?:https?|file|ftp):\S+|image)/,'[ \1 (\2 missing) ]') +                else para.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}((?:https?|file|ftp):\S+|image)/,'[ \1 (\2 missing) ]')                  end                end              else @@ -317,7 +317,7 @@ module SiSU_DAL              end            end          end -        para.gsub!(/\{\s+(\S+\.(?:png|jpg|gif))\s+/i,'{\1 ') if para =~/\{\s+\S+\.(?:png|jpg|gif).+?\}(?:(?:https?|file|ftp):\S+|image)/ +        para.gsub!(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ') if para =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/          tuned_file << para unless para.nil?        end        tuned_file @@ -1147,7 +1147,7 @@ module SiSU_DAL        #s=s.gsub(/¡¡\d+¡/,' ')                                                  # tables        #s=s.gsub(/¡/,' ')                                                       # tables tidy later        #s=s.gsub(/<.+?>/,'') -      s=s.gsub(/\{.+?\.(?:png|jpg|gif).+?\}(?:https?|file|ftp)\\\:\S+ /,' [image] ')             # else image names found in search +      s=s.gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ')             # else image names found in search        s=s.gsub(/\s\s+/,' ')        s=s.strip      end diff --git a/lib/sisu/v0/dal_doc_str.rb b/lib/sisu/v0/dal_doc_str.rb index 37e9be3c..d34bf01e 100644 --- a/lib/sisu/v0/dal_doc_str.rb +++ b/lib/sisu/v0/dal_doc_str.rb @@ -216,15 +216,15 @@ module SiSU_document_structure                    end                  else                    ocno+=1 -                  if para=~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/;                             ocnt+=1 #table +                  if para=~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/;                      ocnt+=1 #table                      ocn_dv,ocn_sp="o#{ocno}","t#{ocnt}" -                  elsif para=~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/;                        ocnc+=1 #code block +                  elsif para=~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/;                ocnc+=1 #code block                      ocn_dv,ocn_sp="o#{ocno}","c#{ocnc}" -                  elsif para=~/^#{Mx[:gr_o]}(?:group|alt|verse)#{Mx[:gr_c]}/;         ocng+=1 #group, poem +                  elsif para=~/^#{Mx[:gr_o]}(?:group|alt|verse)#{Mx[:gr_c]}/; ocng+=1 #group, poem                      ocn_dv,ocn_sp="o#{ocno}","g#{ocng}" -                  elsif para=~/\{\S+?\.(?:png|jpg|gif)\s+/m;     ocni+=1 #image +                  elsif para=~/#{Mx[:lnk_o]}\S+?\.(?:png|jpg|gif)\s+/m;       ocni+=1 #image                      ocn_dv,ocn_sp="o#{ocno}","i#{ocni}" -                  else                                           ocnp+=1 #paragraph +                  else                                                        ocnp+=1 #paragraph                      ocn_dv,ocn_sp="o#{ocno}","p#{ocnp}"                    end                  end diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index c3bd8a7d..35f0582a 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -273,10 +273,12 @@ module SiSU_Syntax          line.gsub!(/^(#{Mx[:lv_o]}[56]:(\S+?)#{Mx[:lv_c]})\s*(.+)/,"\\1 \\3 #{Mx[:mk_o]}:name#\\2#{Mx[:mk_c]}")   #html name marker <a name="\\1"></a>, however at present takes you to correct position within sub-toc, will nneed to clean from sub-toc leaving in main body only          line.gsub!(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}")                     #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')          if line=~/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m -          line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ ([^}]+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,"\\1{ \\2 }\\3 #{Mx[:en_a_o]} \\3 \\4 #{Mx[:en_a_c]}") # watch +          line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ ([^}]+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m, +            "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]} \\3 \\4 #{Mx[:en_a_c]}") # watch          end          if line=~/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m -          line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m,"\\1{ \\2 }\\3\\4 #{Mx[:en_a_o]} \\3 #{Mx[:en_a_c]} ") +          line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m, +            "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]} \\3 #{Mx[:en_a_c]} ")             #text url endnote url shortcut {~^ [text] }http://url is { [text] }http://url #{Mx[:en_a_o]} http://url #{Mx[:en_a_c]} [plus adjustment for commas]             #means for this class, non-object, un-numbered ~# will not work # shortcut should not be used in conjunction with rebgular matches #reversed order, and addition of no-tilde..          end @@ -326,8 +328,9 @@ module SiSU_Syntax          #line.gsub!(/<:\/hi>/,'</span>')          line.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n")          line.gsub!(/[ ]+($)/,'\1') -        #line.gsub!(/\{(.+?)\}(https?:\S+)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked (text or image) -        #line.gsub!(/\{(.+?)\}(image)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2")      #linked image +        line.gsub!(/\{\s*(.+?)\s*\}(https?:\S+)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked (text or image) +        line.gsub!(/\{\s*(.+?)\s*\}(image)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2")      #linked image +        #line.gsub!(/(#{Mx[:lnk_c]})\s*((?:https?|file|ftp):\S+?)/m,'\1\2')          ##semantic          #line.gsub!(/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m,"\\1#{Mx[:sm_set_o]}\\2#{Mx[:sm_set_c]}\\1")          #line.gsub!(/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/,"#{Mx[:sm_subset_o]}\\1#{Mx[:sm_subset_c]}\\2") diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb index 1e788f8e..addd1ae1 100644 --- a/lib/sisu/v0/db_import.rb +++ b/lib/sisu/v0/db_import.rb @@ -141,8 +141,8 @@ module SiSU_DB_import        string.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"<br />\n")        string.gsub!(/#{Mx[:gr_o]}(?:code|alt|group|verse)(?:-end)?#{Mx[:gr_c]}/,'')        string.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'') -      string.gsub!(/\{\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)\}\S+/,'[image: \1] \2') -      string.gsub!(/\{\s*(.+?)\s*\}(?:https?|file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2') +      string.gsub!(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/,'[image: \1] \2') +      string.gsub!(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2')      end      def strip_markup(string) #define rules, make same as in dal clean        string.gsub!(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]') @@ -153,7 +153,7 @@ module SiSU_DB_import        string.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' ')                          #tables        string.gsub!(/#{Mx[:tc_p]}/u,' ')                                                     #tables tidy later        string.gsub!(/<.+?>/,'') -      string.gsub!(/\{.+?\.(?:png|jpg|gif).+?\}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search +      string.gsub!(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search        string.gsub!(/\s\s+/,' ')        string.strip!      end diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 4129893a..821893fc 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -936,7 +936,7 @@ module SiSU_Viz  </td>  <td valign="top" align="justify">}      end -    def margin_css +    def margin_css #unused, check        '<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">  <tr><td valign="top" align="justify"> '      end @@ -1627,11 +1627,13 @@ WOK  #{table_close*4}}      end      def credits_sisu -      %{#{widgets_open} +      %{<div class="substance"> +<p class="content"> +<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="4" border="0">  <tr><td>    #{widget_sisu}    #{widget_way_better} -</table>} +</table></p></div>}      end      def credits_splash      end diff --git a/lib/sisu/v0/digests.rb b/lib/sisu/v0/digests.rb index 9510a12a..42fa6962 100644 --- a/lib/sisu/v0/digests.rb +++ b/lib/sisu/v0/digests.rb @@ -161,8 +161,8 @@ module SiSU_Digest_view              end              ima=[]              if para !~/^%+\s/ \ -            and para =~/(?:^|[^_\\])\{(\S+\.(png|jpg|gif))\s.+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/ -              images=para.scan(/(?:^|[^_\\])\{(\S+\.(?:png|jpg|gif))\s.+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/).flatten +            and para =~/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+\.(png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/ +              images=para.scan(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+\.(?:png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/).flatten              else image=nil              end              x=case para diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index 5b9639dd..5f0d0de9 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -106,7 +106,7 @@ module SiSU_HTML          toc=SiSU_HTML::Source::Toc.new(data,@md).songsheet          links_guide=SiSU_HTML::Source::Links_guide.new(data,@md).toc          data=@tuned_file_array -        scr_toc=SiSU_HTML::Source::Scroll_head_and_segtoc.new(data,@md,toc,links_guide).in_common #watch +        scr_toc=SiSU_HTML::Source::Scroll_head_and_segtoc.new(@md,toc,links_guide).in_common #watch          SiSU_HTML::Source::Seg.new(data,@md).songsheet          data=@tuned_file_array          scr=SiSU_HTML::Source::Scroll.new(data,@md).songsheet @@ -246,7 +246,7 @@ module SiSU_HTML        end      end      class Toc <Links_guide -      @@toc={ :seg=>[],:scr=>[] } +      @@toc={ :seg=>[],:seg_mini=>[],:scr=>[] }        @@seg_url=''        @@dp,@@firstseg=nil,nil        def initialize(data='',md=nil) @@ -255,12 +255,13 @@ module SiSU_HTML          @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern          @pat_heading=/^(?:#{Mx[:lv_o]}[1-6]:\S*?#{Mx[:lv_c]}\s*)?(.*)#{Mx[:id_o]}~(\d+);(?:[hm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/          @pat_strip_heading_name=/<a name="h?\d.*?">(.+?)<\/a>/ -        @tell=SiSU_Screen::Ansi.new(@md.cmd) +        @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md        end        def songsheet #extracts toc for scroll & seg          SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey unless @md.cmd =~/q/          toc=nil          @@firstseg=nil +        @@toc={ :seg=>[],:seg_mini=>[],:scr=>[] }          @data.each do |para|            if para =~/^(?:#{Mx[:lv_o]}[1-6]:|4~!)/              para_toc=para.dup @@ -282,6 +283,7 @@ module SiSU_HTML              if toc                begin                  @@toc[:seg] << toc[:seg] if toc[:seg] +                @@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini]                  @@toc[:scr] << toc[:scr] if toc[:scr]                rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error                end @@ -291,6 +293,10 @@ module SiSU_HTML          @md.firstseg=@@firstseg          @@toc        end +      def minitoc +        minitoc=@@toc[:seg_mini].to_s +        '<div class="toc">' + minitoc + '</div>' +      end      protected        def rss #sort all wrong, disabled but kept          @@toc[:seg] <<<<WOK @@ -322,11 +328,13 @@ WOK          format_head_toc=SiSU_HTML_Format_type::Head_toc.new(@md)          @@toc[:scr] << format_head_toc.metadata          @@toc[:seg] << format_head_toc.seg_metadata +        @@toc[:seg_mini] << format_head_toc.mini_seg_metadata        end        def level_word_index          format_head_toc=SiSU_HTML_Format_type::Head_toc.new(@d0c)          @@toc[:scr] << format_head_toc.concordance          @@toc[:seg] << format_head_toc.concordance +        @@toc[:seg_mini] << format_head_toc.mini_concordance        end        def level_1          para=@data @@ -350,6 +358,10 @@ WOK            format_toc.lev0          else format_toc.lev1          end +        toc[:seg_mini]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/ +          format_toc.lev0 +        else format_toc.mini_lev1 +        end          title=if para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/            m=/#{$1}/            para.gsub!(m,'') @@ -385,6 +397,7 @@ WOK          format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,linkname)          toc={}          toc[:seg]=format_toc.lev2 +        toc[:seg_mini]=format_toc.mini_lev2          if para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/            m=/#{$1}/            para.gsub!(m,'') @@ -408,6 +421,7 @@ WOK          format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,linkname)          toc={}          toc[:seg]=format_toc.lev3 +        toc[:seg_mini]=format_toc.mini_lev3          if para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/            m=/#{$1}/            para.gsub!(m,'') @@ -433,6 +447,10 @@ WOK                %{  <a href="#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}" target="_top">      \\2    </a> }) +            if seg_link =~/(#{Mx[:id_o]}\~\d+;(?:\w|[0-6]:\d+);\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/m +              m=/#{$1}/m +              seg_link.gsub!(m,'') +            end              @@seg_url=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?$/,1]            elsif para =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/              seg_link=para.gsub(/^\s*(#{@md.lv4}\s+)\s*(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, @@ -443,6 +461,7 @@ WOK            format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,seg_link)            toc={}            toc[:seg]=format_toc.lev4 +          toc[:seg_mini]=format_toc.mini_lev4            if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/              m=/#{$1}/              para.gsub!(m,'') @@ -476,6 +495,7 @@ WOK    </a>}            format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,lnk_n_txt)            toc[:seg]=format_toc.lev5 +          toc[:seg_mini]=format_toc.mini_lev5            title=%{#{p_num.goto}#{linkname}</a>}          end          format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) @@ -504,6 +524,7 @@ WOK    </a>}            format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,lnk_n_txt)            toc[:seg]=format_toc.lev6 +          toc[:seg_mini]=format_toc.mini_lev6            title=%{#{p_num.goto}#{linkname}</a>}          end          format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) @@ -535,8 +556,8 @@ WOK        end      end      class Scroll_head_and_segtoc < Toc -      def initialize(data,md='',toc='',links_guide_toc='') -        @data,@md,@toc,@links_guide_toc=data,md,toc,links_guide_toc +      def initialize(md='',toc='',links_guide_toc='') +        @md,@toc,@links_guide_toc=md,toc,links_guide_toc          @vz=SiSU_Env::Get_init.instance.skin        end        def in_common diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 03d97a8d..5e261649 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -85,7 +85,7 @@ module SiSU_HTML_Format          ocn_class='ocn'          @paranum.gsub(/^(\d+|)$/,          %{  <p class="#{ocn_class}"> -      \\1 +    \\1    </p>})        end      end @@ -639,52 +639,7 @@ WOK  <tr><td valign="top">  #{@vz.paragraph_txt}}      end -    def toc_endnote -      %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} -  <a href="#endnotes"> -    Endnotes -  </a> -#{@vz.table_close}} -    end      def title_endnote -      %{#{@vz.margin_txt_0} -  #{@vz.paragraph_txt} -  <a name="endnotes" id="endnotes"></a> -#{@vz.margin_num} -    -#{@vz.table_close}} -    end -    def tail -      %{<br /> -#{@vz.margin_txt_0} -<table summary="scroll tail" bgcolor="#777777"> -<tr><td width="20%"> -#{@vz.banner_band} -</td> -<td width="60%"> -<center>#@tocband_scroll</center> -</td></tr> -</table> -<br /> -#{@vz.paragraph_txt} -  <center> -    #{@vz.credits_splash} -    #{@vz.credits_sisu} -  </center> -#{@vz.margin_num} -#{@vz.table_close} -<a name="bottom id="finish"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits" id="credits"></a> -<font color="white" size="0"> -  #{@md.title*10} -</font> -</body> -</html>}      end    end    class Head_seg < Head_information @@ -861,24 +816,7 @@ WOK    </a>  #{@vz.table_close}}      end -    def toc_endnote -    end      def title_endnote(title,subtitle,creator,table_top_control) -      %{#{@vz.banner_instrument_cover_band_seg} -  <h1 class="banner"> -    #{title} -  </h1> -  <h1 class="subbanner"> -   #{subtitle} -  </h1> -  <h1 class="subbanner"> -    #{creator} -  </h1> -  <h4 class="banner"> -    Endnotes -  </h4> -#{@vz.table_close} -<h1>Endnotes</h1>}      end      def navigation_table        %{<table summary="navigation segment table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0"> @@ -934,18 +872,17 @@ WOK  </center>}      end      def credit -      %{<br/> -#{@vz.credits_splash} +      %{#{@vz.credits_splash}  #{@vz.credits_sisu}  <a name="bottom" id="bottom"></a>  <a name="down" id="down"></a>  <a name="end" id="end"></a>  <a name="finish" id="finish"></a>  <a name="stop" id="stop"></a> -<a name="credits" id="credits"></a>} +<a name="credits" id="credits"></a></div>}      end -    def navigation_band(segtocband,seg_table_top_control) -      %{<table summary="segment navigation band" bgcolor=#{@vz.color_band1} width="100%"><tr> +    def navigation_band(segtocband,seg_table_top_control) #change name to navigaion_band_banner +      %{<table summary="segment navigation band with banner" bgcolor=#{@vz.color_band1} width="100%"><tr>  <td width="20%" align="left">  #{@vz.banner_band}  </td> @@ -958,9 +895,22 @@ WOK  </table>  #{seg_table_top_control}}      end +    def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless +      %{<div class="substance"> +<p class="content"> +<table summary="segment navigation band" bgcolor=#{@vz.color_band1} width="100%"><tr> +<td width="70%" align="center"> +  #{doc_types} +</td> +<td width="30%" align="right"> +  #{segtocband} +</td></tr> +</table> +#{seg_table_top_control} +</p></div>} +    end      def endnote_mark  %{<p class="center" id="endnotes"> -<a href="#top"><hr width=90% /></a>  </p>} #revisit      end    end @@ -998,51 +948,51 @@ WOK        end        @vz=SiSU_Env::Get_init.instance.skin      end -    def para_form(tag,attrib)                                                        # regular paragraphs shaped here +    def para_form_css(tag,attrib)                                                    # regular paragraphs shaped here        ul=ulc=''        ul,ulc="<ul>\n  ","\n  </ul>" if @tag =~/li/ -      %{#{@vz.margin_css} -  #{ul}<#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} +      %{<div class="substance"> +  #{@p_num.ocn_display} +#{ul}<#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name}      #@parablock    </#{tag}>#{ulc} -#{@vz.margin_num_css} -  #{@p_num.ocn_display} -#{@vz.table_close} +</div>  }      end      def para -      para_form('p','norm') +      para_form_css('p','norm')      end      def code -      para_form('p','code') +      para_form_css('p','code')      end      def center -      para_form('p','center') +      para_form_css('p','center')      end      def bold -      para_form('p','bold') +      para_form_css('p','bold')      end      def bullet -      para_form('li','bullet') +      para_form_css('li','bullet')      end      def format(tag,atrib) -      para_form(tag,atrib) +      para_form_css(tag,atrib)      end      def dl        "<dl><b>#@one</b> #@two</dl>"      end -    def table_end                                                                #<!TZ!> -      %{</table> -  #{@vz.margin_num_css.strip} -    #{@p_num.ocn_display} -  #{@vz.table_close}} +    def table_css_end      #<!TZ!> +      '</table> +    </p> +  </div>'      end      def no_paranum -      %{#{@vz.margin_css} -#{@vz.paragraph_txt} +      %{<div class="substance"> +<p class="ocn"> </p> +<p class="norm">    #@one #@two -#{@vz.margin_num} -#{@vz.table_close}} +  </p> +</div> +}      end      def gsub_body        case @one diff --git a/lib/sisu/v0/html_format_css.rb b/lib/sisu/v0/html_format_css.rb index ace6983b..106157ba 100644 --- a/lib/sisu/v0/html_format_css.rb +++ b/lib/sisu/v0/html_format_css.rb @@ -155,53 +155,29 @@ module SiSU_HTML_Format_type      def initialize(md='')        super(md)      end -    def toc_endnote -      %{#{@vz.margin_css} -  <h4 class="toc"> -    <a href="#endnotes"> -      Endnotes -    </a> -  </h4> -#{@vz.table_close}} -    end    end    class Format_scroll < SiSU_HTML_Format::Format_text_object      def initialize(md='',*txt)        super(md,*txt)        @vz=SiSU_Env::Get_init.instance.skin      end -    def indent_one_no_paranum -      %{#{@vz.margin_txt_1} -#{@paragraph.txt} -  #@one -#{@vz.margin_num} -#{@vz.table_close}} -    end -    def indent_two_no_paranum -      %{#{@vz.margin_txt_1} -#{@paragraph.txt} -  #@one -#{@vz.margin_num} -#{@vz.table_close}} -    end      def endnote_body -      %{#{@vz.margin_css} -  <p class="endnote"> -    #@one +      %{<div class="substance"> +<p class="ocn"> </p> +<p class="endnote"> +  #@one    </p> -#{@vz.margin_num_css} -    -#{@vz.table_close}} +</div> +}      end      def header_normal -      %{#{@vz.margin_css} +      %{<div class="substance"> +  #{@p_num.ocn_display}    <#@tag class="#@class" #{@p_num.id}>#{@p_num.name}      #@headname      #@parablock    </#@tag> -#{@vz.margin_num_css} -  #{@p_num.ocn_display} -#{@vz.table_close}} +</div>}      end      def heading_body        @tag,@class='p','norm' @@ -236,13 +212,6 @@ module SiSU_HTML_Format_type      def initialize(md='',*txt)        super(md,*txt)      end -    def navigation_para -      %{#{@vz.margin_css} -#{@paragraph.txt} -  #@one -</p> -#{@vz.table_close}} -    end      def navigation_toc_lev1_advert        %{#{@banner.home_button}\n  <center> @@ -291,39 +260,36 @@ module SiSU_HTML_Format_type      end      def navigation_toc_lev6      end -    def endnote_body_seg_tail -      %{#{@vz.margin_css} +    def endnote_body_seg_tail #FIX +      %{<div class="endnote">    <p class="endnote">      #@one    </p> -#{@vz.margin_num_css}  -#{@vz.table_close}} +</div>}      end      def endnote_body_seg_tail_indent -      %{#{@vz.margin_css} +      %{<div class="endnote">    <p class="endnote_indent">      #@one    </p> -#{@vz.margin_num_css}  -#{@vz.table_close}} +</div>}      end -    def endnote_seg_body(fn='')                                                  #url construction keep within single line... BUG WATCH 200408 +    def endnote_seg_body(fn='')  #FIX                                                #url construction keep within single line... BUG WATCH 200408        fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info -      %{#{@vz.margin_css} +      %{<div class="endnote">    <p class="endnote">      #@one#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}#@two#@three    </p> -#{@vz.margin_num_css}  -#{@vz.table_close}} +</div>}      end      def title_header -      %{#{@vz.margin_css} -  <#@tag class="#@class"> +      %{<div class="substance"> +  #@two +<#@tag class="#@class">      #@one    </#@tag> -#{@vz.margin_num_css}  -#@two -#{@vz.table_close}} +</div> +}      end      def title_header1        @tag,@class='h1','banner' @@ -338,12 +304,12 @@ module SiSU_HTML_Format_type        title_header      end      def title_header4 -      %{#{@vz.margin_css} +      %{<div class="substance"> +  <p class="ocn"> </p>    <h4 class="banner">      #@one    </h4> -#{@vz.margin_num_css}  -#{@vz.table_close}} +</div>}      end      def subtoc_lev        one=if @one \ @@ -374,25 +340,22 @@ module SiSU_HTML_Format_type      end      #% para sisu      def header4 -      %{#@format #{@vz.margin_css} +      %{<div class="substance"> +#{@p_num.ocn_display}    <h1 class="norm" #{@p_num.id}>#{@p_num.name}      #@format      #@parablock    </h1> -#{@vz.margin_num_css} -#{@p_num.ocn_display} -#{@vz.table_close}} +</div>}      end      def header_sub        @parablock.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') -      %{#{@vz.margin_css} -#{@headname} -  <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} +      %{<div class="substance"> +    #{@p_num.ocn_display} +  <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} #{@headname}      #{@parablock}    </#@tag> -#{@vz.margin_num_css} -#{@p_num.ocn_display} -#{@vz.table_close}} +</div>}      end      def header5        @tag,@class='p','bold' @@ -420,17 +383,6 @@ module SiSU_HTML_Format_type    #@parablock  </p>}      end -    def navigation_indent1 -      %{#{@vz.margin_txt_00_1} -#{@paragraph.txt_00} -    #@parablock -  </font> -  </p> -#{@vz.margin_num_css}  -#{@vz.table_close}} -    end -    def navigation_indent2 -    end      def navigation_center        "<center>#@parablock</center>"      end @@ -475,6 +427,27 @@ module SiSU_HTML_Format_type      def lev0 #docinfo        lev('h0','toc')      end +    def mini_lev1 +      lev('h1','minitoc') +    end +    def mini_lev2 +      lev('h2','minitoc') +    end +    def mini_lev3 +      lev('h3','minitoc') +    end +    def mini_lev4 +      lev('h4','minitoc') +    end +    def mini_lev5 +      lev('h5','minitoc') +    end +    def mini_lev6 +      lev('h6','minitoc') +    end +    def mini_lev0 #docinfo +      lev('h0','minitoc') +    end    end  end  __END__ diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index a15c302e..e632c835 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -69,7 +69,7 @@ module SiSU_HTML_seg      @@loop_count=@@seg_total=@@tracker=0      @@is4=@@is3=@@is2=@@is1=0      @@header1=@@header2=@@header3=@@header4=0 -    @@seg[:tocband],@@seg[:title],@@seg[:headers],@@seg[:main],@@seg[:tail],@@seg[:credits],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(9){[]} +    @@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:title],@@seg[:headers],@@seg[:main],@@seg[:tail],@@seg[:credits],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(10){[]}      @@seg[:header_endnotes]=''      @@tablehead,@@number_of_cols=0,0      @@flag_alt=false @@ -85,6 +85,7 @@ module SiSU_HTML_seg      end      def songsheet        begin +        @@minitoc=SiSU_HTML::Source::Toc.new(@data,@md).minitoc          data=get_subtoc_endnotes(@data)          data=articles(data)          Seg.new.cleanup # (((( added )))) @@ -192,6 +193,8 @@ module SiSU_HTML_seg            end          end        end +      @@seg[:main] << '</div>' +      data      end      def header_art(para)        format_head_seg=SiSU_HTML_Format_type::Head_seg.new(@md) @@ -215,7 +218,8 @@ module SiSU_HTML_seg        @p_num ||= ''        if @@is1 == 1          @dc_creator=%{<b>#{@md.dc_creator}</b>\n} if @md.dc_creator.to_s =~/\S/ -        @@seg[:tocband] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) +        @@seg[:tocband_banner] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) +        @@seg[:tocband_bannerless] << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav])          @@seg[:headers] << format_head_seg.seg_head_escript if SiSU_HTML_Format_type::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug          @@seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@dc_creator).gsub(clean,'')          paranum=if @@header1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 @@ -320,14 +324,16 @@ module SiSU_HTML_seg              elsif para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ \              and para =~/^#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/                format_txt_obj.gsub_body -              @sto.seg_lev_para_ocn.table_end +              @sto.seg_lev_para_ocn.table_css_end              else para              end            else para            end          elsif para =~/#{Mx[:tc_p]}|#{Mx[:gr_o]}T[hZ]?/u +          @sto=nil            table=SiSU_HTML_shared::Table.new(para)            para=table.table +        else @sto=nil          end          if @md.flag_separate_endnotes            para.gsub!(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{@md.sfx}#_\\1">})       #endnote- twice #removed file type @@ -345,8 +351,9 @@ module SiSU_HTML_seg              para=format_seg.no_paranum            end          end -        if @sto.format=~/4:\S+/ +        if @sto and @sto.format=~/4:\S+/            para.gsub!(/^\s*4:\S+\s*|<:[-_\w\d]?(-.+?-)?>|4~!.+/m,'')              #sort seg headers +          @@seg[:main] << '<div class="content">'            @@seg[:main] << para            @@seg[:main] << @@seg_subtoc[@@get_hash_fn]                       #% insertion of sub-toc          else @@ -361,20 +368,19 @@ module SiSU_HTML_seg          @@seg[:tail] << format_head_seg.endnote_mark          @@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> </td></tr></table>'        ads=SiSU_HTML_promo::Ad.new(@md)        @@seg[:credits] << format_head_seg.credit << ads.div.close << ads.display << format_head_seg.html_close      end      def output(type='')        if @@seg[:title] =~/\S/ #kludge (for exception file better.ways, how ironic) get a real ruby test, e.g. test that not array or...          filename_seg=[] -        filename_seg << @@seg[:title] << @@seg[:tocband] +        filename_seg << @@seg[:title] << @@seg[:tocband_banner]          if type !~/endnote/ -          filename_seg << @@seg[:headers] << @@seg[:main] +          filename_seg << @@minitoc << @@seg[:main]          else -          filename_seg << @@seg[:header_endnotes] << @@seg[:endnote_all] +          filename_seg << @@seg[:header_endnotes] << @@minitoc  << '<div class="content">' << @@seg[:endnote_all]          end -        filename_seg << @@seg[:tail] << @@seg[:tocband] << @@seg[:credits] +        filename_seg << @@seg[:tail] << @@seg[:tocband_bannerless] << @@seg[:credits]          filename_seg.flatten!.compact!          filename_seg.each do |para|            unless para =~/\A\s*\Z/ @@ -386,7 +392,7 @@ module SiSU_HTML_seg        end      end      def reinitialise -      @@seg[:title],@@seg[:dot_nav],@@seg[:tocband],@@seg[:headers],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(7){[]} +      @@seg[:title],@@seg[:dot_nav],@@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:headers],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(8){[]}        @@segtocband=nil      end      def cleanup diff --git a/lib/sisu/v0/html_table.rb b/lib/sisu/v0/html_table.rb index 1aed4f5d..ffba4b0b 100644 --- a/lib/sisu/v0/html_table.rb +++ b/lib/sisu/v0/html_table.rb @@ -67,17 +67,17 @@ module SiSU_HTML_table        @one,@parablock,@vz=one,one,SiSU_Env::Get_init.instance.skin      end      def table_head(inf) -      %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> -  <tr> -    <td valign="top" align="justify"> -      <p class="norm" id="o#{inf}"><a name="#{inf}"></a></p> -    </td> -    <td> +      %{<div class="substance"> +<p class="ocn"> +  #{inf} +</p> +<p class="norm" id="o#{inf}"><a name="#{inf}"></a>  <table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">}      end      def table_end(tablefoot='') -      %{</table>#{@vz.margin_num}#{@vz.margin_num} #{@vz.table_close} -#{tablefoot}} +      %{</p> +#{tablefoot} +</div><div class="substance">}      end      def table_row(inf,h=false)        bold=if h; '<b>' @@ -109,7 +109,7 @@ module SiSU_HTML_table          tablefoot=[]          @@tablefoot.each {|x| tablefoot << ''}          @@tablefoot=[] -        if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock=table_end +        if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock="</p>\n</div>" #table_end          end        end        if @@tablehead == 1 diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 11976af9..9cc50b23 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -254,10 +254,10 @@ module SiSU_Tune      def urls(data)        @words=[]        data.each do |word| -        @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 +        @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/ +          if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)[;.,]?(?:\s|$)/ +            m,u,d=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)([;.,]?(?:\s|$))/.match(word).captures +          else m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/.match(word).captures              d=''            end            case m @@ -276,13 +276,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?|file|ftp)\S+|image)/,ins) +            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?: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?|file|ftp)\S+/,ins) +            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp)\S+/,ins)            end            word          else word @@ -313,8 +313,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 =~/\{.+?\}((?:https?|file|ftp)\S+|image)/ -            @word_mode=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|\S+/u) +          if para =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/ +            @word_mode=para.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp)\S+|image)|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|\S+/u)              words=urls(@word_mode)              para.gsub!(/.+/m,words)            end @@ -336,7 +336,7 @@ module SiSU_Tune                para.gsub!(/([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,'<<a href="mailto:\1">\1</a>>')              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 +            para.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url              para.gsub!(/(^|#{Mx[:gl_c]}|\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+<)/ diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb index b3815828..58ea4c4f 100644 --- a/lib/sisu/v0/hub.rb +++ b/lib/sisu/v0/hub.rb @@ -134,6 +134,7 @@ module SiSU                    #when /^air$/;             SiSU_Air::Source.new(@opt).read             # -A                    when /^plaintext$/;       SiSU_Plaintext::Source.new(@opt).read       # -a                    when /^wikispeak$/;       SiSU_Wikispeak::Source.new(@opt).read       # -g +                  #when /^wikispeak$/;       SiSU_Wikispeak::Source.new(@opt).read       # -g                    when /^odf$/;             SiSU_ODF::Source.new(@opt).read             # -o                    when /^xml_md_oai_pmh_dc$/; SiSU_XML_metadata::OAI_PMH.new(@opt).read # -O                    when /^texpdf$/;          SiSU_TeX::Source.new(@opt).read             # -p @@ -278,7 +279,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/        if @opt.mod.inspect =~/--convert|--to|--from/          require "#{SiSU_lib}/sst_convert_markup"        end -      if @opt.cmd =~/([AabCcDdFfgGHhIiJjLMmNnOopQqrRSsTtUuVvwWXxYyZ_0-9])/ \ +      if @opt.cmd =~/([AabCcDdFfGHhIiJjLMmNnOopQqrRSsTtUuVvwWXxYyZ_0-9])/ \        and @opt.cmd =~/^-/ \        and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \        or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ #and @@ -425,6 +426,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/          end          if @opt.cmd =~/g/; op('wikispeak','wikispeak')         #% -g wiki          end +        #if @opt.cmd =~/g/; op('wikispeak','wikispeak')         #% -g wiki +        #end          if @opt.cmd =~/o/; op('odf','OpenDocument')            #% -o opendocument          end          if @opt.cmd =~/x/; op('xml','xml sax')                 #% -x xml sax type diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb index 06878094..edbb55f9 100644 --- a/lib/sisu/v0/manpage.rb +++ b/lib/sisu/v0/manpage.rb @@ -277,7 +277,7 @@ WOK            para.gsub!(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,"#{Mx[:br_line]}.B \\1#{Mx[:br_line]}")            para.gsub!(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}")            unless para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/ -            para.gsub!(/(?:^|\s)\{(.+?)\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1 #{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3") +            para.gsub!(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1 #{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3")              para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3")              @manpage[:endnotes]=extract_endnotes(para)              para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_a_c]}/m,'[^\1]') # endnote marker marked up @@ -332,8 +332,8 @@ WOK            para.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'')                                     # remove name links            para.gsub!(/ /,' ')                                          # decide on            para.gsub!(/(["''])/,"\\\\\\1")                                   # quotation marks need escape -          para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/,'    [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") -          para.gsub!(/^(?:^|[^_\\])\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') +          para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,'    [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") +          para.gsub!(/^(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]')            wordlist=para.scan(/\S+/)            if para =~/^#{Rx[:meta]}\s*(.+?)\Z/m # for headers              d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 09c67ff6..f3e3385f 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -222,13 +222,13 @@ module SiSU_ODF        end        def image(para)          para.gsub!(@serial,'') -        m=para.scan(/(\{\s*(.+?)\}((?:https?|file|ftp)\S+|image))/) +        m=para.scan(/(#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image))/)          if m; m.each do |i|              cont,url=i[1],i[2]              cont.gsub!(/([)(\]\[])/,"\\\\\\1")              cont.gsub!(/([+?])/,"\\\\\\1") # incorrect handling of +              url.gsub!(/([+?])/,"\\\\\\1") -            para.sub!(/\{\s*#{cont}\}#{url}/m,image_odf(i)) #watch +            para.sub!(/#{Mx[:lnk_o]}\s*#{cont}\s*#{Mx[:lnk_c]}#{url}/m,image_odf(i)) #watch              para.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix            end            m=nil @@ -242,12 +242,12 @@ module SiSU_ODF        end        def text_link(para)          para.gsub!(@serial,'') -        m=para.scan(/(\{([^}]+?)\}((?:https?|file|ftp)\S+?))([;.,]?(?=\s|$))/) #sort +        m=para.scan(/(#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+?))([;.,]?(?=\s|$))/) #sort          if m            m.each do |i|              txt,url,trail=i[1],i[2]              txt.gsub!(/([)(\]\[])/,"\\\\\\1") -            txt.gsub!(/([+?])/,"\\\\\\1") # problems with + +            txt.gsub!(/([+?*])/,"\\\\\\1") # problems with +              url.gsub!(/([+?])/,"\\\\\\1") # problems with +              para.gsub!(/\{\s*#{txt}\}#{url}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url              para.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix @@ -260,7 +260,7 @@ module SiSU_ODF          para.gsub!(@serial,'')          para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,            '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>\2') #http ftp matches escaped, no decoration -        para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, +        para.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,            '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>\3') #special case \{ e.g. \}http://url          para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,            %{\\1#{@url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\2">\\2</text:a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration @@ -368,8 +368,8 @@ module SiSU_ODF          n3=lv + 2          lv=nil if lv == 0          para=unless para=~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ -          para=if para =~/\{\s*\S+?\.(?:png|jpg|gif)\s.+?\}(?:(?:https?|file|ftp):\S+|image)/; image(para) -          elsif para =~/\{.+?\}(?:(?:https?|file|ftp):\S+|image)/; text_link(para) +          para=if para =~/#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/; image(para) +          elsif para =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/; text_link(para)            else para            end          else para @@ -485,7 +485,7 @@ module SiSU_ODF            para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') # remove empty lines            para.gsub!(/<a href=".+?">(.+?)<\/a>/,'\1')            para.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'')                                       # remove name links -#          para.gsub!(/<a href=".+?">(.+?)<\/a>/im,'\1') +          #para.gsub!(/<a href=".+?">(.+?)<\/a>/im,'\1')            #para.gsub!(/ /,' ')                                            # decide on            #para.gsub!(/\{(\S+?\.(?:png|jpg)) .+?\}(?:http:\/\/\S+|image)/,"    [ \\1 ]") #"[ #{@env.url.images_local}\/\\1 ]")            #para.gsub!(/<!TZ.+/,'') diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index b89a6252..6378c2d5 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -287,7 +287,7 @@ WOK            para.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"')            para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'-\1-')            unless para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/ -            para.gsub!(/\{(.+?)\}((?:https?|file|ftp):\/\/\S+|image)/,'\1 [link:] \2') +            para.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+|image)/,'\1 [link:] \2')              para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3")              para.gsub!(/_((?:https?|file|ftp):\/\/\S+)/,'\1')              extract_endnotes(para) @@ -322,7 +322,7 @@ WOK            para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')            para.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'')                                       # remove name links            para.gsub!(/ /,' ')                                            # decide on -          para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/,'    [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") +          para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,'    [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")            para.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')            #para.gsub!(/^\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')            wordlist=para.scan(/\S+/) diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index a930821e..a4e40685 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -92,10 +92,10 @@ module SiSU_Format_Shared      def urls(data)        @words=[]        data.each do |word| -        @words << if word=~/\{(.+?)\}((?:https?|file|ftp)\S+|image)/ -          if word =~/\{(.+?)\}((?:https?|file|ftp)\S+|image)([;.,](?:\s|$))/ -            m,u,d=/\{(.+?)\}((?:https?|file|ftp)\S+|image)([;.,](?:\s|$))/.match(word).captures -          else m,u=/\{(.+?)\}((?:https?|file|ftp)\S+|image)/.match(word).captures +        @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/ +          if word =~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)([;.,](?:\s|$))/ +            m,u,d=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)([;.,](?:\s|$))/.match(word).captures +          else m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/.match(word).captures              d=''            end            word=case m @@ -114,14 +114,14 @@ module SiSU_Format_Shared                %{<a href="#{u}">[#{png}]</a>#{caption}}              else %{[#{png}] #{caption}}              end -            word.gsub!(/\{.+?\}((?:https?|file|ftp)\S+|image)/,ins) +            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?: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}}              #ins=%{#{link} <a href="#{u}">[link]</a>#{d}} -            word.gsub!(/\{.+?\}(?:https?|file|ftp)\S+/,ins) +            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp)\S+/,ins)            end          else word          end @@ -131,14 +131,14 @@ module SiSU_Format_Shared      end      def markup(para)        if para !~/^#{Mx[:gr_o]}:code#{Mx[:gr_c]}/ -        if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/ -          wm=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|\S+/) +        if para =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/ +          wm=para.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp)\S+|image)|\S+/)            words=urls(wm)            para.gsub!(/.+/m,words)          end          para.gsub!(/#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/m,'')          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)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url          para.gsub!(/(^|#{Mx[:gl_c]}|\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        else          para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>') #code-block: angle brackets special characters diff --git a/lib/sisu/v0/shared_structure.rb b/lib/sisu/v0/shared_structure.rb index f7b78e0e..506b5097 100644 --- a/lib/sisu/v0/shared_structure.rb +++ b/lib/sisu/v0/shared_structure.rb @@ -9,8 +9,7 @@   * Author: Ralph Amissah   * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -   2007, -   2008 Ralph Amissah All Rights Reserved. +   2007, 2008 Ralph Amissah All Rights Reserved.   * License: GPL 3 or later: diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 3c34e67f..9203f0df 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -377,16 +377,16 @@ module SiSU_XML_munge          para.gsub!(/#{Mx[:br_page]}\s*/,'')          para.gsub!(/#{Mx[:br_page_new]}\s*/,'')          para.gsub!(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,''); para.gsub!(/<[-~]#>/,'') -        para.gsub!(/(?:^|[^_\\])\{\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?\}(https?:\/\/\S+)/, -	  %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1" width="\\2" height="\\3" />[\\1] \\4}) -        para.gsub!(/(?:^|[^_\\])\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/, -	  %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1"/>\\1}) -        para.gsub!(/(^|#{Mx[:gl_c]}|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, +        para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}(https?:\/\/\S+)/, +          %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1" width="\\2" height="\\3" />[\\1] \\4}) +        para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?#{Mx[:lnk_c]}(https?:\/\/\S+)/, +          %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1"/>\\1}) +        para.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(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!(/(^|#{Mx[:gl_c]}|\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|$))/, -	  '<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 +          '<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!(/ /,' ')          #para.gsub!(/ /,' ') #clean        else @@ -406,7 +406,7 @@ module SiSU_XML_munge        para.gsub!(/<[-~]#>/,'')        para.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& ') #sort        para.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax -      para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/, +      para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,          "<image.path>#{@dir.url.images_local}\/\\1</image.path>")        para.gsub!(/ /,' ')        #para.gsub!(/ /,' ') #clean @@ -429,7 +429,7 @@ module SiSU_XML_munge        para.gsub!(/<[-~]#>/,'')        para.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& ') #sort        para.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax -      para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/, +      para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,          "<image.path>#{@dir.url.images_local}\/\\1</image.path>")        para.gsub!(/ /,' ')        #para.gsub!(/ /,' ') #clean diff --git a/lib/sisu/v0/sst_do_inline_footnotes.rb b/lib/sisu/v0/sst_do_inline_footnotes.rb index 5cfd38da..ba1f6379 100644 --- a/lib/sisu/v0/sst_do_inline_footnotes.rb +++ b/lib/sisu/v0/sst_do_inline_footnotes.rb @@ -475,6 +475,7 @@ module SiSU_Convert_footnotes        s=s.gsub(/<sup>(\d+)<\/sup>/,'[\1]')        s=s.gsub(/(?: \\;)+/,' ')        s=s.gsub(/\{.+?\.(?:png|jpg|gif).+?\}(?:https?|file|ftp)\\\:\S+ /,' [image] ')             # else image names found in search +      s=s.gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ')             # else image names found in search        s=s.gsub(/\s\s+/,' ')        s=s.strip      end diff --git a/lib/sisu/v0/sst_to_s_xml_dom.rb b/lib/sisu/v0/sst_to_s_xml_dom.rb index 23143ed8..5976d82b 100644 --- a/lib/sisu/v0/sst_to_s_xml_dom.rb +++ b/lib/sisu/v0/sst_to_s_xml_dom.rb @@ -365,6 +365,8 @@ WOK            para.gsub!(/<:pb>\s*/,'')            para.gsub!(/\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/,              "<image.path>#{dir.url.images_local}/\\1</image.path>") +          para.gsub!(/#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/, +            "<image.path>#{dir.url.images_local}/\\1</image.path>")            para.gsub!(/ /,' ')            para=SiSU_document_structure::Structure.new(@md,para).structure            @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 diff --git a/lib/sisu/v0/texinfo_format.rb b/lib/sisu/v0/texinfo_format.rb index 42d62960..b627b616 100644 --- a/lib/sisu/v0/texinfo_format.rb +++ b/lib/sisu/v0/texinfo_format.rb @@ -482,7 +482,7 @@ WOK      end      def http        # very messy clean up ! - work area, testing -      z=@para[/\\\{(.+?)\}(?:https?|file|ftp):\/\//,1] # match operator for z \\ fragile ! +      z=@para[/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:https?|file|ftp):\/\//,1] # match operator for z \\ fragile !        url=@para[/((?:https?|file|ftp):\S+)/im,1]        if @para =~/\.(png|jpg|gif)/          image,w,x,y=z.scan(/\S+/) @@ -496,11 +496,11 @@ WOK        end        if image          dir=SiSU_Env::Info_env.new(@md.fns) -        @para.gsub!(/\{\S+\.(png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+/, # fragile match operator\\ fragile ! +        @para.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/, # fragile match operator\\ fragile !            "\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/#{image}}}#{caption}")        else          link=z[/(.+?)\\/im,1] -        @para.gsub!(/\{.+?\}(?:https?|file|ftp):\/\/\S+/,"\n\\noindent\\href{#{url}}{#{link}}")  # fragile match operator\\ fragile ! +        @para.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/,"\n\\noindent\\href{#{url}}{#{link}}")  # fragile match operator\\ fragile !        end      end    end diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index 8d951dfb..e4bd9c00 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -435,7 +435,7 @@ module SiSU_TeX              end            elsif x =~/code/; @@flag_alt,@@flag_code=true,true            elsif @@flag_alt -            if para =~ /\}(?:https?|file|ftp)/m +            if para =~ /#{Mx[:lnk_c]}(?:https?|file|ftp)/m                para=SiSU_TeX_Pdf::Format_text_object.new(@md,para,'a4').http              end              @group_collect << para #<< "\n\n" @@ -485,7 +485,7 @@ module SiSU_TeX            when /^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/; mono.indent($1)            when /<:=/;                                mono.symbol_graphic #watch            when /^\s*<:image\s+/;                     mono.image -          when /\}image/;                            mono.png +          when /#{Mx[:lnk_c]}image/;                 mono.png            else              para.strip!              para=enclose(para) unless para =~/^$/ @@ -499,7 +499,7 @@ module SiSU_TeX            end            para          end -        if para =~ /\}(?:https?|file|ftp)/ +        if para =~ /#{Mx[:lnk_c]}(?:https?|file|ftp)/            para=if para !~/\.(?:png|jpg|gif)/              SiSU_TeX_Pdf::Format_text_object.new(@md,para,'a4').http            else diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 0fa439f0..a3f2f7d2 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -375,12 +375,12 @@ para        else          tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_tex}")          tell.error2 unless @md.cmd =~/q/ -        @string.gsub!(/\{\S+\.(png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+/,'') # fragile match operator\\ fragile ! +        @string.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/,'') # fragile match operator\\ fragile !        end      end      def image        dir=SiSU_Env::Info_env.new(@md.fns) -      image,m=/<:image\s+(\S+)\s+.+?width=``(\d+)''.+?>/m.match(@string).captures +      image,m=/#{Mx[:lnk_o]}\s*(\S+)\s+.+?width=``(\d+)''.+?#{Mx[:lnk_c]}/m.match(@string).captures        width=m[1] || '100'        width=width.to_i*0.4        image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \ @@ -397,17 +397,17 @@ para          nil        end        if image_source -        @string.gsub!(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/, +        @string.gsub!(/#{Mx[:lnk_o]}\s*((?:https?|file|ftp):\/\/\S+)\s+(\S+).+?#{Mx[:lnk_c]}/,            @center_begin + "\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{image_source}/\\2}}" + @center_end ) -        @string.gsub!(/<:image\s+(\S+)\s+.+\s+?>/, +        @string.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/,            @center_begin + "\\includegraphics*[width=#{width}pt]{#{image_source}/\\1}" + @center_end ) -      else @string.gsub!(/<:image\s+(\S+)\s+.+\s+?>/,'\1}') +      else @string.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/,'\1}')        end      end      def png #fc missing image check        dir=SiSU_Env::Info_env.new(@md.fns)        # messy clean up -      z=@string[/\\\{(\S.+?)\}(?:image|png)/,1].strip if @string =~ /\\\{\S.+?\}(?:image|png)/ # match operator for z \\ fragile ! +      z=@string[/#{Mx[:lnk_o]}(\S.+?)#{Mx[:lnk_c]}(?:image|png)/,1].strip if @string =~ /#{Mx[:lnk_o]}\S.+?#{Mx[:lnk_c]}(?:image|png)/ # match operator for z \\ fragile !        if z #debug 2004w14          image=z[/(\S+?\.(?:png|jpg|gif)\b)/m]          image.gsub!(/\\/,'') @@ -438,29 +438,28 @@ para          nil        end        if image_source -        @string.gsub!(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/, # fragile match operator\\ fragile ! +        @string.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/, # fragile match operator\\ fragile !            "#@center_begin\n\\includegraphics*[width=#{width}pt]{#{image_source}/#{image}}#{caption}#@center_end") -      else -        @string.gsub!(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,'') # fragile match operator\\ fragile ! +      else @string.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/,'')        end      end      def http_word_mode #(orientation='')        # clean up ! - work area, testing        dir=SiSU_Env::Info_env.new(@md.fns)        @words=[] -      @url_generic_rgx=/\\\{.+?\\?\}(?:https?|file|ftp):\S+/ +      @url_generic_rgx=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/        @string.each do |word|          @words << if word=~@url_generic_rgx -          if word =~/\\\{(?:.+?)\\?\}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?(?:[;.,]?(?:\s|$)|(?:\s|$))/ -            regx_url=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/ -            punctuate=/\\\{.+?\\?\}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?([;.,]?(?:\s|$))/.match(word).captures.join +          if word =~/#{Mx[:lnk_o]}(?:.+?)#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?(?:[;.,]?(?:\s|$)|(?:\s|$))/ +            regx_url=%r/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/ +            punctuate=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?([;.,]?(?:\s|$))/.match(word).captures.join            else -            regx_url=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\S+)/ +            regx_url=%r/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\S+)/              punctuate=''            end            z,url=regx_url.match(word).captures if word =~regx_url            url=url.strip -          if word =~/\{\s*\S+\.?(?:png|jpg|gif)/ \ +          if word =~/#{Mx[:lnk_o]}\s*\S+\.?(?:png|jpg|gif)/ \            and word=~/\s+\d+x\d+\s+/              image,x,y=z.scan(/\S+/)              image.gsub!(/\\/,'') @@ -486,37 +485,37 @@ para                "{\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}"              else ''              end -          elsif word =~/\{\s*(\S+\.?\.(?:png|jpg|gif))/ +          elsif word =~/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/              tell=SiSU_Screen::Ansi.new(@md.cmd,%{document built without image: "#{$1}" as image dimensions not provided (& librmagick-ruby is not installed)?\n})              tell.print_grey #unless @opt.cmd =~/q/            end            word=if image #most images fc etc. #% clean up !              word=if @md.fns =~/\.(?:ssm\.)?sst$/ \              and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") -              word=if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ +              word=if word =~ /(#{Mx[:lnk_o]}[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+)/                  "#@center_begin\\\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_local_tex}/#{image}}}#{caption} #@center_end"                end                word              elsif @md.fns =~/\.-ss[tm]$/ \              and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") -              word=if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ +              word=if word =~ /(#{Mx[:lnk_o]}[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+)/                  "#@center_begin\\\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_remote_tex}/#{image}}}#{caption}#@center_end"                end                word              elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}") -              word=if word =~/(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ +              word=if word =~/(#{Mx[:lnk_o]}[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+)/                  "#@center_begin\\\n\\href{#{url}}\n{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/#{image}}}#{caption}#@center_end"                end                word              else                tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}")                tell.error2 unless @md.cmd =~/q/ -              word='' if word =~ /\{\S+\.(png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+/ +              word='' if word =~ /#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/                word              end            else              link=z.strip #[/(.+?)\\/m,1] -            word="\\href{#{url}}{#{link}}#{punctuate}" if word =~/\\\{.+?\\\}(?:https?|file|ftp):\/\/\S+/ +            word="\\href{#{url}}{#{link}}#{punctuate}" if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/              word            end          else word @@ -526,7 +525,7 @@ para        @words      end      def http -      wm=@string.dup.scan(/\\\{.+?\\\}(?:(?:https?|file|ftp):\S+|image)|\w+\s*|./m) +      wm=@string.dup.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)|\w+\s*|./m)        @string=SiSU_TeX_Pdf::Format_text_object.new(@md,wm,@ps).http_word_mode #GET PAPER SIZE AND USE IT      end      def title @@ -993,7 +992,7 @@ WOK        string.gsub!(/\#/,'\#')        string.gsub!(/\%/,'\%')        string.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes -      if string !~/^\s*<:image|\}:image\s/ +      if string !~/^\s*#{Mx[:lnk_o]}|#{Mx[:lnk_c]}image\s/          string.gsub!(/_/,'\_')        end        string.gsub!(/\{/,'\{') @@ -1013,11 +1012,15 @@ WOK        string.gsub!(/&\S+?;/,' ')        string.gsub!(/<a href=".+?">/,' ')        string.gsub!(/<\/a>/,' ') -      string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case -      string.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url -      string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration +      string.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, +        '\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url +      string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/, +        ' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case +      string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, +        '\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration        unless @@flag_code -        string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start +        string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, +          "\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start        else #code-block: angle brackets special characters, note _ already escaped          string.gsub!(/\\_</,'{\UseTextSymbol{OML}{<}}')          string.gsub!(/\\_>/,'{\UseTextSymbol{OML}{>}}') @@ -1025,7 +1028,8 @@ WOK        string.gsub!(/<:ee>/,'')        string.gsub!(/<!>/,' ')        #proposed change, insert, but may be redundant -      string.gsub!(/ \/>#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~|<br)/,' \begin{ParagraphIndent}{0.01\columnwidth}\1\end{ParagraphIndent} ') # footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder +      string.gsub!(/ \/>#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~|<br)/, +        ' \begin{ParagraphIndent}{0.01\columnwidth}\1\end{ParagraphIndent} ') # footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder        string.gsub!(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") # Work Area        string.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}')        #string.gsub!(/<em>(.+?)<\/em>/,'\begin{bfseries}\1 \end{bfseries}') @@ -1049,7 +1053,8 @@ WOK          string.gsub!(/\s+'/,' `')                                # open '          string.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*'/,'\1`')  # open '        end -      string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*#{Mx[:gl_bullet]}\s*/,'\1 \begin{math} \bullet \end{math}~~') #bullets - added 2004w17 watch \\_ +      string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*#{Mx[:gl_bullet]}\s*/, +        '\1 \begin{math} \bullet \end{math}~~') #bullets - added 2004w17 watch \\_        string.gsub!(/(<font.*?>|<\/font>)/,'')        string.gsub!(/\s*#{Mx[:fa_superscript_o]}(\S+?)#{Mx[:fa_superscript_c]}/,'^\1')        #string.gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_paragraph]}|\n)\*/,' \\\\ ') @@ -1084,7 +1089,8 @@ WOK        #string.gsub!(/<=asterisk>/,'{\ast}')        #string.gsub!(/<=copymark>/,"^{\\copyright} ") # watch has been problematic        #copymark='{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} ' -      string.gsub!(/<=copymark>\s*(.+)?\s+(#{Mx[:id_o]}\\~\d+;\w(?:[0-6]:)?\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})/,"^\\copyright \\textnormal{\\1} \\2") # watch likely to be problematic +      string.gsub!(/<=copymark>\s*(.+)?\s+(#{Mx[:id_o]}\\~\d+;\w(?:[0-6]:)?\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})/, +        '^\copyright \textnormal{\1} \2') # watch likely to be problematic        string      end      def xetex_special_characters_1(string)             # ~ ^ $ & % _ { }  #LaTeX special characters - KEEP list @@ -1153,7 +1159,7 @@ WOK        string.gsub!(/\#/,'\#')        string.gsub!(/\%/,'\%')        string.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes -      if string !~/^\s*<:image|\}:image\s/ +      if string !~/^\s*#{Mx[:lnk_o]}|#{Mx[:lnk_c]}image\s/          string.gsub!(/_/,'\_')        end        string.gsub!(/\{/,'\{') @@ -1173,11 +1179,15 @@ WOK        string.gsub!(/&\S+?;/,' ')        string.gsub!(/<a href=".+?">/,' ')        string.gsub!(/<\/a>/,' ') -      string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case -      string.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url -      string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration +      string.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, +        '\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url +      string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/, +        ' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case +      string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, +        '\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration        unless @@flag_code -        string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start +        string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, +          "\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start        else #code-block: angle brackets special characters, note _ already escaped          string.gsub!(/\\_</,'{\UseTextSymbol{OML}{<}}')          string.gsub!(/\\_>/,'{\UseTextSymbol{OML}{>}}') @@ -1185,7 +1195,8 @@ WOK        string.gsub!(/<:ee>/,'')        string.gsub!(/<!>/,' ')        #proposed change, insert, but may be redundant -      string.gsub!(/ \/>#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~|<br)/,' \begin{ParagraphIndent}{0.01\columnwidth}\1\end{ParagraphIndent} ') # footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder +      string.gsub!(/ \/>#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~|<br)/, +        ' \begin{ParagraphIndent}{0.01\columnwidth}\1\end{ParagraphIndent} ') # footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder        string.gsub!(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") # Work Area        string.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}')        #string.gsub!(/<em>(.+?)<\/em>/,'\begin{bfseries}\1 \end{bfseries}') @@ -1249,7 +1260,8 @@ WOK        #string.gsub!(/<=asterisk>/,'{\ast}')        #string.gsub!(/<=copymark>/,"^{\\copyright} ") # watch has been problematic        #copymark='{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} ' -      string.gsub!(/<=copymark>\s*(.+)?\s+(#{Mx[:id_o]}\\~\d+;\w(?:[0-6]:)?\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})/,"^\\copyright \\textnormal{\\1} \\2") # watch likely to be problematic +      string.gsub!(/<=copymark>\s*(.+)?\s+(#{Mx[:id_o]}\\~\d+;\w(?:[0-6]:)?\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})/, +        '^\copyright \textnormal{\1} \2') # watch likely to be problematic        string      end      def special_characters_curly(string) diff --git a/lib/sisu/v0/wikispeak.rb b/lib/sisu/v0/wikispeak.rb index 967387d9..2b0ba560 100644 --- a/lib/sisu/v0/wikispeak.rb +++ b/lib/sisu/v0/wikispeak.rb @@ -253,7 +253,7 @@ WOK            para.gsub!(/<i>(.+?)<\/i>/,"''\\1''")            para.gsub!(/<b>(.+?)<\/b>/,"'''\\1'''")            para.gsub!(/<u>(.+?)<\/u>/,'_\1_') -          para.gsub!(/\{(.+?)\}(https?:\/\/\S+)/,'[\2 \1]') +          para.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(https?:\/\/\S+)/,'[\2 \1]')            para.gsub!(/(https?:\/\/\S+)/,'[\1]')            para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,'')            para.gsub!(/<:p[bn]>/,'')                                         # remove page breaks @@ -261,8 +261,8 @@ WOK            para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')            para.gsub!(/<:name#\S+?>/,'')                                       # remove name links            para.gsub!(/ /,' ')                                            # decide on -          para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/,'    [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") -          para.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') +          para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,'    [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") +          para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]')            #para.gsub!(/^\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')            wordlist=para.scan(/\S+/)            if para =~/^0~(\S+)\s+(.+?)\Z/m # for headers | 
