diff options
63 files changed, 614 insertions, 520 deletions
diff --git a/CHANGELOG_v2 b/CHANGELOG_v2 index c737a112..f4e29be3 100644 --- a/CHANGELOG_v2 +++ b/CHANGELOG_v2 @@ -12,11 +12,38 @@ Reverse Chronological: %% Development branch UNSTABLE +%% 2.3.2.orig.tar.gz (2010-05-03:18/1) +http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.2.orig.tar.gz + sisu_2.3.2.orig.tar.gz + sisu_2.3.2-1.dsc + sisu_2.3.2-1.diff.gz + + * dal, markup, In cases where the line is interpreted as level 1~ (either by + explicit 1~ tag or @make: :heading:) a hash (#) [octothorpe] will be + auto-incremented, markup e.g. "1~ Chapter #: My Way". + + * markup for *{emphasis}* configurable as being displayed as bold, italics or + underscore, the default is that emphasis output is in bold so there is no + change unless configured, either in sisurc.yml (default: emphasis: 'bold'), + or the markup source document header @make: :emphasis: 'bold' [requested] + + * plaintext, wrap width configurable between 20 to 200 characters, the + default width being 78, configuration eithe rin sisurc.yml (default: text_wrap: + 78), or the markup source document header (@make: :plaintext_wrap: 78) + + * param_identify_markup, identify version 2 markup + + * manifest, info, expand on description of book indexes when available + + * screen output, reduce verbosity unless -v or other such option used + + * dal_numbering, number headings, a fix + %% 2.3.1.orig.tar.gz (2010-04-28:17/3) http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.1.orig.tar.gz - sisu_2.3.1.orig.tar.gz - sisu_2.3.1-1.dsc - sisu_2.3.1-1.diff.gz + 03a9912a475a634e4e18024a508c64c67b60337cf0edeab01b96f3d54bc96e4a 2751600 sisu_2.3.1.orig.tar.gz + 475643cc77b3bef83cbeebdb8282240396805c328d2c6b48411555861d9d09e8 1145 sisu_2.3.1-1.dsc + d7f3fbcabb89a0c97347c5174677d5bba7afdedf06f8a56f5ffd47dbe594c27a 276069 sisu_2.3.1-1.diff.gz * param, for topic_register, an additional check required, bug fix, repost @@ -64,7 +91,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.0.orig.tar.gz * switch markup for emphasis and bold, now: *{emphasis}* and !{bold}! which is consistent with !_ declaring a line to be bold, the default is that emphasis output is in bold so there is no change at present, at some time in - the future it is intended that it be possible to configure emphais aoutput + the future it is intended that it be possible to configure emphasis output alternatively to be in italics [requested] %% 2.2.0.orig.tar.gz (2010-04-20:16/2) diff --git a/conf/sisu/v2/sisurc.yml b/conf/sisu/v2/sisurc.yml index 418cdfd1..a5c13293 100644 --- a/conf/sisu/v2/sisurc.yml +++ b/conf/sisu/v2/sisurc.yml @@ -64,10 +64,13 @@ flag: #% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal default: papersize: 'A4,letter' + #text_wrap: 78 + #emphasis: 'bold' #make *{emphasis}* 'bold', 'italics' or 'underscore', default if not configured is 'bold' #digest: 'sha' #sha is sha256, default is md5 #multilingual: false #language_file: 2 #language: 'English' +#% markup, make *{emphasis}* 'bold' or 'italics', default if not configured is 'bold' #% settings used by ssh scp #remote: # - diff --git a/conf/sisu/v2/version.yml b/conf/sisu/v2/version.yml index cce6eb57..2879bb8a 100644 --- a/conf/sisu/v2/version.yml +++ b/conf/sisu/v2/version.yml @@ -1,5 +1,5 @@ --- -:version: 2.3.1 -:date_stamp: 2010w17/3 -:date: "2010-04-28" +:version: 2.3.2 +:date_stamp: 2010w18/1 +:date: "2010-05-03" :project: SiSU diff --git a/data/doc/sisu/v2/CHANGELOG b/data/doc/sisu/v2/CHANGELOG index 1c0343db..d6c2c6ba 100644 --- a/data/doc/sisu/v2/CHANGELOG +++ b/data/doc/sisu/v2/CHANGELOG @@ -12,11 +12,38 @@ Reverse Chronological: %% Development branch UNSTABLE +%% 2.3.2.orig.tar.gz (2010-05-03:18/1) +http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.2.orig.tar.gz + sisu_2.3.2.orig.tar.gz + sisu_2.3.2-1.dsc + sisu_2.3.2-1.diff.gz + + * dal, markup, In cases where the line is interpreted as level 1~ (either by + explicit 1~ tag or @make: :heading:) a hash (#) [octothorpe] will be + auto-incremented, markup e.g. "1~ Chapter #: My Way". + + * markup for *{emphasis}* configurable as being displayed as bold, italics or + underscore, the default is that emphasis output is in bold so there is no + change unless configured, either in sisurc.yml (default: emphasis: 'bold'), + or the markup source document header @make: :emphasis: 'bold' [requested] + + * plaintext, wrap width configurable between 20 to 200 characters, the + default width being 78, configuration eithe rin sisurc.yml (default: text_wrap: + 78), or the markup source document header (@make: :plaintext_wrap: 78) + + * param_identify_markup, identify version 2 markup + + * manifest, info, expand on description of book indexes when available + + * screen output, reduce verbosity unless -v or other such option used + + * dal_numbering, number headings, a fix + %% 2.3.1.orig.tar.gz (2010-04-28:17/3) http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.1.orig.tar.gz - sisu_2.3.1.orig.tar.gz - sisu_2.3.1-1.dsc - sisu_2.3.1-1.diff.gz + 03a9912a475a634e4e18024a508c64c67b60337cf0edeab01b96f3d54bc96e4a 2751600 sisu_2.3.1.orig.tar.gz + 475643cc77b3bef83cbeebdb8282240396805c328d2c6b48411555861d9d09e8 1145 sisu_2.3.1-1.dsc + d7f3fbcabb89a0c97347c5174677d5bba7afdedf06f8a56f5ffd47dbe594c27a 276069 sisu_2.3.1-1.diff.gz * param, for topic_register, an additional check required, bug fix, repost @@ -64,7 +91,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.0.orig.tar.gz * switch markup for emphasis and bold, now: *{emphasis}* and !{bold}! which is consistent with !_ declaring a line to be bold, the default is that emphasis output is in bold so there is no change at present, at some time in - the future it is intended that it be possible to configure emphais aoutput + the future it is intended that it be possible to configure emphasis output alternatively to be in italics [requested] %% 2.2.0.orig.tar.gz (2010-04-20:16/2) diff --git a/data/doc/sisu/v2/sisu_markup_samples/sisu_manual/sisu_download.ssi b/data/doc/sisu/v2/sisu_markup_samples/sisu_manual/sisu_download.ssi index 8423dff8..d6cbdd7d 100644 --- a/data/doc/sisu/v2/sisu_markup_samples/sisu_manual/sisu_download.ssi +++ b/data/doc/sisu/v2/sisu_markup_samples/sisu_manual/sisu_download.ssi @@ -16,7 +16,7 @@ :issued: 2002-11-12 :available: 2002-11-12 :published: 2009-01-18 - :modified: 2010-04-28 + :modified: 2010-05-03 @make: :num_top: 1 @@ -55,9 +55,9 @@ 3~source- Source (tarball tar.gz) -_* {~^ sisu_2.3.1.orig.tar.gz (2010-04-28:17/3) }http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.1.orig.tar.gz +_* {~^ sisu_2.3.2.orig.tar.gz (2010-05-03:18/1) }http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.2.orig.tar.gz -_* {~^ sisu-markup-samples_2.0.2.orig.tar.gz (of 2010-04-27:17/2 ) }http://www.jus.uio.no/sisu/pkg/src/sisu-markup-samples_2.0.2.orig.tar.gz *~sisu-markup-samples +_* {~^ sisu-markup-samples_2.0.3.orig.tar.gz (of 2010-05-01:17/6 ) }http://www.jus.uio.no/sisu/pkg/src/sisu-markup-samples_2.0.3.orig.tar.gz *~sisu-markup-samples For installation notes see http://sisudoc.org/sisu/sisu_manual/installation.html @@ -102,11 +102,11 @@ group{ *{Source}* -{~^ sisu_2.3.1.orig.tar.gz }http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.1.orig.tar.gz +{~^ sisu_2.3.2.orig.tar.gz }http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.2.orig.tar.gz -{~^ sisu_2.3.1-1.diff.gz }http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.1-1.diff.gz +{~^ sisu_2.3.2-1.diff.gz }http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.2-1.diff.gz -{~^ sisu_2.3.1-1.dsc }http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.1-1.dsc +{~^ sisu_2.3.2-1.dsc }http://www.jus.uio.no/sisu/pkg/src/sisu_2.3.2-1.dsc }group @@ -114,15 +114,15 @@ group{ *{Debs}* -{~^ sisu_2.3.1-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu_2.3.1-1_all.deb ~{ <br>sisu, the base code, (the main package on which the others depend), without any dependencies other than ruby (and for convenience the ruby webrick web server), this generates a number of types of output on its own, other packages provide additional functionality, and have their dependencies <br>Depends: ruby (>=1.8.2), libwebrick-ruby<br>Recommends: sisu-pdf, sisu-sqlite, sisu-postgresql, sisu-examples, vim-sisu, librmagick-ruby, trang, tidy, libtidy, librexml-ruby, zip, unzip, openssl }~ +{~^ sisu_2.3.2-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu_2.3.2-1_all.deb ~{ <br>sisu, the base code, (the main package on which the others depend), without any dependencies other than ruby (and for convenience the ruby webrick web server), this generates a number of types of output on its own, other packages provide additional functionality, and have their dependencies <br>Depends: ruby (>=1.8.2), libwebrick-ruby<br>Recommends: sisu-pdf, sisu-sqlite, sisu-postgresql, sisu-examples, vim-sisu, librmagick-ruby, trang, tidy, libtidy, librexml-ruby, zip, unzip, openssl }~ -{~^ sisu-complete_2.3.1-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-complete_2.3.1-1_all.deb ~{ <br>a package that pulls in other packages to build the whole of sisu (excluding sisu-examples) <br>Depends: ruby (>=1.8.2), sisu, sisu-pdf, sisu-postgresql, sisu-remote, sisu-sqlite, vim-sisu<br>Recommends: sisu-examples }~ +{~^ sisu-complete_2.3.2-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-complete_2.3.2-1_all.deb ~{ <br>a package that pulls in other packages to build the whole of sisu (excluding sisu-examples) <br>Depends: ruby (>=1.8.2), sisu, sisu-pdf, sisu-postgresql, sisu-remote, sisu-sqlite, vim-sisu<br>Recommends: sisu-examples }~ -{~^ sisu-pdf_2.3.1-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-pdf_2.3.1-1_all.deb ~{ <br>dependencies used by sisu to produce pdf from LaTeX generated <br>Depends: sisu, tetex-bin, tetex-extra, latex-ucs<br>Suggests: evince, xpdf }~ +{~^ sisu-pdf_2.3.2-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-pdf_2.3.2-1_all.deb ~{ <br>dependencies used by sisu to produce pdf from LaTeX generated <br>Depends: sisu, tetex-bin, tetex-extra, latex-ucs<br>Suggests: evince, xpdf }~ -{~^ sisu-postgresql_2.3.1-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-postgresql_2.3.1-1_all.deb ~{ <br>dependencies used by sisu to populate postgresql database (further configuration is necessary) <br>Depends: sisu, postgresql-8.1, libdbi-ruby, libdbm-ruby, libdbd-pg-ruby<br>Suggests: pgaccess, libdbd-pgsql, postgresql-contrib-8.1 }~ +{~^ sisu-postgresql_2.3.2-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-postgresql_2.3.2-1_all.deb ~{ <br>dependencies used by sisu to populate postgresql database (further configuration is necessary) <br>Depends: sisu, postgresql-8.1, libdbi-ruby, libdbm-ruby, libdbd-pg-ruby<br>Suggests: pgaccess, libdbd-pgsql, postgresql-contrib-8.1 }~ -{~^ sisu-sqlite_2.3.1-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-sqlite_2.3.1-1_all.deb ~{ <br>dependencies used by sisu to populate sqlite database <br>Depends: sisu, sqlite, libdbi-ruby, libdbm-ruby, libdbd-sqlite-ruby<br>Suggests: libdbd-sqlite }~ +{~^ sisu-sqlite_2.3.2-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-sqlite_2.3.2-1_all.deb ~{ <br>dependencies used by sisu to populate sqlite database <br>Depends: sisu, sqlite, libdbi-ruby, libdbm-ruby, libdbd-sqlite-ruby<br>Suggests: libdbd-sqlite }~ }group @@ -136,9 +136,9 @@ _1 http://www.jus.uio.no/sisu/sisu_changelog/changelog.html Book markup samples have been moved to non-free as the substantive text of the documents are available under the author or original publisher's license, and usually do not comply with the Debian Free Software Guidelines. -_* {~^ sisu-markup-samples_2.0.2-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/non-free/s/sisu-markup-samples/sisu-markup-samples_2.0.2-1_all.deb ~{ <br>marked up documents and other examples related to sisu, a larger package containing a number of texts <br>Depends: sisu }~ +_* {~^ sisu-markup-samples_2.0.3-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/non-free/s/sisu-markup-samples/sisu-markup-samples_2.0.3-1_all.deb ~{ <br>marked up documents and other examples related to sisu, a larger package containing a number of texts <br>Depends: sisu }~ -_* {~^ sisu-markup-samples_2.0.2-1.dsc }http://www.jus.uio.no/sisu/pkg/src/sisu-markup-samples_2.0.2-1.dsc ~{ <br>sisu-markup-samples_2.0.2-1.dsc }~ +_* {~^ sisu-markup-samples_2.0.3-1.dsc }http://www.jus.uio.no/sisu/pkg/src/sisu-markup-samples_2.0.3-1.dsc ~{ <br>sisu-markup-samples_2.0.3-1.dsc }~ For changelogs see: @@ -152,9 +152,9 @@ The RPM is generated from the source file using Alien.~{ http://www.kitenet.net/ sudo rpm -i [package name] -_* {~^ sisu-2.3.1-2.noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/sisu-2.3.1-2.noarch.rpm ~{ <br>created using alien }~ +_* {~^ sisu-2.3.2-2.noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/sisu-2.3.2-2.noarch.rpm ~{ <br>created using alien }~ -_* {~^ sisu-markup-samples_2.0.2.orig-2.noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/sisu-markup-samples_2.0.2.orig-2.noarch.rpm ~{ <br> http://www.jus.uio.no/sisu/archive/pool/non-free/s/sisu-markup-samples/sisu-markup-samples_2.0.2-1_all.deb <br> created using: alien -r sisu_0.70.5-1_all.deb }~ +_* {~^ sisu-markup-samples_2.0.3.orig-2.noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/sisu-markup-samples_2.0.3.orig-2.noarch.rpm ~{ <br> http://www.jus.uio.no/sisu/archive/pool/non-free/s/sisu-markup-samples/sisu-markup-samples_2.0.3-1_all.deb <br> created using: alien -r sisu_0.70.5-1_all.deb }~ For changelogs see: diff --git a/data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim b/data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim index dc962b3b..d2f2d94b 100644 --- a/data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim +++ b/data/sisu/v2/conf/editor-syntax-etc/vim/syntax/sisu.vim @@ -1,6 +1,6 @@ "SiSU Vim syntax file "SiSU Maintainer: Ralph Amissah <ralph@amissah.com> -"SiSU Markup: SiSU (sisu-2.0.2, 2010-04-26) +"SiSU Markup: SiSU (sisu-2.3.2, 2010-05-01) "(originally looked at Ruby Vim by Mirko Nasato) if version < 600 @@ -34,7 +34,7 @@ if !exists("sisu_no_identifiers") syn match sisu_sub_header_classify "^\s\+:\(topic_register\|coverage\|format\|identifier\|keywords\|relation\|subject\|type\|dewey\|loc\|oclc\|pg\|isbn\):\s" syn match sisu_sub_header_dates "^\s\+:\(added_to_site\|available\|created\|issued\|modified\|published\|valid\|translated\|original_publication\):\s" syn match sisu_sub_header_original "^\s\+:\(publisher\|date\|language\|language_char\|institution\|nationality\|source\):\s" - syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|italics\|bold\|skin\|stamp\|promo\|ad\|manpage\):\s" + syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|italics\|bold\|emphasis\|plaintext_wrap\|skin\|stamp\|promo\|ad\|manpage\):\s" syn match sisu_sub_header_notes "^\s\+:\(abstract\comment\|description\|history\|prefix\|prefix_[ab]\|suffix\):\s" syn match sisu_sem_marker ";{\|};[a-z._]*[a-z]" syn match sisu_sem_marker_block "\([a-z][a-z._]*\|\):{\|}:[a-z._]*[a-z]" diff --git a/lib/sisu/v2/cgi.rb b/lib/sisu/v2/cgi.rb index dbdc15e7..a375282f 100644 --- a/lib/sisu/v2/cgi.rb +++ b/lib/sisu/v2/cgi.rb @@ -74,8 +74,7 @@ module SiSU_CGI For help on setting up hyperestraier for sisu, type: sisu --help hyperestraier } - tell=SiSU_Screen::Ansi.new(@opt.cmd,a) - tell.print_grey + SiSU_Screen::Ansi.new(@opt.cmd,a).print_grey end def read SiSU_CGI_sqlite::SiSU_search_sqlite.new(@opt,@webserv).sqlite diff --git a/lib/sisu/v2/cgi_pgsql.rb b/lib/sisu/v2/cgi_pgsql.rb index 071e63e4..7a948366 100644 --- a/lib/sisu/v2/cgi_pgsql.rb +++ b/lib/sisu/v2/cgi_pgsql.rb @@ -99,8 +99,7 @@ module SiSU_CGI_pgsql a=%{ generated sisu_pgsql.cgi, BASED ON ALREADY EXISTING directories that could potentially be used to populate postgresql db, (-D) } - tell=SiSU_Screen::Ansi.new(@opt.cmd,a) - tell.print_grey + SiSU_Screen::Ansi.new(@opt.cmd,a).print_grey c=case @webserv when /pwd/; '' else "if necessary make the directory /usr/lib/cgi-bin : @@ -112,12 +111,10 @@ module SiSU_CGI_pgsql a=%{#{c} #{@env.webserv_base_cgi}/cgi-bin/sisu_pgsql.cgi } - tell=SiSU_Screen::Ansi.new(@opt.cmd,a) - tell.warn + SiSU_Screen::Ansi.new(@opt.cmd,a).warn a="postgresql db used for present directory: #{@db.psql.db}" b="\n\t(to create and populate postgresql database see 'man sisu' and in particular the -D flag)\n\t[the database to be used for this directory (#{@db.psql.db}) will have to be created manually if it does not exist,\n\tsee 'sisu --help sql'\n\tif you have permission to create databases:\n\t'sisu -d --createdb'\n\tor using postgresql tools directly:\n\t'createdb #{@db.psql.db}'\n\tfor a list of existing databases try 'psql --list']" - tell=SiSU_Screen::Ansi.new(@opt.cmd,a,b) - tell.txt_cyan + SiSU_Screen::Ansi.new(@opt.cmd,a,b).txt_cyan else puts 'failed in attempt to write sisu_pgsql.cgi to present directory, is directory writable?' end end diff --git a/lib/sisu/v2/cgi_sqlite.rb b/lib/sisu/v2/cgi_sqlite.rb index 860d7bed..5c20b072 100644 --- a/lib/sisu/v2/cgi_sqlite.rb +++ b/lib/sisu/v2/cgi_sqlite.rb @@ -100,8 +100,7 @@ module SiSU_CGI_sqlite a=%{ generated sisu_sqlite.cgi, BASED ON ALREADY CREATED sisu_sqlite.db OUTPUT, (-d) } - tell=SiSU_Screen::Ansi.new(@opt.cmd,a) - tell.print_grey + SiSU_Screen::Ansi.new(@opt.cmd,a).print_grey c=case @webserv when /pwd/; '' else "if necessary make the directory /usr/lib/cgi-bin : @@ -113,8 +112,7 @@ module SiSU_CGI_sqlite #{@env.webserv_base_cgi}/cgi-bin/sisu_sqlite.cgi } b='(to create and populate sisu sqlite database see "man sisu" and in particular the -d flag)' - tell=SiSU_Screen::Ansi.new(@opt.cmd,a,b) - tell.warn + SiSU_Screen::Ansi.new(@opt.cmd,a,b).warn else puts 'failed in attempt to write sisu_sqlite.cgi to present directory, is directory writable?' end end diff --git a/lib/sisu/v2/composite.rb b/lib/sisu/v2/composite.rb index 1a4df738..44518957 100644 --- a/lib/sisu/v2/composite.rb +++ b/lib/sisu/v2/composite.rb @@ -186,16 +186,14 @@ module SiSU_Assemble def insertions? data=@fns_array tuned_file,imagedir=[],[] - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Composite Document',@opt.fns) - tell.grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'Composite Document',@opt.fns).grey_title_hi unless @opt.cmd =~/q/ para=data.each do |para| if para =~/^<<\s+(\S+?\.ss[it])$/ \ or para =~/^<<\{(\S+?\.ss[it])\}$/ \ or para =~/^(?:<<\s*)\|(\S+?)\|@\|.+?\|(?:req(?:quire)?\b|\s*\})?/ \ or para =~/^r\{(.+?)\}/ #depreciated loadfile=$1.strip - tell=SiSU_Screen::Ansi.new(@opt.cmd,'loading:',loadfile) - tell.txt_grey if @opt.cmd =~/[MVv]/ + SiSU_Screen::Ansi.new(@opt.cmd,'loading:',loadfile).txt_grey if @opt.cmd =~/[MVv]/ tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[ti]$/ # and NetTest imagedir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.ss[ti]$/.match(loadfile).captures.join + '/_sisu/image' #watch require 'uri' diff --git a/lib/sisu/v2/concordance.rb b/lib/sisu/v2/concordance.rb index 74338e98..d8da2005 100644 --- a/lib/sisu/v2/concordance.rb +++ b/lib/sisu/v2/concordance.rb @@ -76,20 +76,21 @@ module SiSU_Concordance begin @env,@md=@particulars.env,@particulars.md loc=@env.url.output_tell - tool=(@md.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : '' - tell=SiSU_Screen::Ansi.new(@md.cmd,"Concordance",tool) - tell.grey_title_hi unless @md.cmd =~/q/ + unless @md.cmd =~/q/ + tool=(@md.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : @md.fns + @md.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@md.cmd,"Concordance",tool).grey_title_hi \ + : SiSU_Screen::Ansi.new(@md.cmd,'Concordance',tool).green_title_hi + end wordmax=@env.concord_max unless @md.wc_words.nil? if @md.wc_words < wordmax SiSU_Concordance::Source::Words.new(@particulars).songsheet else - tell=SiSU_Screen::Ansi.new(@md.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})") - tell.warn unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.cmd =~/q/ end else - tell=SiSU_Screen::Ansi.new(@md.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words") - tell.warn unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.cmd =~/q/ SiSU_Concordance::Source::Words.new(@particulars).songsheet end rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error @@ -331,8 +332,7 @@ WOK end credits=@vz.credits_sisu @file_concordance << %{</div><div class="content">#{credits}<div></body>\n</html>} # footer - tell=SiSU_Screen::Ansi.new(@md.cmd,@md.fns,"#{@env.path.output_tell}/#{@md.fn[:concordance]}") - tell.flow if @md.cmd =~/[MV]/ + SiSU_Screen::Ansi.new(@md.cmd,@md.fns,"#{@env.path.output_tell}/#{@md.fn[:concordance]}").flow if @md.cmd =~/[MV]/ end end end diff --git a/lib/sisu/v2/conf.rb b/lib/sisu/v2/conf.rb index bb586aca..f3f978db 100644 --- a/lib/sisu/v2/conf.rb +++ b/lib/sisu/v2/conf.rb @@ -95,36 +95,30 @@ module SiSU_Initialize @pwd,@home=Dir.pwd,@env.path.home end def make_homepage - tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Make homepage','') - tell.colorize unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'invert','Make homepage','').colorize unless @opt.cmd =~/q/ SiSU_Env::Create_site.new(@opt.cmd).homepage end def cp_local_images - tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy images','') - tell.colorize unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy images','').colorize unless @opt.cmd =~/q/ SiSU_Env::Create_site.new(@opt.cmd).cp_local_images SiSU_Env::Create_site.new(@opt.cmd).cp_webserver_images_local #this should not have been necessary SiSU_Env::Create_site.new(@opt.cmd).cp_base_images #base images (nav etc.) used by all html end def cp_external_images - tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy external images','') - tell.colorize if @opt.cmd =~/V/ + SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy external images','').colorize if @opt.cmd =~/V/ SiSU_Env::Create_site.new(@opt.cmd).cp_external_images end def cp_webserver_images - tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy webserver/output file images','') - tell.colorize unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy webserver/output file images','').colorize unless @opt.cmd =~/q/ SiSU_Env::Create_site.new(@opt.cmd).cp_webserver_images SiSU_Env::Create_system_link.new.images end def css - tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring CSSs','') - tell.colorize unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring CSSs','').colorize unless @opt.cmd =~/q/ SiSU_Env::Create_site.new(@opt.cmd).cp_css end def dtd - tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring DTDs','') - tell.colorize unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring DTDs','').colorize unless @opt.cmd =~/q/ @rxng=SiSU_relaxng::RelaxNG.new @path.each { |d| mkdir_p(d[1]) unless FileTest.directory?(d[1]) } #ugly code, sort later diff --git a/lib/sisu/v2/constants.rb b/lib/sisu/v2/constants.rb index 83914038..7fc3b056 100644 --- a/lib/sisu/v2/constants.rb +++ b/lib/sisu/v2/constants.rb @@ -114,6 +114,8 @@ Dx[:rel_o]='‹'; Dx[:rel_c]='›' Tex[:backslash]="\\\\" Tex[:backslash]="\\\\" Tex[:tilde]='\\\\\\~' +#Px[:emphasis_o]= '*'; Px[:emphasis_c]= '*' +#Px[:bold_o]= '!'; Px[:bold_c]= '!' Px[:bold_o]= '*'; Px[:bold_c]= '*' Px[:italics_o]= '/'; Px[:italics_c]= '/' Px[:underscore_o]= '_'; Px[:underscore_c]= '_' diff --git a/lib/sisu/v2/dal.rb b/lib/sisu/v2/dal.rb index b0a9df5d..fd09f64e 100644 --- a/lib/sisu/v2/dal.rb +++ b/lib/sisu/v2/dal.rb @@ -228,8 +228,7 @@ module SiSU_DAL dal=SiSU_DAL::Make.new(@md,file_array).song if @opt.cmd =~/[vM]/ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"~meta/#{@opt.fns}.meta").output if @opt.cmd =~/v/i - tell=SiSU_Screen::Ansi.new(@opt.cmd,"dal -> #{@make_fns.meta}") if @opt.cmd =~/M/ - tell.txt_grey unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,"dal -> #{@make_fns.meta}").txt_grey if @opt.cmd =~/M/ end dal.each{|s| dal_array << s} dal_array diff --git a/lib/sisu/v2/dal_doc_str.rb b/lib/sisu/v2/dal_doc_str.rb index dc9a55b7..46ae8d3c 100644 --- a/lib/sisu/v2/dal_doc_str.rb +++ b/lib/sisu/v2/dal_doc_str.rb @@ -728,7 +728,7 @@ module SiSU_document_structure_extract @dob end def structure_markup_normalize #needs a bit of thinking - dob=if @md.markup_version.to_f < 0.38 #%convert internal representation, consider making 0.38 structure default ([A-C1-6] instead of [1-9]), requires downstream changes + dob=if @md.markup_version.determined < 0.38 #%convert internal representation, consider making 0.38 structure default ([A-C1-6] instead of [1-9]), requires downstream changes @dob.gsub!(/^[456]~/,'!_') @dob.gsub!(/^3~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}") @dob.gsub!(/^3~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}") @@ -756,7 +756,7 @@ module SiSU_document_structure_extract end end def structure_marks - t_o=if @md.markup_version.to_f < 0.38 + t_o=if @md.markup_version.determined < 0.38 @t_o.gsub!(/^1~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}") @t_o.gsub!(/^1~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}") @t_o.gsub!(/^2~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}") diff --git a/lib/sisu/v2/dal_images.rb b/lib/sisu/v2/dal_images.rb index 1e474010..0b6d2b1e 100644 --- a/lib/sisu/v2/dal_images.rb +++ b/lib/sisu/v2/dal_images.rb @@ -76,8 +76,7 @@ module SiSU_images end else if @md.cmd =~/[vVM]/ - tell=SiSU_Screen::Ansi.new(@md.cmd,'use of RMagick is not enabled in sisurc.yml') - tell.warn + SiSU_Screen::Ansi.new(@md.cmd,'use of RMagick is not enabled in sisurc.yml').warn end end data.each do |dob| @@ -102,8 +101,7 @@ module SiSU_images img_col,img_row=img.columns,img.rows else if @md.cmd =~/[vVM]/ - tell=SiSU_Screen::Ansi.new(@md.cmd,'RMagick not present, will attempt to use imagemagick (identify) directly') - tell.warn + SiSU_Screen::Ansi.new(@md.cmd,'RMagick not present, will attempt to use imagemagick (identify) directly').warn end imgk=SiSU_Env::System_call.new.imagemagick gmgk=SiSU_Env::System_call.new.graphicksmagick @@ -140,8 +138,7 @@ module SiSU_images end else images=dob.obj.scan(m) do |image| - tell=SiSU_Screen::Ansi.new(@md.cmd,'where image dimensions have not been provided RMagick or imagemagick is required',image) - tell.warn #unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'where image dimensions have not been provided RMagick or imagemagick is required',image).warn #unless @opt.cmd =~/q/ end end end diff --git a/lib/sisu/v2/dal_numbering.rb b/lib/sisu/v2/dal_numbering.rb index ea68fd22..c8460ced 100644 --- a/lib/sisu/v2/dal_numbering.rb +++ b/lib/sisu/v2/dal_numbering.rb @@ -89,18 +89,20 @@ module SiSU_numbering @tuned_file=@tuned_file.flatten end def number_sub_heading(dob,num,title_no) - case dob.name - when /-/; dob.obj.gsub!(/^/,"#{title_no} ") - when /^#/; dob.obj.gsub!(/^/,"#{title_no} ") - when /^[a-z_\.]+/ - dob.obj.gsub!(/^/,"#{title_no} ") - else - dob.name=title_no if dob.name=~/^$/ #where title contains title number - dob.obj.gsub!(/^/,"#{title_no} ") if title_no =~/\d+/ #main, where title number is to be provided #watch changed placement - end - if @md.toc_lev_limit \ - and @md.toc_lev_limit < num - dob.obj.gsub!(/^/,'!_ ') #bold line, watch + unless dob.obj =~/\d+\.|(?:chapter|article|section|clause)\s+\d+/i #name selection arbitrary, fix + case dob.name + when /-/; dob.obj.gsub!(/^/,"#{title_no} ") + when /^#/; dob.obj.gsub!(/^/,"#{title_no} ") + when /^[a-z_\.]+/ + dob.obj.gsub!(/^/,"#{title_no} ") + else + dob.name=title_no if dob.name=~/^$/ #where title contains title number + dob.obj.gsub!(/^/,"#{title_no} ") if title_no =~/\d+/ #main, where title number is to be provided #watch changed placement + end + if @md.toc_lev_limit \ + and @md.toc_lev_limit < num + dob.obj.gsub!(/^/,'!_ ') #bold line, watch + end end dob end @@ -134,6 +136,7 @@ module SiSU_numbering end t_not=0 data.compact! + chapter_number_counter=0 data.each do |dob| #@md.seg_names << [additions to segment names] title_no=nil dob=SiSU_document_structure_extract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require @@ -141,6 +144,12 @@ module SiSU_numbering and dob.autonum_ \ and defined? @md.make.num_top \ and @md.make.num_top !~/^$/ + if dob.lv=='1' \ + and dob.obj =~/^#\s|\s#(?:\s|$)/ + chapter_number_counter +=1 + dob.obj.gsub!(/^#\s/,"#{chapter_number_counter} ") + dob.obj.gsub!(/#([:,]?\s|[.]?$)/,"#{chapter_number_counter}\\1") + end if dob.ln==no1 @subnumber=1 @subnumber=0 if dob.ln==no1 diff --git a/lib/sisu/v2/dal_substitutions_and_insertions.rb b/lib/sisu/v2/dal_substitutions_and_insertions.rb index c699a17c..e1326232 100644 --- a/lib/sisu/v2/dal_substitutions_and_insertions.rb +++ b/lib/sisu/v2/dal_substitutions_and_insertions.rb @@ -136,7 +136,7 @@ module SiSU_substitute_and_insert data_expand.compact! end data_expand.each do |para| - para=if @md.markup_version.to_f >= 0.38 + para=if @md.markup_version.determined >= 0.38 SiSU_document_structure_extract::Structure.new(@md,para).structure_markup_normalize else SiSU_document_structure_extract::Structure.new(@md,para).structure_marks diff --git a/lib/sisu/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb index b7b9ec4b..2b1da084 100644 --- a/lib/sisu/v2/dal_syntax.rb +++ b/lib/sisu/v2/dal_syntax.rb @@ -69,8 +69,28 @@ module SiSU_Syntax @data_new=[] url_and_stub=SiSU_Env::Info_env.new.url @output_url="#{url_and_stub.remote}" + @env=SiSU_Env::Info_env.new + emph_set=if defined? @md.make.emphasis \ + and not @md.make.emphasis.nil? + @md.make.emphasis + else @env.markup_emphasis + end + @emph=case emph_set + when /bold/ + emph_italics=false + {:o =>Mx[:fa_bold_o], :c =>Mx[:fa_bold_c] } + when /italics/ + emph_italics=true + {:o =>Mx[:fa_italics_o], :c =>Mx[:fa_italics_c] } + when /underscore/ + emph_italics=false + {:o =>Mx[:fa_underscore_o], :c =>Mx[:fa_underscore_c] } + else p __LINE__.to_s + '::' + __FILE__ + end @http_m=%r{\{.+?\}https?://\S+|https?:\S+|\.\.\/\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}} - @manmkp_ital='[i/]\\{.+?\\}[i/]' + @manmkp_ital=emph_italics \ + ? '[i/*]\\{.+?\\}[i/*]' \ + : '[i/]\\{.+?\\}[i/]' tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)} tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?} bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)} @@ -83,7 +103,9 @@ module SiSU_Syntax elsif defined? @vz.markup_make_italic[:str] /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/ end - @manmkp_bold='^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]' + @manmkp_bold=emph_italics \ + ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]' \ + : '^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]' @line_scan_bold=if (defined? @md.make.bold[:str] \ and @md.make.bold[:str]) \ and (defined? @vz.markup_make_bold[:str] \ @@ -332,14 +354,14 @@ module SiSU_Syntax %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}) end dob.obj.gsub!(/<:?p([nb])>/,"#{Mx[:fa_o]}p\\1#{Mx[:fa_c]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ') - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)!\{(.+?)\}!/, - "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)\*\{(.+?)\}\*/, + "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis + dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)!\{(.+?)\}!/, "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)_\{(.+?)\}_/, - "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[]|\(|\>)\/\{(.+?)\}\//, "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics + dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)_\{(.+?)\}_/, + "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/, "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote? dob.obj.gsub!(/(^|[^\\])\^\{(.+?)\}\^/, @@ -359,7 +381,7 @@ module SiSU_Syntax dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/, "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #deleted text dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/, - "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch + "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasise single word, watch dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/, "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([^a-zA-Z0-9]|[ ,.;:'"~$]|$)/, @@ -429,7 +451,7 @@ module SiSU_Syntax puts 'tech' @data.each do |line| line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/, - "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis + "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/, "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)u\{(.+?)\}u/, @@ -439,9 +461,9 @@ module SiSU_Syntax line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)i\{(.+?)\}i/, "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)!\{(.+?)\}!/, - "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis - line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)\*\{(.+?)\}\*/, "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)\*\{(.+?)\}\*/, + "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)_\{(.+?)\}_/, "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//, @@ -465,7 +487,7 @@ module SiSU_Syntax line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/, "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/, - "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch + "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasise single word, watch line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/, "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/, diff --git a/lib/sisu/v2/db_create.rb b/lib/sisu/v2/db_create.rb index f6c2e50f..2676542e 100644 --- a/lib/sisu/v2/db_create.rb +++ b/lib/sisu/v2/db_create.rb @@ -83,7 +83,7 @@ module SiSU_DB_create tell=(@sql_type=='sqlite') \ ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create Sqlite db tables in:',%{"#{@env.path.output}/sisu_sqlite.db"}) \ : SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create PG db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) - tell.colorize unless @opt.cmd =~/q/ + tell.colorize if @opt.cmd =~/vVM/ SiSU_Env::System_call.new.create_pg_db(@env.path.stub_pwd) if @sql_type=='pg' #watch use of path.stub_pwd instead of stub end def output_dir? diff --git a/lib/sisu/v2/db_import.rb b/lib/sisu/v2/db_import.rb index 0e2db8e3..3b5c1cc9 100644 --- a/lib/sisu/v2/db_import.rb +++ b/lib/sisu/v2/db_import.rb @@ -118,10 +118,8 @@ module SiSU_DB_import def marshal_load require "#{SiSU_lib}/dal" # dal.rb @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here - tell=SiSU_Screen::Ansi.new(@opt.cmd,"#{@db.psql.db}::#{@opt.fns}") - tell.puts_blue unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Marshal Load',@fnc) - tell.print_grey if @opt.cmd =~/v/ + SiSU_Screen::Ansi.new(@opt.cmd,"#{@db.psql.db}::#{@opt.fns}").puts_blue if @opt.cmd =~/vVM/ + SiSU_Screen::Ansi.new(@opt.cmd,'Marshal Load',@fnc).puts_grey if @opt.cmd =~/v/ select_first_match=%{ SELECT metadata_and_text.tid FROM metadata_and_text WHERE metadata_and_text.src_filename = '#{@opt.fns}'; } file_exist=@sql_type=~/sqlite/ \ ? @conn.get_first_value(select_first_match) \ @@ -198,7 +196,7 @@ module SiSU_DB_import def pf_db_import_transaction_close end def db_import_metadata #% import documents - populate database - print %{ #{@cX.grey}import documents dbi_unit #{@cX.off} } unless @opt.cmd =~/q/ + print %{ #{@cX.grey}import documents dbi_unit #{@cX.off} } if @opt.cmd =~/vVM/ @tp={} @md=SiSU_Param::Parameters.new(@opt).get #% sisutxt & fulltxt @@ -230,7 +228,7 @@ module SiSU_DB_import end @@id_t =0 if @col[:lid].nil? or @col[:lid].to_s.empty? @@id_t+=1 #bug related, needs to be performed once at start of file, but consider moving, as, placed here it means program will fail if document header lacks @title: - puts %{\n#{@cX.grey}Processing file number#{@cX.off}: #{@cX.green}#{@@id_t}#{@@cX.off}} unless @opt.cmd =~/q/ + puts %{\n#{@cX.grey}Processing file number#{@cX.off}: #{@cX.green}#{@@id_t}#{@@cX.off}} if @opt.cmd =~/vVM/ end ################ CLEAR ############## SiSU_DB_DBI::Test.new(self,@opt).verify #% import title names, filenames (tuple) diff --git a/lib/sisu/v2/db_remove.rb b/lib/sisu/v2/db_remove.rb index 5a7f1244..364f5fc7 100644 --- a/lib/sisu/v2/db_remove.rb +++ b/lib/sisu/v2/db_remove.rb @@ -101,8 +101,7 @@ module SiSU_DB_remove @file.puts sql_entry if @opt.cmd =~/M/ end else - tell=SiSU_Screen::Ansi.new(@opt.cmd,"no such file in database #{@db.psql.db}::#{@opt.fns}") - tell.puts_grey unless @opt.cmd =~/q/ #if @opt.cmd.include? ?v + SiSU_Screen::Ansi.new(@opt.cmd,"no such file in database #{@db.psql.db}::#{@opt.fns}").puts_grey if @opt.cmd =~/vVM/ end end end diff --git a/lib/sisu/v2/db_select.rb b/lib/sisu/v2/db_select.rb index 87452c5c..04d12acb 100644 --- a/lib/sisu/v2/db_select.rb +++ b/lib/sisu/v2/db_select.rb @@ -173,8 +173,7 @@ module SiSU_DB_select db_exist? @sdb_remove_doc.remove @sdb_import.marshal_load - tell=SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?") - tell.puts_grey if @opt.cmd =~/v/ + SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?").puts_grey if @opt.cmd =~/v/ when /^--remove$/ db_exist? @sdb_remove_doc.remove diff --git a/lib/sisu/v2/db_sqltxt.rb b/lib/sisu/v2/db_sqltxt.rb index 17a92683..e1fbed29 100644 --- a/lib/sisu/v2/db_sqltxt.rb +++ b/lib/sisu/v2/db_sqltxt.rb @@ -83,16 +83,14 @@ module SiSU_DB_text and not @md.creator.author.empty? s.gsub!(/@author/,@md.creator.author) else - tell=SiSU_Screen::Ansi.new('v','WARNING Document Author information missing; provide @creator: :author:',@md.fnb) - tell.warn unless @md.cmd.inspect =~/q/ + SiSU_Screen::Ansi.new('v','WARNING Document Author information missing; provide @creator: :author:',@md.fnb).warn unless @md.cmd.inspect =~/q/ end if defined? @md.title \ and defined? @md.title.full \ and not @md.title.full.empty? s.gsub!(/@title/,@md.title.full) else - tell=SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:',@md.fnb) - tell.warn unless @md.cmd.inspect =~/q/ + SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:',@md.fnb).warn unless @md.cmd.inspect =~/q/ end end s.gsub!(/^(?:_[1-9]\*?|_\*)\s+/m,'') diff --git a/lib/sisu/v2/dbi.rb b/lib/sisu/v2/dbi.rb index 7da0ae69..191d5099 100644 --- a/lib/sisu/v2/dbi.rb +++ b/lib/sisu/v2/dbi.rb @@ -126,8 +126,7 @@ module SiSU_DBI when /pg/; read_psql when /sqlite/; read_sqlite end - tell=SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#{@sql_type}) #{@opt.mod}") - tell.dbi_title unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#{@sql_type}) #{@opt.mod}",@opt.fns).dbi_title unless @opt.cmd =~/q/ begin SiSU_DB_DBI::Case.new(@opt,@conn,@sql_type).cases rescue diff --git a/lib/sisu/v2/digests.rb b/lib/sisu/v2/digests.rb index 59893aee..12052631 100644 --- a/lib/sisu/v2/digests.rb +++ b/lib/sisu/v2/digests.rb @@ -74,13 +74,15 @@ module SiSU_Digest_view def read begin @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array - tool=if @opt.cmd =~/[MVv]/; "#{@env.program.text_editor} #{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}" - else '' + unless @opt.cmd =~/q/ + tool=(@opt.cmd =~/[MVv]/) \ + ? "#{@env.program.text_editor} #{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}" \ + : @opt.fns + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,"Document #{@dg} Digests",tool).green_hi_blue \ + : SiSU_Screen::Ansi.new(@opt.cmd,"Document #{@dg} Digests",tool).green_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}").flow if @opt.cmd =~/[MV]/ end - tell=SiSU_Screen::Ansi.new(@opt.cmd,"Document #{@dg} Digests",tool) - tell.green_hi_blue unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}") - tell.flow if @opt.cmd =~/[MV]/ my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) SiSU_Digest_view::Source::Scroll.new(@particulars).songsheet SiSU_Env::Info_skin.new(@md).select @@ -196,8 +198,7 @@ module SiSU_Digest_view elsif FileTest.file?("#{@env.path.image_source_tex}/#{i}") @env.path.image_source_tex else - tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_local_tex}, #{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}") - tell.error2 unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_local_tex}, #{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}").error2 unless @md.cmd =~/q/ nil end @img << /\S+\.(png|jpg|gif)/.match(i)[1] diff --git a/lib/sisu/v2/epub.rb b/lib/sisu/v2/epub.rb index e6ab1e12..fa8b61ab 100644 --- a/lib/sisu/v2/epub.rb +++ b/lib/sisu/v2/epub.rb @@ -84,12 +84,16 @@ module SiSU_EPUB @fnb=@md.fnb @env=@particulars.env loc=@env.path.url.output_tell - tool=if @opt.cmd =~/z/; "#{@env.program.epub_viewer} #{loc}/epub/#{@fnb}.epub" - elsif @opt.cmd =~/[MVv]/; "#{@env.program.epub_viewer} #{loc}/epub/#{@fnb}.epub" - else '' + unless @opt.cmd =~/q/ + tool=if @opt.cmd =~/z/; "#{@env.program.epub_viewer} #{loc}/epub/#{@fnb}.epub" + elsif @opt.cmd =~/[MVv]/; "#{@env.program.epub_viewer} #{loc}/epub/#{@fnb}.epub" + else @opt.fns + end + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_hi_blue \ + : SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{loc}/epub/#{@fnb}.epub").flow if @opt.cmd =~/[MV]/ end - SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_hi_blue unless @opt.cmd =~/q/ - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{loc}/epub/#{@fnb}.epub").flow if @opt.cmd =~/[MV]/ @env.path.epub_bld #(@md) @env.path.epub_cp_images(@md) dir_epub=@env.path.epub @@ -195,7 +199,7 @@ module SiSU_EPUB @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md end def songsheet #extracts toc for scroll & seg - SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey if @md.cmd =~/[MVv]/ toc=nil @@firstseg=nil @@toc={ :seg=>[],:seg_mini=>[],:scr=>[],:ncx=>[],:opf=>[] } @@ -491,7 +495,7 @@ module SiSU_EPUB def in_common toc_shared=[] segtoc=[] - SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey if @md.cmd =~/[MVv]/ format_head_toc=SiSU_EPUB_Format::Head_toc.new(@md) dochead=format_head_toc.head dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge diff --git a/lib/sisu/v2/epub_concordance.rb b/lib/sisu/v2/epub_concordance.rb index f90acf12..301d34a2 100644 --- a/lib/sisu/v2/epub_concordance.rb +++ b/lib/sisu/v2/epub_concordance.rb @@ -76,19 +76,16 @@ module SiSU_EPUB_Concordance @env,@md=@particulars.env,@particulars.md loc=@env.url.output_tell tool=((@md.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : '') - tell=SiSU_Screen::Ansi.new(@md.cmd,"Concordance",tool) - tell.grey_title_hi unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"Concordance",tool).grey_title_hi unless @md.cmd =~/q/ wordmax=@env.concord_max unless @md.wc_words.nil? if @md.wc_words < wordmax SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet else - tell=SiSU_Screen::Ansi.new(@md.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})") - tell.warn unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.cmd =~/q/ end else - tell=SiSU_Screen::Ansi.new(@md.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words") - tell.warn unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.cmd =~/q/ SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet end rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error diff --git a/lib/sisu/v2/epub_segments.rb b/lib/sisu/v2/epub_segments.rb index 5f0b74d3..35edf971 100644 --- a/lib/sisu/v2/epub_segments.rb +++ b/lib/sisu/v2/epub_segments.rb @@ -178,8 +178,7 @@ WOK @@seg_name_xhtml=@@seg_name @@seg_total=@@seg_name.length testforartnum=@@seg_name_xhtml - tell=SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length) - tell.segmented unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length) if @md.cmd =~/[MVv]/ map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags data.each do |dob| if defined? dob.obj \ diff --git a/lib/sisu/v2/epub_tune.rb b/lib/sisu/v2/epub_tune.rb index 25621bdd..d49ac3c1 100644 --- a/lib/sisu/v2/epub_tune.rb +++ b/lib/sisu/v2/epub_tune.rb @@ -208,8 +208,7 @@ module SiSU_EPUB_Tune def songsheet begin @cX=SiSU_Screen::Ansi.new(@md.cmd).cX - tell=SiSU_Screen::Ansi.new(@md.cmd,'Tune') - tell.txt_grey unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Tune').txt_grey if @md.cmd =~/[MVv]/ data=Tune.new(@data,@md).amp_html data=Tune.new(data,@md).endnotes_html data=Tune.new(data,@md).url_markup diff --git a/lib/sisu/v2/help.rb b/lib/sisu/v2/help.rb index 38f0a782..e8698fd0 100644 --- a/lib/sisu/v2/help.rb +++ b/lib/sisu/v2/help.rb @@ -911,8 +911,7 @@ WOK version=SiSU_Env::Info_version.instance.get_version rb_ver=SiSU_Env::Info_version.instance.rbversion if version[:version] - tell=SiSU_Screen::Ansi.new('-v',version[:project],version[:version],version[:date_stamp],version[:date],rb_ver) - tell.version + SiSU_Screen::Ansi.new('-v',version[:project],version[:version],version[:date_stamp],version[:date],rb_ver).version else puts 'SiSU version information not available' end end diff --git a/lib/sisu/v2/html.rb b/lib/sisu/v2/html.rb index 834eefa1..309297df 100644 --- a/lib/sisu/v2/html.rb +++ b/lib/sisu/v2/html.rb @@ -86,12 +86,16 @@ module SiSU_HTML @fnb=@md.fnb @env=@particulars.env loc=@env.url.output_tell - tool=if @opt.cmd =~/z/; "#{@env.program.web_browser} #{loc}/#{@fnb}/#{@md.fn[:index]}" - elsif @opt.cmd =~/[MVv]/; "#{@env.program.web_browser} #{loc}/#{@fnb}/#{@md.fn[:index]}" - else '' + unless @opt.cmd =~/q/ + tool=if @opt.cmd =~/z/; "#{@env.program.web_browser} #{loc}/#{@fnb}/#{@md.fn[:index]}" + elsif @opt.cmd =~/[MVv]/; "#{@env.program.web_browser} #{loc}/#{@fnb}/#{@md.fn[:index]}" + else @opt.fns + end + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_hi_blue \ + : SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@fnb}/#{@md.fn[:index]}").flow if @opt.cmd =~/[MV]/ end - SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_hi_blue unless @opt.cmd =~/q/ - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@fnb}/#{@md.fn[:index]}").flow if @opt.cmd =~/[MV]/ SiSU_Env::Info_skin.new(@md).select data=nil my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns,@md) #Beware #FIX opt and md, both not necessary @@ -226,7 +230,7 @@ module SiSU_HTML @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md end def songsheet #extracts toc for scroll & seg - SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey if @md.cmd =~/[MVv]/ toc=nil @@firstseg=nil @@toc={ :seg=>[],:seg_mini=>[],:scr=>[] } @@ -503,7 +507,7 @@ WOK def in_common toc_shared=[] @segtoc=[] - SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey if @md.cmd =~/[MVv]/ format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) dochead=format_head_toc.head dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge diff --git a/lib/sisu/v2/html_minitoc.rb b/lib/sisu/v2/html_minitoc.rb index 6c3733d7..00b6e384 100644 --- a/lib/sisu/v2/html_minitoc.rb +++ b/lib/sisu/v2/html_minitoc.rb @@ -70,7 +70,7 @@ @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md end def songsheet - SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey if @md.cmd =~/[MVv]/ toc=nil @toc=[] @data.each do |txt| diff --git a/lib/sisu/v2/html_promo.rb b/lib/sisu/v2/html_promo.rb index df13393e..92ea15ec 100644 --- a/lib/sisu/v2/html_promo.rb +++ b/lib/sisu/v2/html_promo.rb @@ -405,8 +405,7 @@ WOK end end else - tell=SiSU_Screen::Ansi.new(@md.cmd,"category not found: #{category}") - tell.warn unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"category not found: #{category}").warn unless @md.cmd =~/q/ end adverts.join end diff --git a/lib/sisu/v2/html_segments.rb b/lib/sisu/v2/html_segments.rb index 022a1d0c..83f9c5c9 100644 --- a/lib/sisu/v2/html_segments.rb +++ b/lib/sisu/v2/html_segments.rb @@ -162,8 +162,7 @@ module SiSU_HTML_seg @@seg_name_html=@@seg_name @@seg_total=@@seg_name.length testforartnum=@@seg_name_html - tell=SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length) - tell.segmented unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length).segmented if @md.cmd =~/[MVv]/ map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags data.each do |dob| if defined? dob.obj \ diff --git a/lib/sisu/v2/html_tune.rb b/lib/sisu/v2/html_tune.rb index 5f9f981c..c0efb72e 100644 --- a/lib/sisu/v2/html_tune.rb +++ b/lib/sisu/v2/html_tune.rb @@ -205,8 +205,7 @@ module SiSU_HTML_Tune def songsheet begin @cX=SiSU_Screen::Ansi.new(@md.cmd).cX - tell=SiSU_Screen::Ansi.new(@md.cmd,'Tune') - tell.txt_grey unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Tune').txt_grey if @md.cmd =~/[MVv]/ data=Tune.new(@data,@md).endnotes_html data=Tune.new(data,@md).url_markup data=Tune.new(data,@md).markup diff --git a/lib/sisu/v2/hub.rb b/lib/sisu/v2/hub.rb index 58f62d0f..bab13ed1 100644 --- a/lib/sisu/v2/hub.rb +++ b/lib/sisu/v2/hub.rb @@ -95,8 +95,7 @@ module SiSU if fns =~ /sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip|\.ssp)$/ require "#{SiSU_lib}/remote" # remote.rb #check pod_name=SiSU_Remote::Remote_download.new(fns).pod.name - tell=SiSU_Screen::Ansi.new(@opt.cmd,pod_name) - tell.puts_blue unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,pod_name).puts_blue unless @opt.cmd =~/q/ @opt.files.shift pod_output(pod_name) break @@ -152,8 +151,7 @@ module SiSU when /^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d end @n_do=@n_do+1 - tell=SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed") - tell.files_processed unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/ ObjectSpace.garbage_collect else #print "not processed --> ", fns, "\n" end @@ -172,8 +170,7 @@ module SiSU end end @n_do=@n_do+1 - tell=SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed") - tell.files_processed unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/ end else Operations.new(@opt).not_found end @@ -225,8 +222,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ def termsheet # -t system("sisu_termsheet #{@opt.cmd} #{@opt.fns}\n") @@n_do=@@n_do+1 - tell=SiSU_Screen::Ansi.new(@opt.cmd,@@n_do,'Termsheet(s) processed') - tell.term_sheet_title unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,@@n_do,'Termsheet(s) processed').term_sheet_title unless @opt.cmd =~/q/ end def webrick # -W port=prt=@fns @@ -488,7 +484,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end else end - if @opt.cmd =~/[QuUvVM]/; op('urls','urls') #% -Q -u -v -V -M urls + unless @opt.cmd =~/[q]/; op('urls','urls') #% unless -q end @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty? diff --git a/lib/sisu/v2/manifest.rb b/lib/sisu/v2/manifest.rb index 85881263..c8dd3753 100644 --- a/lib/sisu/v2/manifest.rb +++ b/lib/sisu/v2/manifest.rb @@ -83,11 +83,13 @@ module SiSU_Manifest xbrowser=@env.program.web_browser browser=@env.program.console_web_browser webserv_url=@env.path.url.output_tell - url_html="#{webserv_url}/#{@md.fnb}/#{@md.fn[:manifest]}" - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}") - tell.green_hi_blue unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}") - tell.grey_tab if @opt.cmd =~/v/i + unless @opt.cmd =~/q/ + url_html="#{webserv_url}/#{@md.fnb}/#{@md.fn[:manifest]}" + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}").green_hi_blue \ + : SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',@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 @@ -134,8 +136,7 @@ module SiSU_Manifest dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{@base_path_src}/#{file}") else sys.md5("#{@base_path_src}/#{file}") end - tell=SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}") - tell.warn if @md.cmd =~/[vVM]/ + SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}").warn if @md.cmd =~/[vVM]/ size=(File.size("#{@base_path_src}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] << "#{file} #{id} #{kb}\n" @@ -147,8 +148,7 @@ module SiSU_Manifest dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{@base_path_pod}/#{file}") else sys.md5("#{@base_path_pod}/#{file}") end - tell=SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}") - tell.warn if @md.cmd =~/[vVM]/ + SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}").warn if @md.cmd =~/[vVM]/ size=(File.size("#{@base_path_pod}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] << "#{file} #{id} #{kb}\n" @@ -196,7 +196,7 @@ module SiSU_Manifest summarize(id,file,img) end if FileTest.file?("#{@base_path}/#{@md.fn[:book_index]}")==true - id,file='HTML, index',@md.fn[:book_index] + id,file='HTML, (book type) index',@md.fn[:book_index] summarize(id,file) end if FileTest.file?("#{@base_path}/#{@md.fn[:concordance]}")==true diff --git a/lib/sisu/v2/manpage.rb b/lib/sisu/v2/manpage.rb index 89e0e3d7..48b22fd3 100644 --- a/lib/sisu/v2/manpage.rb +++ b/lib/sisu/v2/manpage.rb @@ -83,13 +83,11 @@ module SiSU_Manpage @md=SiSU_Param::Parameters.new(@opt).get @env=SiSU_Env::Info_env.new(@opt.fns) path=@env.path.output_tell - tool=if @opt.cmd =~/[MVv]/; "#{@env.program.text_editor} #{path}/man/#{@md.fn[:manpage]}" - else '' - end - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Manpage',tool) - tell.green_hi_blue unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/man/#{@md.fn[:manpage]}") - tell.flow if @opt.cmd =~/[MV]/ + tool=(@opt.cmd =~/[MVv]/) \ + ? "#{@env.program.text_editor} #{path}/man/#{@md.fn[:manpage]}" \ + : '' + SiSU_Screen::Ansi.new(@opt.cmd,'Manpage',tool).green_hi_blue unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/man/#{@md.fn[:manpage]}").flow if @opt.cmd =~/[MV]/ my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here SiSU_Manpage::Source::Scroll.new(@md,@dal_array).songsheet diff --git a/lib/sisu/v2/odf.rb b/lib/sisu/v2/odf.rb index d4aeb616..dc8c90a8 100644 --- a/lib/sisu/v2/odf.rb +++ b/lib/sisu/v2/odf.rb @@ -84,13 +84,15 @@ module SiSU_ODF @env.odf_structure opendoc=@md.fn[:odf] path=@env.path.output_tell - tool=if @opt.cmd =~/[MVv]/; "#{@env.program.odf_viewer} #{path}/#{@md.fnb}/#{opendoc}" - else '' + unless @opt.cmd =~/q/ + tool=(@opt.cmd =~/[MVv]/) \ + ? "#{@env.program.odf_viewer} #{path}/#{@md.fnb}/#{opendoc}" \ + : @opt.fns + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool).green_hi_blue \ + : SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool).green_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{opendoc}").flow if @opt.cmd =~/[MV]/ end - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool) - tell.green_hi_blue unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{opendoc}") - tell.flow if @opt.cmd =~/[MV]/ my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) SiSU_ODF::Source::Scroll.new(@particulars).songsheet SiSU_Env::Info_skin.new(@md).select @@ -186,8 +188,7 @@ module SiSU_ODF elsif FileTest.file?("#{@env.path.image_source_tex}/#{i}") @env.path.image_source_tex else - tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_local_tex},#{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}") - tell.error2 unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_local_tex},#{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}").error2 unless @md.cmd =~/q/ nil end end diff --git a/lib/sisu/v2/options.rb b/lib/sisu/v2/options.rb index ddb0555e..77e56a47 100644 --- a/lib/sisu/v2/options.rb +++ b/lib/sisu/v2/options.rb @@ -149,8 +149,7 @@ module SiSU_commandline and @mod.length==0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default @cmd=shortcut.cf_0 end - tell=SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n") - tell.print_brown if @cmd =~/[vVM]/ + SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/ @files.uniq! end def cmd diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb index a59ac8ff..3db97340 100644 --- a/lib/sisu/v2/param.rb +++ b/lib/sisu/v2/param.rb @@ -106,8 +106,7 @@ module SiSU_Param @md end if defined? @md.title.main # on removal check problems with -U - tell=SiSU_Screen::Ansi.new(@cmd,param_msg,@md.title.main) - tell.txt_grey if @cmd =~/[MVv]/ + SiSU_Screen::Ansi.new(@cmd,param_msg,@md.title.main).txt_grey if @cmd =~/[MVv]/ end @@md=@md else @@md @@ -162,8 +161,7 @@ module SiSU_Param puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}" s else - tell=SiSU_Screen::Ansi.new('v',"#{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns) - tell.warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new('v',"#{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.cmd =~/q/ nil end end @@ -391,8 +389,7 @@ module SiSU_Param elsif @h['main'] @h['main'] else - tell=SiSU_Screen::Ansi.new(@cmd,'WARNING Document Copyright missing; provide @rights: :copyright:') - tell.warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@cmd,'WARNING Document Copyright missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/ '' end l,n=Db[:col_info_note],'rights.copyright.text' @@ -459,8 +456,7 @@ module SiSU_Param s +=' License: ' + copyright.license end if s.empty? - tell=SiSU_Screen::Ansi.new(@cmd,'WARNING Document Rights information missing; provide @rights: :copyright:') - tell.warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@cmd,'WARNING Document Rights information missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/ else l,n=Db[:col_info_note],'rights.all' validate_length(s,l,n) @@ -657,6 +653,21 @@ module SiSU_Param y=((x =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) { :str =>'\b(?:' + m + ')\b', :regx => y } end + def emphasis + if @h['emphasis'] =~/bold/; 'bold' + elsif @h['emphasis'] =~/italics?/; 'italics' + elsif @h['emphasis'] =~/under(?:line|score)/; 'underscore' + else nil + end + end + def plaintext_wrap + if @h['plaintext_wrap'].to_s =~/\d\d+/ \ + and @h['plaintext_wrap'].to_i > 19 \ + and @h['plaintext_wrap'].to_i < 201 + @h['plaintext_wrap'].to_i + else nil + end + end def skin @h['skin'] end @@ -857,16 +868,16 @@ module SiSU_Param fns_array=@data.dup skip unless fns_array # consider @markup_version=SiSU_Markup_type::Markup_identify.new(fns_array,@opt).markup_version? #% determine markup version - if fns_array[0] =~ /^(?:% )?(?:SiSU\s+(?:master\s+)?[\d.]*|sisu-[\d.]+)$/ #check markup and markup version - if fns_array[0] =~ /^(?:% )?(?:SiSU\s+(?:master\s+)?|sisu-)[\d.]+$/ #check markup and markup version - @markup_version_declared=fns_array[0].match(/^(?:% )?(?:SiSU\s+(?:master\s+)?|sisu-)([\d.]+)$/)[1] - sm_a,sm_b,sm_c=fns_array[0].match(/^(?:% )?(?:SiSU\s+(?:master\s+)?|sisu-)([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?$/)[1..3] + if fns_array[0] =~ /^(?:%\s+)?(?:SiSU\s+(?:master\s+)?[\d.]*|sisu-[\d.]+)$/ #check markup and markup version + if fns_array[0] =~ /^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)[\d.]+$/ #check markup and markup version + @markup_version_declared=fns_array[0].match(/^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)([\d.]+)$/)[1] + sm_a,sm_b,sm_c=fns_array[0].match(/^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?$/)[1..3] sm_c ||=0 sv=(@cmd =~/[VMv]/) ? ("SiSU version (#{@sisu_version[:version]})") : '' s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\-\S+)?$/)[1..3] - tell=(@markup_version_declared.to_f==@markup_version.to_f) \ - ? SiSU_Screen::Ansi.new(@cmd,"Markup version (#{@markup_version})",sv) \ - : SiSU_Screen::Ansi.new(@cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version})",sv) + tell=(@markup_version_declared.to_f==@markup_version.determined) \ + ? SiSU_Screen::Ansi.new(@cmd,"Markup version (#{@markup_version.series} version #{@markup_version.determined})",sv) \ + : SiSU_Screen::Ansi.new(@cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version.series} version #{@markup_version.determined})",sv) ok=if s_a.to_i > sm_a.to_i true elsif s_a.to_i == sm_a.to_i \ @@ -881,16 +892,18 @@ module SiSU_Param if ok tell.txt_green if @cmd =~/[vVM]/ else - tell=SiSU_Screen::Ansi.new(@cmd,"Warning: markup version determined (#{@markup_version}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})") - tell.warn unless @cmd =~/q/ + SiSU_Screen::Ansi.new(@cmd,"Warning: markup version determined (#{@markup_version.determined}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})").warn unless @cmd =~/q/ end else - tell=SiSU_Screen::Ansi.new(@cmd,'No SiSU markup version provided') - tell.warn if @cmd =~/[VM]/ + SiSU_Screen::Ansi.new(@cmd,'No SiSU markup version provided').warn if @cmd =~/[VM]/ end else - tell=SiSU_Screen::Ansi.new(@cmd,'SiSU filetype indicator not provided') - tell.warn unless @cmd =~/q/ + mv=if defined? @markup_version.determined and not @markup_version.determined.nil? + x=@markup_version.determined + "markup version determined #{x}" + else '' + end + SiSU_Screen::Ansi.new(@cmd,'SiSU filetype indicator not provided',mv).warn unless @cmd =~/q/ end @code_flag=false fns_array.each do |para| #% Scan document @@ -1004,19 +1017,18 @@ module SiSU_Param if para=~/^:?A~/ if @markup.nil? \ or @markup.empty? - @markup=@markup_version.to_s - elsif @markup !~/0\.38/; @markup=@markup.strip + "; #{@markup_version}" + @markup=@markup_version.determined.to_s + elsif @markup !~/0\.38/; @markup=@markup.strip + "; #{@markup_version.determined}" end end - if (para=~/^:?A~/ and @markup_version >= 0.38) \ - or (para=~/^1~/ and @markup_version < 0.38) + if (para=~/^:?A~/ and @markup_version.determined >= 0.38) \ + or (para=~/^1~/ and @markup_version.determined < 0.38) if @title.nil? @title=para[/^:?[A1]~\S*(.+)$/m,1] @html_title=@title.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'') @title.chomp!("\n") @html_title.chomp!("\n") - tell=SiSU_Screen::Ansi.new(@cmd,'Parameters',@html_title) - tell.txt_grey if @cmd =~/v/ + SiSU_Screen::Ansi.new(@cmd,'Parameters',@html_title).txt_grey if @cmd =~/v/ end end end @@ -1117,7 +1129,7 @@ module SiSU_Param end @topic_register_array.sort! end - if @markup_version.to_f >= 0.38 #convert values in headers to internal representation + if @markup_version.determined >= 0.38 #convert values in headers to internal representation translated=[] translate_list=[@pagenew,@pagebreak,@num_top,@toc_lev_limit] translate_list.each do |t| @@ -1193,8 +1205,7 @@ module SiSU_Param if @en[:note] > 0 \ and @en[:sum] > 0 if @en[:sum] > 0 - else tell=SiSU_Screen::Ansi.new(@cmd,'both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}") - tell.warn if @cmd !~/q/ + else SiSU_Screen::Ansi.new(@cmd,'both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn if @cmd !~/q/ end end if @en[:mark] != @en[:note] \ @@ -1205,12 +1216,10 @@ module SiSU_Param footnote_conversion_errors << "#{@fns}:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})\n" end if @title.main !~/[\S]/ - tell=SiSU_Screen::Ansi.new(@cmd,'WARNING Document Title missing','please provide @title:') - tell.warn unless @cmd =~/q/ + SiSU_Screen::Ansi.new(@cmd,'WARNING Document Title missing','please provide @title:').warn unless @cmd =~/q/ end if @author !~/[\S]/ - tell=SiSU_Screen::Ansi.new(@cmd,'Warning Document Author missing','please provide @creator: :author:') - tell.warn unless @cmd =~/q/ + SiSU_Screen::Ansi.new(@cmd,'Warning Document Author missing','please provide @creator: :author:').warn unless @cmd =~/q/ end # Elementary Document Structure Analysis - adds complexity may remove - need to develop - appears to work, proof of concept if @title.nil? @@ -1224,10 +1233,8 @@ module SiSU_Param @title.chomp!("\n") @html_title.chomp!("\n") title_trigger=1 - tell=SiSU_Screen::Ansi.new(@cmd,@html_title) - tell.txt_cyan unless @cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@cmd,'Parameters') - tell.txt_grey unless @cmd =~/q/ + SiSU_Screen::Ansi.new(@cmd,@html_title).txt_cyan unless @cmd =~/q/ + SiSU_Screen::Ansi.new(@cmd,'Parameters').txt_grey unless @cmd =~/q/ end end end @@ -1295,8 +1302,7 @@ module SiSU_Param @lv5 ||=/^5~/ @lv6 ||=/^6~/ if @doc_skin - tell=SiSU_Screen::Ansi.new(@cmd,"doc_skin <- #{@doc_skin}") - tell.txt_grey if @cmd =~/v/ + SiSU_Screen::Ansi.new(@cmd,"doc_skin <- #{@doc_skin}").txt_grey if @cmd =~/v/ end @data=nil #else whole file's contents are stored in md pstore & is not required to be... big waste actually Store.new(self,@env).store #% pstore @@ -1310,8 +1316,7 @@ module SiSU_Param end def store File.unlink(@pstorefile) if FileTest.file?(@pstorefile) - tell=SiSU_Screen::Ansi.new(@md.cmd,"PStore -> #{@pstorefile}") - tell.txt_grey if @md.cmd =~/[MV]/ + SiSU_Screen::Ansi.new(@md.cmd,"PStore -> #{@pstorefile}").txt_grey if @md.cmd =~/[MV]/ store=PStore.new(@pstorefile) store.transaction do store['md']=@md diff --git a/lib/sisu/v2/param_identify_markup.rb b/lib/sisu/v2/param_identify_markup.rb index 0f0f40a0..97b6d888 100644 --- a/lib/sisu/v2/param_identify_markup.rb +++ b/lib/sisu/v2/param_identify_markup.rb @@ -60,85 +60,108 @@ =end module SiSU_Markup_type class Markup_identify - @@fns,@@version_determined,@@version_declared,@@declared_doc_type='','','','[text?]' - attr_accessor :version_determined,:version_declared,:declared_doc_type + @@version={} + @@fns,@@version[:determined],@@version[:declared],@@declared_doc_type='','','','[text?]' + attr_accessor :version,:declared_doc_type def initialize(content,opt) @cont,@opt=content,opt end def identify - @version_determined,@version_declared,@declared_doc_type=@@version_determined,@@version_declared,@@declared_doc_type + @version,@declared_doc_type=@@version,@@declared_doc_type if @opt.fns != @@fns if @cont[0] =~ /^(?:%\s+)?SiSU\s+(text|master|insert)\s+([0-9](?:\.[0-9]+){1,2})/ \ or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ - @declared_doc_type,@version_declared=$1,$2 + @declared_doc_type,@version[:declared]=$1,$2 elsif @cont[0] =~ /^(?:%\s+)?SiSU\s+([0-9](?:\.[0-9]+){1,2})/ \ or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ - @version_declared=$1 + @version[:declared]=$1 end - @flag_66,@flag_57,@flag_38=false,false,false + @flag_2_0,@flag_66,@flag_57,@flag_38=false,false,false,false @cont.each_with_index do |y,i| if y =~/^(?:0\{?~links?|@links?:)\s/ links=unless y =~/\{.+?\}\S+/; oldlinks=' (pre 0.20.4 header links)' else ' (post 0.20.4 header links)' end end + if y =~/^@make:|^@classify|^\s\s?:\S+?:\s+\S/ + version=2.0.to_f + @version[:determined]=version + @flag_2_0=true + break + end unless @flag_38 if y =~/^:?A~/ - version=0.38 - @version_determined=version + version=0.38.to_f + @version[:determined]=version @flag_38=true end end if @flag_38 if @flag_69 \ or y =~/^=\{.+?\}\s*$/ - version=0.69 + version=0.69.to_f @flag_69=true - @version_determined=version + @version[:determined]=version break end if @flag_66 \ or y =~/[:;]\{.+?\}[:;][a-z+]/ - version='0.66' + version=0.66.to_f @flag_66=true - @version_determined=version + @version[:determined]=version break end end end @flag_57,@flag_38=false,false - unless @flag_66 or @flag_69 + unless @flag_2_0 \ + or @flag_66 \ + or @flag_69 @cont.each_with_index do |y,i| if @flag_57 \ or y =~/^:?A~\?? @title/ - @version_determined=0.57 + @version[:determined]=0.57.to_f @flag_57=true break end if @flag_38 \ or y =~/^:?A~/ - @version_determined=0.38 + @version[:determined]=0.38.to_f @flag_38=true break if i >= 200 if y =~ /(?:~{\*+|~\[\*|~\[\+)\s/ - @version_determined=0.42 #0.38 can safely be treated as 0.42 + @version[:determined]=0.42 #0.38 can safely be treated as 0.42 break end end if y =~/^0~/ \ and not @flag_38 - @version_determined=0.16 + @version[:determined]=0.16.to_f break end end end @@fns=@opt.fns - @@version_determined,@@version_declared,@@declared_doc_type=@version_determined,@version_declared,@declared_doc_type + @@version,@@declared_doc_type=@version,@declared_doc_type end self end def markup_version? - identify.version_determined.to_f + def determined + identify.version[:determined].to_f + end + def series + s=case identify.version[:determined].to_s + when /^[01]\./; '1.0' + when /^[2]\./; '2.0' + else '2.0' + end + "series #{s}" + end + def declared + identify.version[:declared].to_f + end + self end end end diff --git a/lib/sisu/v2/plaintext.rb b/lib/sisu/v2/plaintext.rb index 851da3f8..a57339f4 100644 --- a/lib/sisu/v2/plaintext.rb +++ b/lib/sisu/v2/plaintext.rb @@ -79,20 +79,31 @@ module SiSU_Plaintext end def read begin - @md=SiSU_Param::Parameters.new(@opt).get - @env=SiSU_Env::Info_env.new(@opt.fns) - path=@env.path.output_tell - tool=if @opt.cmd =~/[MVv]/; "#{@env.program.text_editor} #{path}/#{@md.fnb}/#{@md.fn[:plain]}" - else '' + md=SiSU_Param::Parameters.new(@opt).get + env=SiSU_Env::Info_env.new(@opt.fns) + unless @opt.cmd =~/q/ + path=env.path.output_tell + tool=(@opt.cmd =~/[MVv]/) \ + ? "#{env.program.text_editor} #{path}/#{md.fnb}/#{md.fn[:plain]}" \ + : @opt.fns + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool).green_hi_blue \ + : SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool).green_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{md.fnb}/#{md.fn[:plain]}").flow if @opt.cmd =~/[MV]/ end - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool) - tell.green_hi_blue unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:plain]}") - tell.flow if @opt.cmd =~/[MV]/ my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) - @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here - SiSU_Plaintext::Source::Scroll.new(@dal_array,@md).songsheet - SiSU_Env::Info_skin.new(@md).select #watch + dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here + wrap_width=if defined? md.make.plaintext_wrap \ + and md.make.plaintext_wrap + md.make.plaintext_wrap + elsif defined? env.plaintext_wrap \ + and env.plaintext_wrap + env.plaintext_wrap + else 78 + end + #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78 + SiSU_Plaintext::Source::Scroll.new(dal_array,md,wrap_width).songsheet + SiSU_Env::Info_skin.new(md).select #watch rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure end @@ -103,8 +114,8 @@ module SiSU_Plaintext require "#{SiSU_lib}/shared_txt" # shared_txt.rb include SiSU_text_utils @@endnotes={ :para=>[],:end=>[] } - def initialize(data,md) - @data,@md=data,md + def initialize(data,md,wrap_width) + @data,@md,@wrap_width=data,md,wrap_width @brace_url=SiSU_Viz::Skin.new.url_decoration @vz=SiSU_Env::Get_init.instance.skin @tab="\t" @@ -141,9 +152,9 @@ module SiSU_Plaintext end notes=@n.flatten notes.each do |e| - util=if e.to_s =~/^\[[\d*+]+\]:/; SiSU_text_utils::Wrap.new(e.to_s,78,4,1) - else SiSU_text_utils::Wrap.new(e.to_s,78,1,1) - end + util=(e.to_s =~/^\[[\d*+]+\]:/) \ + ? (SiSU_text_utils::Wrap.new(e.to_s,@wrap_width,4,1)) \ + : (SiSU_text_utils::Wrap.new(e.to_s,@wrap_width,1,1)) wrap=util.line_wrap if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m wrap.gsub!(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB @@ -166,7 +177,7 @@ GSUB array.each do |meta| tag,inf=meta.scan(/^.+?:\s|.+/) if tag and inf - util=SiSU_text_utils::Wrap.new(inf,78,15,1) + util=SiSU_text_utils::Wrap.new(inf,@wrap_width,15,1) txt=util.line_wrap @plaintext[:metadata] <<<<WOK @@ -220,22 +231,22 @@ WOK if dob.is=='para' if dob.indent =~/[1-9]/ util=if dob.bullet_ - SiSU_text_utils::Wrap.new("* #{dob.obj}",78,dob.indent.to_i*2) - else SiSU_text_utils::Wrap.new(dob.obj,78,dob.indent.to_i*2) + 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) end else util=if dob.bullet_ - SiSU_text_utils::Wrap.new("* #{dob.obj}",78,0) - else SiSU_text_utils::Wrap.new(dob.obj,78,0) + SiSU_text_utils::Wrap.new("* #{dob.obj}",@wrap_width,0) + else SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,0) end end - else util=SiSU_text_utils::Wrap.new(dob.obj,78,0) + else util=SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,0) end util.line_wrap end if lv times=wrapped.length - times=78 if times > 78 + times=@wrap_width if times > @wrap_width @plaintext[:body] << case lv when 1; wrapped.upcase << @br << Px[:lv1]*times << @br when 2; wrapped.upcase << @br << Px[:lv2]*times << @br @@ -356,10 +367,9 @@ WOK content << plaintext[:head] content << plaintext[:body] content << @@endnotes[:end] if @@endnotes_ - content << "#{@br}#{divider*78}#{@br}" + content << "#{@br}#{divider*@wrap_width}#{@br}" content << plaintext[:metadata] - content << "#{@br}#{divider*78}#{@br}" if @md.stmp =~/\w+/ #not used? - content << plaintext[:owner_details] if @md.stmp =~/\w+/ #not used? + content << "#{@br}#{divider*@wrap_width}#{@br}" if @md.stmp =~/\w+/ #not used? content << plaintext[:tail] Output.new(content,@md).plaintext @@endnotes={ :para=>[],:end=>[] } diff --git a/lib/sisu/v2/remote.rb b/lib/sisu/v2/remote.rb index b46202b7..4efe1770 100644 --- a/lib/sisu/v2/remote.rb +++ b/lib/sisu/v2/remote.rb @@ -70,43 +70,35 @@ module SiSU_Remote @remote=SiSU_Env::Info_remote.new(@opt) end def rsync - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put) - tell.dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put).dark_grey_title_hi unless @opt.cmd =~/q/ @remote.rsync end def rsync_base - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync') - tell.dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync').dark_grey_title_hi unless @opt.cmd =~/q/ @remote.rsync_base end def rsync_base_sync - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync and sync') - tell.dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync and sync').dark_grey_title_hi unless @opt.cmd =~/q/ @remote.rsync_base_sync end def rsync_sitemaps - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement sitemaps ->','rsync') - tell.dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement sitemaps ->','rsync').dark_grey_title_hi unless @opt.cmd =~/q/ @remote.rsync_sitemaps end def rsync_harvest - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement metadata harvest ->','rsync_harvest') - tell.dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement metadata harvest ->','rsync_harvest').dark_grey_title_hi unless @opt.cmd =~/q/ @remote.rsync_harvest end def scp - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put) - tell.dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put).dark_grey_title_hi unless @opt.cmd =~/q/ @remote.scp end def scp_base - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement of base site ->','excluding images') - tell.dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement of base site ->','excluding images').dark_grey_title_hi unless @opt.cmd =~/q/ @remote.scp_base end def scp_base_all - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','complete') - tell.dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','complete').dark_grey_title_hi unless @opt.cmd =~/q/ @remote.scp_base_all end end diff --git a/lib/sisu/v2/rexml.rb b/lib/sisu/v2/rexml.rb index 082e99d3..dc599e64 100644 --- a/lib/sisu/v2/rexml.rb +++ b/lib/sisu/v2/rexml.rb @@ -90,12 +90,10 @@ module SiSU_Rexml xmlfile=IO.readlines(@fnap,'').join begin @xmldoc=REXML::Document.new xmlfile - tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','REXML',"XML document #{@fnap} loaded") #% tell - tell.colorize unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'invert','REXML',"XML document #{@fnap} loaded").colorize unless @md.cmd =~/q/ #% tell if @md.cmd =~ /v/i #% substantive text @xmldoc.elements.each(@e_head) do |e| - tell=SiSU_Screen::Ansi.new(@md.cmd,'brown',e) - tell.colorize unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'brown',e).colorize unless @md.cmd =~/q/ end end rescue REXML::ParseException @@ -103,8 +101,7 @@ module SiSU_Rexml end end else - tell=SiSU_Screen::Ansi.new(@md.cmd,'fuschia',"File Not Found #{xmlfile}",'requested XML processing skipped') - tell.colorize unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'fuschia',"File Not Found #{xmlfile}",'requested XML processing skipped').colorize unless @md.cmd =~/q/ exit end rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error diff --git a/lib/sisu/v2/share_src.rb b/lib/sisu/v2/share_src.rb index d0f1923e..5c5576f3 100644 --- a/lib/sisu/v2/share_src.rb +++ b/lib/sisu/v2/share_src.rb @@ -70,10 +70,12 @@ module SiSU_Markup @output_path="#{@env.path.output}/src" end def read - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns) - tell.green_hi_blue unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"Copy sisu markup file to output directory","#{@opt.fns} -> #{@output_path}") - tell.warn unless @opt.cmd =~/q/ + unless @opt.cmd =~/q/ + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns).green_hi_blue \ + : SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns).green_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,"Copy sisu markup file to output directory","#{@opt.fns} -> #{@output_path}").warn if @opt.cmd =~/[MVv]/ + end mkdir_p("#{@env.path.output}/src") unless FileTest.directory?("#{@env.path.output}/src") mkdir_p(@output_path) unless FileTest.directory?(@output_path) if FileTest.directory?(@output_path) @@ -86,8 +88,7 @@ module SiSU_Markup end end else - tell=SiSU_Screen::Ansi.new(@opt.cmd,"Output directory does not exist","#{@opt.fns} -> #{@output_path}") - tell.warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,"Output directory does not exist","#{@opt.fns} -> #{@output_path}").warn if @opt.cmd =~/[MVv]/ exit end end diff --git a/lib/sisu/v2/share_src_kdissert.rb b/lib/sisu/v2/share_src_kdissert.rb index 6b4ece9c..4c37f3ff 100644 --- a/lib/sisu/v2/share_src_kdissert.rb +++ b/lib/sisu/v2/share_src_kdissert.rb @@ -69,10 +69,8 @@ module SiSU_Kdi_source @output_path="#{@env.path.output}/#{@opt.fnb}" end def read - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Share Kdissert Source Document!',@opt.fnb) - tell.green_hi_blue unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"Copy kdissert file to output directory","#{@opt.fnb} -> #{@output_path}") - tell.warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'Share Kdissert Source Document!',@opt.fnb).green_hi_blue unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,"Copy kdissert file to output directory","#{@opt.fnb} -> #{@output_path}").warn unless @opt.cmd =~/q/ mkdir_p(@env.path.output) unless FileTest.directory?(@env.path.output) mkdir_p(@output_path) unless FileTest.directory?(@output_path) if FileTest.directory?(@output_path) @@ -81,8 +79,7 @@ module SiSU_Kdi_source cp(@opt.fnb,@output_path) end else - tell=SiSU_Screen::Ansi.new(@opt.cmd,"Output directory does not exist","#{@opt.fnb} -> #{@output_path}") - tell.warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,"Output directory does not exist","#{@opt.fnb} -> #{@output_path}").warn unless @opt.cmd =~/q/ exit end end diff --git a/lib/sisu/v2/shared_markup_alt.rb b/lib/sisu/v2/shared_markup_alt.rb index 71405e02..52ecfe24 100644 --- a/lib/sisu/v2/shared_markup_alt.rb +++ b/lib/sisu/v2/shared_markup_alt.rb @@ -260,8 +260,7 @@ module SiSU_text_representation elsif FileTest.file?("#{@env.path.image_source_tex}/#{i}") @env.path.image_source_tex else - tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_local_tex}, #{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}") - tell.error2 unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_local_tex}, #{@env.path.image_source_remote_tex} and #{@env.path.image_source_tex}").error2 unless @md.cmd =~/q/ nil end img_type = /\S+\.(png|jpg|gif)/.match(i)[1] diff --git a/lib/sisu/v2/shared_txt.rb b/lib/sisu/v2/shared_txt.rb index 9d35743b..abf5e035 100644 --- a/lib/sisu/v2/shared_txt.rb +++ b/lib/sisu/v2/shared_txt.rb @@ -62,9 +62,7 @@ module SiSU_text_utils @para,@n_char_max,@n_indent=para,n_char_max,n_indent @n_char_max_extend = n_char_max @br="\n" - @n_hang=unless n_hang; @n_hang=@n_indent - else n_hang - end + @n_hang=n_hang ? n_hang : @n_indent end def line_wrap space=' ' @@ -72,13 +70,18 @@ module SiSU_text_utils line=0 out=[] out[line]='' + @para.gsub!(/<br>/,' <br> ') @para.gsub!(/#{Mx[:br_nl]}/,"\n\n") - words=@para.scan(/\n\n|\S+/m) + words=@para.scan(/\n\n|<br>|\S+/m) while words != '' word=words.shift if not word out[line] unless out[line].empty? #check break + elsif word =~/<br>/ + word=nil + out[line]=out[line].gsub(/<br>/,'') + line=line elsif word =~/\n\n/ word="\n" @n_char_max_extend = @n_char_max + out[line].length diff --git a/lib/sisu/v2/sisupod_make.rb b/lib/sisu/v2/sisupod_make.rb index 0b4b56d8..c721f257 100644 --- a/lib/sisu/v2/sisupod_make.rb +++ b/lib/sisu/v2/sisupod_make.rb @@ -82,19 +82,24 @@ module SiSU_Doc rm_rf("#{@env.path.processing}sisupod/*") if FileTest.directory?("#{@env.path.processing}sisupod") end def read - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (zip)',@opt.fns) - tell.green_hi_blue unless @opt.cmd =~/q/ + unless @opt.cmd =~/q/ + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (zip)',@opt.fns).green_hi_blue \ + : SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (zip)',@opt.fns).green_title_hi + end unless @opt.fns.empty? - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Make sisu document (zip) and place in output directory',"#{@opt.fns} -> file://#{@env.path.output_pod}/#{@zipfile}.zip") - tell.warn unless @opt.cmd =~/q/ + unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'Make sisu document (zip) and place in output directory',"#{@opt.fns} -> file://#{@env.path.output_pod}/#{@zipfile}.zip").warn if @opt.cmd =~/[MVv]/ + end directories sisupod_build sisupod_zip #sisupod_7zip else - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Make (zip) of sisu work directory',"#{@env.stub_pwd}\_#{@date}.zip") - tell.warn unless @opt.cmd =~/q/ - tell.blue_tab unless @opt.cmd =~/q/ + if @opt.cmd =~/[MVv]/ + SiSU_Screen::Ansi.new(@opt.cmd,'Make (zip) of sisu work directory',"#{@env.stub_pwd}\_#{@date}.zip").warn + SiSU_Screen::Ansi.new(@opt.cmd,'').blue_tab + end ans=@ans.response?('make sisupod of entire directory?') if ans; sisupod_zip_directory end @@ -122,12 +127,11 @@ module SiSU_Doc }) else puts "the required systemlink 'sisupod' could not be created on the current directory: remove the file or directory named 'sisupod' within #{Dir.pwd}" end - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (tar gzip)',@opt.fns) - tell.green_hi_blue unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Zipped directory',sisupod_directory) - tell.warn unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new('',sisupod_directory) - tell.blue_tab unless @opt.cmd =~/q/ + if @opt.cmd =~/[MVv]/ + SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (tar gzip)',@opt.fns).green_hi_blue + SiSU_Screen::Ansi.new(@opt.cmd,'Zipped directory',sisupod_directory).warn + SiSU_Screen::Ansi.new('',sisupod_directory).blue_tab + end end def directories SiSU_Env::Info_env.new.sisupod @@ -270,8 +274,7 @@ module SiSU_Doc mv #{@zipfile}.7z #{@local_path}/. & rm -r sisupod/* && cd #{@env.path.pwd} }) - tell=SiSU_Screen::Ansi.new('',"#{@opt.fns}.7z") - tell.blue_tab unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new('',"#{@opt.fns}.7z").blue_tab unless @opt.cmd =~/q/ end def sisupod_zip mkdir_p(@local_path) unless FileTest.directory?(@local_path) @@ -283,8 +286,7 @@ module SiSU_Doc mv #{@zipfile}.zip #{@local_path}/. & rm -r sisupod/* && cd #{@env.path.pwd} }) - tell=SiSU_Screen::Ansi.new('',"#{@zipfile}.zip") - tell.blue_tab unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new('',"#{@zipfile}.zip").blue_tab if @opt.cmd =~/[MVv]/ end end end diff --git a/lib/sisu/v2/sitemaps.rb b/lib/sisu/v2/sitemaps.rb index c6a80c23..87bd21c0 100644 --- a/lib/sisu/v2/sitemaps.rb +++ b/lib/sisu/v2/sitemaps.rb @@ -89,8 +89,7 @@ module SiSU_Sitemaps @sitemap_idx_fn='sitemapindex.xml' @env=SiSU_Env::Info_env.new output_idx(sitemap_index) - tell=SiSU_Screen::Ansi.new(@opt.cmd,"sitemap index:","#{@env.path.output}/#{@sitemap_idx_fn}") - tell.result unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,"sitemap index:","#{@env.path.output}/#{@sitemap_idx_fn}").result unless @opt.cmd =~/q/ end rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure diff --git a/lib/sisu/v2/sst_do_inline_footnotes.rb b/lib/sisu/v2/sst_do_inline_footnotes.rb index 27c2da8b..f114d97a 100644 --- a/lib/sisu/v2/sst_do_inline_footnotes.rb +++ b/lib/sisu/v2/sst_do_inline_footnotes.rb @@ -117,8 +117,7 @@ module SiSU_Convert_footnotes protected def create_dal dal_array=[] - tell=SiSU_Screen::Ansi.new(@opt.cmd,'convert footnotes') - tell.green_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'convert footnotes').green_title_hi unless @opt.cmd =~/q/ file_array=IO.readlines(@opt.fns,'') file_array.each do |l| if l =~/\r\n/; l.gsub!(/\r\n/,"\n") @@ -132,13 +131,11 @@ module SiSU_Convert_footnotes meta=nil dal=SiSU_Convert_footnotes::Make.new(@md,file_array).song SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.fns}.fn").output if @md.cmd =~/v/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"#{@md.fns}.fn -> #{@md.fns}.fn") unless @md.cmd =~/q/ - tell.txt_red unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,"#{@md.fns}.fn -> #{@md.fns}.fn").txt_red unless @md.cmd =~/q/ dal.each{|s| dal_array << "#{s.strip}\n\n" unless s.strip.empty?} dal_array else - tell=SiSU_Screen::Ansi.new(@md.cmd,'no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)') - tell.warn if @cmd !~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn if @cmd !~/q/ '' end end diff --git a/lib/sisu/v2/sst_to_s_xml_sax.rb b/lib/sisu/v2/sst_to_s_xml_sax.rb index 3522eb6d..25dfe927 100644 --- a/lib/sisu/v2/sst_to_s_xml_sax.rb +++ b/lib/sisu/v2/sst_to_s_xml_sax.rb @@ -428,8 +428,8 @@ WOK def xml if @prog.tidy !=false #note values can be other than true if @md.cmd =~/[VM]/ - tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure') - tell.colorize unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure').colorize unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'','','check document structure') tell.grey_open unless @md.cmd =~/q/ tidyfile='/dev/null' #don't want one or screen output, check for alternative flags tidy =SiSU_Env::System_call.new("#{Dir.pwd}/#{@md.fn[:sxs]}",tidyfile) diff --git a/lib/sisu/v2/sysenv.rb b/lib/sisu/v2/sysenv.rb index ed0fe136..f440fd3f 100644 --- a/lib/sisu/v2/sysenv.rb +++ b/lib/sisu/v2/sysenv.rb @@ -246,10 +246,9 @@ module SiSU_Env if load_prog require @prog else - tell=if @mandatory; SiSU_Screen::Ansi.new(@cmd,"module required: #{@prog}") - else SiSU_Screen::Ansi.new(@cmd,"#{@prog} load requested") - end - tell.warn + @mandatory \ + ? (SiSU_Screen::Ansi.new(@cmd,"module required: #{@prog}").warn) \ + : (SiSU_Screen::Ansi.new(@cmd,"#{@prog} load requested").warn) end load_prog end @@ -689,17 +688,13 @@ module SiSU_Env if @pdfetex_flag; texpdf_cmd=case texpdf when /xetex/ - if @input =~/landscape\.tex$/ - %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize} -l" #{@input} #{tell}\n} - else - %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #{@input} #{tell}\n} - end + @input =~/landscape\.tex$/ \ + ? %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize} -l" #{@input} #{tell}\n} \ + : %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #{@input} #{tell}\n} when /xelatex/ - if @input =~/landscape\.tex$/ - %{#{texpdf} -interaction=#{mode} -papersize="#{papersize} -l" #{@input} #{tell}\n} - else - %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #{@input} #{tell}\n} - end + @input =~/landscape\.tex$/ \ + ? %{#{texpdf} -interaction=#{mode} -papersize="#{papersize} -l" #{@input} #{tell}\n} \ + : %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #{@input} #{tell}\n} when /pdftex/; "#{texpdf} -interaction=#{mode} -fmt=pdflatex #{@input} #{tell}\n" when /pdflatex/; "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n" end @@ -875,6 +870,31 @@ module SiSU_Env ? @rc['processing']['concord_max'] \ : (defaults[:concord_max]) end + def markup_emphasis + if defined? @rc['default']['emphasis'] \ + and @rc['default']['emphasis'] \ + and @rc['default']['emphasis']=~/bold/ + 'bold' + elsif defined? @rc['default']['emphasis'] \ + and @rc['default']['emphasis'] \ + and @rc['default']['emphasis']=~/italic/ + 'italics' + elsif defined? @rc['default']['emphasis'] \ + and @rc['default']['emphasis'] \ + and @rc['default']['emphasis']=~/underscore/ + 'underscore' + else 'bold' + end + end + def plaintext_wrap + ((defined? @rc['default']['text_wrap']) \ + && (@rc['default']['text_wrap']) \ + && (@rc['default']['text_wrap'].to_s=~/\d\d+/) \ + && (@rc['default']['text_wrap'].to_i > 19) \ + && (@rc['default']['text_wrap'].to_i < 201)) \ + ? @rc['default']['text_wrap'].to_i \ + : 78 + end def current_document @@current_document||=Dir.pwd @@current_document @@ -1844,8 +1864,7 @@ WOK cmd=if @cmd; @cmd else '' end - tell=SiSU_Screen::Ansi.new(cmd,"WARNING - no local image directory or images:", defaults[:image_local] ) - tell.warn unless cmd =~/q/ + SiSU_Screen::Ansi.new(cmd,"WARNING - no local image directory or images:", defaults[:image_local] ).warn unless cmd =~/q/ @@local_image=false end url.images @@ -1863,8 +1882,7 @@ WOK '../_sisu/image_external' else if @@local_image==true - tell=SiSU_Screen::Ansi.new(@cmd,"WARNING - image directory for external images or no such images:", :image_external ) - tell.warn unless @cmd =~/q/ + SiSU_Screen::Ansi.new(@cmd,"WARNING - image directory for external images or no such images:", :image_external ).warn unless @cmd =~/q/ @@local_image=false end url.images_external @@ -2077,8 +2095,7 @@ WOK if FileTest.file?("#{Dir.pwd}/#{fns_pod}") system("unzip -q #{Dir.pwd}/#{fns_pod} -d #{path.processing}") else - tell=SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}") - tell.warn unless @cmd=~/q/ + SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/ end sisupod_processing_path end @@ -3264,7 +3281,7 @@ WOK css_path=['/etc/sisu/css',"#{@home}/.sisu/css","#{@pwd}/_sisu/css"] #BROKEN if defined? @rc['permission_set']['css_modify'] \ and @rc['permission_set']['css_modify'] - tell=SiSU_Screen::Ansi.new(@cmd,"modify is css set to: #{@rc['permission_set']['css_modify']}") + SiSU_Screen::Ansi.new(@cmd,"modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/ css_path.each do |x| if FileTest.directory?(x) cd(x) @@ -3275,9 +3292,8 @@ WOK cd(@pwd) end end - else tell=SiSU_Screen::Ansi.new(@cmd,"modify css is not set or is set to: false") + else SiSU_Screen::Ansi.new(@cmd,"modify css is not set or is set to: false").warn if @cmd=~/[MV]/ end - tell.warn if @cmd=~/[MV]/ fn_css=SiSU_Env::CSS_default.new css=SiSU_Style::CSS.new path_style="#{@env.path.output}/#{@env.path.style}" diff --git a/lib/sisu/v2/texpdf.rb b/lib/sisu/v2/texpdf.rb index f0e04b33..a9b1df51 100644 --- a/lib/sisu/v2/texpdf.rb +++ b/lib/sisu/v2/texpdf.rb @@ -104,14 +104,11 @@ module SiSU_TeX def song begin @md=@particulars.md - tell=SiSU_Screen::Ansi.new(@opt.cmd,'LaTeX/PDF') - tell.green_title_hi unless @opt.cmd =~/q/ - path=@env.url.output_tell + SiSU_Screen::Ansi.new(@opt.cmd,'LaTeX/PDF',@md.fns).green_title_hi unless @opt.cmd =~/q/ if @opt.cmd =~/[MVv]/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{path}/#{@md.fnb}/#{@md.fn[:pdf_l]}") - tell.flow - tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{path}/#{@md.fnb}/#{@md.fn[:pdf_p]}") - tell.flow + path=@env.url.output_tell + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{path}/#{@md.fnb}/#{@md.fn[:pdf_l]}").flow + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{path}/#{@md.fnb}/#{@md.fn[:pdf_p]}").flow end @md=@particulars.md SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) @@ -159,26 +156,24 @@ module SiSU_TeX def latex_do(texfilename,papersize) @texfilename=texfilename @@n_lpdf=@@n_lpdf+1 - tell=SiSU_Screen::Ansi.new(@md.cmd,"#{papersize} portrait ->") - tell.dark_grey_title_hi if @md.cmd =~/[MVv]/ + SiSU_Screen::Ansi.new(@md.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.cmd =~/[MVv]/ tex_fn_base=@texfilename.gsub(/\.tex$/,'') cmd=SiSU_Env::System_call.new("#{tex_fn_base}.tex",'',@md.cmd) tell=SiSU_Screen::Ansi.new(@md.cmd) - tell.grey_open unless @md.cmd =~/q/ + tell.grey_open if @md.cmd =~/[MVv]/ if "#{tex_fn_base}" =~/\w+/ \ and "#{papersize}" =~/\w+/ 2.times { |i| cmd.latex2pdf(@md,papersize) } end - tell.p_off unless @md.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@md.cmd,"#{papersize} landscape ->") - tell.dark_grey_title_hi if @md.cmd =~/[MVv]/ + tell.p_off if @md.cmd =~/[MVv]/ + SiSU_Screen::Ansi.new(@md.cmd,"#{papersize} landscape ->").dark_grey_title_hi if @md.cmd =~/[MVv]/ cmd=SiSU_Env::System_call.new("#{tex_fn_base}.landscape.tex",'',@md.cmd) - tell.grey_open + tell.grey_open if @md.cmd =~/[MVv]/ if "#{tex_fn_base}" =~/\w+/ \ and "#{papersize}" =~/\w+/ 2.times { |i| cmd.latex2pdf(@md,papersize) } end - tell.p_off unless @md.cmd =~/q/ + tell.p_off if @md.cmd =~/[MVv]/ pwd=Dir.pwd portrait_pdf="#{pwd}/#{tex_fn_base}.pdf" landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf" @@ -200,8 +195,7 @@ module SiSU_TeX rm(landscape_pdf) else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.cmd.inspect =~/M/ end - tell=SiSU_Screen::Ansi.new(@md.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)') - tell.generic_number unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number if @md.cmd =~/[MVv]/ end def latexrun_selective begin @@ -256,8 +250,7 @@ module SiSU_TeX ") end else - tell=SiSU_Screen::Ansi.new(@md.cmd,"FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped") - tell.warn + SiSU_Screen::Ansi.new(@md.cmd,"FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn end lst=Dir["*.{aux,log,out}"] lst.each {|file| File.unlink(file)} if lst @@ -296,8 +289,7 @@ module SiSU_TeX data=@data @@tex_footnote_array=[] @@rights=nil - tell=SiSU_Screen::Ansi.new(@md.cmd,"pdfTex portrait & landscape") - tell.txt_grey unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"pdfTex portrait & landscape").txt_grey if @md.cmd=~/[MVvz]/ if defined? @md.rights.all \ and not @md.rights.all.empty? rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index aca5378e..2d81f40c 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -290,8 +290,7 @@ module SiSU_TeX_Pdf @txt.gsub!(/<:=\s*(\S+?)\s*>/, "\\includegraphics*[width=11pt]{#{dir.path.image_source_tex}/c_\\1.png}") else - tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_tex}") - tell.error2 unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_tex}").error2 unless @md.cmd =~/q/ @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'') # fragile match operator\\ fragile ! end end @@ -309,8 +308,7 @@ module SiSU_TeX_Pdf elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}") dir.path.image_source_tex else - tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}") - tell.error2 unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}").error2 unless @md.cmd =~/q/ nil end if image_source #CHECK @@ -347,8 +345,7 @@ module SiSU_TeX_Pdf else unless image.nil? \ or image.length < 2 - tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}") - tell.error2 unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}").error2 unless @md.cmd =~/q/ end nil end @@ -492,8 +489,7 @@ 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 (either image not found or neither imagemagick nor graphicsmagick is installed)?\n}) - tell.print_grey #unless @opt.cmd =~/q/ + 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}).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 ! @@ -530,8 +526,7 @@ module SiSU_TeX_Pdf end images_hash[ps] else - tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}") - tell.error2 unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}").error2 unless @md.cmd =~/q/ if images_hash[ps] =~url_image_rgx \ or images_hash[ps] =~image_rgx images_hash[ps]='' @@ -1262,8 +1257,7 @@ WOK sisu_ico=if FileTest.file?("#{dir.path.image_source_tex}/sisu.png") "\\includegraphics*[width=60pt]{#{dir.path.image_source_tex}/sisu.png}" else - tell=SiSU_Screen::Ansi.new(@md.cmd,'WARNING - image directory or image(s) missing:', %{"#{dir.path.image_source_tex}"} ) - tell.warn unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'WARNING - image directory or image(s) missing:', %{"#{dir.path.image_source_tex}"} ).warn unless @md.cmd =~/q/ " SiSU " end url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') diff --git a/lib/sisu/v2/update.rb b/lib/sisu/v2/update.rb index c83d49f1..21b766e2 100644 --- a/lib/sisu/v2/update.rb +++ b/lib/sisu/v2/update.rb @@ -70,8 +70,7 @@ module SiSU_Update_control_flag @env=SiSU_Env::Info_env.new(@md.fns) out=@env.path.output base_path="#{out}/#{@md.fnb}" - tell=SiSU_Screen::Ansi.new(@md.cmd,'Checking previous output',base_path) - tell.green_hi_blue unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Checking previous output',base_path).green_hi_blue unless @md.cmd =~/q/ Set_CF.new(@md).set_flags rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error ensure diff --git a/lib/sisu/v2/urls.rb b/lib/sisu/v2/urls.rb index a08df9de..917b6fec 100644 --- a/lib/sisu/v2/urls.rb +++ b/lib/sisu/v2/urls.rb @@ -124,7 +124,7 @@ module SiSU_urls def songsheet begin urls_all if @opt.cmd=~/U/ - urls_select if @opt.cmd=~/[uvVM]/ + urls_select unless @opt.cmd=~/q/ rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure end @@ -140,8 +140,7 @@ module SiSU_urls if x =~/^m/ \ and @opt.cmd=~/m/ \ and x=~/^[#{opt.cmd}]/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.path.dal}/#{@opt.fns}.meta") - tell.maintenance unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.path.dal}/#{@opt.fns}.meta").maintenance if @opt.cmd =~/[MVv]/ end if x=~/^([hHw])/ \ and @opt.cmd=~/[hHw]/ \ @@ -155,11 +154,13 @@ module SiSU_urls and x=~/^[#{@opt.cmd}]/ tool=@prog.pdf_viewer fns=@opt.fns.gsub(/~/,'-') - tell=if y =~/landscape/ - SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.path.tex}/#{fns}.landscape.tex") - else SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.path.tex}/#{fns}.tex") + unless @opt.cmd =~/q/ + tell=if y =~/landscape/ + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.path.tex}/#{fns}.landscape.tex") + else SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.path.tex}/#{fns}.tex") + end + tell.maintenance if @opt.cmd =~/[MVv]/ end - tell.maintenance unless @opt.cmd =~/q/ end if x=~/^o/ \ and @opt.cmd=~/o/ \ @@ -169,92 +170,88 @@ module SiSU_urls if x=~/^e/ \ and @opt.cmd=~/e/ \ and x=~/^[#{@opt.cmd}]/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.path.epub}/OPS/toc.xhtml") - tell.maintenance unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.path.epub}/OPS/toc.xhtml").maintenance if @opt.cmd =~/[MVv]/ end if x !~/^[me]/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{tool} #{@env.path.output}/#{@fnb}/#{y}") - tell.maintenance unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{tool} #{@env.path.output}/#{@fnb}/#{y}").maintenance if @opt.cmd =~/[MVv]/ end @opt.cmd.gsub!(/#{m}/,'') end end def urls_select - tell=SiSU_Screen::Ansi.new(@opt.cmd,"URLs") - tell.grey_title_hi unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output}/#{@fnb}") - tell.flow unless @opt.cmd =~/q/ + unless @opt.cmd =~/q/ + i="(output manifest) #{@env.url.output_tell}/#{@fnb}/sisu_manifest.html" + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'URLs').grey_title_hi \ + : SiSU_Screen::Ansi.new(@opt.cmd,'URL',i).green_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output}/#{@fnb}").flow if @opt.cmd =~/[MVv]/ + end m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m @pwd_stub="#{@env.url.output_tell}"[m,1] - @u.each do |x,y| - if @opt.fns =~ @m_regular - if x=~/^([abchHNopwxXyY])/ \ - and @opt.cmd=~/[abchHNopwxXyY]/ \ - and x=~/^[#{@opt.cmd}]/ - m=$1 - tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}") - tell.result unless @opt.cmd =~/q/ - @opt.cmd.gsub!(/#{m}/,'') - end - if x=~/^I/ \ - and @opt.cmd =~/I/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","cd #{@env.path.texinfo}; pinfo ./#{@fnb}.#{y}; cd -") - tell.result unless @opt.cmd =~/q/ - @opt.cmd.gsub!(/I/,'') - end - if x=~/^D/ \ - and @opt.cmd =~/D/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}",y) - tell.result unless @opt.cmd =~/q/ - @opt.cmd.gsub!(/D[iu]/,'') - end - if x=~/^d/ \ - and @opt.cmd =~/d/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI sqlite","sqlite3 #{@env.path.output}/sisu_sqlite.db", "#{y}") - tell.result unless @opt.cmd =~/q/ - @opt.cmd.gsub!(/d[iu]/,'') - end - if x=~/^e/ \ - and @opt.cmd =~/e/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.epub_viewer} #{@env.path.output}/epub/#{y}") - tell.result unless @opt.cmd =~/q/ - end - if x=~/^i/ \ - and @opt.cmd =~/i/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.manpage_generator} #{@env.path.manpage}/#{@fnb}.1 |most") - tell.result unless @opt.cmd =~/q/ - @opt.cmd.gsub!(/I/,'') - end - if x=~/^P/ \ - and @opt.cmd =~/P/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} Profile","#{@pwd_stub}::#{@opt.fns}",y) - tell.result unless @opt.cmd =~/q/ - @opt.cmd.gsub!(/P/,'') - end - if x=~/^s/ \ - and @opt.cmd =~/s/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/src/#{y}") - tell.result unless @opt.cmd =~/q/ - @opt.cmd.gsub!(/I/,'') - end - if x=~/^S/ \ - and @opt.cmd =~/[sS]/ - zipfile=if @opt.fns =~/\.ssm\.sst$/; y.gsub(/(?:\~\S{2,3})?(\.ssm\.sst\.zip)$/,'.ssm.zip') - else y.gsub(/(?:\~\S{2,3})?(\.sst\.zip)$/,'\1') + unless @opt.cmd =~/q/ + @u.each do |x,y| + if @opt.fns =~ @m_regular + if @opt.cmd =~/[MVv]/ + if x=~/^([abchHNopwxXyY])/ \ + and @opt.cmd=~/[abchHNopwxXyY]/ \ + and x=~/^[#{@opt.cmd}]/ + m=$1 + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}").result + @opt.cmd.gsub!(/#{m}/,'') + end + if x=~/^I/ \ + and @opt.cmd =~/I/ + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","cd #{@env.path.texinfo}; pinfo ./#{@fnb}.#{y}; cd -").result + @opt.cmd.gsub!(/I/,'') + end + if x=~/^D/ \ + and @opt.cmd =~/D/ + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}",y).result + @opt.cmd.gsub!(/D[iu]/,'') + end + if x=~/^d/ \ + and @opt.cmd =~/d/ + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI sqlite","sqlite3 #{@env.path.output}/sisu_sqlite.db", "#{y}").result + @opt.cmd.gsub!(/d[iu]/,'') + end + if x=~/^e/ \ + and @opt.cmd =~/e/ + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.epub_viewer} #{@env.path.output}/epub/#{y}").result + end + if x=~/^i/ \ + and @opt.cmd =~/i/ + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.manpage_generator} #{@env.path.manpage}/#{@fnb}.1 |most").result + @opt.cmd.gsub!(/I/,'') + end + if x=~/^P/ \ + and @opt.cmd =~/P/ + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} Profile","#{@pwd_stub}::#{@opt.fns}",y).result + @opt.cmd.gsub!(/P/,'') + end + if x=~/^s/ \ + and @opt.cmd =~/s/ + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/src/#{y}").result + @opt.cmd.gsub!(/I/,'') + end + if x=~/^S/ \ + and @opt.cmd =~/[sS]/ + zipfile=if @opt.fns =~/\.ssm\.sst$/; y.gsub(/(?:\~\S{2,3})?(\.ssm\.sst\.zip)$/,'.ssm.zip') + else y.gsub(/(?:\~\S{2,3})?(\.sst\.zip)$/,'\1') + end + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/pod/#{y}").result + @opt.cmd.gsub!(/I/,'') + end end - tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/pod/#{y}") - tell.result unless @opt.cmd =~/q/ - @opt.cmd.gsub!(/I/,'') + urls_maintenance(@opt,x,y) if @opt.cmd =~/[MV]/ end - urls_maintenance(@opt,x,y) if @opt.cmd =~/[MV]/ end end end def urls_all - tell=SiSU_Screen::Ansi.new(@opt.cmd,'URLs') - tell.grey_title_hi unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output}/#{@fnb}") - tell.flow unless @opt.cmd =~/q/ + if @opt.cmd =~/[MVv]/ + SiSU_Screen::Ansi.new(@opt.cmd,'URLs').grey_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output}/#{@fnb}").flow + end @u.each do |x,y| tell=case x when /^m/ @@ -271,8 +268,10 @@ module SiSU_urls when /^i/ SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.manpage_generator} #{@env.path.manpage}/#{@fnb}.1 |most") end - tellx.result if tellx - tell.result if tell + if @opt.cmd =~/[MVv]/ + tellx.result if tellx + tell.result if tell + end tellx=nil end end diff --git a/lib/sisu/v2/wikispeak.rb b/lib/sisu/v2/wikispeak.rb index 0bb77c36..df6cdb50 100644 --- a/lib/sisu/v2/wikispeak.rb +++ b/lib/sisu/v2/wikispeak.rb @@ -78,13 +78,11 @@ module SiSU_Wikispeak @md=SiSU_Param::Parameters.new(@opt).get @env=SiSU_Env::Info_env.new(@opt.fns) path=@env.path.output_tell - tool=if @opt.cmd =~/[MVv]/; "#{@env.program.text_editor} #{path}/#{@md.fnb}/#{@md.fn[:wiki]}" - else '' - end - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Wikispeak',tool) - tell.green_hi_blue unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}") - tell.flow if @opt.cmd =~/[MV]/ + tool=(@opt.cmd =~/[MVv]/) \ + ? "#{@env.program.text_editor} #{path}/#{@md.fnb}/#{@md.fn[:wiki]}" \ + : '' + SiSU_Screen::Ansi.new(@opt.cmd,'Wikispeak',tool).green_hi_blue unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}").flow if @opt.cmd =~/[MV]/ my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here SiSU_Wikispeak::Source::Scroll.new(@dal_array,@md).songsheet diff --git a/lib/sisu/v2/xhtml.rb b/lib/sisu/v2/xhtml.rb index 80eb76d5..f142f3ce 100644 --- a/lib/sisu/v2/xhtml.rb +++ b/lib/sisu/v2/xhtml.rb @@ -80,14 +80,18 @@ module SiSU_XHTML def read begin @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array - path=@env.path.output_tell - loc=@env.url.output_tell - tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:xhtml]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:xhtml]}" - elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:xhtml]}" - else '' + unless @opt.cmd =~/q/ + path=@env.path.output_tell + loc=@env.url.output_tell + tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:xhtml]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:xhtml]}" + elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:xhtml]}" + else @opt.fns + end + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XHTML',tool).colorize \ + : SiSU_Screen::Ansi.new(@opt.cmd,'XHTML',tool).green_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{@md.fnb}/#{@md.fn[:xhtml]}").flow if @opt.cmd =~/[MV]/ end - SiSU_Screen::Ansi.new(@opt.cmd,'invert','XHTML',tool).colorize unless @opt.cmd =~/q/ - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:xhtml]}").flow if @opt.cmd =~/[MV]/ SiSU_XHTML::Source::Songsheet.new(@particulars).song rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure @@ -381,8 +385,8 @@ WOK if @prog.tidy !=false if @md.cmd =~/[VM]/ unless @md.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure') - tell.colorize + SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure').colorize + tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','','') tell.grey_open end tidyfile='/dev/null' #don't want one or screen output, check for alternative flags diff --git a/lib/sisu/v2/xml.rb b/lib/sisu/v2/xml.rb index 7c95f1ce..d3ff280e 100644 --- a/lib/sisu/v2/xml.rb +++ b/lib/sisu/v2/xml.rb @@ -80,14 +80,18 @@ module SiSU_XML_SAX def read begin @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array - path=@env.path.output_tell - loc=@env.url.output_tell - tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:sax]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sax]}" - elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:sax]}" - else '' + unless @opt.cmd =~/q/ + path=@env.path.output_tell + loc=@env.url.output_tell + tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:sax]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sax]}" + elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:sax]}" + else @opt.fns + end + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',tool).colorize \ + : SiSU_Screen::Ansi.new(@opt.cmd,'XML SAX',tool).green_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{@md.fnb}/#{@md.fn[:sax]}").flow if @opt.cmd =~/[MV]/ end - SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',tool).colorize unless @opt.cmd =~/q/ - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:sax]}").flow if @opt.cmd =~/[MV]/ SiSU_XML_SAX::Source::Songsheet.new(@particulars).song rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure @@ -422,8 +426,8 @@ WOK if @prog.tidy !=false #note values can be other than true if @md.cmd =~/[VM]/ unless @md.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure') - tell.colorize + SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure').colorize + tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','','') tell.grey_open end tidyfile='/dev/null' #don't want one or screen output, check for alternative flags diff --git a/lib/sisu/v2/xml_dom.rb b/lib/sisu/v2/xml_dom.rb index ff38ff86..c07364f2 100644 --- a/lib/sisu/v2/xml_dom.rb +++ b/lib/sisu/v2/xml_dom.rb @@ -78,14 +78,18 @@ module SiSU_XML_DOM def read begin @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array - path=@env.path.output_tell - loc=@env.url.output_tell - tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:dom]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:dom]}" - elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:dom]}" - else '' + unless @opt.cmd =~/q/ + path=@env.path.output_tell + loc=@env.url.output_tell + tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:dom]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:dom]}" + elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:dom]}" + else @opt.fns + end + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML DOM',tool).colorize \ + : SiSU_Screen::Ansi.new(@opt.cmd,'XML DOM',tool).green_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{@md.fnb}/#{@md.fn[:dom]}").flow if @opt.cmd =~/[MV]/ end - SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML DOM',tool).colorize unless @opt.cmd =~/q/ - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:dom]}").flow if @opt.cmd =~/[MV]/ SiSU_XML_DOM::Source::Songsheet.new(@particulars).songsheet rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure @@ -504,8 +508,8 @@ WOK def xml if @prog.tidy !=false if @md.cmd =~/[VM]/ - tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure') - tell.colorize unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure').colorize unless @md.cmd =~/q/ + tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','','') tell.grey_open unless @md.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) |