From c36e976c00bac90fd01fe12f6c9bc632e3b209b7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 10 Mar 2010 16:43:15 -0500 Subject: epub, html: make robust where missing param values --- lib/sisu/v2/epub.rb | 34 ++++++++++++++++++++++++++-------- lib/sisu/v2/epub_format.rb | 17 ++++++++++++++--- lib/sisu/v2/epub_segments.rb | 5 ++++- lib/sisu/v2/html.rb | 15 +++++++++++---- 4 files changed, 55 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/epub.rb b/lib/sisu/v2/epub.rb index 6df06025..e6ab1e12 100644 --- a/lib/sisu/v2/epub.rb +++ b/lib/sisu/v2/epub.rb @@ -499,7 +499,8 @@ module SiSU_EPUB segtoc << format_head_toc.head #<< ads.div.major toc_shared << format_head_toc.toc_head_escript if SiSU_EPUB_Format::Head_toc.method_defined? :toc_head_escript segtoc << format_head_toc.toc_head_escript if SiSU_EPUB_Format::Head_toc.method_defined? :toc_head_escript - if @md.rights.all + if defined? @md.rights.all \ + and @md.rights.all rights=format_head_toc.rights.all rights=SiSU_EPUB_Tune::Clean_xhtml.new(rights).clean end @@ -517,7 +518,8 @@ module SiSU_EPUB format_txt_obj=SiSU_EPUB_Format::Format_text_object.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold segtoc << format_txt_obj.center_bold - if @md.creator.author + if defined? @md.creator.author \ + and @md.creator.author creator_endnote=@md.creator.author.gsub(/(\*+)/,%{ \\1}) tmp_head=creator_endnote + "\n" txt_obj={:txt =>tmp_head} @@ -529,21 +531,34 @@ module SiSU_EPUB segtoc << format_head_toc.copyat segtoc << seg_toc_band tmp_head=nil - if @md.prefix_a + if defined? @md.prefix_a \ + and @md.prefix_a tmp_head ||= %{#{@md.prefix_a}\n} toc_shared << tmp_head.dup segtoc << tmp_head.dup end tmp_head=nil toc_shared << @links_guide_toc - toc_shared << rights if @md.rights.all - toc_shared << prefix_b if @md.prefix_b + if defined? @md.rights.all \ + and @md.rights.all + toc_shared << rights + end + if defined? @md.prefix_b \ + and @md.prefix_b + toc_shared << prefix_b + end #Table of Contents added/appended here toc_shared << @toc[:scr] segtoc << @links_guide_toc segtoc << @toc[:seg] - segtoc << rights if @md.rights.all - segtoc << prefix_b if @md.prefix_b + if defined? @md.rights.all \ + and @md.rights.all + segtoc << rights + end + if defined? @md.prefix_b \ + and @md.prefix_b + segtoc << prefix_b + end #Segtoc tail added here segtoc << seg_toc_band_bottom segtoc << format_head_toc.xhtml_close @@ -618,7 +633,10 @@ module SiSU_EPUB def images img_pth=@md.env.path.image_source_local_tex @md.ec[:image].each do |x| - cp("#{img_pth}/#{x}","#{@md.env.path.epub}/OPS/image") if FileTest.directory?("#{@md.env.path.epub}/OPS/image") + if FileTest.directory?("#{@md.env.path.epub}/OPS/image") \ + and FileTest.file?("#{img_pth}/#{x}") + cp("#{img_pth}/#{x}","#{@md.env.path.epub}/OPS/image") + end end end def concordance diff --git a/lib/sisu/v2/epub_format.rb b/lib/sisu/v2/epub_format.rb index 5599a435..498912a3 100644 --- a/lib/sisu/v2/epub_format.rb +++ b/lib/sisu/v2/epub_format.rb @@ -1024,17 +1024,28 @@ WOK WOK end def metadata #metadata dc - illustrator=if defined? @md.creator.illustrator and @md.creator.illustrator =~/\S+/ + author=if defined? @md.creator.author \ + and @md.creator.author =~/\S+/ + %{\n #{@md.creator.author}} + else '' + end + illustrator=if defined? @md.creator.illustrator \ + and @md.creator.illustrator =~/\S+/ %{\n #{@md.creator.illustrator}} else '' end + rights=if defined? @md.rights.all \ + and @md.rights.all =~/\S+/ + %{\n #{@md.rights.all}} + else '' + end < #{@md.title.full} - #{@md.creator.author}#{illustrator} + #{author}#{illustrator} en-US ... - #{@md.rights.all} + #{rights} urn:uuid:#{@md.dgst[1]} WOK diff --git a/lib/sisu/v2/epub_segments.rb b/lib/sisu/v2/epub_segments.rb index 3f402c92..6436612c 100644 --- a/lib/sisu/v2/epub_segments.rb +++ b/lib/sisu/v2/epub_segments.rb @@ -300,7 +300,10 @@ WOK end @p_num ||= '' if @@is1==1 - @author=%{#{@md.creator.author}\n} if @md.creator.author.to_s =~/\S/ + if defined? @md.creator.author \ + and @md.creator.author + @author=%{#{@md.creator.author}\n} + end @@seg[:nav] << format_head_seg.navigation_band(@@segtocband) ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix else '' diff --git a/lib/sisu/v2/html.rb b/lib/sisu/v2/html.rb index 4959d683..834eefa1 100644 --- a/lib/sisu/v2/html.rb +++ b/lib/sisu/v2/html.rb @@ -533,7 +533,7 @@ WOK format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold - if @md.creator.author + if defined? @md.creator.author creator_endnote=@md.creator.author.gsub(/(\*+)/,%{ \\1}) tmp_head=creator_endnote + "\n" txt_obj={:txt =>tmp_head} @@ -553,13 +553,20 @@ WOK end tmp_head=nil toc_shared << @links_guide_toc - toc_shared << rights if @md.rights.all - toc_shared << prefix_b if @md.prefix_b + if defined? @md.rights.all #and ? @md.rights.all + toc_shared << rights + end + if defined? @md.prefix_b + toc_shared << prefix_b + end #Table of Contents added/appended here toc_shared << @toc[:scr] @segtoc << @links_guide_toc @segtoc << @toc[:seg] - @segtoc << rights if @md.rights.all + if defined? @md.rights.all \ + and not @md.rights.all.empty? + @segtoc << rights + end @segtoc << prefix_b if @md.prefix_b #Segtoc tail added here @segtoc << "

