From 200843919b9d7e41012af32e876c43d3fb44a852 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:04:52 -0400 Subject: v3: urls, --concordance (hyphen added, descriptive) --- lib/sisu/v3/urls.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb index 2e73a91f..d5698b53 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -118,7 +118,7 @@ module SiSU_urls 'X --xml-dom (XML dom type)'=>@fn[:dom], 'y --manifest (Manifest, html)'=>@fn[:manifest], 'Y (Sitemap, xml)'=>@fn[:sitemap], - 'w -concordance (Concordance, html)'=>@fn[:concordance], + 'w --concordance (Concordance, html)'=>@fn[:concordance], }.sort {|a,b| a[0].downcase<=>b[0].downcase} end def songsheet -- cgit v1.2.3 From b739f3f1afeeb7798a906f06d030392d2d3e33e2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:05:50 -0400 Subject: v3: sysenv, avoid creation of spurious directories in output tree * an image copy section removed (re-implement correctly later) --- lib/sisu/v3/sysenv.rb | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index d709cd52..4a168e2d 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -2142,20 +2142,10 @@ WOK #end def images_local if FileTest.directory?(path.image_source_include) - if @@image_flag - images=Dir.glob("#{path.image_source_include}/*.{png,jpg,gif}") - pth="#{path.webserv}/#{@stub_pwd}" - mkdir_p("#{pth}/_sisu/image") unless FileTest.directory?("#{pth}/_sisu/image") - images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0 - @@image_flag=false - end path.image_source_include -# "#{Xx[:html_relative2]}/_sisu/image" else if @@local_image==true - cmd=if @cmd; @cmd - else '' - end + cmd=@cmd ? @cmd : '' SiSU_Screen::Ansi.new(cmd,"WARNING - no local image directory or images:", defaults[:image_local] ).warn unless cmd =~/q/ @@local_image=false end -- cgit v1.2.3 From 9c518b4507322eef03a7921783e033e79f438448 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:07:18 -0400 Subject: v3: sysenv, cosmetic --- lib/sisu/v3/sysenv.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 4a168e2d..8816212d 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -696,28 +696,28 @@ module SiSU_Env end def relaxng(cmd='') #trang - convert between different schema languages for XML program='trang' - program_ref="\n\t\tsee http://www.thaiopensource.com/relaxng/trang.html" + program_ref="\n\t\tsee " if program_found?(program); system("trang #{@input} #{@output}") else puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/ end end def imagemagick #imagemagick is a image manipulation program program='identify' - program_ref="\n\t\tsee http://www.imagemagick.org/" + program_ref="\n\t\tsee " found=(program_found?(program)) ? true : false puts "\tWARN: #{program} is not installed #{program_ref}" unless found found end def graphicksmagick #graphicsmagick is a image manipulation program program='gm' - program_ref="\n\t\tsee http://www.graphicsmagick.org/" + program_ref="\n\t\tsee " found=(program_found?(program)) ? true : false puts "\tWARN: #{program} is not installed #{program_ref}" unless found found end def well_formed? #tidy - check for well formed xml xhtml etc. program=@prog.tidy - program_ref="\n\t\tsee http://tidy.sourceforge.net/" + program_ref="\n\t\tsee " if program_found?(program); system("#{@prog.tidy} -xml #{@input} > #{@output}") else puts "\tWARN: #{program} is not installed #{program_ref}" end @@ -741,8 +741,7 @@ module SiSU_Env end def latex2pdf(md,papersize='a4') #convert from latex to pdf tell=((@cmd =~/[MVv]/) ? '' : '> /dev/null' ) - mode='batchmode' - #mode='nonstopmode' + mode='batchmode' #mode='nonstopmode' program_ref="\n\t\tSee http://www.tug.org/applications/pdftex/\n\t\tOn Debian this is is included in tetex-extra" texpdf=tex2pdf_engine if @pdfetex_flag; -- cgit v1.2.3 From 5eb77a9b2e3558ef1d7393b60d3acd2b8d97912b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:08:59 -0400 Subject: v3: param, cleanup setting of auto endotes --- lib/sisu/v3/param.rb | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 22b711df..2d2c22c0 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -1172,17 +1172,8 @@ module SiSU_Param when /^\^~\s+\S/; @en[:note] +=1 #% processing end end - if para =~/~\{|\^~ |~\^|<:ee>|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m; @flag_auto_endnotes,@flag_endnotes=true,true - end - unless @flag_auto_endnotes - if para =~/^(4~endnotes\b|<:ee>)/ - @flag_separate_endnotes=true - @flag_endnotes=true - end - end - if para =~/^(?:4~endnotes|<:ee>)/; @flag_separate_endnotes_make=false - end - if para =~/\s*.+/; @flag_endnotes=true + if para =~/~\{|\^~ |~\^|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m + @flag_auto_endnotes,@flag_endnotes=true,true end if para =~/^(?:table\{|\{table)/i; @flag_tables=true end -- cgit v1.2.3 From bdc8fb1810ad1295ebedca29926bc58481e1dd24 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:10:12 -0400 Subject: v3: xmls (sax, dom, xhtml) use of tidy, correct output location --- lib/sisu/v3/xhtml.rb | 8 ++++---- lib/sisu/v3/xml.rb | 8 ++++---- lib/sisu/v3/xml_dom.rb | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/xhtml.rb b/lib/sisu/v3/xhtml.rb index ba8238d2..03415280 100644 --- a/lib/sisu/v3/xhtml.rb +++ b/lib/sisu/v3/xhtml.rb @@ -107,7 +107,7 @@ module SiSU_XHTML def song begin SiSU_XHTML::Source::Scroll.new(@particulars).songsheet - SiSU_XHTML::Source::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use + SiSU_XHTML::Source::Tidy.new(@md,@file.place_file.xhtml.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@file.place_file.xhtml.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error ensure @@ -395,8 +395,8 @@ WOK end end class Tidy - def initialize(md,dir) - @md,@env=md,dir + def initialize(md,file) + @md,@file=md,file @prog=SiSU_Env::Info_program.new end def xml @@ -408,7 +408,7 @@ WOK tell.grey_open end tidyfile='/dev/null' #don't want one or screen output, check for alternative flags - tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:xhtml]}",tidyfile) + tidy=SiSU_Env::System_call.new(@file,tidyfile) tidy.well_formed? tell.p_off unless @md.opt.cmd =~/q/ end diff --git a/lib/sisu/v3/xml.rb b/lib/sisu/v3/xml.rb index 23cfb5bc..f2751da1 100644 --- a/lib/sisu/v3/xml.rb +++ b/lib/sisu/v3/xml.rb @@ -107,7 +107,7 @@ module SiSU_XML_SAX def song begin SiSU_XML_SAX::Source::Scroll.new(@particulars).songsheet - SiSU_XML_SAX::Source::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use + SiSU_XML_SAX::Source::Tidy.new(@md,@file.place_file.xml_sax.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_sax.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error ensure @@ -437,8 +437,8 @@ WOK end end class Tidy - def initialize(md,dir) - @md,@env=md,dir + def initialize(md,file) + @md,@file=md,file @prog=SiSU_Env::Info_program.new end def xml @@ -450,7 +450,7 @@ WOK tell.grey_open end tidyfile='/dev/null' #don't want one or screen output, check for alternative flags - tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:sax]}",tidyfile) + tidy=SiSU_Env::System_call.new(@file,tidyfile) tidy.well_formed? tell.p_off unless @md.opt.cmd =~/q/ end diff --git a/lib/sisu/v3/xml_dom.rb b/lib/sisu/v3/xml_dom.rb index 22b11ebc..7a0d55f3 100644 --- a/lib/sisu/v3/xml_dom.rb +++ b/lib/sisu/v3/xml_dom.rb @@ -104,7 +104,7 @@ module SiSU_XML_DOM def songsheet begin SiSU_XML_DOM::Source::Scroll.new(@particulars).songsheet - SiSU_XML_DOM::Source::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use + SiSU_XML_DOM::Source::Tidy.new(@md,@file.place_file.xml_dom.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_dom.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error ensure @@ -513,8 +513,8 @@ WOK end end class Tidy - def initialize(md,dir) - @md,@env=md,dir + def initialize(md,file) + @md,@file=md,file @prog=SiSU_Env::Info_program.new end def xml @@ -524,7 +524,7 @@ WOK tell=SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','','') tell.grey_open unless @md.opt.cmd =~/q/ tidyfile='/dev/null' #don't want one or screen output, check for alternative flags - tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:dom]}",tidyfile) + tidy=SiSU_Env::System_call.new(@file,tidyfile) tidy.well_formed? tell.p_off unless @md.opt.cmd =~/q/ end -- cgit v1.2.3 From 427c8b2969fef30a403a55adfc32b449d78d7fe9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:11:52 -0400 Subject: v3: texpdf, XeTeX language settings (setmainlanguage setotherlanguage) * get from directory or filename if header @make: :language: not set --- lib/sisu/v3/texpdf.rb | 2 +- lib/sisu/v3/texpdf_format.rb | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 522480fd..22269fc2 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -183,7 +183,7 @@ module SiSU_TeX when /legal/; pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 end - Dir.mkdir(@md.file.output_path.pdf.dir) unless FileTest.directory?(@md.file.output_path.pdf.dir) + mkdir_p(@md.file.output_path.pdf.dir) unless FileTest.directory?(@md.file.output_path.pdf.dir) if FileTest.file?(portrait_pdf) cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}") rm(portrait_pdf) diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index d7942121..cd63cd4e 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -636,10 +636,20 @@ module SiSU_TeX_Pdf end def tex_head_lang #babel 18n lang_char_arr=@md.i18n - mainlang_char=lang_char_arr.slice(0) + mainlang_char=if @md.i18n == Array \ + and @md.i18n.length > 0 + lang_char_arr.slice(0) + else @md.opt.lng + end mainlang=@lang.list[mainlang_char][:xlp] - otherlang=[] - lang_char_arr.slice(1..9).each { |ch| otherlang << @lang.list[ch][:xlp] } + otherlang=if mainlang != 'english' + [ @lang.list['en'][:xlp] ] + else [] + end + if lang_char_arr.length > 0 + lang_char_arr.slice(1..9).each { |ch| otherlang << @lang.list[ch][:xlp] } + otherlang.uniq! + end otherlang=otherlang.join(',') { mainlang: mainlang, otherlang: otherlang } end -- cgit v1.2.3 From a44bbf20b1f06c938ae0579a7771005995273c0c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:12:52 -0400 Subject: v3: epub, opf fixes --- lib/sisu/v3/epub_format.rb | 90 +++++++++++++++++++++++++++++++++++++++----- lib/sisu/v3/epub_segments.rb | 6 ++- 2 files changed, 85 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index e75ad112..9f169f5e 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1037,16 +1037,90 @@ WOK def metadata #metadata dc author=if defined? @md.creator.author \ and @md.creator.author =~/\S+/ - x=@md.creator.author.gsub!(//,'>') - @md.creator.author.gsub!(/<br(?: \/)?>/,'
') - %{\n #{x}} + m='' + @md.creator.author_detail.each do |x| + surname=x[:the] \ + ? x[:the] \ + : '' + other_names=x[:others] \ + ? ', ' + x[:others] \ + : '' + m=(m.empty?) \ + ? (surname + other_names) \ + : (m + '; ' + surname + ', ' + other_names) + m.gsub!(//,'>') + m.gsub!(/<br(?: \/)?>/,';') + end + x=@md.creator.author.dup + x.gsub!(//,'>') + x.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} + else '' + end + translator=if defined? @md.creator.translator \ + and @md.creator.translator =~/\S+/ + m='' + @md.creator.translator_detail.each do |x| + surname=x[:the] \ + ? x[:the] \ + : '' + other_names=x[:others] \ + ? ', ' + x[:others] \ + : '' + m=(m.empty?) \ + ? (surname + other_names) \ + : (m + '; ' + surname + ', ' + other_names) + m.gsub!(//,'>') + m.gsub!(/<br(?: \/)?>/,';') + end + x=@md.creator.translator.dup + x.gsub!(//,'>') + x.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} else '' end illustrator=if defined? @md.creator.illustrator \ and @md.creator.illustrator =~/\S+/ - x=@md.creator.illustrator.gsub!(//,'>') - @md.creator.illustrator.gsub!(/<br(?: \/)?>/,'
') - %{\n #{x}} + m='' + @md.creator.illustrator_detail.each do |x| + surname=x[:the] \ + ? x[:the] \ + : '' + other_names=x[:others] \ + ? ', ' + x[:others] \ + : '' + m=(m.empty?) \ + ? (surname + other_names) \ + : (m + '; ' + surname + ', ' + other_names) + m.gsub!(//,'>') + m.gsub!(/<br(?: \/)?>/,';') + end + x=@md.creator.illustrator.dup + x.gsub!(//,'>') + x.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} + else '' + end + date_published=if defined? @md.date.published \ + and @md.date.published =~/\S+/ + x=@md.date.published.dup + x.gsub!(//,'>') + x.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} + else '' + end + subject=if defined? @md.classify.subject \ + and @md.classify.subject =~/\S+/ + x=@md.classify.subject.dup + x.gsub!(//,'>') + x.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} + else '' + end + language=if defined? @md.opt.lng \ + and @md.opt.lng =~/\S+/ + language=@md.opt.lng.gsub(/
/,'
') + %{\n #{language}} else '' end rights=if defined? @md.rights.all \ @@ -1058,10 +1132,8 @@ WOK < #{@md.title.full} - #{author}#{illustrator} - en-US + #{author}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} ... - #{rights} urn:uuid:#{@md.dgst[1]} WOK diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index ed8c8d39..7bddf917 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -395,7 +395,8 @@ WOK if @md.flag_separate_endnotes # may need to revisit, check dob.obj.gsub!(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">}) #endnote- twice #removed file type end - if dob.is =~/heading|para/ and (not dob.ocn or dob.ocn.to_s.empty?) + if dob.is =~/heading|para/ \ + and (not dob.ocn or dob.ocn.to_s.empty?) format_seg=SiSU_EPUB_Format::Format_seg.new(@md,dob) end if (dob.is=='heading' or dob.is=='heading_insert' or dob.is=='para') \ @@ -414,7 +415,8 @@ WOK end def tail format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) - if @md.flag_auto_endnotes and @@seg_endnotes[@@get_hash_fn] + if @md.flag_auto_endnotes \ + and @@seg_endnotes[@@get_hash_fn] @@seg[:tail] << %{\n
\n
\n} if @@seg_endnotes[@@get_hash_fn].flatten.length > 0 @@seg[:tail] << format_head_seg.endnote_mark -- cgit v1.2.3 From f965e5904777542136ff525685193be307bbcfe8 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:14:34 -0400 Subject: v3: qrcode, manifest, (++), QR code (metadata) images for manifest * generate images using qrencode --- lib/sisu/v3/hub.rb | 4 + lib/sisu/v3/manifest.rb | 28 ++ lib/sisu/v3/options.rb | 6 + lib/sisu/v3/qrcode.rb | 733 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/sisu/v3/sysenv.rb | 39 ++- 5 files changed, 804 insertions(+), 6 deletions(-) create mode 100644 lib/sisu/v3/qrcode.rb (limited to 'lib') diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 7b847d4f..5e288b96 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -157,6 +157,7 @@ module SiSU when /^xml_scaffold$/; SiSU_XML_scaffold::Source.new(@opt).read # -k xml_scaffold.rb when /^embedded$/; SiSU_Embedded::Source.new(@opt).read # -m embedded.rb (image and other content) #check when /^manifest$/; SiSU_Manifest::Source.new(@opt).read # -y manifest.rb + when /^qrcode$/; SiSU_QRcode::Source.new(@opt).read # -Q qrcode.rb when /^sitemaps$/; SiSU_Sitemaps::Source.new(@opt).read # -Y sitemaps.rb when /^zap$/; SiSU_Zap::Source.new(@opt).read # -Z zap.rb when /^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d dbi.rb @@ -398,6 +399,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source end end + if @opt.act[:qrcode] #% --qrcode, -Q + op('qrcode','QRcode') + end if @opt.act[:hash_digests] #% --hash-digests, -N digest tree op('digests','digests') end diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index 06745c35..c6db7f25 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -415,6 +415,33 @@ module SiSU_Manifest published_languages(id,file) end end + def qrc_image + pth="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + fn=@f.base_filename.manifest_txt + #fix relative path for different output structures + img_md="../../_sisu/image/qrc_md.#{fn}.png" + img_title="../../_sisu/image/qrc_title.#{fn}.png" + if FileTest.file?("#{pth}/qrc_md.#{fn}.png")==true + @manifest[:html] <<< +

QR code SiSU document metadata:

+

+ qrcode metadata +

+ +WOK + end + if FileTest.file?("#{pth}/qrc_title.#{fn}.png")==true + @manifest[:html] <<< +

QR code document title info:

+

+ qrcode title +

+ +WOK + end + end def source_tests if @md.fns =~/\.ssm\.sst$/ #% decide whether to extract and include requested/required documents req=@md.fns @@ -813,6 +840,7 @@ WOK WOK language_versions + qrc_image @manifest[:html] <<<
diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 81d12db8..b5771590 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -309,6 +309,7 @@ module SiSU_commandline when /^--(?:po4a|pot?)$/; c=c+'P' when /^--(?:termsheet)$/; c=c+'T' when /^--(?:manifest)$/; c=c+'y' + when /^--(?:qrcode)$/; c=c+'Q' when /^--(?:sqlite)$/; c=c+'d' when /^--(?:pg|pg?sql|postgresql)$/; c=c+'D' when /^--(?:remote|rsync)$/; c=c+'R' @@ -551,6 +552,11 @@ module SiSU_commandline true else false end + act[:qrcode]=if cmd =~/Q/ \ + or mod.inspect =~/"--qrcode"/ + true + else false + end act[:manifest]=if cmd =~/y/ \ or mod.inspect =~/"--manifest"/ true diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v3/qrcode.rb new file mode 100644 index 00000000..0e9cad4a --- /dev/null +++ b/lib/sisu/v3/qrcode.rb @@ -0,0 +1,733 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: summary of generated outputs and metadata + +=end +module SiSU_QRcode + require_relative 'sysenv' # sysenv.rb + include SiSU_Env + require_relative 'prog_text_translation' # prog_text_translation.rb + require_relative 'particulars' # particulars.rb + include SiSU_Particulars + require_relative 'html' # html.rb + require_relative 'param' # param.rb + include SiSU_Param + require_relative 'i18n' # i18n.rb + include SiSU_Viz + class Source + def initialize(opt) + @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) + l=SiSU_Env::Standardise_language.new(@opt.lng).language + @doc_language=l[:n] + end + def read + begin + @env=SiSU_Env::Info_env.new(@opt.fns) + @md=SiSU_Param::Parameters.new(@opt).get + SiSU_Env::Info_skin.new(@md).select + xbrowser=@env.program.web_browser + browser=@env.program.console_web_browser + unless @opt.cmd =~/q/ + url_html="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'QR code',"#{xbrowser} #{url_html}").green_hi_blue \ + : SiSU_Screen::Ansi.new(@opt.cmd,'QR code',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}").green_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i + end + data=SiSU_HTML::Source::Html_environment.new(@particulars).tuned_file_instructions + Output_Info.new(@md).check_output(data) + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + ensure + end + end + private + class Output_Info 0 + @manifest[:txt] << %{#{@translate.topic_register}:\n} +@sp=' ' + @md.topic_register_array.each do |t| + t.each_with_index do |st,i| + if st.class==Array + st.each do |v| + @manifest[:txt] << %{#{@sp*i}#{v}\n} + end + else @manifest[:txt] << %{#{@sp*i}#{st}\n} + end + end + end + end + if @md.fns + id,info=@translate.sourcefile,@md.fns + metadata(id,info) + end + if @md.en[:mismatch] > 0 + id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})" + metadata(id,info) + end + if @md.wc_words + id,info=@translate.word_count,@md.wc_words + metadata(id,info) + end + if @md.dgst + id,info="#{@translate.sourcefile_digest} (#{@dg})",@md.dgst[1] + metadata(id,info) + end + if @md.sc_number + id,info=@translate.sc_number,@md.sc_number + metadata(id,info) + end + if @md.sc_date + id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}" + metadata(id,info) + end + end + def check_output(data) + begin + id,file='','' + vz=SiSU_Env::Get_init.instance.skin + @f=SiSU_Env::SiSU_file.new(@md) #.base_filename + url=@f.output_path.base.url + @en_manifest=if @env.output_dir_structure.by_language_code? + "#{url}/en/manifest/#{@md.fnb}.html" + elsif @env.output_dir_structure.by_filetype? + "#{url}/manifest/#{@md.fnb}.#{lc}.html" + else + "#{url}/sisu_manifest.#{lc}.html" + end + @manifest[:txt] <<< Date: Tue, 26 Jul 2011 20:16:49 -0400 Subject: v3: param, manifest, qrcode, epub, added creator.editor field --- lib/sisu/v3/epub_format.rb | 24 +++++++++++++++++++++++- lib/sisu/v3/manifest.rb | 5 +++++ lib/sisu/v3/param.rb | 21 +++++++++++++++++++++ lib/sisu/v3/qrcode.rb | 5 +++++ 4 files changed, 54 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 9f169f5e..6879c933 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1057,6 +1057,28 @@ WOK %{\n #{x}} else '' end + editor=if defined? @md.creator.editor \ + and @md.creator.editor =~/\S+/ + m='' + @md.creator.editor_detail.each do |x| + surname=x[:the] \ + ? x[:the] \ + : '' + other_names=x[:others] \ + ? ', ' + x[:others] \ + : '' + m=(m.empty?) \ + ? (surname + other_names) \ + : (m + '; ' + surname + ', ' + other_names) + m.gsub!(//,'>') + m.gsub!(/<br(?: \/)?>/,';') + end + x=@md.creator.editor.dup + x.gsub!(//,'>') + x.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} + else '' + end translator=if defined? @md.creator.translator \ and @md.creator.translator =~/\S+/ m='' @@ -1132,7 +1154,7 @@ WOK < #{@md.title.full} - #{author}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} + #{author}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} ... urn:uuid:#{@md.dgst[1]} diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index c6db7f25..f94534a4 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -490,6 +490,11 @@ WOK id,info=@translate.author,@md.creator.author metadata(id,info) end + if defined? @md.creator.editor \ + and @md.creator.editor=~/\S+/ + id,info=@translate.editor,@md.creator.editor + metadata(id,info) + end if defined? @md.creator.contributor \ and @md.creator.contributor=~/\S+/ id,info=@translate.contributor,@md.creator.contributor diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 2d2c22c0..c33bab75 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -300,6 +300,27 @@ module SiSU_Param names=name_format(s) names[:name_a_h] end + def editor + names=@h['editor'] \ + ? name_format(@h['editor']) \ + : nil + s=(names.class==Hash) \ + ? names[:name_str] \ + : nil + s=if s + l,n=Db[:col_name],'creator.editor' + validate_length(s,l,n) + else nil + end + end + def editor_detail + names=@h['editor'] \ + ? name_format(@h['editor']) \ + : nil + (names.class==Hash) \ + ? names[:name_a_h] \ + : nil + end def contributor names=@h['contributor'] \ ? name_format(@h['contributor']) \ diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v3/qrcode.rb index 0e9cad4a..b31bc7a5 100644 --- a/lib/sisu/v3/qrcode.rb +++ b/lib/sisu/v3/qrcode.rb @@ -485,6 +485,11 @@ WOK metadata(id,info) md_title_info(id,info) end + if defined? @md.creator.editor \ + and @md.creator.editor=~/\S+/ + id,info=@translate.editor,@md.creator.editor + metadata(id,info) + end if defined? @md.creator.contributor \ and @md.creator.contributor=~/\S+/ id,info=@translate.contributor,@md.creator.contributor -- cgit v1.2.3 From 399e6eaa0597b59b20135da362da894e09630e8b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:17:56 -0400 Subject: v3: sql db, constants, cgi-sql, structure changed, creator.editor field added --- lib/sisu/v3/cgi_sql_common.rb | 23 ++++++++++++++++------- lib/sisu/v3/constants.rb | 4 ++-- lib/sisu/v3/db_columns.rb | 29 +++++++++++++++++++++++++++++ lib/sisu/v3/db_create.rb | 2 ++ lib/sisu/v3/db_load_tuple.rb | 2 ++ 5 files changed, 51 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb index 8dce0743..5a2b9fde 100644 --- a/lib/sisu/v3/cgi_sql_common.rb +++ b/lib/sisu/v3/cgi_sql_common.rb @@ -138,7 +138,7 @@ module SiSU_CGI_sql search_field='' if checked_echo !~/\S/ @base,@search_field,@selected_db,@result_type,@checked_sql_limit,@checked_tip,@checked_stats,@checked_searched,@checked_url,@checked_case,@checked_echo,@checked_sql,@checked_all,@checked_none,@checked_selected,@checked_default,@search_note,@the_can=base,search_field,selected_db,result_type,checked_sql_limit,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can @tip=if checked_tip =~/\S/ - 'text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;
' + 'text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; editor:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;
' else '' end end @@ -231,10 +231,10 @@ module SiSU_CGI_sql def search_request <<-'WOK_SQL' class Search_request #% search_for - attr_accessor :text1,:fulltext,:keywords,:title,:author,:topic_register,:subject,:description,:publisher,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid,:filename + attr_accessor :text1,:fulltext,:keywords,:title,:author,:topic_register,:subject,:description,:publisher,:editor,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid,:filename def initialize(search_field='',q='') @search_field,@q=search_field,q - @text1=@fulltext=@keywords=@title=@author=@topic_register=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@comment=@abstract=@owner=@date_created=@date_issued=@date_modified=@date_available=@date_valid=@filename='' + @text1=@fulltext=@keywords=@title=@author=@topic_register=@subject=@description=@publisher=@editor=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@comment=@abstract=@owner=@date_created=@date_issued=@date_modified=@date_available=@date_valid=@filename='' if @search_field=~/\S/ @text1=text_to_match('text:') @fulltext=text_to_match('fulltxt:') @@ -244,6 +244,7 @@ module SiSU_CGI_sql @subject=text_to_match('subj(?:ect)?:') # DublinCore 3 - subject @description=text_to_match('description:') # DublinCore 4 - description @publisher=text_to_match('pub(?:lisher)?:') # DublinCore 5 - publisher + @editor=text_to_match('editor:') @contributor=text_to_match('contributor:') # DublinCore 6 - contributor @date=text_to_match('date:') # DublinCore 7 - date dd-mm-yy @type=text_to_match('type:') # DublinCore 8 - type @@ -275,6 +276,7 @@ module SiSU_CGI_sql @subject=q['sj'] if q['sj']=~/\S/ @description=q['dsc'] if q['dsc']=~/\S/ @publisher=q['pb'] if q['pb']=~/\S/ + @editor=q['cntr'] if q['cntr']=~/\S/ @contributor=q['cntr'] if q['cntr']=~/\S/ @date=q['dt'] if q['dt']=~/\S/ @type=q['ty'] if q['ty']=~/\S/ @@ -381,6 +383,11 @@ module SiSU_CGI_sql search[:text] << st[:search] search[:endnotes] << st[:search] end + st=Dbi_search_string.new('metadata_and_text.creator_editor',search_for.editor,q['cntr'],cse).string + if st[:flag] + search[:text] << st[:search] + search[:endnotes] << st[:search] + end st=Dbi_search_string.new('metadata_and_text.creator_contributor',search_for.contributor,q['cntr'],cse).string if st[:flag] search[:text] << st[:search] @@ -709,6 +716,7 @@ module SiSU_CGI_sql sj='&sj=' + CGI.escape(@search_for.subject) if @search_for.subject=~/\S/ dsc='&dsc=' + CGI.escape(@search_for.description) if @search_for.description=~/\S/ pb='&pb=' + CGI.escape(@search_for.publisher) if @search_for.publisher=~/\S/ + edt='&edt=' + CGI.escape(@search_for.editor) if @search_for.editor=~/\S/ cntr='&cntr=' + CGI.escape(@search_for.contributor) if @search_for.contributor=~/\S/ dt='&dt=' + CGI.escape(@search_for.date) if @search_for.date=~/\S/ ty='&ty=' + CGI.escape(@search_for.type) if @search_for.type=~/\S/ @@ -727,8 +735,8 @@ module SiSU_CGI_sql dtv='&dtv=' + CGI.escape(@search_for.date_valid) if @search_for.date_valid=~/\S/ fns='&fns=' + CGI.escape(@search_for.filename) if @search_for.filename=~/\S/ @@canned_search_url=(checked_all =~/checked/) \ - ? "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" \ - : "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}" + ? "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" \ + : "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}" mod=ft=~/\S+/ ? (ft.gsub(/ft/,'s1')) : s1 @canned_base_url="#{@base}?#{mod}&db=#{cgi['db']}" if checked_case=~/\S/ @@ -762,12 +770,13 @@ module SiSU_CGI_sql green=%{} canned_search_url_txt=CGI.escapeHTML(@@canned_search_url) the_can=%{#{canned_note} #{canned_search_url_txt}
} - p_text=p_fulltext=p_keywords=p_title=p_author=p_topic_register=p_subject=p_description=p_publisher=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_filename='' + p_text=p_fulltext=p_keywords=p_title=p_author=p_topic_register=p_subject=p_description=p_publisher=p_editor=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_filename='' p_filename=%{filename: #{green}#{@search_for.filename}

} if @search_for.filename =~/\S+/ p_text=%{text: #{green}#{@search_for.text1}
} if @search_for.text1 =~/\S+/ p_fulltext=%{fulltxt: #{green}#{@search_for.fulltext}
} if @search_for.fulltext =~/\S+/ p_title=%{title: #{green}#{@search_for.title}
} if @search_for.title =~/\S+/ p_author=%{author: #{green}#{@search_for.author}
} if @search_for.author =~/\S+/ + p_editor=%{editor: #{green}#{@search_for.editor}
} if @search_for.editor=~/\S+/ p_contributor=%{contributor: #{green}#{@search_for.contributor}
} if @search_for.contributor =~/\S+/ p_date=%{date: #{green}#{@search_for.date}
} if @search_for.date =~/\S+/ p_rights=%{rights: #{green}#{@search_for.rights}
} if @search_for.rights =~/\S+/ @@ -789,7 +798,7 @@ module SiSU_CGI_sql database: #{green}#{@db}; selected view: #{green}#{cgi['view']} search string: "#{green}#{analyze_format}"
- #{p_text} #{p_fulltext} #{p_keywords} #{p_title} #{p_author} #{p_topic_register} #{p_subject} #{p_description} #{p_publisher} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename} + #{p_text} #{p_fulltext} #{p_keywords} #{p_title} #{p_author} #{p_topic_register} #{p_subject} #{p_description} #{p_publisher} #{p_editor} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename} WOK #eg = %{canned search e.g.:
#{url}
find: #{analyze}
database: #{database}} diff --git a/lib/sisu/v3/constants.rb b/lib/sisu/v3/constants.rb index ae2a3b18..918a581f 100644 --- a/lib/sisu/v3/constants.rb +++ b/lib/sisu/v3/constants.rb @@ -151,8 +151,8 @@ Px[:lv3]= '=' Px[:lv4]= '-' Px[:lv5]= '.' Px[:lv6]= '.' -Db[:name_prefix]="SiSU#{SiSU_version_dir}d_" -Db[:name_prefix_db]="sisu_#{SiSU_version_dir}d_" +Db[:name_prefix]="SiSU#{SiSU_version_dir}e_" +Db[:name_prefix_db]="sisu_#{SiSU_version_dir}e_" Db[:col_title]=800 Db[:col_title_part]=400 Db[:col_title_edition]=10 diff --git a/lib/sisu/v3/db_columns.rb b/lib/sisu/v3/db_columns.rb index d8a6f3cf..99118f92 100644 --- a/lib/sisu/v3/db_columns.rb +++ b/lib/sisu/v3/db_columns.rb @@ -273,6 +273,7 @@ module SiSU_DB_columns #% creator @creator: :author: + :editor: :contributor: :illustrator: :photographer: @@ -353,6 +354,34 @@ module SiSU_DB_columns end self end + def creator_editor + def name + 'creator_editor' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document editor name(s)';} + end + def tuple + t=if defined? @md.creator.editor_detail \ + and @md.creator.editor_detail.class==Array \ + and @md.creator.editor_detail.length > 0 + txt=@md.creator.editor_detail #dc + txt='' + @md.creator.editor_detail.each do |h| + txt=txt + %{#{h[:the]}, #{h[:others]}; } + end + txt.gsub!(/[;, ]+\s*$/,'') + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end def creator_contributor # DublinCore 6 - contributor def name 'creator_contributor' diff --git a/lib/sisu/v3/db_create.rb b/lib/sisu/v3/db_create.rb index 35750c4b..1804410a 100644 --- a/lib/sisu/v3/db_create.rb +++ b/lib/sisu/v3/db_create.rb @@ -116,6 +116,7 @@ module SiSU_DB_create #{column.creator_author.create_column} #{column.creator_author_honorific.create_column} #{column.creator_author_nationality.create_column} + #{column.creator_editor.create_column} #{column.creator_contributor.create_column} #{column.creator_illustrator.create_column} #{column.creator_photographer.create_column} @@ -375,6 +376,7 @@ module SiSU_DB_create %{#{column.creator_author.column_comment}}, %{#{column.creator_author_honorific.column_comment}}, %{#{column.creator_author_nationality.column_comment}}, + %{#{column.creator_editor.column_comment}}, %{#{column.creator_contributor.column_comment}}, %{#{column.creator_illustrator.column_comment}}, %{#{column.creator_photographer.column_comment}}, diff --git a/lib/sisu/v3/db_load_tuple.rb b/lib/sisu/v3/db_load_tuple.rb index b8408f22..f7f39c08 100644 --- a/lib/sisu/v3/db_load_tuple.rb +++ b/lib/sisu/v3/db_load_tuple.rb @@ -132,6 +132,7 @@ module SiSU_DB_tuple #{@tp.column.creator_author.tuple[0]} #{@tp.column.creator_author_honorific.tuple[0]} #{@tp.column.creator_author_nationality.tuple[0]} +#{@tp.column.creator_editor.tuple[0]} #{@tp.column.creator_contributor.tuple[0]} #{@tp.column.creator_illustrator.tuple[0]} #{@tp.column.creator_photographer.tuple[0]} @@ -216,6 +217,7 @@ tid) #{@tp.column.creator_author.tuple[1]} #{@tp.column.creator_author_honorific.tuple[1]} #{@tp.column.creator_author_nationality.tuple[1]} +#{@tp.column.creator_editor.tuple[1]} #{@tp.column.creator_contributor.tuple[1]} #{@tp.column.creator_illustrator.tuple[1]} #{@tp.column.creator_photographer.tuple[1]} -- cgit v1.2.3 From 5e292103d5da448844c7c5bc38b920874d895107 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:22:49 -0400 Subject: v3: dal, indent, control of first line of indent & rest of paragraph * implements hanging indent, and possibility to set first line step indent * __[1-9] hanging indent (initial indent 0); paragraph text indent [1-9] * _[0-9]?_[1-9] initial indent; paragraph text indent * __[1-9]! bold words \\ part of hanging indent paragraph text --- lib/sisu/v3/dal_doc_objects.rb | 14 +++++---- lib/sisu/v3/dal_doc_str.rb | 66 +++++++++++++++++++++++++++++++++++++----- lib/sisu/v3/dal_syntax.rb | 20 +++++++++++-- 3 files changed, 83 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/dal_doc_objects.rb b/lib/sisu/v3/dal_doc_objects.rb index ad5f8bb7..8a330f13 100644 --- a/lib/sisu/v3/dal_doc_objects.rb +++ b/lib/sisu/v3/dal_doc_objects.rb @@ -167,10 +167,10 @@ module SiSU_document_structure end end class Object_para - attr_accessor :obj,:is,:tags,:of,:name,:idx,:bullet_,:indent,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp + attr_accessor :obj,:is,:tags,:of,:name,:idx,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp def initialize @of='para' - @is=@obj=@name=@idx=@bullet_=@indent=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil + @is=@obj=@name=@idx=@bullet_=@indent=@hang=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil @tags=[] end def paragraph(h,o=nil) @@ -185,6 +185,7 @@ module SiSU_document_structure osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] indent= h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level + hang= h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level bullet_=h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted? note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) @@ -193,7 +194,7 @@ module SiSU_document_structure end digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5 tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@name,@tags,@obj,@indent,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp + @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp self end def docinfo(h,o=nil) @@ -208,6 +209,7 @@ module SiSU_document_structure osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] indent= nil #Integer, indent level + hang= nil #Integer, indent level bullet_=false #Bool, bulleted? note_= false #Bool, endnotes/footnotes? (processing optimization) image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) @@ -216,7 +218,7 @@ module SiSU_document_structure end digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5 tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@name,@tags,@obj,@indent,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp + @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp self end end @@ -325,10 +327,10 @@ module SiSU_document_structure end end class Object_table - attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp + attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp def initialize @of='block' - @is=@obj=@lv=@name=@idx=@indent=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@digest=@tmp=nil + @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@digest=@tmp=nil @tags=[] end def table(h,o=nil) diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb index ed289015..52425437 100644 --- a/lib/sisu/v3/dal_doc_str.rb +++ b/lib/sisu/v3/dal_doc_str.rb @@ -92,8 +92,36 @@ module SiSU_document_structure_extract def bullet_test(str) bool=((str=~/\*/) ? true : false) end - def indent_test(str) - num=((str=~/^_([1-9])/) ? $1 : 0) + def hang_and_indent_test(str) + hang_indent=if str=~/^_([1-9])[^_]/ + [$1,$1] + elsif str=~/^__([1-9])/ + [0,$1] + elsif str=~/^_([0-9])_([0-9])/ + [$1,$2] + else + [0,0] + end + hang,indent=hang_indent[0],hang_indent[1] + [hang,indent] + end + def hang_and_indent_def_test(str1,str2) + hang_indent=if str1=~/^_([1-9])[^_]/ + [$1,$1] + elsif str1=~/^__([1-9])/ + [0,$1] + elsif str1=~/^_([0-9])_([0-9])/ + [$1,$2] + else + [0,0] + end + obj=if str2 =~/^(.+?)\s+\\\\(?:\s+|\n)/ + str2.gsub(/^(.+?)(\s+\\\\(?:\s+|\n))/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") + else + str2.gsub(/^(.+?)\n/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\n") + end + hang,indent=hang_indent[0],hang_indent[1] + [hang,indent,obj] end def endnote_test?(str) bool=((str=~/~\{.+?\}~|~\[.+?\]~/) ? true : false) @@ -171,16 +199,37 @@ module SiSU_document_structure_extract SiSU_document_structure::Object_heading.new.heading(h) else nil end - when /^(?:_[1-9]|_[1-9]?\*)\s+/ #indented and/or bullet paragraph - t_o=if t_o=~/^(_(?:[1-9]?\*|[1-9])\s+)(.+)/m + when /^_(?:[1-9]!?|[1-9]?\*)\s+/ #indented and/or bullet paragraph + t_o=if t_o=~/^(_(?:[1-9]?\*|[1-9]!?)\s+)(.+)/m tst,obj=$1,$2 - indent=indent_test(tst) + if t_o=~/^_[1-9]!\s+.+/m + hang,indent,obj=hang_and_indent_def_test(tst,obj) + else + hang,indent=hang_and_indent_test(tst) + end bullet=bullet_test(tst) image=image_test(obj) note=endnote_test?(obj) obj,tags=extract_tags(obj) unless obj=~/\A\s*\Z/m - h={ bullet_: bullet, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags } + h={ bullet_: bullet, hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags } + SiSU_document_structure::Object_para.new.paragraph(h) + end + else nil + end + when /^_[0-9]?_[0-9]!?\s+/ #hanging indent paragraph + t_o=if t_o=~/^(_[0-9]?_[0-9]!?\s+)(.+)/m + tst,obj=$1,$2 + if t_o=~/^_[0-9]?_[0-9]!\s+.+/m + hang,indent,obj=hang_and_indent_def_test(tst,obj) + else + hang,indent=hang_and_indent_test(tst) + end + image=image_test(obj) + note=endnote_test?(obj) + obj,tags=extract_tags(obj) + unless obj=~/\A\s*\Z/m + h={ hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags } SiSU_document_structure::Object_para.new.paragraph(h) end else nil @@ -196,7 +245,7 @@ module SiSU_document_structure_extract note=endnote_test?(t_o) obj,tags=extract_tags(t_o) unless obj=~/\A\s*\Z/m - h={ bullet_: false, indent: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags } + h={ bullet_: false, indent: 0, hang: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags } SiSU_document_structure::Object_para.new.paragraph(h) end end @@ -725,7 +774,8 @@ module SiSU_document_structure_extract end def structure_markup #build structure where structure provided only in meta header @dob=if @dob.is =~/para/ \ - and @dob.indent !~/[1-9]/ \ + and ((@dob.hang !~/[1-9]/ and @dob.indent !~/[1-9]/) \ + or (@dob.hang != @dob.indent)) \ and not @dob.bullet_ @dob=case @dob.obj when /^#{@md.lv1}/ diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb index 4595d6e1..bb1aacbe 100644 --- a/lib/sisu/v3/dal_syntax.rb +++ b/lib/sisu/v3/dal_syntax.rb @@ -398,9 +398,19 @@ module SiSU_Syntax dob.obj.gsub!(/=\{(.+?)\}/, "#{Mx[:idx_o]}\\1#{Mx[:idx_c]}") dob.obj.gsub!(/^\s*_([1-9])\*\s*/, - "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut + "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut dob.obj.gsub!(/^\s*_([1-9])\s+/, - "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #indent + "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}") #indent + dob.obj.gsub!(/^\s*_([1-9])!\s+(.+?)\s*$/, + "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} ") #indent bold + dob.obj.gsub!(/^\s*__([1-9])\s+/, + "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}") #hang + dob.obj.gsub!(/^\s*__([1-9])!\s+(.+?)\s*$/, + "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} ") #hangdef + dob.obj.gsub!(/^\s*_([0-9])_([0-9])\s+/, + "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}") #hang + dob.obj.gsub!(/^\s*_([0-9])_([0-9])!\s+(.+?)\s*$/, + "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\3#{Mx[:fa_bold_c]} ") #hangdef dob.obj.gsub!(/<:hi>/,"#{Mx[:fa_hilite_o]}") #'') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) dob.obj.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'') dob.obj.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n") @@ -517,7 +527,11 @@ module SiSU_Syntax line.gsub!(/^\s*_\([1-9]\)\(\*\+\)\s*/, "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}") #bullets, shortcut line.gsub!(/^\s*_\([1-9]\)\s+/, - "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") + "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #watch + line.gsub!(/^\s*__\([1-9]\)\s+/, + "#{Mx[:pa_o]}:h\\1#{Mx[:pa_c]}") #watch + #line.gsub!(/^\s*__\([1-9]\)!\s+/, + # "#{Mx[:pa_o]}:hd\\1#{Mx[:pa_c]}") #watch line.gsub!(/#{Mx[:br_line]}\s*_[12]\s+/, "#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') end -- cgit v1.2.3 From 051b32167ddbff4193e7d52d8be434ef3f70470d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:24:41 -0400 Subject: v3: plaintext, indent ... --- lib/sisu/v3/plaintext.rb | 7 ++++++- lib/sisu/v3/shared_txt.rb | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/plaintext.rb b/lib/sisu/v3/plaintext.rb index b7ad1680..aee1e56f 100644 --- a/lib/sisu/v3/plaintext.rb +++ b/lib/sisu/v3/plaintext.rb @@ -225,7 +225,12 @@ WOK wrapped=if dob.is =='para' \ or dob.is=='heading' if dob.is=='para' - if dob.indent =~/[1-9]/ + if dob.hang \ + and dob.hang =~/[0-9]/ \ + and dob.indent != dob.hang + util=SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2,dob.hang.to_i*2) + #util=SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,dob.hang.to_i*2,0) + elsif dob.indent =~/[1-9]/ util=if dob.bullet_ SiSU_text_utils::Wrap.new("* #{dob.obj}",@wrap_width,dob.indent.to_i*2) else SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2) diff --git a/lib/sisu/v3/shared_txt.rb b/lib/sisu/v3/shared_txt.rb index 6f25a06b..c81e1c37 100644 --- a/lib/sisu/v3/shared_txt.rb +++ b/lib/sisu/v3/shared_txt.rb @@ -84,8 +84,8 @@ module SiSU_text_utils line=line elsif word =~/\n\n/ word="\n" - @n_char_max_extend = @n_char_max + out[line].length - line=line + @n_char_max_extend = @n_char_max + line += 1 elsif (out[line].length + word.length) > (@n_char_max_extend - @n_indent) \ and out[line] =~/\S+/ @n_char_max_extend = @n_char_max @@ -104,7 +104,7 @@ module SiSU_text_utils end @oldword=word if word =~/\S+/ end - x=out.join(spaces_indent).gsub(/\A\n+/m,'').insert(0,spaces_hang) + spaces_hang + out.join(spaces_indent) end def line_wrap_indent1 @n_indent,@n_hang=2,2 -- cgit v1.2.3 From 476ee850a8f11f49578281137620189304223de0 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:25:25 -0400 Subject: v3: css, indent ... --- lib/sisu/v3/css.rb | 1323 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 1285 insertions(+), 38 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/css.rb b/lib/sisu/v3/css.rb index 463492af..e86c3076 100644 --- a/lib/sisu/v3/css.rb +++ b/lib/sisu/v3/css.rb @@ -342,7 +342,8 @@ WOK margin-right: 2em; margin-top: 10px; margin-bottom: 0px; - text-indent: 0mm; + padding-left: 0em; + text-indent: 0em; } p, h0, h1, h2, h3, h4, h5, h6 { display: block; @@ -357,16 +358,431 @@ WOK margin-top: 3px; margin-bottom: 3px; } + + /* indent */ + p.norm { } - p.i1 {margin-left: 1em;} - p.i2 {margin-left: 2em;} - p.i3 {margin-left: 3em;} - p.i4 {margin-left: 4em;} - p.i5 {margin-left: 5em;} - p.i6 {margin-left: 6em;} - p.i7 {margin-left: 7em;} - p.i8 {margin-left: 8em;} - p.i9 {margin-left: 9em;} + p.i1 {padding-left: 1em;} + p.i2 {padding-left: 2em;} + p.i3 {padding-left: 3em;} + p.i4 {padding-left: 4em;} + p.i5 {padding-left: 5em;} + p.i6 {padding-left: 6em;} + p.i7 {padding-left: 7em;} + p.i8 {padding-left: 8em;} + p.i9 {padding-left: 9em;} + + /* hanging indent */ + + p.h0i0 { + padding-left: 0em; + text-indent: 0em; + } + p.h0i1 { + padding-left: 1em; + text-indent: -1em; + } + p.h0i2 { + padding-left: 2em; + text-indent: -2em; + } + p.h0i3 { + padding-left: 3em; + text-indent: -3em; + } + p.h0i4 { + padding-left: 4em; + text-indent: -4em; + } + p.h0i5 { + padding-left: 5em; + text-indent: -5em; + } + p.h0i6 { + padding-left: 6em; + text-indent: -6em; + } + p.h0i7 { + padding-left: 7em; + text-indent: -7em; + } + p.h0i8 { + padding-left: 8em; + text-indent: -8em; + } + p.h0i9 { + padding-left: 9em; + text-indent: -9em; + } + + p.h1i0 { + padding-left: 0em; + text-indent: 1em; + } + p.h1i1 { + padding-left: 1em; + text-indent: 0em; + } + p.h1i2 { + padding-left: 2em; + text-indent: -1em; + } + p.h1i3 { + padding-left: 3em; + text-indent: -2em; + } + p.h1i4 { + padding-left: 4em; + text-indent: -3em; + } + p.h1i5 { + padding-left: 5em; + text-indent: -4em; + } + p.h1i6 { + padding-left: 6em; + text-indent: -5em; + } + p.h1i7 { + padding-left: 7em; + text-indent: -6em; + } + p.h1i8 { + padding-left: 8em; + text-indent: -7em; + } + p.h1i9 { + padding-left: 9em; + text-indent: -8em; + } + + p.h2i0 { + padding-left: 0em; + text-indent: 2em; + } + p.h2i1 { + padding-left: 1em; + text-indent: 1em; + } + p.h2i2 { + padding-left: 2em; + text-indent: 0em; + } + p.h2i3 { + padding-left: 3em; + text-indent: -1em; + } + p.h2i4 { + padding-left: 4em; + text-indent: -2em; + } + p.h2i5 { + padding-left: 5em; + text-indent: -3em; + } + p.h2i6 { + padding-left: 6em; + text-indent: -4em; + } + p.h2i7 { + padding-left: 7em; + text-indent: -5em; + } + p.h2i8 { + padding-left: 8em; + text-indent: -6em; + } + p.h2i9 { + padding-left: 9em; + text-indent: -7em; + } + + p.h3i0 { + padding-left: 0em; + text-indent: 3em; + } + p.h3i1 { + padding-left: 1em; + text-indent: 2em; + } + p.h3i2 { + padding-left: 2em; + text-indent: 1em; + } + p.h3i3 { + padding-left: 3em; + text-indent: 0em; + } + p.h3i4 { + padding-left: 4em; + text-indent: -1em; + } + p.h3i5 { + padding-left: 5em; + text-indent: -2em; + } + p.h3i6 { + padding-left: 6em; + text-indent: -3em; + } + p.h3i7 { + padding-left: 7em; + text-indent: -4em; + } + p.h3i8 { + padding-left: 8em; + text-indent: -5em; + } + p.h3i9 { + padding-left: 9em; + text-indent: -6em; + } + + p.h4i0 { + padding-left: 0em; + text-indent: 4em; + } + p.h4i1 { + padding-left: 1em; + text-indent: 3em; + } + p.h4i2 { + padding-left: 2em; + text-indent: 2em; + } + p.h4i3 { + padding-left: 3em; + text-indent: 1em; + } + p.h4i4 { + padding-left: 4em; + text-indent: 0em; + } + p.h4i5 { + padding-left: 5em; + text-indent: -1em; + } + p.h4i6 { + padding-left: 6em; + text-indent: -2em; + } + p.h4i7 { + padding-left: 7em; + text-indent: -3em; + } + p.h4i8 { + padding-left: 8em; + text-indent: -4em; + } + p.h4i9 { + padding-left: 9em; + text-indent: -5em; + } + + p.h5i0 { + padding-left: 0em; + text-indent: 5em; + } + p.h5i1 { + padding-left: 1em; + text-indent: 4em; + } + p.h5i2 { + padding-left: 2em; + text-indent: 3em; + } + p.h5i3 { + padding-left: 3em; + text-indent: 2em; + } + p.h5i4 { + padding-left: 4em; + text-indent: 1em; + } + p.h5i5 { + padding-left: 5em; + text-indent: 0em; + } + p.h5i6 { + padding-left: 6em; + text-indent: -1em; + } + p.h5i7 { + padding-left: 7em; + text-indent: -2em; + } + p.h5i8 { + padding-left: 8em; + text-indent: -3em; + } + p.h5i9 { + padding-left: 9em; + text-indent: -4em; + } + + p.h6i0 { + padding-left: 0em; + text-indent: 6em; + } + p.h6i1 { + padding-left: 1em; + text-indent: 5em; + } + p.h6i2 { + padding-left: 2em; + text-indent: 4em; + } + p.h6i3 { + padding-left: 3em; + text-indent: 3em; + } + p.h6i4 { + padding-left: 4em; + text-indent: 2em; + } + p.h6i5 { + padding-left: 5em; + text-indent: 1em; + } + p.h6i6 { + padding-left: 6em; + text-indent: 0em; + } + p.h6i7 { + padding-left: 7em; + text-indent: -1em; + } + p.h6i8 { + padding-left: 8em; + text-indent: -2em; + } + p.h6i9 { + padding-left: 9em; + text-indent: -3em; + } + + p.h7i0 { + padding-left: 0em; + text-indent: 7em; + } + p.h7i1 { + padding-left: 1em; + text-indent: 6em; + } + p.h7i2 { + padding-left: 2em; + text-indent: 5em; + } + p.h7i3 { + padding-left: 3em; + text-indent: 4em; + } + p.h7i4 { + padding-left: 4em; + text-indent: 3em; + } + p.h7i5 { + padding-left: 5em; + text-indent: 2em; + } + p.h7i6 { + padding-left: 6em; + text-indent: 1em; + } + p.h7i7 { + padding-left: 7em; + text-indent: 0em; + } + p.h7i8 { + padding-left: 8em; + text-indent: -1em; + } + p.h7i9 { + padding-left: 9em; + text-indent: -2em; + } + + p.h8i0 { + padding-left: 0em; + text-indent: 8em; + } + p.h8i1 { + padding-left: 1em; + text-indent: 7em; + } + p.h8i2 { + padding-left: 2em; + text-indent: 6em; + } + p.h8i3 { + padding-left: 3em; + text-indent: 5em; + } + p.h8i4 { + padding-left: 4em; + text-indent: 4em; + } + p.h8i5 { + padding-left: 5em; + text-indent: 3em; + } + p.h8i6 { + padding-left: 6em; + text-indent: 2em; + } + p.h8i7 { + padding-left: 7em; + text-indent: 1em; + } + p.h8i8 { + padding-left: 8em; + text-indent: 0em; + } + p.h8i9 { + padding-left: 9em; + text-indent: -1em; + } + + p.h9i0 { + padding-left: 0em; + text-indent: 9em; + } + p.h9i1 { + padding-left: 1em; + text-indent: 8em; + } + p.h9i2 { + padding-left: 2em; + text-indent: 7em; + } + p.h9i3 { + padding-left: 3em; + text-indent: 6em; + } + p.h9i4 { + padding-left: 4em; + text-indent: 5em; + } + p.h9i5 { + padding-left: 5em; + text-indent: 4em; + } + p.h9i6 { + padding-left: 6em; + text-indent: 3em; + } + p.h9i7 { + padding-left: 7em; + text-indent: 2em; + } + p.h9i8 { + padding-left: 8em; + text-indent: 1em; + } + p.h9i9 { + padding-left: 9em; + text-indent: 0em; + } p.it0 { margin-left: 0em; @@ -1339,35 +1755,446 @@ WOK text-align: left; } text[class|="indent0"] { - margin-left: 10%; + padding-left: 10%; } text[class|="indent1"] { - margin-left: 15%; + padding-left: 15%; } text[class|="indent2"] { - margin-left: 20%; + padding-left: 20%; } text[class|="indent3"] { - margin-left: 25%; + padding-left: 25%; } text[class|="indent4"] { - margin-left: 30%; + padding-left: 30%; } text[class|="indent5"] { - margin-left: 35%; + padding-left: 35%; } text[class|="indent6"] { - margin-left: 40%; + padding-left: 40%; } text[class|="indent7"] { - margin-left: 45%; + padding-left: 45%; } text[class|="indent8"] { - margin-left: 50%; + padding-left: 50%; } text[class|="indent9"] { - margin-left: 55%; + padding-left: 55%; + } + + text[class|="hang0_indent0"] { + padding-left: 10%; + text-indent: 0%; + } + text[class|="hang0_indent1"] { + padding-left: 15%; + text-indent: -5%; + } + text[class|="hang0_indent2"] { + padding-left: 20%; + text-indent: -10%; + } + text[class|="hang0_indent3"] { + padding-left: 25%; + text-indent: -15%; + } + text[class|="hang0_indent4"] { + padding-left: 30%; + text-indent: -20%; + } + text[class|="hang0_indent5"] { + padding-left: 35%; + text-indent: -25%; + } + text[class|="hang0_indent6"] { + padding-left: 40%; + text-indent: -30%; + } + text[class|="hang0_indent7"] { + padding-left: 45%; + text-indent: -35%; + } + text[class|="hang0_indent8"] { + padding-left: 50%; + text-indent: -40%; + } + text[class|="hang0_indent9"] { + padding-left: 55%; + text-indent: -45%; + } + + text[class|="hang1_indent0"] { + padding-left: 10%; + text-indent: 5%; + } + text[class|="hang1_indent1"] { + padding-left: 15%; + text-indent: 0%; + } + text[class|="hang1_indent2"] { + padding-left: 20%; + text-indent: -5%; + } + text[class|="hang1_indent3"] { + padding-left: 25%; + text-indent: -10%; + } + text[class|="hang1_indent4"] { + padding-left: 30%; + text-indent: -15%; + } + text[class|="hang1_indent5"] { + padding-left: 35%; + text-indent: -20%; + } + text[class|="hang1_indent6"] { + padding-left: 40%; + text-indent: -25%; + } + text[class|="hang1_indent7"] { + padding-left: 45%; + text-indent: -30%; + } + text[class|="hang1_indent8"] { + padding-left: 50%; + text-indent: -35%; + } + text[class|="hang1_indent9"] { + padding-left: 55%; + text-indent: -40%; + } + + text[class|="hang2_indent0"] { + padding-left: 10%; + text-indent: 10%; + } + text[class|="hang2_indent1"] { + padding-left: 15%; + text-indent: 5%; + } + text[class|="hang2_indent2"] { + padding-left: 20%; + text-indent: 0%; + } + text[class|="hang2_indent3"] { + padding-left: 25%; + text-indent: -5%; + } + text[class|="hang2_indent4"] { + padding-left: 30%; + text-indent: -10%; + } + text[class|="hang2_indent5"] { + padding-left: 35%; + text-indent: -15%; + } + text[class|="hang2_indent6"] { + padding-left: 40%; + text-indent: -20%; + } + text[class|="hang2_indent7"] { + padding-left: 45%; + text-indent: -25%; + } + text[class|="hang2_indent8"] { + padding-left: 50%; + text-indent: -30%; + } + text[class|="hang2_indent9"] { + padding-left: 55%; + text-indent: -35%; + } + + text[class|="hang3_indent0"] { + padding-left: 10%; + text-indent: 15%; + } + text[class|="hang3_indent1"] { + padding-left: 15%; + text-indent: 10%; + } + text[class|="hang3_indent2"] { + padding-left: 20%; + text-indent: 5%; + } + text[class|="hang3_indent3"] { + padding-left: 25%; + text-indent: 0%; + } + text[class|="hang3_indent4"] { + padding-left: 30%; + text-indent: -5%; + } + text[class|="hang3_indent5"] { + padding-left: 35%; + text-indent: -10%; + } + text[class|="hang3_indent6"] { + padding-left: 40%; + text-indent: -15%; + } + text[class|="hang3_indent7"] { + padding-left: 45%; + text-indent: -20%; + } + text[class|="hang3_indent8"] { + padding-left: 50%; + text-indent: -25%; + } + text[class|="hang3_indent9"] { + padding-left: 55%; + text-indent: -30%; + } + + text[class|="hang4_indent0"] { + padding-left: 10%; + text-indent: 20%; + } + text[class|="hang4_indent1"] { + padding-left: 15%; + text-indent: 15%; + } + text[class|="hang4_indent2"] { + padding-left: 20%; + text-indent: 10%; + } + text[class|="hang4_indent3"] { + padding-left: 25%; + text-indent: 5%; + } + text[class|="hang4_indent4"] { + padding-left: 30%; + text-indent: 0%; + } + text[class|="hang4_indent5"] { + padding-left: 35%; + text-indent: -5%; + } + text[class|="hang4_indent6"] { + padding-left: 40%; + text-indent: -10%; } + text[class|="hang4_indent7"] { + padding-left: 45%; + text-indent: -15%; + } + text[class|="hang4_indent8"] { + padding-left: 50%; + text-indent: -20%; + } + text[class|="hang4_indent9"] { + padding-left: 55%; + text-indent: -25%; + } + + text[class|="hang5_indent0"] { + padding-left: 10%; + text-indent: 25%; + } + text[class|="hang5_indent1"] { + padding-left: 15%; + text-indent: 20%; + } + text[class|="hang5_indent2"] { + padding-left: 20%; + text-indent: 15%; + } + text[class|="hang5_indent3"] { + padding-left: 25%; + text-indent: 10%; + } + text[class|="hang5_indent4"] { + padding-left: 30%; + text-indent: 5%; + } + text[class|="hang5_indent5"] { + padding-left: 35%; + text-indent: 0%; + } + text[class|="hang5_indent6"] { + padding-left: 40%; + text-indent: -5%; + } + text[class|="hang5_indent7"] { + padding-left: 45%; + text-indent: -10%; + } + text[class|="hang5_indent8"] { + padding-left: 50%; + text-indent: -15%; + } + text[class|="hang5_indent9"] { + padding-left: 55%; + text-indent: -20%; + } + + text[class|="hang6_indent0"] { + padding-left: 10%; + text-indent: 30%; + } + text[class|="hang6_indent1"] { + padding-left: 15%; + text-indent: 25%; + } + text[class|="hang6_indent2"] { + padding-left: 20%; + text-indent: 20%; + } + text[class|="hang6_indent3"] { + padding-left: 25%; + text-indent: 15%; + } + text[class|="hang6_indent4"] { + padding-left: 30%; + text-indent: 10%; + } + text[class|="hang6_indent5"] { + padding-left: 35%; + text-indent: 5%; + } + text[class|="hang6_indent6"] { + padding-left: 40%; + text-indent: 0%; + } + text[class|="hang6_indent7"] { + padding-left: 45%; + text-indent: -5%; + } + text[class|="hang6_indent8"] { + padding-left: 50%; + text-indent: -10%; + } + text[class|="hang6_indent9"] { + padding-left: 55%; + text-indent: -15%; + } + + text[class|="hang7_indent0"] { + padding-left: 10%; + text-indent: 35%; + } + text[class|="hang7_indent1"] { + padding-left: 15%; + text-indent: 30%; + } + text[class|="hang7_indent2"] { + padding-left: 20%; + text-indent: 25%; + } + text[class|="hang7_indent3"] { + padding-left: 25%; + text-indent: 20%; + } + text[class|="hang7_indent4"] { + padding-left: 30%; + text-indent: 15%; + } + text[class|="hang7_indent5"] { + padding-left: 35%; + text-indent: 10%; + } + text[class|="hang7_indent6"] { + padding-left: 40%; + text-indent: 5%; + } + text[class|="hang7_indent7"] { + padding-left: 45%; + text-indent: 0%; + } + text[class|="hang7_indent8"] { + padding-left: 50%; + text-indent: -5%; + } + text[class|="hang7_indent9"] { + padding-left: 55%; + text-indent: -10%; + } + + text[class|="hang8_indent0"] { + padding-left: 10%; + text-indent: 40%; + } + text[class|="hang8_indent1"] { + padding-left: 15%; + text-indent: 35%; + } + text[class|="hang8_indent2"] { + padding-left: 20%; + text-indent: 30%; + } + text[class|="hang8_indent3"] { + padding-left: 25%; + text-indent: 25%; + } + text[class|="hang8_indent4"] { + padding-left: 30%; + text-indent: 20%; + } + text[class|="hang8_indent5"] { + padding-left: 35%; + text-indent: 15%; + } + text[class|="hang8_indent6"] { + padding-left: 40%; + text-indent: 10%; + } + text[class|="hang8_indent7"] { + padding-left: 45%; + text-indent: 5%; + } + text[class|="hang8_indent8"] { + padding-left: 50%; + text-indent: 0%; + } + text[class|="hang8_indent9"] { + padding-left: 55%; + text-indent: -5%; + } + + text[class|="hang9_indent0"] { + padding-left: 10%; + text-indent: 45%; + } + text[class|="hang9_indent1"] { + padding-left: 15%; + text-indent: 40%; + } + text[class|="hang9_indent2"] { + padding-left: 20%; + text-indent: 35%; + } + text[class|="hang9_indent3"] { + padding-left: 25%; + text-indent: 30%; + } + text[class|="hang9_indent4"] { + padding-left: 30%; + text-indent: 25%; + } + text[class|="hang9_indent5"] { + padding-left: 35%; + text-indent: 20%; + } + text[class|="hang9_indent6"] { + padding-left: 40%; + text-indent: 15%; + } + text[class|="hang9_indent7"] { + padding-left: 45%; + text-indent: 10%; + } + text[class|="hang9_indent8"] { + padding-left: 50%; + text-indent: 5%; + } + text[class|="hang9_indent9"] { + padding-left: 55%; + text-indent: 0%; + } + text[class|="indent_bullet"] { text-indent: 0%; } @@ -1645,59 +2472,479 @@ WOK font-weight: bold; text-align: left; } + text[class|="indent0"] { + padding-left: 10%; + } text[class|="indent1"] { - margin-left: 10%; + padding-left: 15%; } text[class|="indent2"] { - margin-left: 15%; + padding-left: 20%; } text[class|="indent3"] { - margin-left: 20%; + padding-left: 25%; } text[class|="indent4"] { - margin-left: 25%; + padding-left: 30%; } text[class|="indent5"] { - margin-left: 30%; + padding-left: 35%; } text[class|="indent6"] { - margin-left: 35%; + padding-left: 40%; } text[class|="indent7"] { - margin-left: 40%; + padding-left: 45%; } text[class|="indent8"] { - margin-left: 45%; + padding-left: 50%; } text[class|="indent9"] { - margin-left: 50%; + padding-left: 55%; + } + + text[class|="hang0_indent0"] { + padding-left: 10%; + text-indent: 0%; + } + text[class|="hang0_indent1"] { + padding-left: 15%; + text-indent: -5%; + } + text[class|="hang0_indent2"] { + padding-left: 20%; + text-indent: -10%; + } + text[class|="hang0_indent3"] { + padding-left: 25%; + text-indent: -15%; + } + text[class|="hang0_indent4"] { + padding-left: 30%; + text-indent: -20%; + } + text[class|="hang0_indent5"] { + padding-left: 35%; + text-indent: -25%; + } + text[class|="hang0_indent6"] { + padding-left: 40%; + text-indent: -30%; + } + text[class|="hang0_indent7"] { + padding-left: 45%; + text-indent: -35%; + } + text[class|="hang0_indent8"] { + padding-left: 50%; + text-indent: -40%; + } + text[class|="hang0_indent9"] { + padding-left: 55%; + text-indent: -45%; + } + + text[class|="hang1_indent0"] { + padding-left: 10%; + text-indent: 5%; + } + text[class|="hang1_indent1"] { + padding-left: 15%; + text-indent: 0%; + } + text[class|="hang1_indent2"] { + padding-left: 20%; + text-indent: -5%; + } + text[class|="hang1_indent3"] { + padding-left: 25%; + text-indent: -10%; + } + text[class|="hang1_indent4"] { + padding-left: 30%; + text-indent: -15%; + } + text[class|="hang1_indent5"] { + padding-left: 35%; + text-indent: -20%; + } + text[class|="hang1_indent6"] { + padding-left: 40%; + text-indent: -25%; + } + text[class|="hang1_indent7"] { + padding-left: 45%; + text-indent: -30%; + } + text[class|="hang1_indent8"] { + padding-left: 50%; + text-indent: -35%; + } + text[class|="hang1_indent9"] { + padding-left: 55%; + text-indent: -40%; + } + + text[class|="hang2_indent0"] { + padding-left: 10%; + text-indent: 10%; + } + text[class|="hang2_indent1"] { + padding-left: 15%; + text-indent: 5%; + } + text[class|="hang2_indent2"] { + padding-left: 20%; + text-indent: 0%; + } + text[class|="hang2_indent3"] { + padding-left: 25%; + text-indent: -5%; + } + text[class|="hang2_indent4"] { + padding-left: 30%; + text-indent: -10%; + } + text[class|="hang2_indent5"] { + padding-left: 35%; + text-indent: -15%; + } + text[class|="hang2_indent6"] { + padding-left: 40%; + text-indent: -20%; + } + text[class|="hang2_indent7"] { + padding-left: 45%; + text-indent: -25%; + } + text[class|="hang2_indent8"] { + padding-left: 50%; + text-indent: -30%; + } + text[class|="hang2_indent9"] { + padding-left: 55%; + text-indent: -35%; + } + + text[class|="hang3_indent0"] { + padding-left: 10%; + text-indent: 15%; + } + text[class|="hang3_indent1"] { + padding-left: 15%; + text-indent: 10%; + } + text[class|="hang3_indent2"] { + padding-left: 20%; + text-indent: 5%; + } + text[class|="hang3_indent3"] { + padding-left: 25%; + text-indent: 0%; + } + text[class|="hang3_indent4"] { + padding-left: 30%; + text-indent: -5%; + } + text[class|="hang3_indent5"] { + padding-left: 35%; + text-indent: -10%; + } + text[class|="hang3_indent6"] { + padding-left: 40%; + text-indent: -15%; + } + text[class|="hang3_indent7"] { + padding-left: 45%; + text-indent: -20%; + } + text[class|="hang3_indent8"] { + padding-left: 50%; + text-indent: -25%; + } + text[class|="hang3_indent9"] { + padding-left: 55%; + text-indent: -30%; + } + + text[class|="hang4_indent0"] { + padding-left: 10%; + text-indent: 20%; + } + text[class|="hang4_indent1"] { + padding-left: 15%; + text-indent: 15%; + } + text[class|="hang4_indent2"] { + padding-left: 20%; + text-indent: 10%; + } + text[class|="hang4_indent3"] { + padding-left: 25%; + text-indent: 5%; + } + text[class|="hang4_indent4"] { + padding-left: 30%; + text-indent: 0%; + } + text[class|="hang4_indent5"] { + padding-left: 35%; + text-indent: -5%; + } + text[class|="hang4_indent6"] { + padding-left: 40%; + text-indent: -10%; + } + text[class|="hang4_indent7"] { + padding-left: 45%; + text-indent: -15%; + } + text[class|="hang4_indent8"] { + padding-left: 50%; + text-indent: -20%; + } + text[class|="hang4_indent9"] { + padding-left: 55%; + text-indent: -25%; + } + + text[class|="hang5_indent0"] { + padding-left: 10%; + text-indent: 25%; + } + text[class|="hang5_indent1"] { + padding-left: 15%; + text-indent: 20%; + } + text[class|="hang5_indent2"] { + padding-left: 20%; + text-indent: 15%; + } + text[class|="hang5_indent3"] { + padding-left: 25%; + text-indent: 10%; + } + text[class|="hang5_indent4"] { + padding-left: 30%; + text-indent: 5%; + } + text[class|="hang5_indent5"] { + padding-left: 35%; + text-indent: 0%; + } + text[class|="hang5_indent6"] { + padding-left: 40%; + text-indent: -5%; + } + text[class|="hang5_indent7"] { + padding-left: 45%; + text-indent: -10%; + } + text[class|="hang5_indent8"] { + padding-left: 50%; + text-indent: -15%; + } + text[class|="hang5_indent9"] { + padding-left: 55%; + text-indent: -20%; + } + + text[class|="hang6_indent0"] { + padding-left: 10%; + text-indent: 30%; + } + text[class|="hang6_indent1"] { + padding-left: 15%; + text-indent: 25%; + } + text[class|="hang6_indent2"] { + padding-left: 20%; + text-indent: 20%; + } + text[class|="hang6_indent3"] { + padding-left: 25%; + text-indent: 15%; + } + text[class|="hang6_indent4"] { + padding-left: 30%; + text-indent: 10%; + } + text[class|="hang6_indent5"] { + padding-left: 35%; + text-indent: 5%; + } + text[class|="hang6_indent6"] { + padding-left: 40%; + text-indent: 0%; + } + text[class|="hang6_indent7"] { + padding-left: 45%; + text-indent: -5%; + } + text[class|="hang6_indent8"] { + padding-left: 50%; + text-indent: -10%; + } + text[class|="hang6_indent9"] { + padding-left: 55%; + text-indent: -15%; + } + + text[class|="hang7_indent0"] { + padding-left: 10%; + text-indent: 35%; + } + text[class|="hang7_indent1"] { + padding-left: 15%; + text-indent: 30%; + } + text[class|="hang7_indent2"] { + padding-left: 20%; + text-indent: 25%; + } + text[class|="hang7_indent3"] { + padding-left: 25%; + text-indent: 20%; + } + text[class|="hang7_indent4"] { + padding-left: 30%; + text-indent: 15%; + } + text[class|="hang7_indent5"] { + padding-left: 35%; + text-indent: 10%; + } + text[class|="hang7_indent6"] { + padding-left: 40%; + text-indent: 5%; + } + text[class|="hang7_indent7"] { + padding-left: 45%; + text-indent: 0%; + } + text[class|="hang7_indent8"] { + padding-left: 50%; + text-indent: -5%; + } + text[class|="hang7_indent9"] { + padding-left: 55%; + text-indent: -10%; + } + + text[class|="hang8_indent0"] { + padding-left: 10%; + text-indent: 40%; + } + text[class|="hang8_indent1"] { + padding-left: 15%; + text-indent: 35%; + } + text[class|="hang8_indent2"] { + padding-left: 20%; + text-indent: 30%; + } + text[class|="hang8_indent3"] { + padding-left: 25%; + text-indent: 25%; + } + text[class|="hang8_indent4"] { + padding-left: 30%; + text-indent: 20%; + } + text[class|="hang8_indent5"] { + padding-left: 35%; + text-indent: 15%; + } + text[class|="hang8_indent6"] { + padding-left: 40%; + text-indent: 10%; + } + text[class|="hang8_indent7"] { + padding-left: 45%; + text-indent: 5%; + } + text[class|="hang8_indent8"] { + padding-left: 50%; + text-indent: 0%; + } + text[class|="hang8_indent9"] { + padding-left: 55%; + text-indent: -5%; + } + + text[class|="hang9_indent0"] { + padding-left: 10%; + text-indent: 45%; + } + text[class|="hang9_indent1"] { + padding-left: 15%; + text-indent: 40%; + } + text[class|="hang9_indent2"] { + padding-left: 20%; + text-indent: 35%; + } + text[class|="hang9_indent3"] { + padding-left: 25%; + text-indent: 30%; + } + text[class|="hang9_indent4"] { + padding-left: 30%; + text-indent: 25%; + } + text[class|="hang9_indent5"] { + padding-left: 35%; + text-indent: 20%; + } + text[class|="hang9_indent6"] { + padding-left: 40%; + text-indent: 15%; + } + text[class|="hang9_indent7"] { + padding-left: 45%; + text-indent: 10%; + } + text[class|="hang9_indent8"] { + padding-left: 50%; + text-indent: 5%; + } + text[class|="hang9_indent9"] { + padding-left: 55%; + text-indent: 0%; + } + + text[class|="indent_bullet"] { + text-indent: 0%; + } + text[class|="indent_bullet0"] { + text-indent: 0%; } text[class|="indent_bullet1"] { - margin-left: 10%; + padding-left: 10%; } text[class|="indent_bullet2"] { - margin-left: 15%; + padding-left: 15%; } text[class|="indent_bullet3"] { - margin-left: 20%; + padding-left: 20%; } text[class|="indent_bullet4"] { - margin-left: 25%; + padding-left: 25%; } text[class|="indent_bullet5"] { - margin-left: 30%; + padding-left: 30%; } text[class|="indent_bullet6"] { - margin-left: 35%; + padding-left: 35%; } text[class|="indent_bullet7"] { - margin-left: 40%; + padding-left: 40%; } text[class|="indent_bullet8"] { - margin-left: 45%; + padding-left: 45%; } text[class|="indent_bullet9"] { - margin-left: 50%; + padding-left: 50%; } text[class|="verse"], text[class|="block"], text[class|="group"], text[class|="code"] { text-align: left; -- cgit v1.2.3 From 1abd2f99b807f9f33d1bd39c0a692e1455bf44f1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:26:52 -0400 Subject: v3: xhtml, xml sax & dom, indent (partially implemented) ... --- lib/sisu/v3/xhtml.rb | 7 ++++++- lib/sisu/v3/xml.rb | 7 ++++++- lib/sisu/v3/xml_dom.rb | 8 +++++++- 3 files changed, 19 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/xhtml.rb b/lib/sisu/v3/xhtml.rb index 03415280..569b1dc3 100644 --- a/lib/sisu/v3/xhtml.rb +++ b/lib/sisu/v3/xhtml.rb @@ -321,8 +321,13 @@ WOK and dob.bullet_==true xml_structure(dob,"indent_bullet#{dob.indent}") elsif dob.is =='para' \ - and dob.indent.to_s =~/[1-9]/ + and dob.indent.to_s =~/[1-9]/ \ + and dob.indent == dob.hang xml_structure(dob,"indent#{dob.indent}") + elsif dob.is=='para' \ + and dob.hang.to_s =~/[0-9]/ \ + and dob.indent != dob.hang + xml_structure(dob,"hang#{dob.hang.to_s}_indent#{dob.indent.to_s}") else xml_structure(dob) end end diff --git a/lib/sisu/v3/xml.rb b/lib/sisu/v3/xml.rb index f2751da1..73e9345c 100644 --- a/lib/sisu/v3/xml.rb +++ b/lib/sisu/v3/xml.rb @@ -346,8 +346,13 @@ WOK and dob.bullet_==true xml_structure(dob,"indent_bullet#{dob.indent}") elsif dob.is =~ /^para/ \ - and dob.indent.to_s =~/[1-9]/ + and dob.indent.to_s =~/[1-9]/ \ + and dob.indent == dob.hang xml_structure(dob,"indent#{dob.indent}") + elsif dob.is =~ /^para/ \ + and dob.hang.to_s =~/[0-9]/ \ + and dob.indent != dob.hang + xml_structure(dob,"hang#{dob.hang.to_s}_indent#{dob.indent.to_s}") else xml_structure(dob) end end diff --git a/lib/sisu/v3/xml_dom.rb b/lib/sisu/v3/xml_dom.rb index 7a0d55f3..664bccdc 100644 --- a/lib/sisu/v3/xml_dom.rb +++ b/lib/sisu/v3/xml_dom.rb @@ -412,9 +412,15 @@ WOK type="indent_bullet#{dob.indent.to_s}" xml_markup(dob) elsif dob.is=='para' \ - and dob.indent.to_s =~/[1-9]/ + and dob.indent.to_s =~/[1-9]/ \ + and dob.indent == dob.hang type="indent#{dob.indent.to_s}" xml_markup(dob) + elsif dob.is=='para' \ + and dob.hang.to_s =~/[0-9]/ \ + and dob.indent != dob.hang + type="hang#{dob.hang.to_s}_indent#{dob.indent.to_s}" + xml_markup(dob) else type='norm' xml_markup(dob) -- cgit v1.2.3 From 392f8d5cc7b48dfe27eb1c1034b04e899a54f7bf Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:27:58 -0400 Subject: v3: html, indent ... --- lib/sisu/v3/html_scroll.rb | 20 +++++++++++++------- lib/sisu/v3/html_segments.rb | 20 +++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/html_scroll.rb b/lib/sisu/v3/html_scroll.rb index d58dd502..0a37bcca 100644 --- a/lib/sisu/v3/html_scroll.rb +++ b/lib/sisu/v3/html_scroll.rb @@ -153,16 +153,22 @@ module SiSU_HTML_scroll end elsif dob.is=='para' if dob.indent \ - and dob.indent =~/[1-9]/ + and dob.hang \ + and dob.indent =~/[0-9]/ \ + and dob.hang =~/[0-9]/ if dob.bullet_ - sto.format('li',"i#{dob.indent}") - else sto.format('p',"i#{dob.indent}") - end - else - if dob.bullet_ - sto.format('li','bullet') + if dob.indent =~/[1-9]/ + sto.format('li',"i#{dob.indent}") + else + sto.format('li','bullet') + end + elsif dob.indent == dob.hang + sto.format('p',"i#{dob.indent}") + elsif dob.indent != dob.hang + sto.format('p',"h#{dob.hang}i#{dob.indent}") else sto.para end + else sto.para end elsif dob.is=='block' sto.block diff --git a/lib/sisu/v3/html_segments.rb b/lib/sisu/v3/html_segments.rb index ccd48407..e6dc0d35 100644 --- a/lib/sisu/v3/html_segments.rb +++ b/lib/sisu/v3/html_segments.rb @@ -389,16 +389,22 @@ module SiSU_HTML_seg end elsif dob.is=='para' if dob.indent \ - and dob.indent =~/[1-9]/ + and dob.hang \ + and dob.indent =~/[0-9]/ \ + and dob.hang =~/[0-9]/ if dob.bullet_ - sto.format('li',"i#{dob.indent}") - else sto.format('p',"i#{dob.indent}") - end - else - if dob.bullet_ - sto.format('li','bullet') + if dob.indent =~/[1-9]/ + sto.format('li',"i#{dob.indent}") + else + sto.format('li','bullet') + end + elsif dob.indent == dob.hang + sto.format('p',"i#{dob.indent}") + elsif dob.indent != dob.hang + sto.format('p',"h#{dob.hang}i#{dob.indent}") else sto.para end + else sto.para end end elsif dob.is=='block' -- cgit v1.2.3 From 727db14c20acedb648b127976e6e0ed104d8515a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:28:55 -0400 Subject: v3: epub, indent ... --- lib/sisu/v3/epub_format.rb | 430 ++++++++++++++++++++++++++++++++++++++++++- lib/sisu/v3/epub_segments.rb | 28 ++- 2 files changed, 440 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 6879c933..2a9af20e 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -161,6 +161,7 @@ module SiSU_EPUB_Format margin-right: 2em; margin-top: 10px; margin-bottom: 0px; + padding-left: 0em; text-indent: 0mm; } p, h0, h1, h2, h3, h4, h5, h6 { @@ -177,15 +178,426 @@ module SiSU_EPUB_Format margin-bottom: 3px; } p.norm { } - p.i1 {margin-left: 1em;} - p.i2 {margin-left: 2em;} - p.i3 {margin-left: 3em;} - p.i4 {margin-left: 4em;} - p.i5 {margin-left: 5em;} - p.i6 {margin-left: 6em;} - p.i7 {margin-left: 7em;} - p.i8 {margin-left: 8em;} - p.i9 {margin-left: 9em;} + p.i1 {padding-left: 1em;} + p.i2 {padding-left: 2em;} + p.i3 {padding-left: 3em;} + p.i4 {padding-left: 4em;} + p.i5 {padding-left: 5em;} + p.i6 {padding-left: 6em;} + p.i7 {padding-left: 7em;} + p.i8 {padding-left: 8em;} + p.i9 {padding-left: 9em;} + + p.h0i0 { + padding-left: 0em; + text-indent: 0em; + } + p.h0i1 { + padding-left: 1em; + text-indent: -1em; + } + p.h0i2 { + padding-left: 2em; + text-indent: -2em; + } + p.h0i3 { + padding-left: 3em; + text-indent: -3em; + } + p.h0i4 { + padding-left: 4em; + text-indent: -4em; + } + p.h0i5 { + padding-left: 5em; + text-indent: -5em; + } + p.h0i6 { + padding-left: 6em; + text-indent: -6em; + } + p.h0i7 { + padding-left: 7em; + text-indent: -7em; + } + p.h0i8 { + padding-left: 8em; + text-indent: -8em; + } + p.h0i9 { + padding-left: 9em; + text-indent: -9em; + } + + p.h1i0 { + padding-left: 0em; + text-indent: 1em; + } + p.h1i1 { + padding-left: 1em; + text-indent: 0em; + } + p.h1i2 { + padding-left: 2em; + text-indent: -1em; + } + p.h1i3 { + padding-left: 3em; + text-indent: -2em; + } + p.h1i4 { + padding-left: 4em; + text-indent: -3em; + } + p.h1i5 { + padding-left: 5em; + text-indent: -4em; + } + p.h1i6 { + padding-left: 6em; + text-indent: -5em; + } + p.h1i7 { + padding-left: 7em; + text-indent: -6em; + } + p.h1i8 { + padding-left: 8em; + text-indent: -7em; + } + p.h1i9 { + padding-left: 9em; + text-indent: -8em; + } + + p.h2i0 { + padding-left: 0em; + text-indent: 2em; + } + p.h2i1 { + padding-left: 1em; + text-indent: 1em; + } + p.h2i2 { + padding-left: 2em; + text-indent: 0em; + } + p.h2i3 { + padding-left: 3em; + text-indent: -1em; + } + p.h2i4 { + padding-left: 4em; + text-indent: -2em; + } + p.h2i5 { + padding-left: 5em; + text-indent: -3em; + } + p.h2i6 { + padding-left: 6em; + text-indent: -4em; + } + p.h2i7 { + padding-left: 7em; + text-indent: -5em; + } + p.h2i8 { + padding-left: 8em; + text-indent: -6em; + } + p.h2i9 { + padding-left: 9em; + text-indent: -7em; + } + + p.h3i0 { + padding-left: 0em; + text-indent: 3em; + } + p.h3i1 { + padding-left: 1em; + text-indent: 2em; + } + p.h3i2 { + padding-left: 2em; + text-indent: 1em; + } + p.h3i3 { + padding-left: 3em; + text-indent: 0em; + } + p.h3i4 { + padding-left: 4em; + text-indent: -1em; + } + p.h3i5 { + padding-left: 5em; + text-indent: -2em; + } + p.h3i6 { + padding-left: 6em; + text-indent: -3em; + } + p.h3i7 { + padding-left: 7em; + text-indent: -4em; + } + p.h3i8 { + padding-left: 8em; + text-indent: -5em; + } + p.h3i9 { + padding-left: 9em; + text-indent: -6em; + } + + p.h4i0 { + padding-left: 0em; + text-indent: 4em; + } + p.h4i1 { + padding-left: 1em; + text-indent: 3em; + } + p.h4i2 { + padding-left: 2em; + text-indent: 2em; + } + p.h4i3 { + padding-left: 3em; + text-indent: 1em; + } + p.h4i4 { + padding-left: 4em; + text-indent: 0em; + } + p.h4i5 { + padding-left: 5em; + text-indent: -1em; + } + p.h4i6 { + padding-left: 6em; + text-indent: -2em; + } + p.h4i7 { + padding-left: 7em; + text-indent: -3em; + } + p.h4i8 { + padding-left: 8em; + text-indent: -4em; + } + p.h4i9 { + padding-left: 9em; + text-indent: -5em; + } + + p.h5i0 { + padding-left: 0em; + text-indent: 5em; + } + p.h5i1 { + padding-left: 1em; + text-indent: 4em; + } + p.h5i2 { + padding-left: 2em; + text-indent: 3em; + } + p.h5i3 { + padding-left: 3em; + text-indent: 2em; + } + p.h5i4 { + padding-left: 4em; + text-indent: 1em; + } + p.h5i5 { + padding-left: 5em; + text-indent: 0em; + } + p.h5i6 { + padding-left: 6em; + text-indent: -1em; + } + p.h5i7 { + padding-left: 7em; + text-indent: -2em; + } + p.h5i8 { + padding-left: 8em; + text-indent: -3em; + } + p.h5i9 { + padding-left: 9em; + text-indent: -4em; + } + + p.h6i0 { + padding-left: 0em; + text-indent: 6em; + } + p.h6i1 { + padding-left: 1em; + text-indent: 5em; + } + p.h6i2 { + padding-left: 2em; + text-indent: 4em; + } + p.h6i3 { + padding-left: 3em; + text-indent: 3em; + } + p.h6i4 { + padding-left: 4em; + text-indent: 2em; + } + p.h6i5 { + padding-left: 5em; + text-indent: 1em; + } + p.h6i6 { + padding-left: 6em; + text-indent: 0em; + } + p.h6i7 { + padding-left: 7em; + text-indent: -1em; + } + p.h6i8 { + padding-left: 8em; + text-indent: -2em; + } + p.h6i9 { + padding-left: 9em; + text-indent: -3em; + } + + p.h7i0 { + padding-left: 0em; + text-indent: 7em; + } + p.h7i1 { + padding-left: 1em; + text-indent: 6em; + } + p.h7i2 { + padding-left: 2em; + text-indent: 5em; + } + p.h7i3 { + padding-left: 3em; + text-indent: 4em; + } + p.h7i4 { + padding-left: 4em; + text-indent: 3em; + } + p.h7i5 { + padding-left: 5em; + text-indent: 2em; + } + p.h7i6 { + padding-left: 6em; + text-indent: 1em; + } + p.h7i7 { + padding-left: 7em; + text-indent: 0em; + } + p.h7i8 { + padding-left: 8em; + text-indent: -1em; + } + p.h7i9 { + padding-left: 9em; + text-indent: -2em; + } + + p.h8i0 { + padding-left: 0em; + text-indent: 8em; + } + p.h8i1 { + padding-left: 1em; + text-indent: 7em; + } + p.h8i2 { + padding-left: 2em; + text-indent: 6em; + } + p.h8i3 { + padding-left: 3em; + text-indent: 5em; + } + p.h8i4 { + padding-left: 4em; + text-indent: 4em; + } + p.h8i5 { + padding-left: 5em; + text-indent: 3em; + } + p.h8i6 { + padding-left: 6em; + text-indent: 2em; + } + p.h8i7 { + padding-left: 7em; + text-indent: 1em; + } + p.h8i8 { + padding-left: 8em; + text-indent: 0em; + } + p.h8i9 { + padding-left: 9em; + text-indent: -1em; + } + + p.h9i0 { + padding-left: 0em; + text-indent: 9em; + } + p.h9i1 { + padding-left: 1em; + text-indent: 8em; + } + p.h9i2 { + padding-left: 2em; + text-indent: 7em; + } + p.h9i3 { + padding-left: 3em; + text-indent: 6em; + } + p.h9i4 { + padding-left: 4em; + text-indent: 5em; + } + p.h9i5 { + padding-left: 5em; + text-indent: 4em; + } + p.h9i6 { + padding-left: 6em; + text-indent: 3em; + } + p.h9i7 { + padding-left: 7em; + text-indent: 2em; + } + p.h9i8 { + padding-left: 8em; + text-indent: 1em; + } + p.h9i9 { + padding-left: 9em; + text-indent: 0em; + } + p.it0 { margin-left: 0em; diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index 7bddf917..b9b75b9c 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -360,8 +360,11 @@ WOK @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,dob.ocn) end sto=SiSU_EPUB_Format::Format_text_object.new(@md,dob) - dob_xhtml=if dob.is=='heading' or dob.is=='heading_insert' or dob.is=='para' - dob_xhtml=if dob.is=='heading' or dob.is=='heading_insert' + dob_xhtml=if dob.is=='heading' \ + or dob.is=='heading_insert' \ + or dob.is=='para' + dob_xhtml=if dob.is=='heading' \ + or dob.is=='heading_insert' if dob.ln==4 sto.seg_heading4 # work on see Split_text_object elsif dob.ln==5 @@ -369,16 +372,23 @@ WOK elsif dob.ln==6; sto.seg_heading6 end elsif dob.is=='para' - if dob.indent and dob.indent =~/[1-9]/ + if dob.indent \ + and dob.hang \ + and dob.indent =~/[0-9]/ \ + and dob.hang =~/[0-9]/ if dob.bullet_ - sto.format('li',"i#{dob.indent}") - else sto.format('p',"i#{dob.indent}") - end - else - if dob.bullet_ - sto.format('li','bullet') + if dob.indent =~/[1-9]/ + sto.format('li',"i#{dob.indent}") + else + sto.format('li','bullet') + end + elsif dob.indent == dob.hang + sto.format('p',"i#{dob.indent}") + elsif dob.indent != dob.hang + sto.format('p',"h#{dob.hang}i#{dob.indent}") else sto.para end + else sto.para end end elsif dob.is =~/^(?:block|group|alt)$/ -- cgit v1.2.3 From dba6d8b359e626a30d613685b0a686c29df4e98b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:30:47 -0400 Subject: v3: texpdf, indent ... --- lib/sisu/v3/texpdf.rb | 8 ++- lib/sisu/v3/texpdf_format.rb | 148 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 22269fc2..9e223920 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -515,8 +515,14 @@ module SiSU_TeX if dob.bullet_ dob.tmp=tst.bullet elsif dob.indent \ - and dob.indent =~/[1-9]/ + and dob.hang \ + and dob.indent =~/[1-9]/ \ + and dob.indent == dob.hang dob.tmp=tst.indent + elsif dob.hang \ + and dob.hang =~/[0-9]/ \ + and (dob.indent != dob.hang or dob.indent =~/[1-9]/) + dob.tmp=tst.hang else dob.tmp.strip! dob=enclose(dob) unless dob.tmp =~/^$/ diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index cd63cd4e..76f0630a 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -293,6 +293,141 @@ module SiSU_TeX_Pdf # '\subsubsection*{\1}') dob end + def hang + case @dob.indent + when /0/ + case @dob.hang + when /0/; indent,hang='0mm', '0mm' + when /1/; indent,hang='0mm','10mm' + when /2/; indent,hang='0mm','20mm' + when /3/; indent,hang='0mm','30mm' + when /4/; indent,hang='0mm','40mm' + when /5/; indent,hang='0mm','50mm' + when /6/; indent,hang='0mm','60mm' + when /7/; indent,hang='0mm','70mm' + when /8/; indent,hang='0mm','80mm' + when /9/; indent,hang='0mm','90mm' + end + when /1/ + case @dob.hang + when /0/; indent,hang='10mm','-10mm' + when /1/; indent,hang='10mm', '0mm' + when /2/; indent,hang='10mm', '10mm' + when /3/; indent,hang='10mm', '20mm' + when /4/; indent,hang='10mm', '30mm' + when /5/; indent,hang='10mm', '40mm' + when /6/; indent,hang='10mm', '50mm' + when /7/; indent,hang='10mm', '60mm' + when /8/; indent,hang='10mm', '70mm' + when /9/; indent,hang='10mm', '80mm' + end + when /2/ + case @dob.hang + when /0/; indent,hang='20mm','-20mm' + when /1/; indent,hang='20mm','-10mm' + when /2/; indent,hang='20mm', '0mm' + when /3/; indent,hang='20mm', '10mm' + when /4/; indent,hang='20mm', '20mm' + when /5/; indent,hang='20mm', '30mm' + when /6/; indent,hang='20mm', '40mm' + when /7/; indent,hang='20mm', '50mm' + when /8/; indent,hang='20mm', '60mm' + when /9/; indent,hang='20mm', '70mm' + end + when /3/ + case @dob.hang + when /0/; indent,hang='30mm','-30mm' + when /1/; indent,hang='30mm','-20mm' + when /2/; indent,hang='30mm','-10mm' + when /3/; indent,hang='30mm', '0mm' + when /4/; indent,hang='30mm', '10mm' + when /5/; indent,hang='30mm', '20mm' + when /6/; indent,hang='30mm', '30mm' + when /7/; indent,hang='30mm', '40mm' + when /8/; indent,hang='30mm', '50mm' + when /9/; indent,hang='30mm', '60mm' + end + when /4/ + case @dob.hang + when /0/; indent,hang='40mm','-40mm' + when /1/; indent,hang='40mm','-30mm' + when /2/; indent,hang='40mm','-20mm' + when /3/; indent,hang='40mm','-10mm' + when /4/; indent,hang='40mm', '0mm' + when /5/; indent,hang='40mm', '10mm' + when /6/; indent,hang='40mm', '20mm' + when /7/; indent,hang='40mm', '30mm' + when /8/; indent,hang='40mm', '40mm' + when /9/; indent,hang='40mm', '50mm' + end + when /5/ + case @dob.hang + when /0/; indent,hang='50mm','-50mm' + when /1/; indent,hang='50mm','-40mm' + when /2/; indent,hang='50mm','-30mm' + when /3/; indent,hang='50mm','-20mm' + when /4/; indent,hang='50mm','-10mm' + when /5/; indent,hang='50mm', '0mm' + when /6/; indent,hang='50mm', '10mm' + when /7/; indent,hang='50mm', '20mm' + when /8/; indent,hang='50mm', '30mm' + when /9/; indent,hang='50mm', '40mm' + end + when /6/ + case @dob.hang + when /0/; indent,hang='60mm','-60mm' + when /1/; indent,hang='60mm','-50mm' + when /2/; indent,hang='60mm','-40mm' + when /3/; indent,hang='60mm','-30mm' + when /4/; indent,hang='60mm','-20mm' + when /5/; indent,hang='60mm','-10mm' + when /6/; indent,hang='60mm', '0mm' + when /7/; indent,hang='60mm', '10mm' + when /8/; indent,hang='60mm', '20mm' + when /9/; indent,hang='60mm', '30mm' + end + when /7/ + case @dob.hang + when /0/; indent,hang='70mm','-70mm' + when /1/; indent,hang='70mm','-60mm' + when /2/; indent,hang='70mm','-50mm' + when /3/; indent,hang='70mm','-40mm' + when /4/; indent,hang='70mm','-30mm' + when /5/; indent,hang='70mm','-20mm' + when /6/; indent,hang='70mm','-10mm' + when /7/; indent,hang='70mm', '0mm' + when /8/; indent,hang='70mm', '10mm' + when /9/; indent,hang='70mm', '20mm' + end + when /8/ + case @dob.hang + when /0/; indent,hang='80mm','-80mm' + when /1/; indent,hang='80mm','-70mm' + when /2/; indent,hang='80mm','-60mm' + when /3/; indent,hang='80mm','-50mm' + when /4/; indent,hang='80mm','-40mm' + when /5/; indent,hang='80mm','-30mm' + when /6/; indent,hang='80mm','-20mm' + when /7/; indent,hang='80mm','-10mm' + when /8/; indent,hang='80mm', '0mm' + when /9/; indent,hang='80mm', '10mm' + end + when /9/ + case @dob.hang + when /0/; indent,hang='90mm','-90mm' + when /1/; indent,hang='90mm','-80mm' + when /2/; indent,hang='90mm','-70mm' + when /3/; indent,hang='90mm','-60mm' + when /4/; indent,hang='90mm','-50mm' + when /5/; indent,hang='90mm','-40mm' + when /6/; indent,hang='90mm','-30mm' + when /7/; indent,hang='90mm','-20mm' + when /8/; indent,hang='90mm','-10mm' + when /9/; indent,hang='90mm', '0mm' + end + end + "\\begin{ParagraphHang}{#{indent}}{#{hang}}#{@dob.tmp} \\end{ParagraphHang}}" + end def indent indent=case @dob.indent when /1/; '0mm' @@ -928,6 +1063,19 @@ WOK \\item[] } {\\end{list}} + +\\newenvironment{ParagraphHang}[2]% +{ +\\begin{list}{}{% +\\setlength\\topsep{0pt}% +\\addtolength{\\leftmargin}{#1} +\\itemindent=#2 +\\setlength\\parsep{0pt plus 1pt}% +} +\\item[] +} +{\\end{list}} + \\newenvironment{Bullet}[1]% { \\begin{list}{}{% -- cgit v1.2.3 From e3330f16f31ccc9cd62d5d1f15e76cec4e45485d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:32:10 -0400 Subject: v3: sql (pg, sqlite), indent ... --- lib/sisu/v3/db_import.rb | 10 +++++++++- lib/sisu/v3/shared_html_lite.rb | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v3/db_import.rb index 541399a9..ac6f0104 100644 --- a/lib/sisu/v3/db_import.rb +++ b/lib/sisu/v3/db_import.rb @@ -393,8 +393,16 @@ module SiSU_DB_import SiSU_Format_Shared::CSS_Format.new(@md,data).html_table elsif data.is=='code' SiSU_Format_Shared::CSS_Format.new(@md,data).code - elsif defined? data.indent and data.indent =~/[1-9]/ + elsif defined? data.indent \ + and defined? data.hang \ + and data.indent =~/[1-9]/ \ + and data.indent == data.hang SiSU_Format_Shared::CSS_Format.new(@md,data).indent(data.indent) + elsif defined? data.indent \ + and defined? data.hang \ + and data.hang =~/[0-9]/ \ + and data.indent != data.hang + SiSU_Format_Shared::CSS_Format.new(@md,data).hang_indent(data.hang,data.indent) else SiSU_Format_Shared::CSS_Format.new(@md,data).norm end diff --git a/lib/sisu/v3/shared_html_lite.rb b/lib/sisu/v3/shared_html_lite.rb index fca0cfb8..0dd13a34 100644 --- a/lib/sisu/v3/shared_html_lite.rb +++ b/lib/sisu/v3/shared_html_lite.rb @@ -236,6 +236,12 @@ GSUB h={ txt: txt, class: "indent#{t}", type: 'substantive', id: @ocn } tag_para(h) end + def hang_indent(f,t) + txt=markup_object(@t_o) + h={ txt: txt, class: "hang#{f}indent#{t}", type: 'substantive', id: @ocn } + #h={ txt: txt, class: "h#{f}i#{t}", type: 'substantive', id: @ocn } + tag_para(h) + end def para_table %{

} end -- cgit v1.2.3 From d9dcd8911f88949c268683beb925642a5f2e1035 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:33:39 -0400 Subject: v3: odf, manpage, "new" indent not implemented --- lib/sisu/v3/manpage.rb | 6 +++++- lib/sisu/v3/odf.rb | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/manpage.rb b/lib/sisu/v3/manpage.rb index 0a2c2fcc..e23caa76 100644 --- a/lib/sisu/v3/manpage.rb +++ b/lib/sisu/v3/manpage.rb @@ -202,11 +202,15 @@ WOK or dob.is=='heading' paragraph=dob.obj if dob.is=='para' - if dob.indent =~/[1-9]/ + if dob.indent =~/[1-9]/ \ + and dob.indent == dob.hang util=if dob.bullet_ SiSU_text_utils::Wrap.new("* #{paragraph}",78,dob.indent.to_i*2) else SiSU_text_utils::Wrap.new(paragraph,78,dob.indent.to_i*2) end + elsif dob.hang =~/[0-9]/ \ + and dob.indent != dob.hang # NOT yet implemented + util=SiSU_text_utils::Wrap.new(paragraph,78,dob.indent.to_i*2) else util=if dob.bullet_ SiSU_text_utils::Wrap.new("* #{paragraph}",78,0) diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb index c42ce349..49856a87 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -308,7 +308,13 @@ module SiSU_ODF %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration - dob.obj= if dob.is=='para' and dob.indent.to_s =~/[0-9]/ # and t_o.bullet_==true + dob.obj= if dob.is=='para' \ + and dob.indent.to_s =~/[0-9]/ \ + and dob.indent == dob.hang + %{#{dob.obj}#{p_num}} + elsif dob.is=='para' \ + and dob.hang.to_s =~/[0-9]/ \ + and dob.indent != dob.hang # NOT yet implemented %{#{dob.obj}#{p_num}} else %{#{dob.obj}#{p_num}} end -- cgit v1.2.3 From d613c9786784d6ff948d11dc248564ccca6ed469 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:34:37 -0400 Subject: v3: po4a, indent (check for breakage) --- lib/sisu/v3/po4a.rb | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/po4a.rb b/lib/sisu/v3/po4a.rb index dd2aff7a..c87da346 100644 --- a/lib/sisu/v3/po4a.rb +++ b/lib/sisu/v3/po4a.rb @@ -498,8 +498,8 @@ GSUB #puts z unless z.empty? end end - def pot_structure(desc,orig,trans,indent=0) - SiSU_po4a_utils::Wrap.new(@md,orig,trans,desc,@wrap_width,indent) + def pot_structure(desc,orig,trans,indent=0,hang=0) + SiSU_po4a_utils::Wrap.new(@md,orig,trans,desc,@wrap_width,indent,hang) end def pot_structure_heading(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document lv=n=n3=nil @@ -533,7 +533,8 @@ GSUB end def pot_structure_para(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document util=nil - wrapped=if dob_src.indent =~/[1-9]/ + wrapped=if dob_src.indent =~/[1-9]/ \ + and dob_src.indent == dob_src.hang s_mark=desc=orig=trans='' if dob_src.bullet_ mark="_#{dob_src.indent}* " @@ -557,6 +558,20 @@ GSUB orig="#{s_mark}#{dob_src.obj}" trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}" util=pot_structure(desc,orig,trans) + elsif dob_src.hang =~/[0-9]/ \ + and dob_src.indent != dob_src.hang + s_mark=desc=orig=trans='' + mark="_#{dob_src.hang}_#{dob_src.indent} " + d="#{dob_src.is}: hang #{dob_src.hang} indent #{dob_src.indent}" + instruct=s_mark='' + if @md.opt.cmd=~/M/ + instruct=%{\n# markup for indented text with a first line indented to a different level from the rest of the paragraph, is at the start of the line/object, an underscore and the first indent level a second underscore and the indent level for the rest of the paragraph, "#{mark1}"} + s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"} + end + desc="#{d}#{s_mark}#{instruct}" + orig="#{s_mark}#{dob_src.obj}" + trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}" + util=pot_structure(desc,orig,trans) else s_mark=desc=orig=trans='' if dob_src.bullet_ -- cgit v1.2.3