\n" #bugfix sort later DEBUGNOW -- cgit v1.2.3 From 750ea614a1870efc5d43670629f702a4660aca2b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 10 Mar 2010 16:44:12 -0500 Subject: texpdf_format, where image missing, escape image markup loop --- lib/sisu/v2/texpdf_format.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index 9847d092..aca5378e 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -492,8 +492,9 @@ module SiSU_TeX_Pdf hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace caption=(c ? "{\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" : '') elsif images_hash[ps] =~/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/m - tell=SiSU_Screen::Ansi.new(@md.cmd,%{document built without image: "#{$1}" as image dimensions not provided (& librmagick-ruby is not installed)?\n}) + tell=SiSU_Screen::Ansi.new(@md.cmd,%{document built without image: "#{$1}" as image dimensions not provided (either image not found or neither imagemagick nor graphicsmagick is installed)?\n}) tell.print_grey #unless @opt.cmd =~/q/ + images_hash[ps].gsub!(/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/,'[image]') end if image #most images fc etc. #% clean up ! if @md.fns =~/\.(?:ssm\.)?sst$/ \ -- cgit v1.2.3 From 438f9863e6a3e52b2d0db357c60f8ef93a4fee51 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 10 Mar 2010 16:45:06 -0500 Subject: sysenv, html_promo, db name prefix from constants (now SiSUv2_) --- lib/sisu/v2/html_promo.rb | 6 ++++-- lib/sisu/v2/sysenv.rb | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/html_promo.rb b/lib/sisu/v2/html_promo.rb index 962184f2..df13393e 100644 --- a/lib/sisu/v2/html_promo.rb +++ b/lib/sisu/v2/html_promo.rb @@ -146,10 +146,12 @@ module SiSU_HTML_promo end def search_form_sisu(table=true) db=if @prod['db']=~/\S+/ - (@prod['db']=~/^SiSU_\S+/) ? @prod['db'] : "SiSU_#{@prod['db']}" + (@prod['db']=~/^#{Db[:name_prefix]}\S+/) ? @prod['db'] : "#{Db[:name_prefix]}#{@prod['db']}" elsif defined? @rc['search']['sisu']['db'] \ and @rc['search']['sisu']['db'] =~/\S+/ - (@rc['search']['sisu']['db']=~/^SiSU_\S+/) ? @prod['search']['sisu']['db'] : "SiSU_#{@prod['db']}" + (@rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ + ? @prod['search']['sisu']['db'] \ + : "#{Db[:name_prefix]}#{@prod['db']}" else nil end action=if @prod['action']=~/^http:\/\// diff --git a/lib/sisu/v2/sysenv.rb b/lib/sisu/v2/sysenv.rb index 9f69ccfe..99d0beb1 100644 --- a/lib/sisu/v2/sysenv.rb +++ b/lib/sisu/v2/sysenv.rb @@ -1004,9 +1004,9 @@ module SiSU_Env elsif widget.search? db=if rc['search']['sisu']['flag']==true \ and rc['search']['sisu']['db']=~/\S+/ - (rc['search']['sisu']['db']=~/^SiSU_\S+/) \ + (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ ? rc['search']['sisu']['db'] \ - : "SiSU_#{rc['search']['sisu']['db']}" + : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" else nil end action=rc['search']['sisu']['action'] @@ -1074,9 +1074,9 @@ WOK elsif widget.search_fixed? db=if rc['search']['sisu']['flag']==true \ and rc['search']['sisu']['db']=~/\S+/ - (rc['search']['sisu']['db']=~/^SiSU_\S+/) \ + (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ ? rc['search']['sisu']['db'] \ - : "SiSU_#{rc['search']['sisu']['db']}" + : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" else nil end action=rc['search']['sisu']['action'] @@ -1171,9 +1171,9 @@ WOK elsif widget_static.search? \ and rc['search']['sisu']['flag']==true db=if rc['search']['sisu']['db']=~/\S+/ - (rc['search']['sisu']['db']=~/^SiSU_\S+/) \ + (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ ? rc['search']['sisu']['db'] \ - : "SiSU_#{rc['search']['sisu']['db']}" + : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" else nil end action=rc['search']['sisu']['action'] -- cgit v1.2.3 From 93817753b2dc0143c78b3b1522d658cfde5bc331 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 12 Mar 2010 10:57:19 -0500 Subject: html tables fix (in html_segments, an erroneous assignment where there should have been comparison) --- lib/sisu/v2/dal_doc_str.rb | 2 +- lib/sisu/v2/epub_segments.rb | 2 +- lib/sisu/v2/html_scroll.rb | 8 +++----- lib/sisu/v2/html_segments.rb | 2 +- lib/sisu/v2/sysenv.rb | 6 ------ 5 files changed, 6 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/dal_doc_str.rb b/lib/sisu/v2/dal_doc_str.rb index 88ddaec9..dc9a55b7 100644 --- a/lib/sisu/v2/dal_doc_str.rb +++ b/lib/sisu/v2/dal_doc_str.rb @@ -234,7 +234,7 @@ module SiSU_document_structure_extract @h={:head_=>heading,:cols=>cols,:widths=>col,:idx=>idx} elsif t_o=~/^\{table(?:~h)?(?:\s+\d+;?)?\}\n.+\Z/m m1,m2,hd=nil,nil,nil - tbl= /^\{table(?:~h)?(?:\s+\d+;?)?\}\n(.+)\Z/m.match(t_o)[1] #two table representations should be consolidated as one + tbl=/^\{table(?:~h)?(?:\s+\d+;?)?\}\n(.+)\Z/m.match(t_o)[1] #two table representations should be consolidated as one hd=((t_o =~/^\{table~h/) ? true : false) tbl,tags=extract_tags(tbl) rws=tbl.split(/\n/) diff --git a/lib/sisu/v2/epub_segments.rb b/lib/sisu/v2/epub_segments.rb index 6436612c..5f0b74d3 100644 --- a/lib/sisu/v2/epub_segments.rb +++ b/lib/sisu/v2/epub_segments.rb @@ -379,7 +379,7 @@ WOK end elsif dob.is =~/^(?:group|alt)$/ sto.para #fix this should be group type specific #FIX - elsif dob.is =~/^verse$/ + elsif dob.is=='verse' sto.verse elsif dob.is=='code' sto.code diff --git a/lib/sisu/v2/html_scroll.rb b/lib/sisu/v2/html_scroll.rb index 59a3ee42..a5ff9b00 100644 --- a/lib/sisu/v2/html_scroll.rb +++ b/lib/sisu/v2/html_scroll.rb @@ -147,13 +147,11 @@ module SiSU_HTML_scroll else sto.para end end - elsif dob.is =~/^(?:group|alt)$/m - sto.para #fix this should be group type specific #FIX - elsif dob.is =='group' + elsif dob.is=='group' sto.group - elsif dob.is =='alt' + elsif dob.is=='alt' sto.alt - elsif dob.is =='verse' + elsif dob.is=='verse' sto.verse elsif dob.is=='code' sto.code diff --git a/lib/sisu/v2/html_segments.rb b/lib/sisu/v2/html_segments.rb index 79aa699e..022a1d0c 100644 --- a/lib/sisu/v2/html_segments.rb +++ b/lib/sisu/v2/html_segments.rb @@ -373,7 +373,7 @@ module SiSU_HTML_seg sto.group elsif dob.is=='alt' sto.alt - elsif dob.is='verse' + elsif dob.is=='verse' sto.verse elsif dob.is=='code' sto.code diff --git a/lib/sisu/v2/sysenv.rb b/lib/sisu/v2/sysenv.rb index 99d0beb1..ddb48bba 100644 --- a/lib/sisu/v2/sysenv.rb +++ b/lib/sisu/v2/sysenv.rb @@ -1948,12 +1948,6 @@ WOK ? @rc['program_select']['odf_viewer'] \ : 'oowriter' #'odf-viewer','oowriter' end - def epub_viewer - ((defined? @rc['program_select']['epub_viewer']) \ - && @rc['program_select']['epub_viewer'] =~/\S\S+/) \ - ? @rc['program_select']['epub_viewer'] \ - : web_browser - end def manpage_generator ((defined? @rc['program_select']['man']) \ && @rc['program_select']['man'] =~/\S\S+/) \ -- cgit v1.2.3 From fcad39c09b62e340ce667a851e25c998fe40c53e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 17 Mar 2010 13:52:27 -0400 Subject: documentation minor update, add epub, modify some dir paths --- lib/sisu/v2/defaults.rb | 70 +++++++++++++++++++++++++++++++++++-------------- lib/sisu/v2/help.rb | 13 ++++++++- 2 files changed, 62 insertions(+), 21 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/defaults.rb b/lib/sisu/v2/defaults.rb index 52c2cd45..a654aed7 100644 --- a/lib/sisu/v2/defaults.rb +++ b/lib/sisu/v2/defaults.rb @@ -1715,13 +1715,14 @@ WOK SiSU information Structuring Universe - Structured information, Serialized Units - software for electronic texts, documents, books, digital libraries in plaintext, html, XHTML, XML, -ODF (OpenDocument), LaTeX, PDF, SQL (PostgreSQL and SQLite), and +ODF (OpenDocument), EPUB, LaTeX, PDF, SQL (PostgreSQL and SQLite), and for search - - + + +"document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, EPUB, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" /> @@ -1751,20 +1752,10 @@ software for electronic texts, document collections, books, digital libraries, a with "atomic search" and text positioning system (shared text citation numbering: "ocn")

-outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQL (PostgreSQL and SQLite) +outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, PDF, SQL (PostgreSQL and SQLite)

@@ -1776,7 +1767,7 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQ ---

- + SiSU Manual

@@ -1784,7 +1775,7 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQ ---

- + What does SiSU do? Summary

@@ -1796,6 +1787,16 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQ Book Samples and Markup Examples

+

+ + sorted by Author (sisu metadata) + +

+

+ + sorted by Topic (sisu metadata) + +

---

@@ -1848,6 +1849,21 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQ

=============

+

+ + sisu markup + +

+

+ + sisu commands + +

+

+ + sisu manual + +

sisu man pages @@ -1964,13 +1980,13 @@ markup defines document structure (this may be done once in a header pattern-mat

(iii) (a) -multiple outputs primarily industry established and institutionally accepted open standard formats, include amongst others: plaintext (UTF-8); html; (structured) XML; ODF (Open Document text)l; LaTeX; PDF (via LaTeX); SQL type databases (currently PostgreSQL and SQLite). Also produces: concordance files; document content certificates (md5 or sha256 digests of headings, paragraphs, images etc.) and html manifests (and sitemaps of content). +multiple outputs primarily industry established and institutionally accepted open standard formats, include amongst others: plaintext (UTF-8); html; (structured) XML; ODF (Open Document text); EPUB; LaTeX; PDF (via LaTeX); SQL type databases (currently PostgreSQL and SQLite). Also produces: concordance files; document content certificates (md5 or sha256 digests of headings, paragraphs, images etc.) and html manifests (and sitemaps of content). (b) takes advantage of the strengths implicit in these very different output types, (e.g. PDFs produced using typesetting of LaTeX, databases populated with documents at an individual object/paragraph level, making possible granular search (and related possibilities))

(iv) -outputs share a common numbering system (dubbed "object citation numbering" (ocn)) that is meaningful (to man and machine) across various digital outputs whether paper, screen, or database oriented, (PDF, html, XML, sqlite, postgresql), this numbering system can be used to reference content.

+outputs share a common numbering system (dubbed "object citation numbering" (ocn)) that is meaningful (to man and machine) across various digital outputs whether paper, screen, or database oriented, (PDF, html, XML, EPUB, sqlite, postgresql), this numbering system can be used to reference content.

(v) SQL databases are populated at an object level (roughly headings, paragraphs, verse, tables) and become searchable with that degree of granularity, the output information provides the object/paragraph numbers which are relevant across all generated outputs; it is also possible to look at just the matching paragraphs of the documents in the database; [output indexing also work well with search indexing tools like hyperesteier].

@@ -2040,7 +2056,7 @@ document source may be bundled together (automatically) with associated document

(xxii) -for basic document generation, the only software dependency is Ruby, and a few standard Unix tools (this covers plaintext, html, XML, ODF, LaTeX). To use a database you of course need that, and to convert the LaTeX generated to PDF, a LaTeX processor like tetex or texlive. +for basic document generation, the only software dependency is Ruby, and a few standard Unix tools (this covers plaintext, html, XML, ODF, EPUB, LaTeX). To use a database you of course need that, and to convert the LaTeX generated to PDF, a LaTeX processor like tetex or texlive.

as a developers tool it is flexible and extensible @@ -2051,6 +2067,20 @@ More information on SiSU p

+ +

+ +
+ + + + idx + txt +search.sisudoc.org +
+ +

+

SiSU ("SiSU information Structuring Universe" or "Structured information, Serialized Units"),1 is a Unix command line oriented framework for document structuring, publishing and search. Featuring minimalistic markup, multiple standard outputs, a common citation system, and granular search.

diff --git a/lib/sisu/v2/help.rb b/lib/sisu/v2/help.rb index 894f1654..38f0a782 100644 --- a/lib/sisu/v2/help.rb +++ b/lib/sisu/v2/help.rb @@ -75,7 +75,7 @@ module SiSU_Help def help_request begin gotten=nil - regx=/^(list|com(?:mands)?|mod(?:ifiers)|markup|syntax|example(?:37|38)?|head(?:ers?)?|(?:heading|title|level|structure)s?|endnotes|footnotes|tables?|customise|skin|dir(?:ectories)?|paths?|lang(?:uage)?|modules|setup|conf(?:ig(?:ure)?)?|standards?|li[cs]en[sc]e|scratch|install|termsheet|dublin(?:core)?|dc|customise|styles?|appearance|theme|env(ironment)?|dir(?:ector(?:y|ies))?|metaverse|abstract|features|summary|(?:short)?cuts?|sisu|about|ext(?:ernal)?(?:_?prog(?:rams)?)?)|utf-?8|plaintext|html|xml|xhtml|odf|odt|opendocument|css|pdf|latex|tex|(?:tex)?info|search|(?:hyper)?est(?:raier)?|searchform|cgi|sql|db|postgresql|pg?sql|sqlite|convert|php|webrick|sitemaps?|ya?ml|ansi|colors|-[AabcDdEeFHhIMmNnopqrRSstUuVvwXxyZz0-9]|-[Ddcv]|-[CcFLSVvW]/ + regx=/^(list|com(?:mands)?|mod(?:ifiers)|markup|syntax|example(?:37|38)?|head(?:ers?)?|(?:heading|title|level|structure)s?|endnotes|footnotes|tables?|customise|skin|dir(?:ectories)?|paths?|lang(?:uage)?|modules|setup|conf(?:ig(?:ure)?)?|standards?|li[cs]en[sc]e|scratch|install|termsheet|dublin(?:core)?|dc|customise|styles?|appearance|theme|env(ironment)?|dir(?:ector(?:y|ies))?|metaverse|abstract|features|summary|(?:short)?cuts?|sisu|about|ext(?:ernal)?(?:_?prog(?:rams)?)?)|utf-?8|plaintext|html|xml|xhtml|epub|odf|odt|opendocument|css|pdf|latex|tex|(?:tex)?info|search|(?:hyper)?est(?:raier)?|searchform|cgi|sql|db|postgresql|pg?sql|sqlite|convert|php|webrick|sitemaps?|ya?ml|ansi|colors|-[AabcDdEeFHhIMmNnopqrRSstUuVvwXxyZz0-9]|-[Ddcv]|-[CcFLSVvW]/ help_info=%{#{@cX.blue_hi}SiSU help#{@cX.off} #{@cX.ruby}~#{@cX.off} #{@request}} help_list=%{#{@cX.blue}sisu --help#{@cX.off} #{@cX.cyan}type keyword else "enter" to exit help:\n\tkeywords include:#{@cX.off} #{@cX.brown}list, (com)mands, short(cuts), (mod)ifiers, (env)ironment, markup, syntax, headers, headings, endnotes, tables, example, customise, skin, (dir)ectories, path, (lang)uage, db, install, setup, (conf)igure, convert, external_programs, dublincore, termsheet, search, sql, hyper(est)raier, features, external_programs, license#{@cX.off} \n} help_prompt=%{#{@cX.fuschia}exit, [or carriage return to exit help] #{@cX.off}\n#{@cX.blue_hi}SiSU help#{@cX.off} #{@cX.ruby}~#{@cX.off} } @@ -125,6 +125,7 @@ module SiSU_Help when /xhtml|-b/; @help.xhtml when /xml|-[xX]/; @help.xml when /odf|odt|opendocument|-o/; @help.odf + when /epub|-e/; @help.epub when /php/; @help.php when /pdf|-p/; @help.pdf when /latex|tex/; @help.latex @@ -995,6 +996,7 @@ WOK pdf viewer: #{@cX.blue}#{@env.program.pdf_viewer}#{@cX.off} xml viewer: #{@cX.blue}#{@env.program.xml_editor}#{@cX.off} odf viewer: #{@cX.blue}#{@env.program.odf_viewer}#{@cX.off} + epub viewer: #{@cX.blue}#{@env.program.epub_viewer}#{@cX.off} (default selections can be changed in sisurc.yml under program_select:) #{@cX.green}programs used if available#{@cX.off} word count: #{program_found?(@env.program.wc)} @@ -1504,6 +1506,8 @@ WOK sisu -X [filename/wildcard] xml document (dom type parsing) sisu -o [filename/wildcard] odt document, (odf open document format) + + sisu -e [filename/wildcard] odt document, (epub document) WOK help_commands end @@ -1511,6 +1515,13 @@ WOK print < Date: Wed, 17 Mar 2010 15:40:34 -0400 Subject: param, adjustment for manpage synopsis --- lib/sisu/v2/param.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb index 947c018e..f5085d50 100644 --- a/lib/sisu/v2/param.rb +++ b/lib/sisu/v2/param.rb @@ -535,7 +535,7 @@ module SiSU_Param manpage['name']='man page "name/whatis" information not provided, set in header @man: name=[whatis information]' end if manpage['synopsis'] - manpage['synopsis']=manpage['synopsis'].join("\n.BR\n") + manpage['synopsis']=manpage['synopsis'].join("\n\n.BR\n") manpage['synopsis'].gsub!(/(-)/m,"\\\\\\1") manpage['synopsis'].gsub!(/\A/,"\n.SH SYNOPSIS\n") else -- cgit v1.2.3 From f7a5bfcd7b7e6b922b992019e616d36f475ad091 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 17 Mar 2010 15:41:47 -0400 Subject: plaintext docoration (more flexible markings) --- lib/sisu/v2/constants.rb | 19 ++++++++++++++++++- lib/sisu/v2/plaintext.rb | 44 ++++++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/constants.rb b/lib/sisu/v2/constants.rb index 384c8c19..9abe9c0b 100644 --- a/lib/sisu/v2/constants.rb +++ b/lib/sisu/v2/constants.rb @@ -58,7 +58,7 @@ =end Sfx={:txt=>'.txt',:html=>'.html',:xhtml=>'.xhtml',:xml=>'.xml',:epub=>'.epub',:epub_xhtml=>'.xhtml',:odt=>'.odt',:pdf=>'.pdf'} -Ax,Xx,Mx,Rx,Hx,Dx,Db,Tex={},{},{},{},{},{},{},{} +Ax,Xx,Mx,Rx,Hx,Dx,Px,Db,Tex={},{},{},{},{},{},{},{},{} Ax[:tab]="\t" Xx[:protect]='☞' Xx[:segment]='Ф' @@ -115,6 +115,23 @@ Db[:name_prefix]="SiSU#{SiSU_version_dir}_" Tex[:backslash]="\\\\" Tex[:backslash]="\\\\" Tex[:tilde]='\\\\\\~' +Px[:bold_o]= '*'; Px[:bold_c]= '*' +Px[:italics_o]= '/'; Px[:italics_c]= '/' +Px[:underscore_o]= '_'; Px[:underscore_c]= '_' +Px[:cite_o]= '"'; Px[:cite_c]= '"' +Px[:insert_o]= '+'; Px[:insert_c]= '+' +Px[:strike_o]= '-'; Px[:strike_c]= '-' +Px[:superscript_o]='^'; Px[:superscript_c]='^' +Px[:subscript_o]= '['; Px[:subscript_c]= ']' +Px[:hilite_o]= '*'; Px[:hilite_c]= '*' +Px[:lv1]= '*' +Px[:lv2]= '=' +Px[:lv3]= '=' +#Px[:lv2_3]= '=' +Px[:lv4]= '-' +Px[:lv5]= '.' +Px[:lv6]= '.' +#Px[:lv5_6]= '.' __END__ consider: 〔comment〕 diff --git a/lib/sisu/v2/plaintext.rb b/lib/sisu/v2/plaintext.rb index 4e7cb2f1..ddc82839 100644 --- a/lib/sisu/v2/plaintext.rb +++ b/lib/sisu/v2/plaintext.rb @@ -237,10 +237,14 @@ WOK times=wrapped.length times=78 if times > 78 @plaintext[:body] << case lv - when 1; wrapped.upcase << @br << '*'*times << @br - when 2..3; wrapped.upcase << @br << '='*times << @br - when 4; wrapped.upcase << @br << '-'*times << @br - when 5..6; wrapped.upcase << @br << '.'*times << @br + when 1; wrapped.upcase << @br << Px[:lv1]*times << @br + when 2; wrapped.upcase << @br << Px[:lv2]*times << @br + when 3; wrapped.upcase << @br << Px[:lv3]*times << @br + #when 2..3; wrapped.upcase << @br << Px[:lv2_3]*times << @br + when 4; wrapped.upcase << @br << Px[:lv4]*times << @br + when 5; wrapped.upcase << @br << Px[:lv5]*times << @br + when 6; wrapped.upcase << @br << Px[:lv6]*times << @br + #when 5..6; wrapped.upcase << @br << Px[:lv5_6]*times << @br end else @plaintext[:body] << wrapped << @br # main text, contents, body KEEP @@ -266,15 +270,23 @@ WOK fix=[] data.each do |dob| dob.obj.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{@br}#{table_message}") #fix - dob.obj.gsub!(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,'') # remove dummy headings (used by html) #check - dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*\1*') - dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/\1/') - dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_\1_') - dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]') - dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^') - dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+\1+') - dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"') - dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'-\1-') + dob.obj.gsub!(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,'') # remove dummy headings (used by html) #check also [~-]# + dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, + "#{Px[:bold_o]}\\1#{Px[:bold_c]}") + dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/, + "#{Px[:italics_o]}\\1#{Px[:italics_c]}") + dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/, + "#{Px[:underscore_o]}\\1#{Px[:underscore_c]}") + dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/, + "#{Px[:subscript_o]}\\1#{Px[:subscript_c]}") + dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/, + "#{Px[:superscript_o]}\\1#{Px[:superscript_c]}") + dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/, + "#{Px[:insert_o]}\\1#{Px[:insert_c]}") + dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/, + "#{Px[:cite_o]}\\1#{Px[:cite_c]}") + dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/, + "#{Px[:strike_o]}\\1#{Px[:strike_c]}") unless dob.is=='code' dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]') @@ -305,11 +317,11 @@ WOK dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _< dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_< end - dob.obj.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks + dob.obj.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') dob.obj.gsub!(/(.+?)<\/a>/m,'\1') - dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') # remove name links - dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ') # decide on + dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') # remove name links + dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ') # decide on dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") dob.obj.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') -- cgit v1.2.3