diff options
author | Ralph Amissah <ralph@amissah.com> | 2008-07-22 20:03:57 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2008-07-22 20:03:57 -0400 |
commit | 812a2ffaf4ff90abc6225e1dde8f4fbb6c92c2c0 (patch) | |
tree | 67efd138f4f690c75efd38d75d53e1b72c0024e2 | |
parent | Updated sisu-0.67.5 (diff) | |
parent | changelog and version updated (diff) |
Merge branch 'upstream' into debian/sid
64 files changed, 5327 insertions, 4606 deletions
@@ -9,11 +9,34 @@ Reverse Chronological: %% STABLE MANIFEST +%% sisu_0.68.0.orig.tar.gz (2008-07-22:29/2) +http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0.orig.tar.gz + sisu_0.68.0.orig.tar.gz + sisu_0.68.0-1.dsc + sisu_0.68.0-1.diff.gz + +Should simplify maintenance; numerous small fixes +Not without risk but should be easier to maintain. + + Fixes numerous small bugs, should simplify maintenance. + Not without risk but should be easier to maintain. + + * Middle layer document representation changed (changes to the programs + internal representation of text (markup)). Input unchanged; output should + remain much the same. Changed processing markup (middle layer), affects + internal downstream processing. Should simplify writing of downstream + parsers and should increase both consistency and flexibility (as internal + markup is now more easily modified). + + * texpdf, produces pdfs in multiple document sizes as specified in config + + * many small fixes + %% sisu_0.67.5.orig.tar.gz (2008-07-12:27/6) http://www.jus.uio.no/sisu/pkg/src/sisu_0.67.5.orig.tar.gz - sisu_0.67.5.orig.tar.gz - sisu_0.67.5-1.dsc - sisu_0.67.5-1.diff.gz + f07a6b01c52c178c4ed57d31eb3a9162e8d59aa643b7cfb8f4250c307c0fa019 1500535 sisu_0.67.5.orig.tar.gz + b4b01d9d3bd0b82e9c946cd2a1586b5b550912ed24f01b634f0f9c441ba72c77 1159 sisu_0.67.5-1.dsc + c5cf3905985e8545d4b87958ed0d8bd1ed72a93051117a8c9631a4cded41da2a 146710 sisu_0.67.5-1.diff.gz * texpdf xetex and xelatex processing commands, fix @@ -32,7 +55,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.67.4.orig.tar.gz * manifest minor changes to document information displayed -%% sisu_0.67.3.orig.tar.gz (2008-07-02:27/4) +%% sisu_0.67.3.orig.tar.gz (2008-07-03:26/4) http://www.jus.uio.no/sisu/pkg/src/sisu_0.67.3.orig.tar.gz f8c57f0e1992a5a829c321b5648dd53d31e65067d1b9464969a4e33afa9be2be 1500468 sisu_0.67.3.orig.tar.gz c4aeb2f843980dde75611e305eb51618540f0223d5e5e969a9590c49980998de 1159 sisu_0.67.3-1.dsc @@ -4,12 +4,7 @@ raise "Please, use Ruby1.8 (1.8.4 or later), current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' or RUBY_VERSION > '1.9' #raise "Please, use Ruby1.8.4 or later, current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' $VERBOSE=nil -if RUBY_VERSION < '1.9' - $KCODE='u' - TS1='¡' -else - TS1='¡'.force_encoding('utf-8') -end +$KCODE='u' if RUBY_VERSION < '1.9' branch='v0' SiSU_lib="sisu/#{branch}" require "#{SiSU_lib}/hub" diff --git a/conf/sisu/sisurc.yml b/conf/sisu/sisurc.yml index d5c186e8..34629d86 100644 --- a/conf/sisu/sisurc.yml +++ b/conf/sisu/sisurc.yml @@ -61,9 +61,9 @@ flag: iii: '-NhwpoabxXyYv' # includes verbose; -m run by default iv: '-NhwpoabxXYDyv --import' # includes verbose; -m run by default v: '-NhwpoabxXYDyv --update' # includes verbose; -m run by default -#% papersize, (LaTeX/pdf) current values A4, US_letter, book_b5, book_a5, US_legal +#% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal default: - papersize: 'A4' + papersize: 'A4,letter' #digest: 'sha' #sha is sha256, default is md5 #multilingual: false #language_file: 2 diff --git a/conf/sisu/version.yml b/conf/sisu/version.yml index fb6a31b5..ac7dd106 100644 --- a/conf/sisu/version.yml +++ b/conf/sisu/version.yml @@ -1,5 +1,5 @@ --- -:version: 0.67.5 -:date_stamp: 2008w27/6 -:date: "2008-07-12" +:version: 0.68.0 +:date_stamp: 2008w29/2 +:date: "2008-07-22" :project: SiSU diff --git a/data/doc/sisu/CHANGELOG b/data/doc/sisu/CHANGELOG index a99561a2..03f069fc 100644 --- a/data/doc/sisu/CHANGELOG +++ b/data/doc/sisu/CHANGELOG @@ -9,11 +9,34 @@ Reverse Chronological: %% STABLE MANIFEST +%% sisu_0.68.0.orig.tar.gz (2008-07-22:29/2) +http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0.orig.tar.gz + sisu_0.68.0.orig.tar.gz + sisu_0.68.0-1.dsc + sisu_0.68.0-1.diff.gz + +Should simplify maintenance; numerous small fixes +Not without risk but should be easier to maintain. + + Fixes numerous small bugs, should simplify maintenance. + Not without risk but should be easier to maintain. + + * Middle layer document representation changed (changes to the programs + internal representation of text (markup)). Input unchanged; output should + remain much the same. Changed processing markup (middle layer), affects + internal downstream processing. Should simplify writing of downstream + parsers and should increase both consistency and flexibility (as internal + markup is now more easily modified). + + * texpdf, produces pdfs in multiple document sizes as specified in config + + * many small fixes + %% sisu_0.67.5.orig.tar.gz (2008-07-12:27/6) http://www.jus.uio.no/sisu/pkg/src/sisu_0.67.5.orig.tar.gz - sisu_0.67.5.orig.tar.gz - sisu_0.67.5-1.dsc - sisu_0.67.5-1.diff.gz + f07a6b01c52c178c4ed57d31eb3a9162e8d59aa643b7cfb8f4250c307c0fa019 1500535 sisu_0.67.5.orig.tar.gz + b4b01d9d3bd0b82e9c946cd2a1586b5b550912ed24f01b634f0f9c441ba72c77 1159 sisu_0.67.5-1.dsc + c5cf3905985e8545d4b87958ed0d8bd1ed72a93051117a8c9631a4cded41da2a 146710 sisu_0.67.5-1.diff.gz * texpdf xetex and xelatex processing commands, fix @@ -32,7 +55,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.67.4.orig.tar.gz * manifest minor changes to document information displayed -%% sisu_0.67.3.orig.tar.gz (2008-07-02:27/4) +%% sisu_0.67.3.orig.tar.gz (2008-07-03:26/4) http://www.jus.uio.no/sisu/pkg/src/sisu_0.67.3.orig.tar.gz f8c57f0e1992a5a829c321b5648dd53d31e65067d1b9464969a4e33afa9be2be 1500468 sisu_0.67.3.orig.tar.gz c4aeb2f843980dde75611e305eb51618540f0223d5e5e969a9590c49980998de 1159 sisu_0.67.3-1.dsc diff --git a/data/doc/sisu/html/sisu.1.html b/data/doc/sisu/html/sisu.1.html index e7682a89..f7b70fcd 100644 --- a/data/doc/sisu/html/sisu.1.html +++ b/data/doc/sisu/html/sisu.1.html @@ -10,13 +10,13 @@ <h2><a name='sect0' href='#toc0'>Name</a></h2> sisu - documents: markup, structuring, publishing in multiple standard -formats, and search +formats, and search <h2><a name='sect1' href='#toc1'>Synopsis</a></h2> sisu [-abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0-9] [filename/wildcard ] sisu [-Ddcv] [instruction] sisu [-CcFLSVvW] SISU - -MANUAL, RALPH AMISSAH -<p> WHAT IS SISU? -<p> 1. INTRODUCTION - WHAT IS SISU? +MANUAL, RALPH AMISSAH +<p> WHAT IS SISU? +<p> 1. INTRODUCTION - WHAT IS SISU? <p> <b>SiSU</b> is a framework for document structuring, publishing (in multiple open standard formats) and search, comprising of: (a) a lightweight document @@ -24,13 +24,13 @@ structure and presentation markup syntax; and (b) an accompanying engine for generating standard document format outputs from documents prepared in sisu markup syntax, which is able to produce multiple standard outputs (including the population of sql databases) that (can) share a common numbering -system for the citation of text within a document. +system for the citation of text within a document. <p> <b>SiSU</b> is developed under an open source, software libre license (GPL3). Its use case for development is to cope with medium to large document sets with evolving markup related technologies, which should be prepared once, and for which you want multiple output formats that can be updated and a common mechanism for cross-output-format -citation, and search. +citation, and search. <p> <b>SiSU</b> both defines a markup syntax and provides an engine that produces open standards format outputs from documents prepared with <b>SiSU</b> markup. From a single lightly prepared document sisu custom builds @@ -42,7 +42,7 @@ of representation of the document. Significantly <b>SiSU</b> markup is more spar than html and outputs which include html, LaTeX, landscape and portrait pdfs, Open Document Format (ODF), all of which can be added to and updated. <b>SiSU</b> is also able to populate SQL type databases at an object level, which -means that searches can be made with that degree of granularity. +means that searches can be made with that degree of granularity. <p> Source document preparation and output generation is a two step process: (i) document source is prepared, that is, marked up in sisu markup syntax and (ii) the @@ -59,14 +59,14 @@ by these documents and at these locations within each document). Document output formats share a common object numbering system for locating content. This is particularly suitable for works (finalized texts as opposed to works that are frequently changed or updated) for which it provides a fixed -means of reference of content. +means of reference of content. <p> In preparing a <b>SiSU</b> document you optionally provide semantic information related to the document in a document header, and in marking up the substantive text provide information on the structure of the document, primarily indicating heading levels and footnotes. You also provide information on basic text attributes where used. The rest is automatic, sisu from this information custom builds[^2] the different forms -of output requested. +of output requested. <p> <b>SiSU</b> works with an abstraction of the document based on its structure which is comprised of its structure (or frame)[^3] and the objects[^4] it contains, which enables <b>SiSU</b> to represent the document @@ -80,7 +80,7 @@ pages; and in publishing in different formats, html, landscape and portrait pdf etc. again page numbers are of no use to cite text in a manner that is relevant against the different output types. Dealing with documents at an object level together with object numbering also has implications for -search. +search. <p> One of the challenges of maintaining documents is to keep them in a format that would allow users to use them without depending on a proprietary software popular at the time. Consider the ease of dealing with legacy proprietary @@ -104,109 +104,107 @@ and the archival of documents), and existing output to be updated (html has evolved and the related module has been updated repeatedly over the years, presumably when the World Wide Web Consortium (w3c) finalises html 5 which is currently under development, the html module will again be updated -allowing all existing documents to be regenerated as html 5). +allowing all existing documents to be regenerated as html 5). <p> The document formats are written to the file-system and available for indexing by independent indexing tools, whether off the web like Google and Yahoo or on the site -like Lucene and Hyperestraier. +like Lucene and Hyperestraier. <p> <b>SiSU</b> also provides other features such as concordance files and document content certificates, and the working against an abstraction of document structure has further possibilities for the research and development of other document representations, the availability of objects is useful for example for topic maps and the commercial law thesaurus by Vikki Rogers and Al Krtizer, together with the flexibility -of <b>SiSU</b> offers great possibilities. +of <b>SiSU</b> offers great possibilities. <p> <b>SiSU</b> is primarily for published works, which can take advantage of the citation system to reliably reference its documents. <b>SiSU</b> works well in a complementary manner with such collaborative technologies as Wikis, which can take advantage of and be used to discuss -the substance of content prepared in <b>SiSU</b> +the substance of content prepared in <b>SiSU</b> <p> <<a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a> -> +> <p> 2. -COMMANDS SUMMARY -<p> 2.1 SYNOPSIS +COMMANDS SUMMARY +<p> 2.1 SYNOPSIS <p> <b>SiSU</b> - Structured information, Serialized -Units - a document publishing system -<p> sisu [ -abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0-9 - ] [ filename/ -<p> sisu [ -Ddcv ] [ instruction ] -<p> sisu [ -CcFLSVvW ] -<p> Note: -commands should be issued from within the directory that contains the marked -up files, cd to markup directory. -<p> 2.2 DESCRIPTION -<p> <b>SiSU</b> <b>SiSU</b> is a document -publishing system, that from a simple single marked-up document, produces -multiple of output formats including: plaintext, html, LaTeX, pdf, xhtml, -XML, info, and SQL (PostgreSQL and SQLite), which share numbered text objects -( structure information. For more see: <<a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a> -> -<p> 2.3 DOCUMENT - -<p>PROCESSING COMMAND FLAGS -<p> +Units - a document publishing system +<p> sisu [ -abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0-9 + ] [ filename/ wildcard ] +<p> sisu [ -Ddcv ] [ instruction ] +<p> sisu [ -CcFLSVvW + ] +<p> Note: commands should be issued from within the directory that contains +the marked up files, cd to markup directory. +<p> 2.2 DESCRIPTION +<p> <b>SiSU</b> <b>SiSU</b> +is a document publishing system, that from a simple single marked-up document, +produces multiple of output formats including: plaintext, html, LaTeX, +pdf, xhtml, XML, info, and SQL (PostgreSQL and SQLite), which share numbered +text objects ( structure information. For more see: <<a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a> +> + +<p> 2.3 DOCUMENT PROCESSING COMMAND FLAGS +<p> <dl> -<dt><b> -a [filename/wildcard]</b> </dt> -<dd>produces plaintext with -Unix linefeeds and without markup, (object numbers are omitted), has footnotes -at end of each paragraph that contains them [ -A for equivalent dos (linefeed) - output file] [see -e for and search endnotes]. (Options include: --endnotes -for endnotes --footnotes for footnotes at the end of each paragraph --unix -for unix linefeed (default) --msdos for msdos linefeed) +<dt><b>-a [filename/wildcard]</b> </dt> +<dd>produces plaintext +with Unix linefeeds and without markup, (object numbers are omitted), has +footnotes at end of each paragraph that contains them [ -A for equivalent + dos (linefeed) output file] [see -e for (Options include: --endnotes for endnotes +--footnotes for footnotes at the end of each paragraph --unix for unix linefeed +(default) --msdos for msdos linefeed) <p> </dd> -<dt><b> -b [filename/wildcard]</b> -</dt> -<dd>produces xhtml/XML output for browser viewing (sax parsing). +<dt><b>-b [filename/wildcard]</b> </dt> +<dd>produces xhtml/XML +output for browser viewing (sax parsing). <p> </dd> -<dt><b> -C [--init-site]</b> -</dt> -<dd>configure/initialise shared output directory files initialize shared output -directory (config files such as css and dtd files are not updated if they -already exist unless modifier is used). -C --init-site configure/initialise -site more extensive than -C on its own, shared output directory files/force -update, existing shared output config files such as css and dtd files are -updated if this modifier is used. +<dt><b>-C [--init-site]</b> </dt> +<dd>configure/initialise +shared output directory files initialize shared output directory (config +files such as css and dtd files are not updated if they already exist unless +modifier is used). -C --init-site configure/initialise site more extensive than +-C on its own, shared output directory files/force update, existing shared +output config files such as css and dtd files are updated if this modifier +is used. <p> </dd> -<dt><b> -CC</b> </dt> -<dd> configure/initialise shared output - directory files initialize shared output directory (config files such as - css and dtd and search is used). The equivalent of: -C --init-site and search -configure/initialise site, more extensive than -C on its own, shared output - directory files/force update, existing shared output config files such - as css and dtd files are updated and search if -CC is used. such as css and - dtd files are updated and search +<dt><b>-CC</b> </dt> +<dd>configure/initialise shared output directory files initialize +shared output directory (config files such as css and dtd files are not +updated if they already exist unless modifier is used). The equivalent of: +-C --init-site configure/initialise site, more extensive than -C on its own, +shared output directory files/force update, existing shared output config +files such as css and dtd files are updated if -CC is used. <p> </dd> -<dt><b> -c [filename/wildcard]</b> </dt> -<dd>screen toggle ansi -screen colour on or off depending on default set (unless -c flag is used: -if sisurc colour default is set to ’true’, output to screen will be with -colour, if sisurc colour default is set to ’false’ or is undefined screen -output will be without colour). +<dt><b>-c [filename/wildcard]</b> +</dt> +<dd>screen toggle ansi screen colour on or off depending on default set (unless +-c flag is used: if sisurc colour default is set to ’true’, output to screen +will be with colour, if sisurc colour default is set to ’false’ or is undefined +screen output will be without colour). <p> </dd> -<dt><b> -D [instruction] [filename]</b> </dt> -<dd>database postgresql -( --pgsql may be used instead) possible instructions, include: --createdb; ---create; --dropall; --import [filename]; --update [filename]; --remove [filename]; -see database section below. +<dt><b>-D [instruction] [filename]</b> </dt> +<dd>database +postgresql ( --pgsql may be used instead) possible instructions, include: +--createdb; --create; --dropall; --import [filename]; --update [filename]; --remove +[filename]; see database section below. <p> </dd> -<dt><b> -d [--db-[database type (sqlite|pg)]] --[instruction] -</dt> -<dd>[filename] database type default set to sqlite, (for which --sqlite may be -used instead) or to specify another database --db-[pgsql, sqlite] (however -see -D) possible instructions include: --createdb; --create; --dropall; --import - [filename]; --update [filename]; --remove [filename]; see database section -below. +<dt><b>-d [--db-[database type (sqlite|pg)]] +--[instruction] [filename]</b> </dt> +<dd>database type default set to sqlite, (for which +--sqlite may be used instead) or to specify another database --db-[pgsql, sqlite] +(however see -D) possible instructions include: --createdb; --create; --dropall; +--import [filename]; --update [filename]; --remove [filename]; see database section +below. <p> </dd> -<dt><b> -F [--webserv=webrick]</b> </dt> +<dt><b>-F [--webserv=webrick]</b> </dt> <dd>generate examples of (naive) cgi search form for sqlite and pgsql depends on your already having used sisu to populate an sqlite and/or pgsql database, (the sqlite version scans the output directories @@ -219,137 +217,139 @@ usually 80). The samples are dumped in the present work directory which must be writable, (with screen instructions given that they be copied to the cgi-bin directory). -Fv (in addition to the above) provides some information -<p>on setting up hyperestraier for sisu +<p>on setting up hyperestraier for sisu <p> </dd> -<dt><b> -H [filename/wildcard]</b> </dt> +<dt><b>-H [filename/wildcard]</b> </dt> <dd>produces html without link suffixes (.html .pdf etc.) ( an appropriately configured web -server. [behaviour switched after 0.35 see -h]. +server. [behaviour switched after 0.35 see -h]. <p> </dd> -<dt><b> -h [filename/wildcard]</b> </dt> +<dt><b>-h [filename/wildcard]</b> </dt> <dd>produces html (with hardlinks i.e. with name suffixes in links/local urls). html, with internal document links that include the document suffix, i.e. whether it is .html or .pdf (required for browsing directly off a file system, and works -with most web servers). [behaviour switched after +with most web servers). [behaviour switched after 0.35 see -H]. <p> </dd> -<dt><b> -I [filename/wildcard]</b> +<dt><b>-I [filename/wildcard]</b> </dt> -<dd>produces texinfo and info file, (view with pinfo). +<dd>produces texinfo and info file, (view with pinfo). <p> </dd> -<dt><b> -i [filename/wildcard]</b> +<dt><b>-i [filename/wildcard]</b> </dt> -<dd>produces man page of file, not suitable for all outputs. +<dd>produces man page of file, not suitable for all outputs. <p> </dd> -<dt><b> -L</b> </dt> -<dd> prints license - information. +<dt><b>-L</b> </dt> +<dd>prints license +information. <p> </dd> -<dt><b> -M [filename/wildcard/url]</b> </dt> +<dt><b>-M [filename/wildcard/url]</b> </dt> <dd>maintenance mode files created for -processing preserved and their locations indicated. (also see -V) +processing preserved and their locations indicated. (also see -V) <p> </dd> -<dt><b> -m [filename/wildcard/url]</b> +<dt><b>-m [filename/wildcard/url]</b> </dt> <dd>assumed for most other flags, creates new meta-markup file, (the metaverse ) that is used in all subsequent processing of other output. This step is -assumed for most processing flags. To skip it see -n +assumed for most processing flags. To skip it see -n <p> </dd> -<dt><b> -N [filename/wildcard/url]</b> +<dt><b>-N [filename/wildcard/url]</b> </dt> <dd>document digest or document content certificate ( DCC ) as md5 digest tree of the document: the digest for the document, and digests for each object contained within the document (together with information on software versions -that produced it) (digest.txt). -NV for verbose digest output to screen. +that produced it) (digest.txt). -NV for verbose digest output to screen. <p> </dd> -<dt><b> -n - [filename/wildcard/url]</b> </dt> +<dt><b>-n +[filename/wildcard/url]</b> </dt> <dd>skip meta-markup (building of -m which is otherwise -assumed by most processing flags. +assumed by most processing flags. <p> </dd> -<dt><b> -o [filename/wildcard/url]</b> </dt> +<dt><b>-o [filename/wildcard/url]</b> </dt> <dd>output basic -document in opendocument file format (opendocument.odt). +document in opendocument file format (opendocument.odt). <p> </dd> -<dt><b> -p [filename/wildcard]</b> +<dt><b>-p [filename/wildcard]</b> </dt> <dd>produces LaTeX pdf (portrait.pdf & landscape.pdf). Default paper size is set in config file, or document header, or provided with additional command line parameter, e.g. --papersize-a4 preset sizes include: ’A4’, U.S. ’letter’ and -’legal’ and book sizes ’A5’ and ’B5’ (system defaults to A4). +’legal’ and book sizes ’A5’ and ’B5’ (system defaults to A4). <p> </dd> -<dt><b> -q [filename/wildcard]</b> +<dt><b>-q [filename/wildcard]</b> </dt> -<dd>quiet less output to screen. +<dd>quiet less output to screen. <p> </dd> -<dt><b> -R [filename/wildcard]</b> </dt> +<dt><b>-R [filename/wildcard]</b> </dt> <dd>copies sisu output files to remote host using rsync. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your different if -R is used with other flags from if used alone. Alone the rsync --delete parameter is sent, useful for cleaning the remote directory (when -R is -used together with other flags, it is not). Also see -r +used together with other flags, it is not). Also see -r <p> </dd> -<dt><b> -r [filename/wildcard]</b> +<dt><b>-r [filename/wildcard]</b> </dt> <dd>copies sisu output files to remote host using scp. This requires that sisurc.yml has been provided with information on hostname and username, and that you -<p>have your +<p>have your <p> </dd> -<dt><b> -S</b> </dt> -<dd> produces a sisupod a zipped sisu directory of markup local - configuration file, images and skins. Note: this only includes the configuration - files or skins contained in ./_sisu not those in ~/.sisu -S [filename/wildcard] -option. Note: (this option is tested only with zsh). +<dt><b>-S</b> </dt> +<dd>produces a sisupod a zipped sisu directory of markup files +including sisu markup source files and the directories local configuration +file, images and skins. Note: this only includes the configuration files +or skins contained in ./_sisu not those in ~/.sisu -S [filename/wildcard] +option. Note: (this<br> + option is tested only with zsh). <p> </dd> -<dt><b> -S [filename/wildcard]</b> -</dt> -<dd>produces a zipped file of the prepared document specified along with associated -images, by default named sisupod.zip they may alternatively be named with -the filename extension .ssp This provides a quick way of gathering the relevant -parts of a sisu document which can then for example be emailed. A sisupod -includes sisu markup source file, (along with associated documents if a -master file, or available in multilingual versions), together with related -images and skin. <b>SiSU</b> commands can be run directly against a sisupod contained -in a local directory, or provided as a url on a remote site. As there is -a security issue with skins provided by other users, they are not applied -unless the flag --trust or --trusted is added to the command instruction, it -is recommended that file that are not your own are treated as untrusted. -The directory structure of the unzipped file is understood by sisu, and -sisu commands can be run within it. Note: if you wish to send multiple files, -it quickly becomes more space efficient to zip the sisu markup directory, -rather than the individual files for sending). See the -S option without +<dt><b>-S [filename/wildcard]</b> </dt> +<dd>produces a zipped +file of the prepared document specified along with associated images, by +default named sisupod.zip they may alternatively be named with the filename +extension .ssp This provides a quick way of gathering the relevant parts +of a sisu document which can then for example be emailed. A sisupod includes +sisu markup source file, (along with associated documents if a master file, +or available in multilingual versions), together with related images and +skin. <b>SiSU</b> commands can be run directly against a sisupod contained in a +local directory, or provided as a url on a remote site. As there is a security +issue with skins provided by other users, they are not applied unless the +flag --trust or --trusted is added to the command instruction, it is recommended +that file that are not your own are treated as untrusted. The directory +structure of the unzipped file is understood by sisu, and sisu commands +can be run within it. Note: if you wish to send multiple files, it quickly +becomes more space efficient to zip the sisu markup directory, rather than +the individual files for sending). See the -S option without [filename/wildcard]. <p> </dd> -<dt><b> -s [filename/wildcard]</b> </dt> -<dd>copies sisu markup file to output directory. +<dt><b>-s [filename/wildcard]</b> </dt> +<dd>copies sisu markup file to output directory. <p> </dd> -<dt><b> -t [filename/wildcard +<dt><b>-t [filename/wildcard (*.termsheet.rb)]</b> </dt> -<dd>standard form document builder, preprocessing feature +<dd>standard form document builder, preprocessing feature <p> </dd> -<dt><b> -U [filename/wildcard]</b> </dt> +<dt><b>-U [filename/wildcard]</b> </dt> <dd>prints url output list/map for the available processing flags options and resulting files that could be requested, (can be used to get a list of processing options in relation to a file, together with @@ -357,355 +357,358 @@ information on the output that would be produced), -u provides url output mapping for those flags requested for processing. The default assumes sisu_webrick is running and provides webrick url mappings where appropriate, but these -<p>can be switched to file system paths in sisurc.yml +<p>can be switched to file system paths in sisurc.yml <p> </dd> -<dt><b> -u [filename/wildcard]</b> +<dt><b>-u [filename/wildcard]</b> </dt> <dd>provides url mapping of output files for the flags requested for processing, -<p>also see -U +<p>also see -U <p> </dd> -<dt><b> -V</b> </dt> -<dd> on its own, provides <b> SiSU</b> version and environment information - (sisu --help env) +<dt><b>-V</b> </dt> +<dd>on its own, provides <b>SiSU</b> version and environment information +(sisu --help env) <p> </dd> -<dt><b> -V [filename/wildcard]</b> </dt> +<dt><b>-V [filename/wildcard]</b> </dt> <dd>even more verbose than the -v flag. -(also see -M) +(also see -M) <p> </dd> -<dt><b> -v</b> </dt> -<dd> on its own, provides <b> SiSU</b> version information +<dt><b>-v</b> </dt> +<dd>on its own, provides <b>SiSU</b> version information <p> </dd> -<dt><b> -v [filename/wildcard]</b> +<dt><b>-v [filename/wildcard]</b> </dt> <dd>provides verbose output of what is being built, where it is being built (and error messages if any), as with -u flag provides a url mapping of files -created for each of the processing flag requests. See also -V +created for each of the processing flag requests. See also -V <p> </dd> -<dt><b> -W</b> </dt> -<dd> starts ruby’s - webrick webserver points at sisu output the default port is set to 8081 - and can be [tip: the so html output should be created using the -h option - rather than -H; also, note -F webrick ]. +<dt><b>-W</b> </dt> +<dd>starts ruby’s +webrick webserver points at sisu output directories, the default port is +set to 8081 and can be changed in the resource configuration files. [tip: + the webrick server requires link suffixes, so html output should be created + using the -h option rather than and search -H; also, note -F webrick ]. <p> </dd> -<dt><b> -w [filename/wildcard]</b> </dt> -<dd>produces concordance -(wordmap) a rudimentary index of all the words in a document. (Concordance -files are not generated for documents of over 260,000 words unless this -limit is increased in the file sisurc.yml) +<dt><b>-w +[filename/wildcard]</b> </dt> +<dd>produces concordance (wordmap) a rudimentary index +of all the words in a document. (Concordance files are not generated for +documents of over 260,000 words unless this limit is increased in the file +sisurc.yml) <p> </dd> -<dt><b> -X [filename/wildcard]</b> </dt> -<dd>produces -XML output with deep document structure, in the nature of dom. +<dt><b>-X [filename/wildcard]</b> </dt> +<dd>produces XML output with deep document +structure, in the nature of dom. <p> </dd> -<dt><b> -x [filename/wildcard]</b> -</dt> -<dd>produces XML output shallow structure (sax parsing). +<dt><b>-x [filename/wildcard]</b> </dt> +<dd>produces XML output +shallow structure (sax parsing). <p> </dd> -<dt><b> -Y [filename/wildcard]</b> -</dt> -<dd>produces a short sitemap entry for the document, based on html output and -the sisu_manifest. --sitemaps generates/updates the sitemap index of existing -sitemaps. (Experimental, [g,y,m announcement this week]) +<dt><b>-Y [filename/wildcard]</b> </dt> +<dd>produces a short +sitemap entry for the document, based on html output and the sisu_manifest. +--sitemaps generates/updates the sitemap index of existing sitemaps. (Experimental, +[g,y,m announcement this week]) <p> </dd> -<dt><b> -y [filename/wildcard]</b> -</dt> -<dd>produces an html summary of output generated (hyperlinked to content) and -document specific metadata (sisu_manifest.html). This step is assumed for -most processing flags. +<dt><b>-y [filename/wildcard]</b> </dt> +<dd>produces an html +summary of output generated (hyperlinked to content) and document specific +metadata (sisu_manifest.html). This step is assumed for most processing flags. + <p> </dd> -<dt><b> -Z [filename/wildcard]</b> </dt> -<dd>Zap, if used with other processing -flags deletes output files of the type about to be processed, prior to -processing. If -Z is used as the lone processing related flag (or in conjunction -with a combination of -[mMvVq]), will remove the related document output -directory. +<dt><b>-Z [filename/wildcard]</b> </dt> +<dd>Zap, if used with other processing flags deletes +output files of the type about to be processed, prior to processing. If +-Z is used as the lone processing related flag (or in conjunction with a +combination of -[mMvVq]), will remove the related document output directory. + <p> </dd> -<dt><b> -z [filename/wildcard]</b> </dt> -<dd>produces php (zend) [this feature is disabled - for the time being] +<dt><b>-z [filename/wildcard]</b> </dt> +<dd>produces php (zend) [this feature is disabled for + the time being] <p> </dd> </dl> -3. COMMAND LINE MODIFIERS -<p> +3. COMMAND LINE MODIFIERS +<p> <dl> -<dt><b> --no-ocn</b> </dt> -<dd> [with -h -H or -p] switches +<dt><b>--no-ocn</b> </dt> +<dd>[with -h -H or -p] switches off object citation numbering. Produce output without identifying numbers -in margins of html or LaTeX/pdf output. +in margins of html or LaTeX/pdf output. <p> </dd> -<dt><b> --no-annotate</b> </dt> -<dd> strips output text of - editor endnotes[^*1] denoted by asterisk or dagger/plus sign +<dt><b>--no-annotate</b> </dt> +<dd>strips output text of +editor endnotes[^*1] denoted by asterisk or dagger/plus sign <p> </dd> -<dt><b> --no-asterisk</b> +<dt><b>--no-asterisk</b> </dt> -<dd> strips output text of editor endnotes[^*2] denoted by asterisk sign +<dd>strips output text of editor endnotes[^*2] denoted by asterisk sign <p> </dd> -<dt><b> --no-dagger</b> +<dt><b>--no-dagger</b> </dt> -<dd> strips output text of editor endnotes[^+1] denoted by dagger/plus sign +<dd>strips output text of editor endnotes[^+1] denoted by dagger/plus sign <p> </dd> </dl> -4. DATABASE COMMANDS -<p> dbi - database interface +4. DATABASE COMMANDS +<p> dbi - database interface <p> -D or --pgsql set for postgresql -d or --sqlite default set for sqlite -d is modifiable with --db=[database type - (pgsql or sqlite)] -<p> + (pgsql or sqlite)] +<p> <dl> -<dt><b> -Dv --createall</b> </dt> -<dd> initial step, creates required relations - (tables, indexes) in existing postgresql database (a database should be - created manually and given the same name as working directory, as requested) - (rb.dbi) [ -dv --createall sqlite equivalent] it may be necessary to run sisu +<dt><b>-Dv --createall</b> </dt> +<dd>initial step, creates required relations +(tables, indexes) in existing postgresql database (a database should be +created manually and given the same name as working directory, as requested) +(rb.dbi) [ -dv --createall sqlite equivalent] it may be necessary to run sisu -Dv --createdb initially NOTE: at the present time for postgresql it may be necessary to manually create the database. The command would be ’createdb - [database name]’ where database name would be SiSU_[present working directory - name (without path)]. Please use only alphanumerics and underscores. +[database name]’ where database name would be SiSU_[present working directory + name (without path)]. Please use only alphanumerics and underscores. <p> </dd> -<dt><b> -Dv - --import</b> </dt> -<dd> [filename/wildcard] imports data specified to postgresql db (rb.dbi) - [ -dv --import sqlite equivalent] +<dt><b>-Dv +--import</b> </dt> +<dd>[filename/wildcard] imports data specified to postgresql db (rb.dbi) +[ -dv --import sqlite equivalent] <p> </dd> -<dt><b> -Dv --update</b> </dt> -<dd> [filename/wildcard] updates/imports -specified data to postgresql db (rb.dbi) [ -dv --update sqlite equivalent] +<dt><b>-Dv --update</b> </dt> +<dd>[filename/wildcard] updates/imports +specified data to postgresql db (rb.dbi) [ -dv --update sqlite equivalent] <p> </dd> -<dt><b> -D --remove</b> </dt> -<dd> [filename/wildcard] removes specified data to postgresql db (rb.dbi) - [ -d --remove sqlite equivalent] +<dt><b>-D --remove</b> </dt> +<dd>[filename/wildcard] removes specified data to postgresql db (rb.dbi) +[ -d --remove sqlite equivalent] <p> </dd> -<dt><b> -D --dropall</b> </dt> -<dd> kills data & indexes [ -d --dropall - sqlite equivalent] -<p> The v in e.g. -Dv is for verbose output. +<dt><b>-D --dropall</b> </dt> +<dd>kills data --dropall sqlite equivalent] + +<p> The v in e.g. -Dv is for verbose output. <p> </dd> </dl> -5. SHORTCUTS, -SHORTHAND FOR MULTIPLE FLAGS -<p> +5. SHORTCUTS, SHORTHAND FOR MULTIPLE +FLAGS +<p> <dl> -<dt><b> --update [filename/wildcard]</b> </dt> -<dd>Checks existing -file output and runs the flags required to update this output. This means -that if only html and pdf output was requested on previous runs, only the --hp files will be applied, and only these will be generated this time, together -with the summary. This can be very convenient, if you offer different outputs -of different files, and just want to do the same again. +<dt><b>--update [filename/wildcard]</b> </dt> +<dd>Checks existing file output and runs +the flags required to update this output. This means that if only html and +pdf output was requested on previous runs, only the -hp files will be applied, +and only these will be generated this time, together with the summary. This +can be very convenient, if you offer different outputs of different files, +and just want to do the same again. <p> </dd> -<dt><b> -0 to -5 [filename - or wildcard]</b> </dt> -<dd>Default shorthand mappings (note that the defaults can be -changed/configured in the sisurc.yml file): +<dt><b>-0 to -5 [filename or wildcard]</b> </dt> +<dd>Default +shorthand mappings (note that the defaults can be changed/configured in +the sisurc.yml file): <p> </dd> -<dt><b> -0</b> </dt> -<dd> -mNhwpAobxXyYv [this is the - default action run when no i.e. on ’sisu [filename]’] +<dt><b>-0</b> </dt> +<dd>-mNhwpAobxXyYv [this is the default action run when + no i.e. on ’sisu [filename]’] <p> </dd> -<dt><b> -1</b> </dt> -<dd> -mNHwpy give, i.e. on - ’sisu [filename]’] +<dt><b>-1</b> </dt> +<dd>-mNHwpy <p> </dd> -<dt><b> -2</b> </dt> -<dd> -mNHwpaoy give, i.e. on ’sisu [filename]’] +<dt><b>-2</b> </dt> +<dd>-mNHwpaoy <p> </dd> -<dt><b> -3</b> </dt> -<dd> -mNhwpAobxXyY - i.e. on ’sisu [filename]’] +<dt><b>-3</b> </dt> +<dd>-mNhwpAobxXyY <p> </dd> -<dt><b> -4</b> </dt> -<dd> -mNhwpAobxXDyY --import ’sisu [filename]’] +<dt><b>-4</b> </dt> +<dd>-mNhwpAobxXDyY + +<p>- +<p>- +<p>import <p> </dd> -<dt><b> -5</b> </dt> -<dd> -mNhwpAobxXDyY - --update ’sisu [filename]’] -<p> add -v for verbose mode and -c for color, e.g. sisu --2vc [filename or wildcard] -<p> consider -u for appended url info or -v for +<dt><b>-5</b> </dt> +<dd>-mNhwpAobxXDyY --update +<p> add -v for verbose mode and -c for color, +e.g. sisu -2vc [filename or +<p> consider -u for appended url info or -v for verbose -<p>verbose output +<p>output <p> </dd> </dl> -5.1 COMMAND LINE WITH FLAGS - BATCH PROCESSING -<p> In the data -directory run sisu -mh filename or wildcard eg. cisg.sst documents. -<p> Running -sisu (alone without any flags, filenames or wildcards) brings up the interactive -help, as does any sisu command that is not recognised. Enter to escape. -<p> -6. HELP -<p> 6.1 SISU MANUAL -<p> The most up to date information on sisu should -be contained in the sisu_manual, available at: +5.1 COMMAND LINE WITH FLAGS - BATCH PROCESSING +<p> In the data directory +run sisu -mh filename or wildcard eg. cisg.sst documents. +<p> Running sisu (alone +without any flags, filenames or wildcards) brings up the interactive help, +as does any sisu command that is not recognised. Enter to escape. +<p> 6. HELP + +<p> 6.1 SISU MANUAL +<p> The most up to date information on sisu should be contained +in the sisu_manual, available at: <p> <<a href='http://sisudoc.org/sisu/sisu_manual/'>http://sisudoc.org/sisu/sisu_manual/</a> ><br> - + <p> The manual can be generated from source, found respectively, either -within the <b>SiSU</b> tarball or installed locally at: +within the <b>SiSU</b> tarball or installed locally at: <p> ./data/doc/sisu/sisu_markup_samples/sisu_manual/<br> - + <p> /usr/share/doc/sisu/sisu_markup_samples/sisu_manual/<br> - -<p> move to the respective directory and type e.g.: + +<p> move to the respective directory and type e.g.: <p> sisu sisu_manual.ssm<br> - -<p> 6.2 SISU MAN PAGES + +<p> 6.2 SISU MAN PAGES <p> If <b>SiSU</b> is installed on your system usual man commands -should be available, try: +should be available, try: <p> man sisu<br> - + <p> man sisu_markup<br> - + <p> man sisu_commands<br> - + <p> Most <b>SiSU</b> man pages are generated directly from sisu documents that are used to prepare the sisu manual, the sources files for which are located -within the <b>SiSU</b> tarball at: +within the <b>SiSU</b> tarball at: <p> ./data/doc/sisu/sisu_manual/<br> - -<p> Once installed, directory equivalent to: + +<p> Once installed, directory equivalent to: <p> /usr/share/doc/sisu/sisu_manual/<br> - -<p> Available man pages are converted back to html using man2html: + +<p> Available man pages are converted back to html using man2html: <p> /usr/share/doc/sisu/html/<br> - + <p> ./data/doc/sisu/html/<br> - -<p> An online version of the sisu man page is available here: + +<p> An online version of the sisu man page is available here: <p> * various sisu man pages <<a href='http://www.jus.uio.no/sisu/man/'>http://www.jus.uio.no/sisu/man/</a> -> [^7] +> [^7] <p> * sisu.1 <<a href='http://www.jus.uio.no/sisu/man/sisu.1.html'>http://www.jus.uio.no/sisu/man/sisu.1.html</a> > - [^8] -<p> 6.3 SISU BUILT-IN INTERACTIVE HELP +[^8] +<p> 6.3 SISU BUILT-IN INTERACTIVE HELP <p> This is particularly useful for -getting the current sisu setup/environment information: +getting the current sisu setup/environment information: <p> sisu --help<br> - -<p> sisu --help [subject]<br> - + +<p> sisu --help [subject]<br> + <p> sisu --help commands<br> - + <p> sisu --help markup<br> - -<p> sisu --help env [for feedback on the way your system is and search<br> + +<p> sisu --help env [for feedback on the way your system is <br> setup with regard to sisu]<br> - -<p> sisu -V [environment information, same as above command]<br> - + +<p> sisu -V [environment information, same as above command]<br> + <p> sisu (on its own provides version and some help information)<br> - + <p> Apart from real-time information on your current configuration the <b>SiSU</b> manual and man pages are likely to contain more up-to-date information than -the sisu interactive help (for example on commands and markup). +the sisu interactive help (for example on commands and markup). <p> NOTE: Running the command sisu (alone without any flags, filenames or wildcards) brings up the interactive help, as does any sisu command that is not recognised. -Enter to escape. -<p> 6.4 HELP SOURCES +Enter to escape. +<p> 6.4 HELP SOURCES <p> For lists of alternative help sources, -see: -<p> <b>man page</b> +see: +<p> <b>man page</b> <p> man sisu_help_sources<br> - -<p> <b>man2html</b> + +<p> <b>man2html</b> <p> /usr/share/doc/sisu/sisu_manual/sisu_help_sources/index.html<br> - -<p> <b>sisu generated html</b> + +<p> <b>sisu generated html</b> <p> /usr/share/doc/sisu/html/sisu_help_sources/index.html<br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_help_sources/index.html'>http://sisudoc.org/sisu/sisu_help_sources/index.html</a> ><br> - -<p> 7. INTRODUCTION TO SISU MARKUP[^9] -<p> 7.1 SUMMARY + +<p> 7. INTRODUCTION TO SISU MARKUP[^9] +<p> 7.1 SUMMARY <p> <b>SiSU</b> source documents -are plaintext (UTF-8)[^10] files +are plaintext (UTF-8)[^10] files <p> All paragraphs are separated by an empty -line. -<p> Markup is comprised of: +line. +<p> Markup is comprised of: <p> * at the top of a document, the document header made up of semantic meta-data about the document and if desired additional processing instructions (such an instruction to automatically number headings -from a particular level down) +from a particular level down) <p> * followed by the prepared substantive text of which the most important single characteristic is the markup of different heading levels, which define the primary outline of the document -structure. Markup of substantive text includes: +structure. Markup of substantive text includes: <p> * heading levels defines document structure<br> - + <p> * text basic attributes, italics, bold etc.<br> - + <p> * grouped text (objects), which are to be treated differently, such as code<br> blocks or poems.<br> - + <p> * footnotes/endnotes<br> - + <p> * linked text and images<br> - + <p> * paragraph actions, such as indent, bulleted, numbered-lists, etc.<br> - + <p> Some interactive help on markup is available, by typing sisu and selecting -<p>markup or sisu --help markup -<p> To check the markup in a file: +<p>markup or sisu --help markup +<p> To check the markup in a file: <p> sisu --identify - [filename].sst<br> - -<p> For brief descriptive summary of markup history +[filename].sst<br> + +<p> For brief descriptive summary of markup history <p> sisu --query-history<br> - -<p> or if for a particular version: + +<p> or if for a particular version: <p> sisu --query-0.38<br> - -<p> 7.2 MARKUP EXAMPLES -<p> 7.2.1 ONLINE + +<p> 7.2 MARKUP EXAMPLES +<p> 7.2.1 ONLINE <p> Online markup examples are available together with the respective outputs produced from <<a href='http://www.jus.uio.no/sisu/SiSU/examples.html'>http://www.jus.uio.no/sisu/SiSU/examples.html</a> > or from <<a href='http://www.jus.uio.no/sisu/sisu_examples/'>http://www.jus.uio.no/sisu/sisu_examples/</a> -> +> <p> There is of course this document, which provides a cursory overview of sisu markup and the respective output produced: <<a href='http://www.jus.uio.no/sisu/sisu_markup/'>http://www.jus.uio.no/sisu/sisu_markup/</a> -> +> <p> Some example marked up files are available as html with syntax highlighting for viewing: <<a href='http://www.jus.uio.no/sisu/sample/syntax'>http://www.jus.uio.no/sisu/sample/syntax</a> > @@ -713,28 +716,28 @@ up files are available as html with syntax highlighting for viewing: <<a href <p> an alternative presentation of markup syntax: <<a href='http://www.jus.uio.no/sisu/sample/on_markup.txt'>http://www.jus.uio.no/sisu/sample/on_markup.txt</a> > -<p> 7.2.2 INSTALLED +<p> 7.2.2 INSTALLED <p> With <b>SiSU</b> installed sample skins may be found in: /usr/share/doc/sisu/sisu_markup_samples/dfsg (or equivalent directory) and if sisu-markup-samples is installed also under: -<p>/usr/share/doc/sisu/sisu_markup_samples/non-free -<p> 8. MARKUP OF HEADERS +<p>/usr/share/doc/sisu/sisu_markup_samples/non-free +<p> 8. MARKUP OF HEADERS <p> Headers consist of semantic meta-data about a document, which can be used by any output module of the program; and may in addition include extra -processing instructions. +processing instructions. <p> Note: the first line of a document may include information on the markup version used in the form of a comment. Comments are a percentage mark at the start of a paragraph (and as the first character -in a line of text) followed by a space and the comment: -<p> +in a line of text) followed by a space and the comment: +<p> <p> <br> <pre> % this would be a comment </pre> -<p> 8.1 SAMPLE HEADER +<p> 8.1 SAMPLE HEADER <p> This current document has a header similar to this -one (without the comments): -<p> +one (without the comments): +<p> <p> <br> <pre> % SiSU 0.57 @title: SiSU @@ -772,178 +775,184 @@ documents that request them, all documents in a directory, or be site-wide. { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html </pre> -<p> 8.2 AVAILABLE HEADERS +<p> 8.2 AVAILABLE HEADERS <p> Header tags appear at the beginning of a document and provide meta information on the document (such as the Dublin Core), or information as to how the document as a whole is to be processed. All header instructions take either the form @headername: or 0~headername. All -<p>Dublin Core meta tags are available +<p>Dublin Core meta tags are available <p> <b>@indentifier:</b> information or instructions -<p> where the information +<p> where the information <p> Note: a header where used should only be used once; all headers apart from @title: are optional; the @structure: header -is used to describe document structure, and can be useful to know. +is used to describe document structure, and can be useful to know. <p> This -<p>is a sample header -<p> <b>% SiSU 0.38</b> [declared file-type identifier with markup - version] -<p> <b>@title:</b> [title text] This is the title of the document and used -as such, this header is the only one that is <i>mandatory</i> -<p> <b>@subtitle:</b> The - -<p>Subtitle if any -<p> <b>@creator:</b> [or @author:] Name of Author -<p> <b>@subject:</b> (whatever -your subject) -<p> <b>@description:</b> -<p> <b>@publisher:</b> -<p> <b>@contributor:</b> -<p> <b>@translator:</b> - [or @translated_by:] -<p> <b>@illustrator:</b> [or @illustrated_by:] -<p> <b>@prepared_by:</b> - [or @digitized_by:] -<p> <b>@date: 2000-08-27</b> [ also @date.created: @date.issued: - @date.available: @date.valid: @date.modified: ] -<p> <b>@type: article</b> -<p> <b>@format:</b> +<p>is a sample header +<p> <b>% SiSU 0.38</b> [declared file-type identifier with markup + version] +<p> +<p> <b>@title:</b> [title text] This is the title of the document and +used as such, this header is the only one that is<br> + <i>mandatory</i> +<p> <b>@subtitle:</b> The Subtitle if any +<p> <b>@creator:</b> [or @author:] Name + +<p>of Author +<p> <b>@subject:</b> (whatever your subject) +<p> <b>@description:</b> +<p> <b>@publisher:</b> + +<p> <b>@contributor:</b> +<p> <b>@translator:</b> [or @translated_by:] +<p> <b>@illustrator:</b> [or + @illustrated_by:] +<p> <b>@prepared_by:</b> [or @digitized_by:] +<p> <b>@date: 2000-08-27</b> +[ also @date.created: @date.issued: @date.available: @date.valid: ] +<p> +<p> <b>@type: -<p> <b>@identifier:</b> -<p> <b>@source:</b> -<p> <b>@language:</b> [or @language.document:] [country - code for language if available, or language, English, en is the default - setting] (en - English, fr - French, de - German, it - Italian, es - Spanish, -pt - Portuguese, sv - Swedish, da - Danish, fi - Finnish, no - Norwegian, is -- Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - Romanian, -ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, sl - Slovenian, -hr - Croatian, cs - Czech, bg - Bul garian ) [however, encodings are not available - for all of the languages listed.] -<p> [@language.original: original language - in which the work was published] +<p>article</b> +<p> <b>@format:</b> +<p> <b>@identifier:</b> +<p> <b>@source:</b> +<p> <b>@language:</b> [or @language.document:] +[country code for language if available, or language, English, en is the + default setting] (en - English, fr - French, de - German, it - Italian, es +- Spanish, pt - Portuguese, sv - Swedish, da - Danish, fi - Finnish, no - Norwegian, +is - Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - +Romanian, ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, +sl - Slovenian, hr - Croatian, cs - Czech, bg - Bul garian ) [however, encodings + are not available for all of the languages listed.] +<p> [@language.original: + original language in which the work was published] <p> <b>@papersize:</b> (A4|US_letter|book_B5|book_A5|US_legal) -<p> <b>@relation:</b> -<p> <b>@coverage:</b> +<p> <b>@relation:</b> +<p> <b>@coverage:</b> <p> <b>@rights:</b> Copyright (c) Name of Right Holder, all rights reserved, or as granted: public domain, copyleft, creative commons -variant, etc. -<p> <b>@owner:</b> +variant, etc. +<p> <b>@owner:</b> <p> <b>@keywords:</b> text document generation processing -management latex pdf structured xml citation [your keywords here, used - for example by rss feeds, and in sql searches] -<p> <b>@abstract:</b> [paper abstract, - placed after table of contents] -<p> <b>@comment:</b> [...] -<p> <b>@catalogue:</b> loc=[Library - of Congress classification]; dewey=[Dewey rss feeds, classification]; isbn=[ISBN]; -pg=[Project Gutenberg text number] -<p> <b>@classify_loc:</b> [Library of Congress - classification] -<p> <b>@classify_dewey:</b> [Dewey classification] -<p> <b>@classify_isbn:</b> - [ISBN] -<p> <b>@classify_pg:</b> [Project Gutenberg text number] -<p> <b>@prefix:</b> [prefix - is placed just after table of contents] -<p> <b>@prefix_a:</b> [prefix is placed - just before table of contents - not implemented] -<p> <b>@prefix_b:</b> -<p> <b>@rcs:</b> $Id: -sisu_markup.sst,v 1.2 2007/09/08 17:12:47 ralph Exp $ [used by rcs or cvs - to embed version (revision control) information into rcs or cvs can usefully - provide a history of -<p> <b>@structure:</b> PART; CHAPTER; SECTION; ARTICLE; none; -none; optional, document structure can be defined by words to match or -regular expression (the regular expression is assumed to start at the beginning +management latex pdf structured xml citation [your keywords here, used + for example by rss feeds, +<p> <b>@abstract:</b> [paper abstract, placed after table + of contents] +<p> <b>@comment:</b> [...] +<p> <b>@catalogue:</b> loc=[Library of Congress classification]; +dewey=[Dewey rss feeds, isbn=[ISBN]; pg=[Project Gutenberg text number] + +<p> <b>@classify_loc:</b> [Library of Congress classification] +<p> <b>@classify_dewey:</b> +[Dewey classification] +<p> <b>@classify_isbn:</b> [ISBN] +<p> <b>@classify_pg:</b> [Project + Gutenberg text number] +<p> <b>@prefix:</b> [prefix is placed just after table of + contents] +<p> <b>@prefix_a:</b> [prefix is placed just before table of contents + - not +<p> <b>@prefix_b:</b> +<p> <b>@rcs:</b> $Id: sisu_markup.sst,v 1.2 2007/09/08 17:12:47 +ralph Exp $ [used by rcs or cvs to embed version (revision control) information + into document, rcs or cvs can usefully provide a history of updates to + a document ] +<p> <b>@structure:</b> PART; CHAPTER; SECTION; ARTICLE; none; none; +optional, document structure can be defined by words to match or regular +expression (the regular expression is assumed to start at the beginning of a line of text i.e. ^) default markers :A~ to :C~ and 1~ to 6~ can be used within text instead, without this header tag, and may be used to supplement the instructions provided in this header tag if provided (@structure: is -a synonym for @toc:) -<p> <b>@level:</b> newpage=3; breakpage=4 [paragraph level, - used by latex to breakpages, the page in newpage] -<p> <b>@markup:</b> information -on the markup used, e.g. new=1,2,3; break=4; num_top=4 [or newpage=1,2,3; - breakpage=4; num_top=4] newpage and breakpage, heading level, used by LaTeX -to breakpages. breakpage: starts on a new page in single column text and -on a new column in double column text; newpage: starts on a new page for -both single and double column texts. num_top=4 [auto-number document, starting - at level 4. the new default is to provide 3 levels, as in 1 level 4, 1.1 - 1.1.1 level 6, markup to be merged within level] num_extract [take numbering - of headings provided (manually in and use for numbering of Available where - a clear numbering structure is without the repetition of a number in a - header.] [In 0.38 notation, you would map to the equivalent levels, the examples - provided would map to the following new=A,B,C; break=1; num_top=1 [or newpage=A,B,C; -breakpage=1; num_top=1] see headings] -<p> <b>@bold:</b> [regular expression of words/phrases - to be made bold] -<p> <b>@italics:</b> [regular expression of words/phrases to italicise] +a synonym for @toc:) +<p> <b>@level:</b> newpage=3; breakpage=4 [paragraph level, + used by latex to breakpages, the page is optional eg. in newpage] +<p> <b>@markup:</b> +information on the markup used, e.g. new=1,2,3; break=4; num_top=4 [or is +newpage=1,2,3; breakpage=4; num_top=4] newpage and breakpage, heading level, +used by LaTeX to breakpages. breakpage: starts on a new page in single column +text and on a new column in double column text; newpage: starts on a new +page for both single and double column texts. num_top=4 [auto-number document, + starting at level 4. the a new default is to provide 3 levels, as in 1 level + 4, 1.1 1.1.1 level 6, markup to be merged within level] num_extract [take + numbering of headings provided (manually in marked up source document), + and use for numbering of segments. Available where a clear numbering structure + is provided within document, without the repetition of a number in a header.] +[In 0.38 notation, you would map to the equivalent levels, the examples + provided would map to the following new=A,B,C; break=1; num_top=1 [or newpage=A,B,C; +breakpage=1; num_top=1] see headings] +<p> <b>@bold:</b> [regular expression of words/phrases + to be made bold] +<p> <b>@italics:</b> [regular expression of words/phrases to italicise] <p> <b>@vocabulary:</b> name of taxonomy/vocabulary/wordlist to use against document <p> <b>@skin:</b> skin_doc_[name_of_desired_document_skin] skins change default settings related to the appearance of documents generated, such as the -urls of the home site, and the icon/logo for the document or site. -<p> +urls of the home site, and the icon/logo for the document or site. +<p> <dl> -<dt><b> @man: - 8;</b> </dt> -<dd> name=sisu - documents: markup, structuring, publishing in multiple standard - formats, and search; synopsis=sisu in [-abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0-9] - [filename/wildcard ] sisu [-Ddcv] [instruction] sisu [-CcFLSVvW] the man +<dt><b>@man: +8;</b> </dt> +<dd>name=sisu - documents: markup, structuring, publishing in multiple standard +formats, and search; synopsis=sisu [-abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0-9] +[filename/wildcard ] sisu [-Ddcv] [instruction] sisu [-CcFLSVvW] the man page category number (default 1) and special tags used in preparing man -<p>page headings +<p>page headings <p> <b>@links:</b> { <b>SiSU</b> }<a href='http://www.jus.uio.no/sisu/;'>http://www.jus.uio.no/sisu/;</a> { FSF }<a href='http://www.fsf.org'>http://www.fsf.org</a> -<p> <b>@promo:</b> sisu, ruby, search_libre_docs, open_society [places content in - right pane in html, makes use of commented out sample in document sample: -and promo.yml, commented out sample in document free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst] - +<p> <b>@promo:</b> sisu, ruby, search_libre_docs, open_society [places content in + right pane in html, makes use of commented out sample in document and promo.yml, + commented out sample in document <p> </dd> </dl> -9. MARKUP OF SUBSTANTIVE TEXT -<p> 9.1 HEADING LEVELS -<p> Heading levels are -:A~ ,:B~ ,:C~ ,1~ ,2~ ,3~ ... :A - :C being part / section headings, followed -by other heading levels, and 1 -6 being headings followed by substantive -text or sub-headings. :A~ usually the title :A~? conditional level 1 heading -(used where a stand-alone document may be imported into another) -<p> <b>:A~ [heading - text]</b> Top level heading [this usually has similar content to the ] NOTE: -the heading levels described here are in 0.38 notation, see heading -<p> <b>:B~ - [heading text]</b> Second level heading [this is a heading level divider] -<p> - <b>:C~ [heading text]</b> Third level heading [this is a heading level divider] - -<p> <b>1~ [heading text]</b> Top level heading preceding substantive text of document -or sub-heading 2, the heading level that would normally be marked 1. or 2. -or 3. etc. in a document, and the level on which sisu by default would break -html output into named segments, names are provided automatically if none -are given (a number), otherwise takes the form 1~my_filename_for_this_segment - -<p> <b>2~ [heading text]</b> Second level heading preceding substantive text of -document or sub-heading 3, the heading level that would normally be marked -1.1 or 1.2 or 1.3 or 2.1 etc. in a document. -<p> <b>3~ [heading text]</b> Third level -heading preceding substantive text of document, that would normally be -marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document -<p> +9. MARKUP OF SUBSTANTIVE TEXT +<p> 9.1 HEADING + +<p>LEVELS +<p> Heading levels are :A~ ,:B~ ,:C~ ,1~ ,2~ ,3~ ... :A - :C being part +/ section headings, followed by other heading levels, and 1 -6 being headings +followed by substantive text or sub-headings. :A~ usually the title :A~? +conditional level 1 heading (used where a stand-alone document may be imported +into another) +<p> <b>:A~ [heading text]</b> Top level heading [this usually has + similar content to the ] NOTE: the heading levels described here are in +0.38 notation, see heading +<p> <b>:B~ [heading text]</b> Second level heading [this + is a heading level divider] +<p> <b>:C~ [heading text]</b> Third level heading [this + is a heading level divider] +<p> <b>1~ [heading text]</b> Top level heading preceding +substantive text of document or sub-heading 2, the heading level that would +normally be marked 1. or 2. or 3. etc. in a document, and the level on which +sisu by default would break html output into named segments, names are +provided automatically if none are given (a number), otherwise takes the + +<p>form 1~my_filename_for_this_segment +<p> <b>2~ [heading text]</b> Second level heading +preceding substantive text of document or sub-heading 3, the heading level +that would normally be marked 1.1 or 1.2 or 1.3 or 2.1 etc. in a document. +<p> +<b>3~ [heading text]</b> Third level heading preceding substantive text of document, +that would normally be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document + +<p> <p> <br> <pre> 1~filename level 1 heading, % the primary division such as Chapter that is followed by substantive text, and may be further subdivided (this is the level on which by default html segments are made) </pre> -<p> 9.2 FONT ATTRIBUTES -<p> <b>markup example:</b> -<p> +<p> 9.2 FONT ATTRIBUTES +<p> <b>markup example:</b> +<p> <p> <br> <pre> normal text !{emphasis}! *{bold text}* _{underscore}_ /{italics}/ normal text @@ -951,228 +960,230 @@ html segments are made) *{bold text}* _{underscore}_ /{italics}/ - + ^{superscript}^ ,{subscript}, +{inserted text}+ -{strikethrough}- </pre> -<p> <b>resulting output:</b> -<p> normal text <em>emphasis</em> <b>bold text</b> <i>underscore</i> <i>italics</i> +<p> <b>resulting output:</b> +<p> normal text <b>emphasis</b> <b>bold text</b> <i>underscore</i> <i>italics</i> <cite>citation</cite> ^superscript^ [subscript] <ins>inserted text</ins> <del>strikethrough</del> -<p> normal text -<p> <em>emphasis</em> -<p> <b>bold text</b> -<p> <i>underscore</i> -<p> <i>italics</i> +<p> normal text +<p> +<p> <b>bold text</b> +<p> <i>underscore</i> +<p> <i>italics</i> <p> <cite>citation</cite> - -<p> ^superscript^ -<p> [subscript] -<p> <ins>inserted text</ins> +<p> + ^superscript^ +<p> [subscript] +<p> <ins>inserted text</ins> <p> <del>strikethrough</del> -<p> 9.3 INDENTATION AND BULLETS -<p> <b>markup example:</b> -<p> +<p> 9.3 INDENTATION AND BULLETS +<p> <b>markup example:</b> +<p> <p> <br> <pre> ordinary paragraph _1 indent paragraph one step _2 indent paragraph two steps _9 indent paragraph nine steps </pre> -<p> <b>resulting output:</b> -<p> ordinary paragraph +<p> +<p> <b>resulting output:</b> +<p> ordinary paragraph <p> indent paragraph one step<br> - + <p> indent paragraph two steps<br> - + <p> indent paragraph nine steps<br> - -<p> <b>markup example:</b> -<p> + +<p> <b>markup example:</b> +<p> <p> <br> -<pre> * bullet text +<pre> _* bullet text _1* bullet text, first indent _2* bullet text, two step indent </pre> -<p> <b>resulting output:</b> -<p> * bullet text +<p> <b>resulting output:</b> +<p> * bullet text <p> * bullet text, first indent<br> - + <p> * bullet text, two step indent<br> - + <p> Numbered List (not to be confused with headings/titles, (document structure)) -<p> <b>markup example:</b> -<p> +<p> <b>markup example:</b> +<p> <p> <br> <pre> # numbered list numbered list 1., 2., 3, etc. _# numbered list numbered list indented a., b., c., d., etc. </pre> -<p> 9.4 FOOTNOTES / ENDNOTES +<p> 9.4 FOOTNOTES / ENDNOTES <p> Footnotes and endnotes not distinguished in markup. They are automatically numbered. Depending on the output file format (html, odf, pdf etc.), the document output selected will have either footnotes -or endnotes. -<p> <b>markup example:</b> -<p> +or endnotes. +<p> <b>markup example:</b> +<p> <p> <br> <pre> ~{ a footnote or endnote }~ </pre> -<p> <b>resulting output:</b> -<p> [^11] -<p> <b>markup example:</b> -<p> +<p> <b>resulting output:</b> +<p> [^11] +<p> <b>markup example:</b> +<p> <p> <br> <pre> normal text~{ self contained endnote marker & endnote in one }~ continues </pre> -<p> <b>resulting output:</b> -<p> normal text[^12] continues -<p> <b>markup example:</b> -<p> +<p> <b>resulting output:</b> +<p> normal text[^12] continues +<p> <b>markup example:</b> +<p> <p> <br> <pre> normal text ~{* unnumbered asterisk footnote/endnote, insert multiple asterisks if required }~ continues normal text ~{** another unnumbered asterisk footnote/endnote }~ continues </pre> -<p> <b>resulting output:</b> -<p> normal text [^*] continues -<p> normal text [^**] continues +<p> <b>resulting output:</b> +<p> normal text [^*] continues +<p> normal text [^**] continues -<p> <b>markup example:</b> -<p> +<p> +<p> <b>markup example:</b> +<p> <p> <br> <pre> normal text ~[* editors notes, numbered asterisk footnote/endnote series ]~ continues normal text ~[+ editors notes, numbered asterisk footnote/endnote series ]~ continues </pre> -<p> <b>resulting output:</b> -<p> normal text [^*3] continues -<p> normal text [^+2] continues +<p> <b>resulting output:</b> +<p> normal text [^*3] continues +<p> normal text [^+2] continues -<p> <b>Alternative endnote pair notation for footnotes/endnotes:</b> -<p> +<p> +<p> <b>Alternative endnote pair notation for footnotes/endnotes:</b> +<p> <p> <br> -<pre> - % note the endnote marker +<pre> % note the endnote marker normal text~^ continues ^~ endnote text following the paragraph in which the marker occurs </pre> -<p> the standard and pair notation cannot be mixed in the same document +<p> the standard and pair notation cannot be mixed in the same document <p> -<p>9.5 LINKS -<p> 9.5.1 NAKED URLS WITHIN TEXT, DEALING WITH URLS +<p>9.5 LINKS +<p> 9.5.1 NAKED URLS WITHIN TEXT, DEALING WITH URLS <p> urls are found within text and marked up automatically. A url within text is automatically hyperlinked to itself and by default decorated with angled braces, unless they are contained within a code block (in which case they are passed as normal text), or escaped by a preceding underscore (in which case the decoration -is omitted). -<p> <b>markup example:</b> -<p> +is omitted). +<p> <b>markup example:</b> +<p> <p> <br> <pre> normal text http://www.jus.uio.no/sisu continues </pre> -<p> <b>resulting output:</b> +<p> <b>resulting output:</b> <p> normal text <<a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a> -> continues +> continues <p> An -<p>escaped url without decoration -<p> <b>markup example:</b> -<p> +<p>escaped url without decoration +<p> <b>markup example:</b> +<p> <p> <br> <pre> normal text http://www.jus.uio.no/sisu continues deb http://www.jus.uio.no/sisu/archive unstable main non-free </pre> -<p> <b>resulting output:</b> +<p> <b>resulting output:</b> <p> normal text <a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a> - continues + continues <p> deb <p><a href='http://www.jus.uio.no/sisu/archive'>http://www.jus.uio.no/sisu/archive</a> - unstable main non-free + unstable main non-free <p> where a code block is used there is neither decoration nor hyperlinking, code blocks are discussed -<p>later in this document -<p> <b>resulting output:</b> -<p> +<p>later in this document +<p> <b>resulting output:</b> +<p> <p> <br> <pre> deb http://www.jus.uio.no/sisu/archive unstable main non-free deb-src http://www.jus.uio.no/sisu/archive unstable main non-free </pre> -<p> To link text or an image to a url the markup is as follows +<p> To link text or an image to a url the markup is as follows <p> <b>markup example:</b> -<p> +<p> <p> <br> <pre> about { SiSU }http://url.org markup </pre> -<p> 9.5.2 LINKING TEXT -<p> <b>resulting output:</b> +<p> 9.5.2 LINKING TEXT +<p> <b>resulting output:</b> <p> about SiSU <<a href='http://www.jus.uio.no/sisu/'>http://www.jus.uio.no/sisu/</a> > -<p>markup +<p>markup <p> A shortcut notation is available so the url link may also be provided -<p>automatically as a footnote -<p> <b>markup example:</b> -<p> +<p>automatically as a footnote +<p> <b>markup example:</b> +<p> <p> <br> <pre> about {~^ SiSU }http://url.org markup </pre> -<p> <b>resulting output:</b> +<p> <b>resulting output:</b> <p> about SiSU <<a href='http://www.jus.uio.no/sisu/'>http://www.jus.uio.no/sisu/</a> -> [^13] markup +> [^13] markup <p> -<p>9.5.3 LINKING IMAGES -<p> <b>markup example:</b> -<p> +<p>9.5.3 LINKING IMAGES +<p> <b>markup example:</b> +<p> <p> <br> -<pre> [ tux.png ] +<pre> [ tux.png ] % various url linked images - [ tux.png ] - [ GnuDebianLinuxRubyBetterWay.png ] + [ tux.png ] + [ GnuDebianLinuxRubyBetterWay.png ] {~^ ruby_logo.png </pre> -<p> <b>resulting output:</b> -<p> [ tux.png ] -<p> tux.png 64x80 +<p> <b>resulting output:</b> +<p> [ tux.png ] +<p> tux.png 64x80 <p> [ ruby_logo (png missing) - ] [^14] -<p> GnuDebianLinuxRubyBetterWay.png 100x101 and Ruby + ] [^14] +<p> GnuDebianLinuxRubyBetterWay.png 100x101 and Ruby <p> <b>linked url footnote -<p>shortcut</b> -<p> +<p>shortcut</b> +<p> <p> <br> <pre> {~^ [text to link] }http://url.org % maps to: { [text to link] }http://url.org ~{ http://url.org }~ % which produces hyper-linked text within a document/paragraph, with an endnote providing the url for the text location used in the hyperlink </pre> -<p> +<p> <p> <br> <pre> text marker *~name </pre> <p> note at a heading level the same is automatically achieved by providing names to headings 1, 2 and 3 i.e. 2~[name] and 3~[name] or in the case of -auto-heading numbering, without further intervention. -<p> 9.6 GROUPED TEXT +auto-heading numbering, without further intervention. +<p> 9.6 GROUPED TEXT <p> 9.6.1 -<p>TABLES -<p> Tables may be prepared in two either of two forms +<p>TABLES +<p> Tables may be prepared in two either of two forms <p> <b>markup example:</b> -<p> +<p> <p> <br> <pre> table{ c3; 40; 30; 30; This is a table @@ -1183,14 +1194,14 @@ auto-heading numbering, without further intervention. column three of row two, and so on }table </pre> -<p> <b>resulting output:</b> +<p> <b>resulting output:</b> <p> [table omitted, see other document formats]<br> - + <p> a second form may be easier to work with in cases where there is not -<p>much information in each column -<p> <b>markup example:</b> [^15] -<p> +<p>much information in each column +<p> <b>markup example:</b> [^15] +<p> <p> <br> <pre> !_ Table 3.1: Contributors to Wikipedia, January 2001 - June 2005 {table~h 24; 12; 12; 12; 12; 12; 12;} @@ -1202,38 +1213,38 @@ auto-heading numbering, without further intervention. 8,442| 16,945 Very active contributors*** | 0| 31| 190| 692| 1,639| 3,016 - No. of English language articles| 25| 16,000| 101,000| 190,000| + No. of English language articles| 25| 16,000| 101,000| 190,000| 320,000| 630,000 - No. of articles, all languages | 25| 19,000| 138,000| 490,000| + No. of articles, all languages | 25| 19,000| 138,000| 490,000| 862,000|1,600,000 \* Contributed at least ten times; \** at least 5 times in last month; \* more than 100 times in last month. </pre> -<p> <b>resulting output:</b> +<p> <b>resulting output:</b> <p> <b>Table 3.1: Contributors to Wikipedia, January 2001 -- June 2005</b> +- June 2005</b> <p> [table omitted, see other document formats]<br> - + <p> * Contributed at least ten times; ** at least 5 times in last month; -*** more than 100 times in last month. -<p> 9.6.2 POEM -<p> <b>basic markup:</b> -<p> +*** more than 100 times in last month. +<p> 9.6.2 POEM +<p> <b>basic markup:</b> +<p> <p> <br> <pre> poem{ Your poem here }poem Each verse in a poem is given a separate object number. </pre> -<p> <b>markup example:</b> -<p> +<p> <b>markup example:</b> +<p> <p> <br> <pre> poem{ ’Fury said to a mouse, That he met in the house, - + both go to law: I will prosecute @@ -1258,13 +1269,13 @@ auto-heading numbering, without further intervention. wasting our breath. - + judge, I’ll be jury, Said cunning old Fury: - + try the whole cause, @@ -1275,115 +1286,71 @@ auto-heading numbering, without further intervention. death. }poem </pre> -<p> <b>resulting output:</b> -<p> +<p> <b>resulting output:</b> +<p> <p> ’Fury said to a<br> - <p> - mouse, That he<br> - <p> - met in the<br> - <p> - house,<br> - <p> - <br> - <p> - both go to<br> - <p> - law: I will<br> - <p> - prosecute<br> - <p> - YOU. --Come,<br> - <p> - I’ll take no<br> - <p> - denial; We<br> - <p> - must have a<br> - <p> - trial: For<br> - <p> - really this<br> - <p> - morning I’ve<br> - <p> - nothing<br> - <p> - to do.<br> - <p> - Said the<br> - <p> - mouse to the<br> - <p> - cur,<br> - <p> - a trial,<br> - <p> - dear Sir,<br> - <p> - With<br> - <p> - no jury<br> - <p> - or judge,<br> - <p> - would be<br> - <p> - wasting<br> - <p> - our<br> - <p> - breath.<br> - <p> - <br> - <p> - judge, I’ll<br> - <p> - be jury,<br> - <p> - Said<br> - <p> - cunning<br> - <p> - old Fury:<br> - <p> - <br> - <p> - try the<br> - <p> - whole<br> - <p> - cause,<br> - <p> - and<br> - <p> - condemn<br> - <p> - you<br> - <p> - to<br> - <p> - death.<br> - <p> - -<p> 9.6.3 GROUP -<p> <b>basic markup:</b> -<p> + mouse, That he<br> + met in the<br> + house,<br> + <br> + both go to<br> + law: I will<br> + prosecute<br> + YOU. --Come,<br> + I’ll take no<br> + denial; We<br> + must have a<br> + trial: For<br> + really this<br> + morning I’ve<br> + nothing<br> + to do.<br> + Said the<br> + mouse to the<br> + cur,<br> + a trial,<br> + dear Sir,<br> + With<br> + no jury<br> + or judge,<br> + would be<br> + wasting<br> + our<br> + breath.<br> + <br> + judge, I’ll<br> + be jury,<br> + Said<br> + cunning<br> + old Fury:<br> + <br> + try the<br> + whole<br> + cause,<br> + and<br> + condemn<br> + you<br> + to<br> + death.<br> + +<p> 9.6.3 GROUP +<p> <b>basic markup:</b> +<p> <p> <br> <pre> group{ Your grouped text here }group A group is treated as an object and given a single object number. </pre> -<p> <b>markup example:</b> -<p> +<p> <b>markup example:</b> +<p> <p> <br> <pre> group{ ’Fury said to a mouse, That he met in the house, - + both go to law: I will prosecute @@ -1408,13 +1375,13 @@ auto-heading numbering, without further intervention. wasting our breath. - + judge, I’ll be jury, Said cunning old Fury: - + try the whole cause, @@ -1425,115 +1392,71 @@ auto-heading numbering, without further intervention. death. }group </pre> -<p> <b>resulting output:</b> -<p> +<p> <b>resulting output:</b> +<p> <p> ’Fury said to a<br> - <p> - mouse, That he<br> - <p> - met in the<br> - <p> - house,<br> - <p> - <br> - <p> - both go to<br> - <p> - law: I will<br> - <p> - prosecute<br> - <p> - YOU. --Come,<br> - <p> - I’ll take no<br> - <p> - denial; We<br> - <p> - must have a<br> - <p> - trial: For<br> - <p> - really this<br> - <p> - morning I’ve<br> - <p> - nothing<br> - <p> - to do.<br> - <p> - Said the<br> - <p> - mouse to the<br> - <p> - cur,<br> - <p> - a trial,<br> - <p> - dear Sir,<br> - <p> - With<br> - <p> - no jury<br> - <p> - or judge,<br> - <p> - would be<br> - <p> - wasting<br> - <p> - our<br> - <p> - breath.<br> - <p> - <br> - <p> - judge, I’ll<br> - <p> - be jury,<br> - <p> - Said<br> - <p> - cunning<br> - <p> - old Fury:<br> - <p> - <br> - <p> - try the<br> - <p> - whole<br> - <p> - cause,<br> - <p> - and<br> - <p> - condemn<br> - <p> - you<br> - <p> - to<br> - <p> - death.<br> - <p> - -<p> 9.6.4 CODE + mouse, That he<br> + met in the<br> + house,<br> + <br> + both go to<br> + law: I will<br> + prosecute<br> + YOU. --Come,<br> + I’ll take no<br> + denial; We<br> + must have a<br> + trial: For<br> + really this<br> + morning I’ve<br> + nothing<br> + to do.<br> + Said the<br> + mouse to the<br> + cur,<br> + a trial,<br> + dear Sir,<br> + With<br> + no jury<br> + or judge,<br> + would be<br> + wasting<br> + our<br> + breath.<br> + <br> + judge, I’ll<br> + be jury,<br> + Said<br> + cunning<br> + old Fury:<br> + <br> + try the<br> + whole<br> + cause,<br> + and<br> + condemn<br> + you<br> + to<br> + death.<br> + +<p> 9.6.4 CODE <p> Code tags are used to escape regular sisu markup, and have been used extensively within this document to provide examples of <b>SiSU</b> markup. You cannot however use code tags to escape code tags. They are however -used in the same way as group or poem tags. +used in the same way as group or poem tags. <p> A code-block is treated as -an object and given a single object number. [an more than 100 times in last +an object and given a single object number. [an more than 100 times in last month. option to number each line of code may be considered at more than -100 times in last month. some later time] +100 times in last month. some later time] <p> <b>use of code tags instead of -poem compared, resulting output:</b> -<p> +poem compared, resulting output:</b> +<p> <p> <br> <pre> ’Fury said to a mouse, That he met in the house, - + both go to law: I will prosecute @@ -1558,13 +1481,13 @@ poem compared, resulting output:</b> wasting our breath. - + judge, I’ll be jury, Said cunning old Fury: - + try the whole cause, @@ -1574,7 +1497,7 @@ poem compared, resulting output:</b> to death. </pre> -<p> 10. COMPOSITE DOCUMENTS MARKUP +<p> 10. COMPOSITE DOCUMENTS MARKUP <p> It is possible to build a document by creating a master document that requires other documents. The documents required may be complete documents that could be generated independently, @@ -1588,11 +1511,11 @@ within a master document <b>.sst</b> regular markup file, or <b>.ssi</b> (insert <p>A secondary file of the composite document is built prior to processing -<p>with the same prefix and the suffix <b>._sst</b> +<p>with the same prefix and the suffix <b>._sst</b> <p> basic markup for importing a -<p>document into a master document -<p> +<p>document into a master document +<p> <p> <br> <pre> << filename1.sst << filename2.ssi @@ -1602,83 +1525,83 @@ results in the text thus linked becoming hyperlinked to the document it is calling in which is convenient for editing. Alternative markup for importation of documents under consideration, and occasionally supported have been. -<p> +<p> <p> <br> <pre> << filename.ssi <<{filename.ssi} % using textlink alternatives << |filename.ssi|@|^| </pre> -<p> MARKUP SYNTAX HISTORY +<p> MARKUP SYNTAX HISTORY <p> 11. NOTES RELATED TO FILES-TYPES AND MARKUP SYNTAX - + <p> 0.38 is substantially current, depreciated 0.16 supported, though file -<p>names were changed at 0.37 -<p> * sisu --query=[sisu version [0.38] or ’history] +<p>names were changed at 0.37 +<p> * sisu --query=[sisu version [0.38] or ’history] -<p> provides a short history of changes to <b>SiSU</b> markup +<p> provides a short history of changes to <b>SiSU</b> markup <p> <b>0.57</b> (2007w34/4) <b>SiSU</b> 0.57 is the same as 0.42 with the introduction of some a shortcut to -use the headers @title and @creator in the first heading [expanded using - the contents of the headers @title: and @author:] -<p> +use the headers @title and @creator in the first heading [expanded using + the and @author:] +<p> <p> <br> <pre> :A~ @title by @author </pre> <p> <b>0.52</b> (2007w14/6) declared document type identifier at start of text/document: <p> .B SiSU<br> - 0.52 -<p> or, backward compatible using the comment marker: + 0.52 +<p> or, backward compatible using the comment marker: <p> %<br> - <b>SiSU</b> 0.38 -<p> variations include ’ <b>SiSU</b> (text|master|insert) [version]’ and ’sisu-[version]’ + <b>SiSU</b> 0.38 +<p> variations include ’ <b>SiSU</b> (text|master|insert) [version]’ and ’sisu-[version]’ -<p> <b>0.51</b> (2007w13/6) skins changed (simplified), markup unchanged +<p> <b>0.51</b> (2007w13/6) skins changed (simplified), markup unchanged <p> <b>0.42</b> (2006w27/4) -* (asterisk) type endnotes, used e.g. in relation to author +* (asterisk) type endnotes, used e.g. in relation to author <p> <b>SiSU</b> 0.42 is the same as 0.38 with the introduction of some additional endnote types, <p> Introduces some variations on endnotes, in particular the use of the -<p>asterisk -<p> +<p>asterisk +<p> <p> <br> <pre> ~{* for example for describing an author }~ and ~{** for describing a second author }~ </pre> -<p> * for example for describing an author +<p> * for example for describing an author <p> ** for describing a second author -<p> and -<p> +<p> and +<p> <p> <br> <pre> ~[* my note ]~ or ~[+ another note ]~ </pre> -<p> which numerically increments an asterisk and plus respectively +<p> which numerically increments an asterisk and plus respectively <p> *1 my -<p>note +1 another note +<p>note +1 another note <p> <b>0.38</b> (2006w15/7) introduced new/alternative notation for headers, e.g. @title: (instead of 0~title), and accompanying document -structure markup, :A,:B,:C,1,2,3 (maps to previous 1,2,3,4,5,6) +structure markup, :A,:B,:C,1,2,3 (maps to previous 1,2,3,4,5,6) <p> <b>SiSU</b> 0.38 introduced alternative experimental header and heading/structure markers, -<p> +<p> <p> <br> <pre> @headername: and headers :A~ :B~ :C~ 1~ 2~ 3~ </pre> -<p> as the equivalent of: -<p> +<p> as the equivalent of: +<p> <p> <br> <pre> 0~headername and headers 1~ 2~ 3~ 4~ 5~ 6~ </pre> <p> The internal document markup of <b>SiSU</b> 0.16 remains valid and standard Though -<p>note that <b>SiSU</b> 0.37 introduced a new file naming convention +<p>note that <b>SiSU</b> 0.37 introduced a new file naming convention <p> <b>SiSU</b> has in effect two sets of levels to be considered, using 0.38 notation A-C headings/levels, pre-ordinary paragraphs /pre-substantive text, and 1-3 headings/levels, levels @@ -1694,45 +1617,45 @@ your face and likely to be understood fairly quickly); the substantive text follows levels 1,2,3 and it is ’nice’ to do most work in those levels <p> <b>0.37</b> (2006w09/7) introduced new file naming convention, .sst (text), .ssm -(master), .ssi (insert), markup syntax unchanged +(master), .ssi (insert), markup syntax unchanged <p> <b>SiSU</b> 0.37 introduced new file naming convention, using the file extensions .sst .ssm and .ssi to replace .s1 .s2 .s3 .r1 .r2 .r3 and .si<br> - -<p> this is captured by the following file ’rename’ instruction: -<p> + +<p> this is captured by the following file ’rename’ instruction: +<p> <p> <br> <pre> rename ’s/.s[123]$/.sst/’ *.s{1,2,3} rename ’s/.r[123]$/.ssm/’ *.r{1,2,3} rename ’s/.si$/.ssi/’ *.si </pre> -<p> The internal document markup remains unchanged, from <b>SiSU</b> 0.16 +<p> The internal document markup remains unchanged, from <b>SiSU</b> 0.16 <p> <b>0.35</b> (2005w52/3) -sisupod, zipped content file introduced +sisupod, zipped content file introduced <p> <b>0.23</b> (2005w36/2) utf-8 for markup -<p>file +<p>file <p> <b>0.22</b> (2005w35/3) image dimensions may be omitted if rmagick is available -<p>to be relied upon -<p> <b>0.20.4</b> (2005w33/4) header 0~links +<p>to be relied upon +<p> <b>0.20.4</b> (2005w33/4) header 0~links <p> <b>0.16</b> (2005w25/2) substantial changes introduced to make markup cleaner, header 0~title type, and headings - [1-6]~ introduced, also percentage sign (%) at start of a text line as comment +[1-6]~ introduced, also percentage sign (%) at start of a text line as comment -<p>marker -<p> <b>SiSU</b> 0.16 (0.15 development branch) introduced the use of +<p>marker +<p> <b>SiSU</b> 0.16 (0.15 development branch) introduced the use of <p> the -header 0~ and headings/structure 1~ 2~ 3~ 4~ 5~ 6~ +header 0~ and headings/structure 1~ 2~ 3~ 4~ 5~ 6~ <p> in place of the 0.1 -header, heading/structure notation +header, heading/structure notation <p> <b>SiSU</b> 0.1 headers and headings structure -represented by header 0{~ and headings/structure 1{ 2{ 3{ 4{~ 5{ 6{ +represented by header 0{~ and headings/structure 1{ 2{ 3{ 4{~ 5{ 6{ <p> 12. -SISU FILETYPES +SISU FILETYPES <p> <b>SiSU</b> has plaintext and binary filetypes, and can process -either type of document. -<p> 12.1 .SST .SSM .SSI MARKED UP PLAIN TEXT +either type of document. +<p> 12.1 .SST .SSM .SSI MARKED UP PLAIN TEXT <p> <b>SiSU</b> documents are prepared as plain-text (utf-8) files with <b>SiSU</b> markup. They may make reference to and contain images (for example), which are stored in the directory @@ -1741,264 +1664,259 @@ that may be distinguished by the file extension used: regular text .sst; master documents, composite documents that incorporate other text, which can be any regular text or text insert; and inserts the contents of which are like regular text except these are marked .ssi and are not processed.<br> - + <p> <b>SiSU</b> processing can be done directly against a sisu documents; which may be located locally or on a remote server for which a url is provided. -<p> <b>SiSU</b> source markup can be shared with the command: -<p> sisu -s [filename]<br> - -<p> 12.1.1 SISU TEXT - REGULAR FILES (.SST) +<p> <b>SiSU</b> source markup can be shared with the command: +<p> sisu -s [filename]<br> + +<p> 12.1.1 SISU TEXT - REGULAR FILES (.SST) <p> The most common form of document -in <b>SiSU</b> , see the section on <b>SiSU</b> markup. +in <b>SiSU</b> , see the section on <b>SiSU</b> markup. <p> <<a href='http://www.jus.uio.no/sisu/sisu_markup'>http://www.jus.uio.no/sisu/sisu_markup</a> > <p> <<a href='http://www.jus.uio.no/sisu/sisu_manual'>http://www.jus.uio.no/sisu/sisu_manual</a> -> -<p> 12.1.2 SISU MASTER FILES (.SSM) +> +<p> 12.1.2 SISU MASTER FILES (.SSM) <p> Composite documents which incorporate other <b>SiSU</b> documents which may be either regular <b>SiSU</b> text .sst which may be generated independently, or inserts prepared solely for the purpose of being incorporated into one or more master documents. <p> The mechanism by which master files incorporate other documents is described -as one of the headings under under <b>SiSU</b> markup in the <b>SiSU</b> manual. +as one of the headings under under <b>SiSU</b> markup in the <b>SiSU</b> manual. <p> Note: Master documents may be prepared in a similar way to regular documents, and processing will occur normally if a .sst file is renamed .ssm without requiring any other documents; the .ssm marker flags that the document may -contain other documents. +contain other documents. <p> Note: a secondary file of the composite document -is built prior to processing with the same prefix and the suffix ._sst [^16] +is built prior to processing with the same prefix and the suffix ._sst [^16] <p> <<a href='http://www.jus.uio.no/sisu/sisu_markup'>http://www.jus.uio.no/sisu/sisu_markup</a> -> +> <p> <<a href='http://www.jus.uio.no/sisu/sisu_manual'>http://www.jus.uio.no/sisu/sisu_manual</a> > -<p> 12.1.3 SISU INSERT FILES (.SSI) +<p> 12.1.3 SISU INSERT FILES (.SSI) <p> Inserts are documents prepared solely for the purpose of being incorporated into one or more master documents. They resemble regular <b>SiSU</b> text files except they are ignored by the <b>SiSU</b> processor. Making a file a .ssi file is a quick and convenient way of flagging that -it is not intended that the file should be processed on its own. +it is not intended that the file should be processed on its own. <p> 12.2 SISUPOD, -ZIPPED BINARY CONTAINER (SISUPOD.ZIP, .SSP) +ZIPPED BINARY CONTAINER (SISUPOD.ZIP, .SSP) <p> A sisupod is a zipped <b>SiSU</b> text file or set of <b>SiSU</b> text files and any associated images that they -contain (this will be extended to include sound and multimedia-files) -<p> +contain (this will be extended to include sound and multimedia-files) +<p> <b>SiSU</b> plaintext files rely on a recognised directory structure to find contents such as images associated with documents, but all images for example for all documents contained in a directory are located in the sub-directory _sisu/image. Without the ability to create a sisupod it can be inconvenient to manually identify all other files associated with a document. A sisupod automatically bundles all associated files with the document that is turned -into a pod. +into a pod. <p> The structure of the sisupod is such that it may for example contain a single document and its associated images; a master document and its associated documents and anything else; or the zipped contents -of a whole directory of prepared <b>SiSU</b> documents. +of a whole directory of prepared <b>SiSU</b> documents. <p> The command to create -a sisupod is: -<p> sisu -S [filename]<br> - -<p> Alternatively, make a pod of the contents of a whole directory: -<p> +a sisupod is: +<p> sisu -S [filename]<br> + +<p> Alternatively, make a pod of the contents of a whole directory: +<p> sisu -S<br> - + <p> <b>SiSU</b> processing can be done directly against a sisupod; which may be -located locally or on a remote server for which a url is provided. +located locally or on a remote server for which a url is provided. <p> <<a href='http://www.jus.uio.no/sisu/sisu_commands'>http://www.jus.uio.no/sisu/sisu_commands</a> > <p> <<a href='http://www.jus.uio.no/sisu/sisu_manual'>http://www.jus.uio.no/sisu/sisu_manual</a> -> +> <p> 13. EXPERIMENTAL ALTERNATIVE INPUT -REPRESENTATIONS -<p> 13.1 ALTERNATIVE XML +REPRESENTATIONS +<p> 13.1 ALTERNATIVE XML <p> <b>SiSU</b> offers alternative XML input representations of documents as a proof of concept, experimental feature. They are however not strictly maintained, and incomplete and should be -handled with care. +handled with care. <p> <b>convert from sst to simple xml representations (sax, -dom and node):</b> -<p> sisu --to-sax [filename/wildcard] or sisu --to-sxs node):<br> - [filename/wildcard]<br> - -<p> sisu --to-dom [filename/wildcard] or sisu --to-sxd node):<br> - [filename/wildcard]<br> - -<p> sisu --to-node [filename/wildcard] or sisu --to-sxn <br> - [filename/wildcard]<br> - +dom and node):</b> +<p> sisu --to-sax [filename/wildcard] or sisu --to-sxs [filename/wildcard]<br> + +<p> sisu --to-dom [filename/wildcard] or sisu --to-sxd [filename/wildcard]<br> + +<p> sisu --to-node [filename/wildcard] or sisu --to-sxn [filename/wildcard]<br> + +<p> <p> <b>convert to sst from any sisu xml representation (sax, dom and node):</b> -<p> sisu --from-xml2sst [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> - -<p> or the same: -<p> sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> - -<p> 13.1.1 XML SAX REPRESENTATION +<p> sisu --from-xml2sst [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> + +<p> or the same: +<p> sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> + +<p> 13.1.1 XML SAX REPRESENTATION <p> To convert from sst to simple xml (sax) -representation: -<p> sisu --to-sax [filename/wildcard] or sisu --to-sxs <br> - [filename/wildcard]<br> - -<p> To convert from any sisu xml representation back to sst +representation: +<p> sisu --to-sax [filename/wildcard] or sisu --to-sxs [filename/wildcard]<br> + +<p> To convert from any sisu xml representation back to sst <p> sisu --from-xml2sst - [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> - -<p> or the same: -<p> sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> - -<p> 13.1.2 XML DOM REPRESENTATION +[filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> + +<p> or the same: +<p> sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> + +<p> 13.1.2 XML DOM REPRESENTATION <p> To convert from sst to simple xml (dom) -representation: -<p> sisu --to-dom [filename/wildcard] or sisu --to-sxd <br> - [filename/wildcard]<br> - -<p> To convert from any sisu xml representation back to sst +representation: +<p> sisu --to-dom [filename/wildcard] or sisu --to-sxd [filename/wildcard]<br> + +<p> To convert from any sisu xml representation back to sst <p> sisu --from-xml2sst - [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> - -<p> or the same: -<p> sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> - -<p> 13.1.3 XML NODE REPRESENTATION +[filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> + +<p> or the same: +<p> sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> + +<p> 13.1.3 XML NODE REPRESENTATION <p> To convert from sst to simple xml (node) -representation: -<p> sisu --to-node [filename/wildcard] or sisu --to-sxn <br> - [filename/wildcard]<br> - -<p> To convert from any sisu xml representation back to sst +representation: +<p> sisu --to-node [filename/wildcard] or sisu --to-sxn [filename/wildcard]<br> + +<p> To convert from any sisu xml representation back to sst <p> sisu --from-xml2sst - [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> - -<p> or the same: -<p> sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> - -<p> 14. CONFIGURATION -<p> 14.1 DETERMINING THE CURRENT CONFIGURATION +[filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> + +<p> or the same: +<p> sisu --from-sxml [filename/wildcard [.sxs.xml,.sxd.xml,sxn.xml]]<br> + +<p> 14. CONFIGURATION +<p> 14.1 DETERMINING THE CURRENT CONFIGURATION <p> Information on the current configuration of <b>SiSU</b> should be available with the help -command: +command: <p> sisu -v<br> - -<p> which is an alias for: + +<p> which is an alias for: <p> sisu --help env<br> - + <p> Either of these should be executed from within a directory that contains -sisu markup source documents. -<p> 14.2 CONFIGURATION FILES (CONFIG.YML) +sisu markup source documents. +<p> 14.2 CONFIGURATION FILES (CONFIG.YML) <p> <b>SiSU</b> configration parameters are adjusted in the configuration file, which can be used to override the defaults set. This includes such things as which directory interim processing should be done in and where the generated -output should be placed. +output should be placed. <p> The <b>SiSU</b> configuration file is a yaml file, which -means indentation is significant. +means indentation is significant. <p> <b>SiSU</b> resource configuration is determined -by looking at the following files if they exist: +by looking at the following files if they exist: <p> ./_sisu/sisurc.yml<br> - + <p> ~/.sisu/sisurc.yml<br> - + <p> /etc/sisu/sisurc.yml<br> - -<p> The search is in the order listed, and the first one found is used. + +<p> The search is in the order listed, and the first one found is used. <p> In the absence of instructions in any of these it falls back to the internal -program defaults. +program defaults. <p> Configuration determines the output and processing directories -and the database access details. +and the database access details. <p> If <b>SiSU</b> is installed a sample sisurc.yml -<p>may be found in /etc/sisu/sisurc.yml -<p> 15. SKINS +<p>may be found in /etc/sisu/sisurc.yml +<p> 15. SKINS <p> Skins modify the default appearance of document output on a document, directory, or site wide basis. -Skins are looked for in the following locations: +Skins are looked for in the following locations: <p> ./_sisu/skin<br> - + <p> ~/.sisu/skin<br> - + <p> /etc/sisu/skin<br> - + <p> <b>Within the skin directory</b> are the following the default sub-directories -for document skins: +for document skins: <p> ./skin/doc<br> - + <p> ./skin/dir<br> - + <p> ./skin/site<br> - + <p> A skin is placed in the appropriate directory and the file named skin_[name].rb <p> The skin itself is a ruby file which modifies the default appearances -set in the program. -<p> 15.1 DOCUMENT SKIN +set in the program. +<p> 15.1 DOCUMENT SKIN <p> Documents take on a document skin, -if the header of the document specifies a skin to be used. -<p> +if the header of the document specifies a skin to be used. +<p> <p> <br> <pre> @skin: skin_united_nations </pre> -<p> 15.2 DIRECTORY SKIN +<p> 15.2 DIRECTORY SKIN <p> A directory may be mapped on to a particular skin, so all documents within that directory take on a particular appearance. If a skin exists in the skin/dir with the same name as the document directory, it will automatically be used for each of the documents in that directory, (except where a document specifies the use of another skin, in the skin/doc -directory). +directory). <p> A personal habit is to place all skins within the doc directory, and symbolic links as needed from the site, or dir directories as required. -<p> 15.3 SITE SKIN -<p> A site skin, modifies the program default skin. +<p> 15.3 SITE SKIN +<p> A site skin, modifies the program default skin. <p> 15.4 SAMPLE -<p>SKINS -<p> With <b>SiSU</b> installed sample skins may be found in: +<p>SKINS +<p> With <b>SiSU</b> installed sample skins may be found in: <p> /etc/sisu/skin/doc and<br> /usr/share/doc/sisu/sisu_markup_samples/dfsg/_sisu/skin/doc<br> - + <p> (or equivalent directory) and if sisu-markup-samples is installed also -under: +under: <p> /usr/share/doc/sisu/sisu_markup_samples/non-free/_sisu/skin/doc<br> - + <p> Samples of list.yml and promo.yml (which are used to create the right -column list) may be found in: +column list) may be found in: <p> /usr/share/doc/sisu/sisu_markup_samples/dfsg/_sisu/skin/yml (or equivalent<br> directory)<br> - -<p> 16. CSS - CASCADING STYLE SHEETS (FOR HTML, XHTML AND XML) + +<p> 16. CSS - CASCADING STYLE SHEETS (FOR HTML, XHTML AND XML) <p> CSS files to modify the appearance of <b>SiSU</b> html, XHTML or XML may be placed in the configuration directory: ./_sisu/css; ~/.sisu/css or; /etc/sisu/css and these will be copied to the<br> - output directories with the command sisu -CC. + output directories with the command sisu -CC. <p> The basic CSS file for html output is html.css, placing a file of that name in directory _sisu/css or equivalent will result in the default file of that name being overwritten. -<p> HTML: html.css -<p> XML DOM: dom.css -<p> XML SAX: sax.css -<p> XHTML: xhtml.css +<p> HTML: html.css +<p> XML DOM: dom.css +<p> XML SAX: sax.css +<p> XHTML: xhtml.css <p> - The default homepage may use homepage.css or html.css + The default homepage may use homepage.css or html.css <p> Under consideration is to permit the placement of a CSS file with a different name in directory _sisu/css directory or equivalent, and change the default CSS file that -is looked for in a skin.[^17] -<p> 17. ORGANISING CONTENT +is looked for in a skin.[^17] +<p> 17. ORGANISING CONTENT <p> 17.1 DIRECTORY STRUCTURE -<p>AND MAPPING +<p>AND MAPPING <p> The output directory root can be set in the sisurc.yml file. Under the root, subdirectories are made for each directory in which a document set resides. If you have a directory named poems or conventions, that directory @@ -2006,7 +1924,7 @@ will be created under the output directory root and the output for all documents contained in the directory of a particular name will be generated to subdirectories beneath that directory (poem or conventions). A document will be placed in a subdirectory of the same name as the document with -the filetype identifier stripped (.sst .ssm) +the filetype identifier stripped (.sst .ssm) <p> The last part of a directory path, representing the sub-directory in which a document set resides, is the directory name that will be used for the output directory. This has @@ -2022,45 +1940,45 @@ named after each institution, and these would be output to the same output directory. Skins could be associated with each institution on a directory basis and resulting documents will take on the appropriate different appearance. -<p> 17.2 ORGANISING CONTENT -<p> 18. HOMEPAGES +<p> 17.2 ORGANISING CONTENT +<p> 18. HOMEPAGES <p> <b>SiSU</b> is about the ability to auto-generate documents. Home pages are regarded as custom built items, and are not created by <b>SiSU</b> <b>SiSU</b> has a default home page, which will not be appropriate for use with other sites, and the means to provide your own home page instead -in one of two ways as part of a site’s configuration, these being: +in one of two ways as part of a site’s configuration, these being: <p> 1. through placing your home page and other custom built documents in the subdirectory _sisu/home/ (this probably being the easier and more convenient option) -<p> 2. through providing what you want as the home page in a skin, +<p> 2. through providing what you want as the home page in a skin, <p> Document sets are contained in directories, usually organised by site or subject. Each directory can/should have its own homepage. See the section on directory -structure and organisation of content. +structure and organisation of content. <p> 18.1 HOME PAGE AND OTHER CUSTOM BUILT -<p>PAGES IN A SUB-DIRECTORY +<p>PAGES IN A SUB-DIRECTORY <p> Custom built pages, including the home page index.html may be placed within the configuration directory _sisu/home/ in any of the locations that is searched for the configuration directory, namely ./_sisu; ~/_sisu; /etc/sisu From there they are copied to the root of the -output directory with the command: +output directory with the command: <p> sisu -CC<br> - -<p> 18.2 HOME PAGE WITHIN A SKIN + +<p> 18.2 HOME PAGE WITHIN A SKIN <p> Skins are described in a separate section, but basically are a file written in the programming language <b>Ruby</b> that may be provided to change the defaults that are provided with sisu with -respect to individual documents, a directories contents or for a site. +respect to individual documents, a directories contents or for a site. <p> If you wish to provide a homepage within a skin the skin should be in the directory _sisu/skin/dir and have the name of the directory for which it is to become the home page. Documents in the directory commercial_law would have the homepage modified in skin_commercial law.rb; or the directory -<p>poems in skin_poems.rb -<p> +<p>poems in skin_poems.rb +<p> <p> <br> <pre> class Home def homepage @@ -2076,20 +1994,20 @@ index.html end end </pre> -<p> 19. MARKUP AND OUTPUT EXAMPLES -<p> 19.1 MARKUP EXAMPLES +<p> 19. MARKUP AND OUTPUT EXAMPLES +<p> 19.1 MARKUP EXAMPLES <p> Current markup examples and document output samples are provided at <<a href='http://www.jus.uio.no/sisu/SiSU/examples.html'>http://www.jus.uio.no/sisu/SiSU/examples.html</a> > <p> Some markup with syntax highlighting may be found under <<a href='http://www.jus.uio.no/sisu/sample/syntax'>http://www.jus.uio.no/sisu/sample/syntax</a> > -but is not as up to date. +but is not as up to date. <p> For some documents hardly any markup at all is required at all, other than a header, and an indication that the levels -to be taken into account by the program in generating its output are. +to be taken into account by the program in generating its output are. <p> 20. -SISU SEARCH - INTRODUCTION +SISU SEARCH - INTRODUCTION <p> <b>SiSU</b> output can easily and conveniently be indexed by a number of standalone indexing tools, such as Lucene, Hyperestraier. @@ -2097,28 +2015,28 @@ indexed by a number of standalone indexing tools, such as Lucene, Hyperestraier. the text object citation system is available hypothetically at least, for all forms of output, it is possible to search the sql database, and either read results from that database, or just as simply map the results to the -html output, which has richer text markup. +html output, which has richer text markup. <p> In addition to this <b>SiSU</b> has the ability to populate a relational sql type database with documents at an object level, with objects numbers that are shared across different output types, which make them searchable with that degree of granularity. Basically, your match criteria is met by these documents and at these locations within each document, which can be viewed within the database directly -or in various output formats. -<p> 21. SQL +or in various output formats. +<p> 21. SQL <p> 21.1 POPULATING SQL TYPE DATABASES <p> <b>SiSU</b> feeds sisu markupd documents into sql type databases PostgreSQL[^18] and/or SQLite[^19] database together with information related to document -structure. +structure. <p> This is one of the more interesting output forms, as all the structural data of the documents are retained (though can be ignored by the user of the database should they so choose). All site texts/documents -are (currently) streamed to four tables: +are (currently) streamed to four tables: <p> * one containing semantic (and other) headers, including, title, author,<br> subject, (the Dublin Core...);<br> - + <p> * another the substantive texts by individual<br> along with structural information, each paragraph being identifiable by its<br> @@ -2126,25 +2044,25 @@ by its<br> substantive text of each paragraph quite naturally being searchable (both in<br> formatted and clean text versions for searching); and<br> - + <p> * a third containing endnotes cross-referenced back to the paragraph from<br> which they are referenced (both in formatted and clean text versions for<br> searching).<br> - + <p> * a fourth table with a one to one relation with the headers table contains<br> full text versions of output, eg. pdf, html, xml, and ascii.<br> - -<p> There is of course the possibility to add further structures. + +<p> There is of course the possibility to add further structures. <p> At this level <b>SiSU</b> loads a relational database with documents chunked into objects, their smallest logical structurally constituent parts, as text objects, with their object citation number and all other structural information needed to construct the document. Text is stored (at this text object level) with and without elementary markup tagging, the stripped version being -so as to facilitate ease of searching. +so as to facilitate ease of searching. <p> Being able to search a relational database at an object level with the <b>SiSU</b> citation system is an effective way of locating content generated by <b>SiSU</b> object numbers, and all versions @@ -2154,203 +2072,202 @@ output formats, with live links to the precise locations in the database or in html/xml documents; or, the structural information provided makes it possible to search the full contents of the database and have headings in which search content appears, or to search only headings etc. (as the -Dublin Core is incorporated it is easy to make use of that as well). +Dublin Core is incorporated it is easy to make use of that as well). <p> 22. -POSTGRESQL -<p> 22.1 NAME +POSTGRESQL +<p> 22.1 NAME <p> <b>SiSU</b> - Structured information, Serialized Units -- a document publishing system, postgresql dependency package +- a document publishing system, postgresql dependency package <p> 22.2 DESCRIPTION <p> Information related to using postgresql with sisu (and related to the sisu_postgresql dependency package, which is a dummy package to install dependencies needed for <b>SiSU</b> to populate a postgresql database, this being -part of <b>SiSU</b> - man sisu). -<p> 22.3 SYNOPSIS -<p> sisu -D [instruction] [filename/wildcard +part of <b>SiSU</b> - man sisu). +<p> 22.3 SYNOPSIS +<p> sisu -D [instruction] [filename/wildcard if required]<br> - -<p> sisu -D --pg --[instruction] [filename/wildcard if required]<br> - -<p> 22.4 COMMANDS + +<p> sisu -D --pg --[instruction] [filename/wildcard if required]<br> + +<p> 22.4 COMMANDS <p> Mappings to two databases are provided by default, postgresql and sqlite, the same commands are used within sisu to construct and populate databases however -d (lowercase) denotes sqlite and -D (uppercase) denotes -postgresql, alternatively --sqlite or --pgsql may be used +postgresql, alternatively --sqlite or --pgsql may be used <p> <b>-D or --pgsql</b> may -be used interchangeably. -<p> 22.4.1 CREATE AND DESTROY DATABASE -<p> +be used interchangeably. +<p> 22.4.1 CREATE AND DESTROY DATABASE +<p> <dl> -<dt><b> --pgsql --createall</b> +<dt><b>--pgsql --createall</b> </dt> -<dd> initial step, creates required relations (tables, indexes) in existing - (postgresql) database (a database should be created manually and given - the same name as working directory, as requested) (rb.dbi) the same name - as working directory, as +<dd>initial step, creates required relations (tables, indexes) in existing +(postgresql) database (a database should be created manually and given +the same name as working directory, as requested) (rb.dbi) <p> </dd> -<dt><b> sisu -D --createdb</b> </dt> -<dd> creates database where no database - existed before as +<dt><b>sisu -D --createdb</b> +</dt> +<dd> +<p>creates database where no database existed before <p> </dd> -<dt><b> sisu -D --create</b> </dt> -<dd> creates database tables where no database - tables existed before database tables where no database tables existed +<dt><b>sisu -D --create</b> </dt> +<dd>creates +<p>database tables where no database tables existed before <p> </dd> -<dt><b> sisu -D --Dropall</b> </dt> -<dd> destroys database (including all its content)! kills data -and drops tables, indexes and database associated with a given directory - (and directories of the same name). a +<dt><b>sisu -D --Dropall</b> +</dt> +<dd>destroys database (including all its content)! kills data and drops tables, +indexes and database associated with a given directory (and directories +of the same name). <p> </dd> -<dt><b> sisu -D --recreate</b> </dt> -<dd> destroys existing +<dt><b>sisu -D --recreate</b> </dt> +<dd>destroys existing database and builds -<p> database and builds a new empty database structure +<p>a new empty database structure <p> </dd> </dl> -22.4.2 IMPORT AND REMOVE - -<p>DOCUMENTS -<p> +22.4.2 IMPORT AND REMOVE DOCUMENTS +<p> <dl> -<dt><b> sisu -D --import -v [filename/wildcard]</b> </dt> -<dd>populates database with -the contents of the file. Imports documents(s) specified to a postgresql -database (at an object level). +<dt><b>sisu +-D --import -v [filename/wildcard]</b> </dt> +<dd>populates database with the contents of +the file. Imports documents(s) specified to a postgresql database (at an +object level). <p> </dd> -<dt><b> sisu -D --update -v [filename/wildcard]</b> </dt> -<dd>updates +<dt><b>sisu -D --update -v [filename/wildcard]</b> </dt> +<dd>updates file contents -<p>file contents in database +<p>in database <p> </dd> -<dt><b> sisu -D --remove -v [filename/wildcard]</b> </dt> -<dd>removes -specified document from postgresql database. +<dt><b>sisu -D --remove -v [filename/wildcard]</b> </dt> +<dd>removes specified document +from postgresql database. <p> </dd> </dl> -23. SQLITE -<p> 23.1 NAME -<p> <b>SiSU</b> -- Structured information, Serialized Units - a document publishing system. - -<p> 23.2 DESCRIPTION -<p> Information related to using sqlite with sisu (and related -to the sisu_sqlite dependency package, which is a dummy package to install -dependencies needed for <b>SiSU</b> to populate an sqlite database, this being -part of <b>SiSU</b> - man sisu). -<p> 23.3 SYNOPSIS -<p> sisu -d [instruction] [filename/wildcard - if required]<br> - -<p> sisu -d --(sqlite|pg) --[instruction] [filename/wildcard if <br> +23. SQLITE +<p> 23.1 NAME +<p> <b>SiSU</b> - Structured information, +Serialized Units - a document publishing system. +<p> 23.2 DESCRIPTION +<p> Information +related to using sqlite with sisu (and related to the sisu_sqlite dependency +package, which is a dummy package to install dependencies needed for <b>SiSU</b> +to populate an sqlite database, this being part of <b>SiSU</b> - man sisu). +<p> 23.3 + +<p>SYNOPSIS +<p> sisu -d [instruction] [filename/wildcard if required]<br> + +<p> sisu -d --(sqlite|pg) --[instruction] [filename/wildcard if <br> required]<br> - -<p> 23.4 COMMANDS + +<p> 23.4 COMMANDS <p> Mappings to two databases are provided by default, postgresql and sqlite, the same commands are used within sisu to construct and populate databases however -d (lowercase) denotes sqlite and -D (uppercase) denotes -postgresql, alternatively --sqlite or --pgsql may be used +postgresql, alternatively --sqlite or --pgsql may be used <p> <b>-d or --sqlite</b> may -be used interchangeably. -<p> 23.4.1 CREATE AND DESTROY DATABASE -<p> +be used interchangeably. +<p> 23.4.1 CREATE AND DESTROY DATABASE +<p> <dl> -<dt><b> --sqlite --createall</b> +<dt><b>--sqlite --createall</b> </dt> -<dd> initial step, creates required relations (tables, indexes) in existing - (sqlite) database (a database should be created as requested) (rb.dbi) the - same name as working directory, as +<dd>initial step, creates required relations (tables, indexes) in existing +(sqlite) database (a database should be created manually and given the +same name as working directory, as requested) (rb.dbi) <p> </dd> -<dt><b> sisu -d --createdb</b> </dt> -<dd> creates database where - no database existed before as +<dt><b>sisu -d --createdb</b> +</dt> +<dd> +<p>creates database where no database existed before <p> </dd> -<dt><b> sisu -d --create</b> </dt> -<dd> creates database tables where - no database tables existed before database tables where no database tables - existed +<dt><b>sisu -d --create</b> </dt> +<dd>creates + +<p>database tables where no database tables existed before <p> </dd> -<dt><b> sisu -d --dropall</b> </dt> -<dd> destroys database (including all its content)! - kills data and drops tables, indexes and database associated with a given - directory (and directories of the same name). a +<dt><b>sisu -d --dropall</b> +</dt> +<dd>destroys database (including all its content)! kills data and drops tables, +indexes and database associated with a given directory (and directories +of the same name). <p> </dd> -<dt><b> sisu -d --recreate</b> </dt> -<dd> destroys +<dt><b>sisu -d --recreate</b> </dt> +<dd>destroys existing database and builds -<p> existing database and builds a new empty database structure +<p>a new empty database structure <p> </dd> </dl> -23.4.2 IMPORT - -<p>AND REMOVE DOCUMENTS -<p> +23.4.2 IMPORT AND REMOVE DOCUMENTS +<p> <dl> -<dt><b> sisu -d --import -v [filename/wildcard]</b> </dt> -<dd>populates database -with the contents of the file. Imports documents(s) specified to an sqlite -database (at an object level). +<dt><b>sisu +-d --import -v [filename/wildcard]</b> </dt> +<dd>populates database with the contents of +the file. Imports documents(s) specified to an sqlite database (at an object +level). <p> </dd> -<dt><b> sisu -d --update -v [filename/wildcard]</b> </dt> -<dd>updates +<dt><b>sisu -d --update -v [filename/wildcard]</b> </dt> +<dd>updates file contents in database -<p>file contents in database <p> </dd> -<dt><b> sisu -d --remove -v [filename/wildcard]</b> </dt> -<dd>removes -specified document from sqlite database. +<dt><b>sisu -d --remove -v [filename/wildcard]</b> </dt> +<dd>removes specified document from sqlite +database. <p> </dd> </dl> -24. INTRODUCTION -<p> 24.1 SEARCH - -DATABASE FRONTEND SAMPLE, UTILISING DATABASE AND SISU FEATURES, INCLUDING -OBJECT CITATION NUMBERING (BACKEND CURRENTLY POSTGRESQL) -<p> Sample search -frontend <<a href='http://search.sisudoc.org'>http://search.sisudoc.org</a> -> [^20] A small database and sample query -front-end (search from) that makes use of the citation system, <i>object</i> citation -numbering to demonstrates functionality.[^21] -<p> <b>SiSU</b> can provide information -on which documents are matched and at what locations within each document -the matches are found. These results are relevant across all outputs using -object citation numbering, which includes html, XML, LaTeX, PDF and indeed -the SQL database. You can then refer to one of the other outputs or in the -SQL database expand the text within the matched objects (paragraphs) in -the documents matched. -<p> Note you may set results either for documents matched -and object number locations within each matched document meeting the search -criteria; or display the names of the documents matched along with the -objects (paragraphs) that meet the search criteria.[^22] -<p> +24. INTRODUCTION +<p> 24.1 SEARCH - DATABASE FRONTEND SAMPLE, UTILISING +DATABASE AND SISU FEATURES, INCLUDING OBJECT CITATION NUMBERING (BACKEND +CURRENTLY POSTGRESQL) +<p> Sample search frontend <<a href='http://search.sisudoc.org'>http://search.sisudoc.org</a> +> +[^20] A small database and sample query front-end (search from) that makes +use of the citation system, <i>object</i> citation numbering to demonstrates functionality.[^21] + +<p> <b>SiSU</b> can provide information on which documents are matched and at what +locations within each document the matches are found. These results are +relevant across all outputs using object citation numbering, which includes +html, XML, LaTeX, PDF and indeed the SQL database. You can then refer to +one of the other outputs or in the SQL database expand the text within +the matched objects (paragraphs) in the documents matched. +<p> Note you may +set results either for documents matched and object number locations within +each matched document meeting the search criteria; or display the names +of the documents matched along with the objects (paragraphs) that meet +the search criteria.[^22] +<p> <dl> -<dt><b> sisu -F --webserv-webrick</b> -</dt> -<dd> -<p> builds a cgi web search frontend for the database created -<p> The following -is feedback on the setup on a machine provided by the help command: -<p> - sisu --help sql<br> - -<p> +<dt><b>sisu -F --webserv-webrick</b> </dt> +<dd>builds a cgi web search + +<p>frontend for the database created +<p> The following is feedback on the setup +on a machine provided by the help command: +<p> sisu --help sql<br> + +<p> <p> <br> <pre> Postgresql user: ralph @@ -2361,289 +2278,292 @@ is feedback on the setup on a machine provided by the help command: current db set: /home/ralph/sisu_www/sisu/sisu_sqlite.db dbi connect DBI:SQLite:/home/ralph/sisu_www/sisu/sisu_sqlite.db </pre> -<p> Note on databases built -<p> By default, [unless otherwise specified] databases +<p> Note on databases built +<p> By default, [unless otherwise specified] databases are built on a directory basis, from collections of documents within that directory. The name of the directory you choose to work from is used as the database name, i.e. if you are working in a directory called /home/ralph/ebook -the database SiSU_ebook is used. [otherwise a manual mapping for the collection - is +the database SiSU_ebook is used. [otherwise a manual mapping for the collection + is <p> </dd> </dl> -24.2 SEARCH FORM -<p> +24.2 SEARCH FORM +<p> <dl> -<dt><b> sisu -F</b> </dt> -<dd> generates a sample search form, which must - be copied to which must be copied to +<dt><b>sisu -F</b> </dt> +<dd>generates a sample search form, which must + +<p>be copied to the web-server cgi directory <p> </dd> -<dt><b> sisu -F --webserv-webrick</b> </dt> -<dd> generates a - sample search form for use with the webrick which must be copied to the - web-server cgi directory which must be copied to the web-server cgi directory +<dt><b>sisu -F --webserv-webrick</b> </dt> +<dd>generates +a sample search form for use with the webrick server, which must be copied +<p>to the web-server cgi directory <p> </dd> -<dt><b> sisu -Fv</b> </dt> -<dd> as above, and provides some information on setting up +<dt><b>sisu -Fv</b> </dt> +<dd>as above, and provides some information + +<p>on setting up hyperestraier <p> </dd> -<dt><b> sisu -W</b> -</dt> -<dd> -<p> starts the webrick server which should be available +<dt><b>sisu -W</b> </dt> +<dd>starts the webrick server which should + +<p>be available wherever sisu is properly installed <p> The generated search -<p>form must be copied manually to the webserver directory as instructed +<p>form must be copied manually to the webserver directory as instructed <p> </dd> </dl> -25. HYPERESTRAIER -<p> See the documentation for hyperestraier: +25. HYPERESTRAIER +<p> See the documentation for hyperestraier: <p> <<a href='http://hyperestraier.sourceforge.net/'>http://hyperestraier.sourceforge.net/</a> ><br> - + <p> /usr/share/doc/hyperestraier/index.html<br> - + <p> man estcmd<br> - -<p> on sisu_hyperestraier: + +<p> on sisu_hyperestraier: <p> man sisu_hyperestraier<br> - + <p> /usr/share/doc/sisu/sisu_markup/sisu_hyperestraier/index.html<br> - + <p> NOTE: the examples that follow assume that sisu output is placed in -<p>the directory /home/ralph/sisu_www +<p>the directory /home/ralph/sisu_www <p> (A) to generate the index within the -webserver directory to be indexed: -<p> estcmd gather -sd [index name] [directory +webserver directory to be indexed: +<p> estcmd gather -sd [index name] [directory path to index]<br> - + <p> the following are examples that will need to be tailored according to -your needs: +your needs: <p> cd /home/ralph/sisu_www<br> - + <p> estcmd gather -sd casket /home/ralph/sisu_www<br> - + <p> you may use the ’find’ command together with ’egrep’ to limit indexing to particular document collection directories within the web server directory: <p> find /home/ralph/sisu_www -type f | egrep<br> ’/home/ralph/sisu_www/sisu/.+?.html$’ |estcmd gather -sd casket -<br> - + <p> Check which directories in the webserver/output directory (~/sisu_www or elsewhere depending on configuration) you wish to include in the search -index. +index. <p> As sisu duplicates output in multiple file formats, it it is probably preferable to limit the estraier index to html output, and as it may also be desirable to exclude files ’plain.txt’, ’toc.html’ and ’concordance.html’, as -these duplicate information held in other html output e.g. +these duplicate information held in other html output e.g. <p> find /home/ralph/sisu_www -type f | egrep<br> ’/sisu_www/(sisu|bookmarks)/.+?.html$’ | egrep -v<br> ’(doc|concordance).html$’ |estcmd gather -sd casket -<br> - + <p> from your current document preparation/markup directory, you would construct -a rune along the following lines: +a rune along the following lines: <p> find /home/ralph/sisu_www -type f | egrep ’/home/ralph/sisu_www/([specify <br> first directory for inclusion]|[specify second directory for <br> inclusion]|[another directory for inclusion? ...])/.+?.html$’ |<br> egrep -v ’(doc|concordance).html$’ |estcmd gather -sd<br> /home/ralph/sisu_www/casket -<br> - -<p> (B) to set up the search form + +<p> (B) to set up the search form <p> (i) copy estseek.cgi to your cgi directory -and set file permissions to 755: +and set file permissions to 755: <p> sudo cp -vi /usr/lib/estraier/estseek.cgi /usr/lib/cgi-bin<br> - + <p> sudo chmod -v 755 /usr/lib/cgi-bin/estseek.cgi<br> - + <p> sudo cp -v /usr/share/hyperestraier/estseek.* /usr/lib/cgi-bin<br> - -<p> [see estraier documentation for paths]<br> - + +<p> [see estraier documentation for paths]<br> + <p> (ii) edit estseek.conf, with attention to the lines starting ’indexname:’ -and ’replace:’: +and ’replace:’: <p> indexname: /home/ralph/sisu_www/casket<br> - + <p> replace: ^file:///home/ralph/sisu_www{{!}}<a href='http://localhost'>http://localhost</a> <br> - + <p> replace: /index.html?${{!}}/<br> - -<p> (C) to test using webrick, start webrick: + +<p> (C) to test using webrick, start webrick: <p> sisu -W<br> - + <p> and try open the url: <<a href='http://localhost:8081/cgi-bin/estseek.cgi'>http://localhost:8081/cgi-bin/estseek.cgi</a> -> +> <p> 26. SISU_WEBRICK - -<p> 26.1 NAME + +<p> 26.1 NAME <p> <b>SiSU</b> - Structured information, Serialized Units - a document -<p>publishing system -<p> 26.2 SYNOPSIS -<p> sisu_webrick [port] -<p> or -<p> sisu -W [port] +<p>publishing system +<p> 26.2 SYNOPSIS +<p> sisu_webrick [port] +<p> or +<p> sisu -W [port] -<p> 26.3 DESCRIPTION +<p> 26.3 DESCRIPTION <p> sisu_webrick is part of <b>SiSU</b> (man sisu) sisu_webrick starts <b>Ruby</b> ’s Webrick web-server and points it to the directories to which <b>SiSU</b> output is written, providing a list of these directories (assuming -<b>SiSU</b> is in use and they exist). +<b>SiSU</b> is in use and they exist). <p> The default port for sisu_webrick is set to 8081, this may be modified in the yaml file: ~/.sisu/sisurc.yml a sample of which is provided as /etc/sisu/sisurc.yml (or in the equivalent directory -on your system). -<p> 26.4 SUMMARY OF MAN PAGE +on your system). +<p> 26.4 SUMMARY OF MAN PAGE <p> sisu_webrick, may be started -on it’s own with the command: sisu_webrick or using the sisu command with -the -W flag: sisu -W [port] -<p> where no port is given and settings are unchanged +on it’s own with the command: sisu_webrick [port] or using the sisu command +with the -W flag: sisu -W [port] +<p> where no port is given and settings are -<p>the default port is 8081 -<p> 26.5 DOCUMENT PROCESSING COMMAND FLAGS -<p> sisu --W [port] starts <b>Ruby</b> Webrick web-server, serving <b>SiSU</b> output directories, +<p>unchanged the default port is 8081 +<p> 26.5 DOCUMENT PROCESSING COMMAND FLAGS + +<p> sisu -W [port] starts <b>Ruby</b> Webrick web-server, serving <b>SiSU</b> output directories, on the port provided, or if no port is provided and the defaults have not -<p>been changed in ~/.sisu/sisurc.yaml then on port 8081 +<p>been changed in ~/.sisu/sisurc.yaml then on port 8081 <p> 26.6 FURTHER INFORMATION <p> For more information on <b>SiSU</b> see: <<a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a> -> +> <p> or man sisu -<p> 26.7 AUTHOR -<p> Ralph Amissah ralph@amissah.com or ralph.amissah@gmail.com +<p> 26.7 AUTHOR +<p> Ralph Amissah ralph@amissah.com or ralph.amissah@gmail.com <p> -<p>26.8 SEE ALSO +<p>26.8 SEE ALSO <p> <a href='http:~/bin/man2html?sisu:1'>sisu(1)</a> <br> - + <p> <a href='http:~/bin/man2html?sisu_vim:7'>sisu_vim(7)</a> <br> - + <p> <a href='http:~/bin/man2html?sisu:8'>sisu(8)</a> <br> - -<p> 27. REMOTE SOURCE DOCUMENTS + +<p> 27. REMOTE SOURCE DOCUMENTS <p> <b>SiSU</b> processing instructions can be run against remote source documents by providing the url of the documents against which the processing instructions are to be carried out. The remote <b>SiSU</b> documents can either be sisu marked up files in plaintext .sst or .ssm or; -zipped sisu files, sisupod.zip or filename.ssp +zipped sisu files, sisupod.zip or filename.ssp <p> <b>.sst / .ssm - sisu text files</b> <p> <b>SiSU</b> can be run against source text files on a remote machine, provide the processing instruction and the url. The source file and any associated -parts (such as images) will be downloaded and generated locally. -<p> +parts (such as images) will be downloaded and generated locally. +<p> <p> <br> <pre> sisu -3 http://[provide url to valid .sst or .ssm file] </pre> <p> Any of the source documents in the sisu examples page can be used in this way, see <<a href='http://www.jus.uio.no/sisu/SiSU/examples.html'>http://www.jus.uio.no/sisu/SiSU/examples.html</a> > and use the url -for the desired document. +for the desired document. <p> NOTE: to set up a remote machine to serve <b>SiSU</b> documents in this way, images should be in the directory relative to the -<p>document source ../_sisu/image -<p> <b>sisupod - zipped sisu files</b> +<p>document source ../_sisu/image +<p> <b>sisupod - zipped sisu files</b> <p> A sisupod is the zipped content of a sisu marked up text or texts and any other associated -parts to the document such as images. +parts to the document such as images. <p> <b>SiSU</b> can be run against a sisupod on a (local or) remote machine, provide the processing instruction and the url, the sisupod will be downloaded and the documents it contains generated -locally. -<p> +locally. +<p> <p> <br> <pre> sisu -3 http://[provide url to valid sisupod.zip or .ssp file] </pre> <p> Any of the source documents in the sisu examples page can be used in this way, see <<a href='http://www.jus.uio.no/sisu/SiSU/examples.html'>http://www.jus.uio.no/sisu/SiSU/examples.html</a> > and use the url -for the desired document. -<p> REMOTE DOCUMENT OUTPUT -<p> 28. REMOTE OUTPUT -<p> +for the desired document. +<p> REMOTE DOCUMENT OUTPUT +<p> 28. REMOTE OUTPUT +<p> Once properly configured <b>SiSU</b> output can be automatically posted once generated -to a designated remote machine using either rsync, or scp. +to a designated remote machine using either rsync, or scp. <p> In order to do this some ssh authentication agent and keychain or similar tool will need to be configured. Once that is done the placement on a remote host can be done seamlessly with the -r (for scp) or -R (for rsync) flag, which -may be used in conjunction with other processing flags, e.g. -<p> +may be used in conjunction with other processing flags, e.g. +<p> <p> <br> <pre> sisu -3R sisu_remote.sst </pre> -<p> 28.1 COMMANDS -<p> +<p> 28.1 COMMANDS +<p> <dl> -<dt><b> -R [filename/wildcard]</b> </dt> +<dt><b>-R [filename/wildcard]</b> </dt> <dd>copies sisu output files to remote host using rsync. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your different if -R is used with other flags from if used alone. Alone the rsync --delete parameter is sent, useful for cleaning the remote directory (when -R is used together -with other flags, it is not). Also see -r +with other flags, it is not). Also see -r <p> </dd> -<dt><b> -r [filename/wildcard]</b> </dt> +<dt><b>-r [filename/wildcard]</b> </dt> <dd>copies sisu output files to remote host using scp. This requires that sisurc.yml has been provided with information on hostname and username, and that you have -<p>your +<p>your <p> </dd> </dl> -28.2 CONFIGURATION +28.2 CONFIGURATION <p> [expand on the setting up of an ssh-agent / keychain] -<p> 29. REMOTE SERVERS +<p> 29. REMOTE SERVERS <p> As <b>SiSU</b> is generally operated using the command line, and works within a Unix type environment, <b>SiSU</b> the program and all documents can just as easily be on a remote server, to which you are logged on using a terminal, and commands and operations would be pretty much the same as -they would be on your local machine. +they would be on your local machine. <p> 30. QUICKSTART - GETTING STARTED HOWTO - -<p> 30.1 INSTALLATION + +<p> 30.1 INSTALLATION <p> Installation is currently most straightforward and tested on the <b>Debian</b> platform, as there are packages for the installation -of sisu and all requirements for what it does. +of sisu and all requirements for what it does. <p> 30.1.1 DEBIAN INSTALLATION <p> <b>SiSU</b> is available directly from the <b>Debian</b> Sid and testing archives (and possibly Ubuntu), assuming your /etc/apt/sources.list is set accordingly: -<p> +<p> <p> <br> <pre> aptitude update aptitude install sisu-complete </pre> <p> The following /etc/apt/sources.list setting permits the download of additional -markup samples: -<p> +markup samples: +<p> <p> <br> <pre> #/etc/apt/sources.list deb http://ftp.fi.debian.org/debian/ unstable main non-free contrib deb-src http://ftp.fi.debian.org/debian/ unstable main non-free contrib d </pre> -<p> The aptitude commands become: -<p> +<p> The aptitude commands become: +<p> <p> <br> <pre> aptitude update aptitude install sisu-complete sisu-markup-samples @@ -2652,308 +2572,308 @@ markup samples: <p>they will be available by adding the following to your /etc/apt/sources.list -<p> +<p> <p> <br> <pre> #/etc/apt/sources.list deb http://www.jus.uio.no/sisu/archive unstable main non-free deb-src http://www.jus.uio.no/sisu/archive unstable main non-free </pre> -<p> repeat the aptitude commands -<p> +<p> repeat the aptitude commands +<p> <p> <br> <pre> aptitude update aptitude install sisu-complete sisu-markup-samples </pre> <p> Note however that it is not necessary to install sisu-complete if not all components of sisu are to be used. Installing just the package sisu -will provide basic functionality. -<p> 30.1.2 RPM INSTALLATION +will provide basic functionality. +<p> 30.1.2 RPM INSTALLATION <p> RPMs are provided though untested, they are prepared by running alien against the source -package, and against the debs. -<p> They may be downloaded from: +package, and against the debs. +<p> They may be downloaded from: <p> <<a href='http://www.jus.uio.no/sisu/SiSU/download.html#rpm'>http://www.jus.uio.no/sisu/SiSU/download.html#rpm</a> ><br> - -<p> as root type: -<p> rpm -i [rpm package name]<br> - -<p> 30.1.3 INSTALLATION FROM SOURCE + +<p> as root type: +<p> rpm -i [rpm package name]<br> + +<p> 30.1.3 INSTALLATION FROM SOURCE <p> To install <b>SiSU</b> from source check information -at: +at: <p> <<a href='http://www.jus.uio.no/sisu/SiSU/download.html#current'>http://www.jus.uio.no/sisu/SiSU/download.html#current</a> ><br> - -<p> * download the source package -<p> * Unpack the source + +<p> * download the source package +<p> * Unpack the source <p> Two alternative modes of installation from source are provided, setup.rb (by Minero Aoki) and a rant(by Stefan Lang) built install file, in either case: the first -steps are the same, download and unpack the source file: +steps are the same, download and unpack the source file: <p> For basic use <b>SiSU</b> is only dependent on the programming language in which it is written <b>Ruby</b> , and <b>SiSU</b> will be able to generate html, various XMLs, including ODF (and will also produce LaTeX). Dependencies required for further actions, though it relies on the installation of additional dependencies which the source tarball does not take care of, for things like using a database -(postgresql or sqlite)[^23] or converting LaTeX to pdf. -<p> <b>setup.rb</b> +(postgresql or sqlite)[^23] or converting LaTeX to pdf. +<p> <b>setup.rb</b> <p> This is a standard ruby installer, using setup.rb is a three step process. In -the root directory of the unpacked <b>SiSU</b> as root type: -<p> +the root directory of the unpacked <b>SiSU</b> as root type: +<p> <p> <br> <pre> ruby setup.rb config ruby setup.rb setup #[and as root:] ruby setup.rb install </pre> -<p> further information on setup.rb is available from: +<p> further information on setup.rb is available from: <p> <<a href='http://i.loveruby.net/en/projects/setup/'>http://i.loveruby.net/en/projects/setup/</a> ><br> - + <p> <<a href='http://i.loveruby.net/en/projects/setup/doc/usage.html'>http://i.loveruby.net/en/projects/setup/doc/usage.html</a> ><br> - -<p> <b></b> -<p> The root directory of the unpacked <b>SiSU</b> as root type: + +<p> <b></b> +<p> The root directory of the unpacked <b>SiSU</b> as root type: <p> ruby install base<br> - -<p> or for a more complete installation: + +<p> or for a more complete installation: <p> ruby install<br> - -<p> or + +<p> or <p> ruby install base<br> - + <p> This makes use of Rant (by Stefan Lang) and the provided Rantfile. It has been configured to do post installation setup setup configuration and generation of first test file. Note however, that additional external package -dependencies, such as tetex-extra are not taken care of for you. +dependencies, such as tetex-extra are not taken care of for you. <p> Further -<p>information on +<p>information on <p> <<a href='http://make.rubyforge.org/'>http://make.rubyforge.org/</a> ><br> - + <p> <<a href='http://rubyforge.org/frs/?group_id=615'>http://rubyforge.org/frs/?group_id=615</a> ><br> - -<p> For a list of alternative actions you may type: + +<p> For a list of alternative actions you may type: <p> ruby install help<br> - + <p> ruby install -T<br> - -<p> 30.2 TESTING SISU, GENERATING OUTPUT + +<p> 30.2 TESTING SISU, GENERATING OUTPUT <p> To check which version of sisu -is installed: -<p> sisu -v +is installed: +<p> sisu -v <p> Depending on your mode of installation one or -a number of markup sample files may be found either in the directory: +a number of markup sample files may be found either in the directory: <p> - -<p> or -<p> -<p> change directory to the appropriate one: + +<p> or +<p> +<p> change directory to the appropriate one: <p> cd /usr/share/doc/sisu/sisu_markup_samples/dfsg -<p> 30.2.1 BASIC TEXT, PLAINTEXT, HTML, XML, ODF +<p> 30.2.1 BASIC TEXT, PLAINTEXT, HTML, XML, ODF <p> Having moved to the directory that contains the markup samples (see instructions above if necessary), -<p>choose a file and run sisu against it +<p>choose a file and run sisu against it <p> sisu -NhwoabxXyv free_as_in_freedom.rms_and_free_software.sam_williams.sst <p> this will generate html including a concordance file, opendocument text format, plaintext, XHTML and various forms of XML, and OpenDocument text -<p> 30.2.2 LATEX / PDF +<p> 30.2.2 LATEX / PDF <p> Assuming a LaTeX engine such as tetex or texlive is installed with the required modules (done automatically on selection of -sisu-pdf in <b>Debian</b> ) +sisu-pdf in <b>Debian</b> ) <p> Having moved to the directory that contains the markup samples (see instructions above if necessary), choose a file and run sisu -<p>against it +<p>against it <p> sisu -pv free_as_in_freedom.rms_and_free_software.sam_williams.sst -<p> sisu -3 free_as_in_freedom.rms_and_free_software.sam_williams.sst +<p> sisu -3 free_as_in_freedom.rms_and_free_software.sam_williams.sst <p> should generate most available output formats: html including a concordance file, opendocument text format, plaintext, XHTML and various forms of XML, and -<p>OpenDocument text and pdf +<p>OpenDocument text and pdf <p> 30.2.3 RELATIONAL DATABASE - POSTGRESQL, SQLITE <p> Relational databases need some setting up - you must have permission to -create the database and write to it when you run sisu. +create the database and write to it when you run sisu. <p> Assuming you have -<p>the database installed and the requisite permissions +<p>the database installed and the requisite permissions <p> sisu --sqlite --recreate <p> sisu --sqlite -v --import free_as_in_freedom.rms_and_free_software.sam_williams.sst -<p> sisu --pgsql --recreate +<p> sisu --pgsql --recreate <p> sisu --pgsql -v --import free_as_in_freedom.rms_and_free_software.sam_williams.sst -<p> 30.3 GETTING HELP -<p> 30.3.1 THE MAN PAGES -<p> Type: +<p> 30.3 GETTING HELP +<p> 30.3.1 THE MAN PAGES +<p> Type: <p> man sisu<br> - + <p> The man pages are also available online, though not always kept as up -to date as within the package itself: +to date as within the package itself: <p> * sisu.1 <<a href='http://www.jus.uio.no/sisu/man/sisu.1'>http://www.jus.uio.no/sisu/man/sisu.1</a> > - [^24] +[^24] <p> * sisu.8 <<a href='http://www.jus.uio.no/sisu/man/sisu.8'>http://www.jus.uio.no/sisu/man/sisu.8</a> -> [^25] +> [^25] <p> * man directory <<a href='http://www.jus.uio.no/sisu/man'>http://www.jus.uio.no/sisu/man</a> -> [^26] -<p> 30.3.2 BUILT IN HELP -<p> sisu --help +> [^26] +<p> 30.3.2 BUILT IN HELP +<p> sisu --help <p> sisu <p>- <p>- -<p>help --env -<p> sisu --help --commands -<p> sisu --help --markup -<p> 30.3.3 THE HOME PAGE -<p> +<p>help --env +<p> sisu --help --commands +<p> sisu --help --markup +<p> 30.3.3 THE HOME PAGE +<p> <<a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a> -> +> <p> <<a href='http://www.jus.uio.no/sisu/SiSU'>http://www.jus.uio.no/sisu/SiSU</a> -> +> <p> 30.4 MARKUP SAMPLES -<p> A number of markup samples (along with output) are available off: +<p> A number of markup samples (along with output) are available off: <p> <<a href='http://www.jus.uio.no/sisu/SiSU/examples.html'>http://www.jus.uio.no/sisu/SiSU/examples.html</a> > -<p> Additional markup samples are packaged separately in the file: -<p> <b>*</b> -<p> +<p> Additional markup samples are packaged separately in the file: +<p> <b>*</b> +<p> On <b>Debian</b> they are available in non-free[^27] to include them it is necessary to include non-free in your /etc/apt/source.list or obtain them from the -sisu home site. -<p> 31. EDITOR FILES, SYNTAX HIGHLIGHTING +sisu home site. +<p> 31. EDITOR FILES, SYNTAX HIGHLIGHTING <p> The directory: <p> ./data/sisu/conf/editor-syntax-etc/<br> - + <p> /usr/share/sisu/conf/editor-syntax-etc<br> - -<p> contains rudimentary sisu syntax highlighting files for: + +<p> contains rudimentary sisu syntax highlighting files for: <p> * (g)vim <<a href='http://www.vim.org'>http://www.vim.org</a> -> +> <p> package: sisu-vim<br> - -<p> status: largely done + +<p> status: largely done <p> there is a vim syntax highlighting and folds component<br> - + <p> * gedit <<a href='http://www.gnome.org/projects/gedit'>http://www.gnome.org/projects/gedit</a> -> +> <p> * gobby <<a href='http://gobby.0x539.de/'>http://gobby.0x539.de/</a> > <p> file: sisu.lang<br> - -<p> place in: + +<p> place in: <p> /usr/share/gtksourceview-1.0/language-specs<br> - -<p> or + +<p> or <p> ~/.gnome2/gtksourceview-1.0/language-specs<br> - + <p> status: very basic syntax highlighting<br> - + <p> comments: this editor features display line wrap and is used by Goby!<br> - + <p> * nano <<a href='http://www.nano-editor.org'>http://www.nano-editor.org</a> -> +> <p> file: nanorc<br> - -<p> save as: + +<p> save as: <p> ~/.nanorc<br> - + <p> status: basic syntax highlighting<br> - + <p> comments: assumes dark background; no display line-wrap; does line breaks<br> - + <p> * diakonos (an editor written in ruby) <<a href='http://purepistos.net/diakonos'>http://purepistos.net/diakonos</a> > -<p> file: diakonos.conf -<p> save as: +<p> file: diakonos.conf +<p> save as: <p> ~/.diakonos/diakonos.conf<br> - -<p> includes: + +<p> includes: <p> status: basic syntax highlighting<br> - -<p> comments: assumes dark background; no display line-wrap + +<p> comments: assumes dark background; no display line-wrap <p> * kate & kwrite <<a href='http://kate.kde.org'>http://kate.kde.org</a> -> +> <p> file: sisu.xml<br> - + <p> place in:<br> - + <p> /usr/share/apps/katepart/syntax<br> - + <p> or<br> - + <p> ~/.kde/share/apps/katepart/syntax<br> - -<p> [settings::configure kate::{highlighting,filetypes}]<br> - -<p> [tools::highlighting::{markup,scripts}::<br> - <b> SiSU</b> ] + +<p> [settings::configure kate::{highlighting,filetypes}]<br> + +<p> [tools::highlighting::{markup,scripts}:: .B SiSU ]<br> + <p> * nedit <<a href='http://www.nedit.org'>http://www.nedit.org</a> -> +> <p> file: sisu_nedit.pats<br> - + <p> nedit -import sisu_nedit.pats<br> - -<p> status: a very clumsy first attempt [not really done]<br> - + +<p> status: a very clumsy first attempt [not really done]<br> + <p> comments: this editor features display line wrap<br> - + <p> * emacs <<a href='http://www.gnu.org/software/emacs/emacs.html'>http://www.gnu.org/software/emacs/emacs.html</a> -> +> <p> files: sisu-mode.el<br> - + <p> to file ~/.emacs add the following 2 lines:<br> - + <p> (add-to-list ’load-path<br> - + <p> (require ’sisu-mode.el)<br> - -<p> [not done / not yet included]<br> - + +<p> [not done / not yet included]<br> + <p> * vim & gvim <<a href='http://www.vim.org'>http://www.vim.org</a> -> +> <p> files:<br> - + <p> package is the most comprehensive sisu syntax highlighting and editor<br> environment provided to date (is for vim/ gvim, and is separate from the<br> contents of this directory)<br> - + <p> status: this includes: syntax highlighting; vim folds; some error checking<br> - + <p> comments: this editor features display line wrap<br> - -<p> NOTE: -<p> [ <b> SiSU</b> parses files with long lines or line breaks, but, display - linewrap (without line-breaks) is a convenient editor feature to have for - sisu markup] -<p> 32. HOW DOES SISU WORK? + +<p> NOTE: +<p> [ .B SiSU parses files with long lines or line breaks, but, display + linewrap (without line-breaks) is a convenient editor feature to have for + sisu markup] +<p> 32. HOW DOES SISU WORK? <p> <b>SiSU</b> markup is fairly minimalistic, it consists of: a (largely optional) document header, made up of information about the document (such as when it was published, who authored it, and @@ -2971,15 +2891,15 @@ considerable flexibility in representing documents different ways and for different purposes (e.g. search, document layout, publishing, content certification, concordance etc.), and makes it possible to take advantage of some of the strengths of established ways of representing documents, (or indeed to -create new ones). -<p> 33. SUMMARY OF FEATURES +create new ones). +<p> 33. SUMMARY OF FEATURES <p> * sparse/minimal markup (clean utf-8 source texts). Documents are prepared in a single UTF-8 file using a minimalistic mnemonic syntax. Typical literature, documents like headers -are optional. +are optional. <p> * markup is easily readable/parsable by the human eye, (basic -markup is simpler and more sparse than the most basic HTML), [this may - also be simpler converted to XML representations of the same input/source +markup is simpler and more sparse than the most basic HTML), [this may + also be converted to XML representations of the same input/source document]. <p> * markup defines document structure (this may be done once in a header pattern-match description, or for heading levels individually); basic text @@ -2989,38 +2909,37 @@ beyond the Dublin core and easily further extended as required); the headers may also contain processing instructions. <b>SiSU</b> markup is primarily an abstraction of document structure and document metadata to permit taking advantage of the basic strengths of existing alternative practical standard ways -of representing documents [be that browser viewing, paper publication, - sql search etc.] (html, xml, odf, latex, pdf, sql) -<p> * for output produces -reasonably elegant output of established industry and institutionally accepted -open standard formats.[3] takes advantage of the different strengths of -various standard formats for representing documents, amongst the output -formats currently supported are: -<p> * html - both as a single scrollable -text and a segmented document<br> - +of representing documents [be that paper publication, sql search etc.] (html, +xml, odf, latex, pdf, sql) +<p> * for output produces reasonably elegant output +of established industry and institutionally accepted open standard formats.[3] +takes advantage of the different strengths of various standard formats +for representing documents, amongst the output formats currently supported +are: +<p> * html - both as a single scrollable text and a segmented document<br> + <p> * xhtml<br> - + <p> * XML - both in sax and dom style xml structures for further development as<br> required<br> - + <p> * ODF - open document format, the iso standard for document storage<br> - + <p> * LaTeX - used to generate pdf<br> - + <p> * pdf (via LaTeX)<br> - + <p> * sql - population of an sql database, (at the same object level that is<br> used to cite text within a document)<br> - + <p> Also produces: concordance files; document content certificates (md5 or sha256 digests of headings, paragraphs, images etc.) and html manifests (and sitemaps of content). (b) takes advantage of the strengths implicit in these very different output types, (e.g. PDFs produced using typesetting of LaTeX, databases populated with documents at an individual object/paragraph -level, making possible granular search (and related possibilities)) +level, making possible granular search (and related possibilities)) <p> * ensuring content can be cited in a meaningful way regardless of selected output format. Online publishing (and publishing in multiple document formats) @@ -3031,23 +2950,23 @@ the text within a document, (which can be utilized for citation and by search engines). The outputs share a common numbering system that is meaningful (to man and machine) across all digital outputs whether paper, screen, or database oriented, (pdf, HTML, xml, sqlite, postgresql), this numbering -system can be used to reference content. +system can be used to reference content. <p> * Granular search within documents. SQL databases are populated at an object level (roughly headings, paragraphs, verse, tables) and become searchable with that degree of granularity, the output information provides the object/paragraph numbers which are relevant across all generated outputs; it is also possible to look at just the matching -paragraphs of the documents in the database; [output indexing also work - well with search indexing tools like hyperestraier]. +paragraphs of the documents in the database; [output indexing also work + well with search indexing tools like hyperestraier]. <p> * long term maintainability of document collections in a world of changing formats, having a very sparsely marked-up source document base. there is a considerable degree of future-proofing, output representations are upgradeable (open document text) module in 2006 and in future html5 output sometime in future, without modification of -<p>existing prepared texts +<p>existing prepared texts <p> * SQL search aside, documents are generated as -required and static once generated. +required and static once generated. <p> * documents produced are static files, and may be batch processed, this needs to be done only once but may be repeated for various reasons as desired (updated content, addition of new @@ -3055,7 +2974,7 @@ output formats, updated technology document presentations/representations) <p> * document source (plaintext utf-8) if shared on the net may be used as -<p>input and processed locally to produce the different document outputs +<p>input and processed locally to produce the different document outputs <p> * document source may be bundled together (automatically) with associated documents (multiple language versions or master document with inclusions) @@ -3068,232 +2987,232 @@ and images and sent as a zip file called a sisupod, if shared on the net <p> * for basic document generation, the only software dependency is <b>Ruby</b> , and a few standard Unix tools (this covers plaintext, HTML, XML, ODF, LaTeX). To use a database you of course need that, and to convert the LaTeX -generated to pdf, a latex processor like tetex or texlive. +generated to pdf, a latex processor like tetex or texlive. <p> * as a developers -<p>tool it is flexible and extensible +<p>tool it is flexible and extensible <p> Syntax highlighting for <b>SiSU</b> markup -is available for a number of text editors. +is available for a number of text editors. <p> <b>SiSU</b> is less about document layout than about finding a way with little markup to be able to construct an abstract representation of a document that makes it possible to produce multiple representations of it which may be rather different from each other and used for different purposes, whether layout and publishing, or -<p>search of content +<p>search of content <p> i.e. to be able to take advantage from this minimal preparation starting point of some of the strengths of rather different established ways of representing documents for different purposes, whether for search (relational database, or indexed flat files generated for that purpose whether of complete documents, or say of files made up of objects), online -viewing (e.g. html, xml, pdf), or paper publication (e.g. pdf)... +viewing (e.g. html, xml, pdf), or paper publication (e.g. pdf)... <p> the solution arrived at is by extracting structural information about the document (about headings within the document) and by tracking objects (which are serialized and also given hash values) in the manner described. It makes possible representations that are quite different from those offered at present. For example objects could be saved individually and identified by their hashes, with an index -of how the objects relate to each other to form a document. +of how the objects relate to each other to form a document. <p> 34. HELP SOURCES - + <p> For a summary of alternative ways to get help on <b>SiSU</b> try one of the -following: -<p> <b>man page</b> +following: +<p> <b>man page</b> <p> man sisu_help<br> - -<p> <b>man2html</b> + +<p> <b>man2html</b> <p> <<a href='http://www.jus.uio.no/sisu/man/sisu_help.1.html'>http://www.jus.uio.no/sisu/man/sisu_help.1.html</a> ><br> - -<p> <b>sisu generated output - links to html</b> + +<p> <b>sisu generated output - links to html</b> <p> <<a href='http://sisudoc.org/sisu/sisu_help/index.html'>http://sisudoc.org/sisu/sisu_help/index.html</a> ><br> - -<p> <b>help sources lists</b> + +<p> <b>help sources lists</b> <p> Alternative sources for this help sources page -listed here: +listed here: <p> man sisu_help_sources<br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_help_sources/index.html'>http://sisudoc.org/sisu/sisu_help_sources/index.html</a> ><br> - -<p> 34.1 MAN PAGES -<p> 34.1.1 MAN + +<p> 34.1 MAN PAGES +<p> 34.1.1 MAN <p> man sisu<br> - + <p> man 7 sisu_complete<br> - + <p> man 7 sisu_pdf<br> - + <p> man 7 sisu_postgresql<br> - + <p> man 7 sisu_sqlite<br> - + <p> man sisu_termsheet<br> - + <p> man sisu_webrick<br> - -<p> 34.2 SISU GENERATED OUTPUT - LINKS TO HTML + +<p> 34.2 SISU GENERATED OUTPUT - LINKS TO HTML <p> Note <b>SiSU</b> documentation is prepared in <b>SiSU</b> and output is available in multiple formats including amongst others html, pdf, and odf which may be also be accessed via the -html pages[^28] -<p> 34.2.1 WWW.SISUDOC.ORG +html pages[^28] +<p> 34.2.1 WWW.SISUDOC.ORG <p> <<a href='http://sisudoc.org/sisu/sisu_manual/index.html'>http://sisudoc.org/sisu/sisu_manual/index.html</a> > <p> <<a href='http://sisudoc.org/sisu/sisu_manual/index.html'>http://sisudoc.org/sisu/sisu_manual/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_commands/index.html'>http://sisudoc.org/sisu/sisu_commands/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_complete/index.html'>http://sisudoc.org/sisu/sisu_complete/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_configuration/index.html'>http://sisudoc.org/sisu/sisu_configuration/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_description/index.html'>http://sisudoc.org/sisu/sisu_description/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_examples/index.html'>http://sisudoc.org/sisu/sisu_examples/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_faq/index.html'>http://sisudoc.org/sisu/sisu_faq/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_filetypes/index.html'>http://sisudoc.org/sisu/sisu_filetypes/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_help/index.html'>http://sisudoc.org/sisu/sisu_help/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_help_sources/index.html'>http://sisudoc.org/sisu/sisu_help_sources/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_howto/index.html'>http://sisudoc.org/sisu/sisu_howto/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_introduction/index.html'>http://sisudoc.org/sisu/sisu_introduction/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_manual/index.html'>http://sisudoc.org/sisu/sisu_manual/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_markup/index.html'>http://sisudoc.org/sisu/sisu_markup/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_output_overview/index.html'>http://sisudoc.org/sisu/sisu_output_overview/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_pdf/index.html'>http://sisudoc.org/sisu/sisu_pdf/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_postgresql/index.html'>http://sisudoc.org/sisu/sisu_postgresql/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_quickstart/index.html'>http://sisudoc.org/sisu/sisu_quickstart/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_remote/index.html'>http://sisudoc.org/sisu/sisu_remote/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_search/index.html'>http://sisudoc.org/sisu/sisu_search/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_skin/index.html'>http://sisudoc.org/sisu/sisu_skin/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_sqlite/index.html'>http://sisudoc.org/sisu/sisu_sqlite/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_syntax_highlighting/index.html'>http://sisudoc.org/sisu/sisu_syntax_highlighting/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_vim/index.html'>http://sisudoc.org/sisu/sisu_vim/index.html</a> ><br> - + <p> <<a href='http://sisudoc.org/sisu/sisu_webrick/index.html'>http://sisudoc.org/sisu/sisu_webrick/index.html</a> ><br> - -<p> 34.3 MAN2HTML -<p> 34.3.1 LOCALLY INSTALLED + +<p> 34.3 MAN2HTML +<p> 34.3.1 LOCALLY INSTALLED <p> <file:///usr/share/doc/sisu/html/sisu.1.html> -<p> <file:///usr/share/doc/sisu/html/sisu_help.1.html> +<p> <file:///usr/share/doc/sisu/html/sisu_help.1.html> <p> <file:///usr/share/doc/sisu/html/sisu_help_sources.1.html> <p> /usr/share/doc/sisu/html/sisu.1.html<br> - + <p> /usr/share/doc/sisu/html/sisu_pdf.7.html<br> - + <p> /usr/share/doc/sisu/html/sisu_postgresql.7.html<br> - + <p> /usr/share/doc/sisu/html/sisu_sqlite.7.html<br> - + <p> /usr/share/doc/sisu/html/sisu_webrick.1.html<br> - -<p> 34.3.2 WWW.JUS.UIO.NO/SISU + +<p> 34.3.2 WWW.JUS.UIO.NO/SISU <p> <<a href='http://www.jus.uio.no/sisu/man/sisu.1.html'>http://www.jus.uio.no/sisu/man/sisu.1.html</a> -> +> <p> <<a href='http://www.jus.uio.no/sisu/man/sisu.1.html'>http://www.jus.uio.no/sisu/man/sisu.1.html</a> ><br> - + <p> <<a href='http://www.jus.uio.no/sisu/man/sisu_complete.7.html'>http://www.jus.uio.no/sisu/man/sisu_complete.7.html</a> ><br> - + <p> <<a href='http://www.jus.uio.no/sisu/man/sisu_pdf.7.html'>http://www.jus.uio.no/sisu/man/sisu_pdf.7.html</a> ><br> - + <p> <<a href='http://www.jus.uio.no/sisu/man/sisu_postgresql.7.html'>http://www.jus.uio.no/sisu/man/sisu_postgresql.7.html</a> ><br> - + <p> <<a href='http://www.jus.uio.no/sisu/man/sisu_sqlite.7.html'>http://www.jus.uio.no/sisu/man/sisu_sqlite.7.html</a> ><br> - + <p> <<a href='http://www.jus.uio.no/sisu/man/sisu_webrick.1.html'>http://www.jus.uio.no/sisu/man/sisu_webrick.1.html</a> ><br> - -<p> DOCUMENT INFORMATION (METADATA) -<p> METADATA + +<p> DOCUMENT INFORMATION (METADATA) +<p> METADATA <p> Document Manifest @ <<a href='http://sisudoc.org/sisu_manual/sisu/sisu_manifest.html'>http://sisudoc.org/sisu_manual/sisu/sisu_manifest.html</a> > -<p> <b>Dublin Core</b> (DC) +<p> <b>Dublin Core</b> (DC) <p> <i>DC</i> tags included with this document are provided here. -<p> DC Title: <i>SiSU</i> - Manual -<p> DC Creator: <i>Ralph</i> Amissah -<p> DC Rights: <i>Copyright</i> -(C) Ralph Amissah 2008, part of SiSU documentation, License GPL 3 -<p> DC -Type: <i>information</i> -<p> DC Date created: <i>2002-08-28</i> -<p> DC Date issued: <i>2002-08-28</i> +<p> DC Title: <i>SiSU</i> - Manual +<p> DC Creator: <i>Ralph</i> Amissah +<p> DC Rights: 3 +<p> DC Type: -<p> DC Date available: <i>2002-08-28</i> -<p> DC Date modified: <i>2008-05-22</i> +<p><i>information</i> +<p> DC Date created: <i>2002-08-28</i> +<p> DC Date issued: <i>2002-08-28</i> +<p> DC +Date available: <i>2002-08-28</i> +<p> DC Date modified: <i>2008-05-22</i> <p> DC Date: <i>2008-05-22</i> -<p> <b>Version Information</b> -<p> Sourcefile: <i>sisu.ssm.sst</i> +<p> <b>Version Information</b> +<p> Sourcefile: <i>sisu.ssm.sst</i> <p> Filetype: <i>SiSU</i> text insert -<p>0.67 -<p> Sourcefile Digest, MD5(sisu.ssm.sst)= <i>7568e6bc171256672e0820a333b37459</i> +<p>0.67 +<p> Sourcefile Digest, MD5(sisu.ssm.sst)= <i>7fbab3b7c0fd0ed2e128585c2982c5c8</i> <p> Skin_Digest: MD5(skin_sisu_manual.rb)= <i>072b2584bedea82ea8a416587b9fa244</i> -<p> <b>Generated</b> -<p> Document (metaverse) last generated: <i>Thu</i> May 22 20:03:01 +<p> <b>Generated</b> +<p> Document (metaverse) last generated: <i>Mon</i> Jul 21 02:54:34 <p>- -<p>0400 2008 -<p> Generated by: <i>SiSU</i> <i>0.66.3</i> of 2008w18/0 (2008-05-11) +<p>0400 2008 +<p> Generated by: <i>SiSU</i> <i>0.68.0</i> of 2008w29/1 (2008-07-21) <p> Ruby version: -<i>ruby</i> 1.8.6 (2008-03-03 patchlevel 114) [i486-linux] -<p> +<i>ruby</i> 1.8.7 (2008-06-20 patchlevel 22) [i486-linux] +<p> <ol> <b>.</b><li>objects include: headings, paragraphs, verse, tables, images, but not footnotes/endnotes which are @@ -3303,9 +3222,9 @@ for that form of presentation, rather than for example the html being a saved version of the odf, or the pdf being a saved version of the html. </li><b>.</b><li>the different heading levels </li><b>.</b><li>units of text, primarily paragraphs and headings, also any tables, poems, code-blocks </li><b>.</b><li>Specification submitted by Adobe to -ISO to become a full open ISO specification <<a href='http://www.linux-watch.com/news/NS7542722606.html'>http://www.linux-watch.com/news/NS7542722606.html</a> -><br> - </li><b>.</b><li>ISO/IEC 26300:2006 </dd> +ISO to become a full open ISO specification <<a href='http://www.linux-watch.com/news/NS7542722606.html'>http://www.linux-watch.com/news/NS7542722606.html</a> +> +</li><b>.</b><li>ISO/IEC 26300:2006 </dd> <dt><b>*1.</b> </dt> <dd>square brackets </dd> @@ -3340,44 +3259,43 @@ notes, numbered asterisk footnote/endnote series </li><b>.</b><li><<a href='h > </li><b>.</b><li><<a href='http://www.ruby-lang.org/en/'>http://www.ruby-lang.org/en/</a> > </li><b>.</b><li>Table from the Wealth of Networks by Yochai Benkler - <<a href='http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler'>http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler</a> -><br> - </li><b>.</b><li>.ssc (for composite) is under consideration but ._sst makes clear that this -is not a regular file to be worked on, and thus less likely that people -will have processing. It may be however that when the resulting file is -shared .ssc is an appropriate suffix to use. </li><b>.</b><li>.B SiSU has worked this way in -the past, though this was dropped as it was thought the complexity outweighed -the flexibility, however, the balance was rather fine and this behaviour -could be reinstated. </li><b>.</b><li><<a href='http://www.postgresql.org/'>http://www.postgresql.org/</a> -> <<a href='http://advocacy.postgresql.org/'>http://advocacy.postgresql.org/</a> -><br> - <<a href='http://en.wikipedia.org/wiki/Postgresql'>http://en.wikipedia.org/wiki/Postgresql</a> -><br> - </li><b>.</b><li><<a href='http://www.hwaci.com/sw/sqlite/'>http://www.hwaci.com/sw/sqlite/</a> -> <<a href='http://en.wikipedia.org/wiki/Sqlite'>http://en.wikipedia.org/wiki/Sqlite</a> -><br> - </li><b>.</b><li><<a href='http://search.sisudoc.org'>http://search.sisudoc.org</a> -> </li><b>.</b><li>(which could be extended further with current -back-end). As regards scaling of the database, it is as scalable as the database -(here Postgresql) and hardware allow. </li><b>.</b><li>of this feature when demonstrated -to an IBM software innovations evaluator in 2004 he said to paraphrase: -this could be of interest to us. We have large document management systems, -you can search hundreds of thousands of documents and we can tell you which -documents meet your search criteria, but there is no way we can tell you -without opening each document where within each your matches are found. -</li><b>.</b><li>There is nothing to stop MySQL support being added in future. </li><b>.</b><li><<a href='http://www.jus.uio.no/sisu/man/sisu.1'>http://www.jus.uio.no/sisu/man/sisu.1</a> +<<a href='http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler'>http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler</a> +> </li><b>.</b><li>.ssc (for composite) +is under consideration but ._sst makes clear that this is not a regular +file to be worked on, and thus less likely that people will have processing. +It may be however that when the resulting file is shared .ssc is an appropriate +suffix to use. </li><b>.</b><li>.B SiSU has worked this way in the past, though this was dropped +as it was thought the complexity outweighed the flexibility, however, the +balance was rather fine and this behaviour could be reinstated. </li><b>.</b><li><<a href='http://www.postgresql.org/'>http://www.postgresql.org/</a> > -</li><b>.</b><li><<a href='http://www.jus.uio.no/sisu/man/sisu.8'>http://www.jus.uio.no/sisu/man/sisu.8</a> -> </li><b>.</b><li><<a href='http://www.jus.uio.no/sisu/man'>http://www.jus.uio.no/sisu/man</a> -> </li><b>.</b><li>the .B Debian -Free Software guidelines require that everything distributed within .B -Debian can be changed - and the documents are authors’ works that while freely -distributable are not freely changeable. </li><b>.</b><li>named index.html or more extensively - -<p>through sisu_manifest.html +<<a href='http://advocacy.postgresql.org/'>http://advocacy.postgresql.org/</a> +> <<a href='http://en.wikipedia.org/wiki/Postgresql'>http://en.wikipedia.org/wiki/Postgresql</a> +> </li><b>.</b><li><<a href='http://www.hwaci.com/sw/sqlite/'>http://www.hwaci.com/sw/sqlite/</a> +> +<<a href='http://en.wikipedia.org/wiki/Sqlite'>http://en.wikipedia.org/wiki/Sqlite</a> +> </li><b>.</b><li><<a href='http://search.sisudoc.org'>http://search.sisudoc.org</a> +> </li><b>.</b><li>(which could +be extended further with current back-end). As regards scaling of the database, +it is as scalable as the database (here Postgresql) and hardware allow. +</li><b>.</b><li>of this feature when demonstrated to an IBM software innovations evaluator +in 2004 he said to paraphrase: this could be of interest to us. We have +large document management systems, you can search hundreds of thousands +of documents and we can tell you which documents meet your search criteria, +but there is no way we can tell you without opening each document where +within each your matches are found. </li><b>.</b><li>There is nothing to stop MySQL support +being added in future. </li><b>.</b><li><<a href='http://www.jus.uio.no/sisu/man/sisu.1'>http://www.jus.uio.no/sisu/man/sisu.1</a> +> </li><b>.</b><li><<a href='http://www.jus.uio.no/sisu/man/sisu.8'>http://www.jus.uio.no/sisu/man/sisu.8</a> +> +</li><b>.</b><li><<a href='http://www.jus.uio.no/sisu/man'>http://www.jus.uio.no/sisu/man</a> +> </li><b>.</b><li>the <b>Debian</b> Free Software guidelines require +that everything distributed within <b>Debian</b> can be changed - and the documents +are authors’ works that while freely distributable are not freely changeable. +</li><b>.</b><li> +<p>named index.html or more extensively through sisu_manifest.html <p> </dd> -<dt>Other versions of this document: </dt> +<dt>Other versions +of this document: </dt> <dd></dd> <dt>manifest: <<a href='http://www.jus.uio.no/sisu/sisu/sisu_manifest.html'><a href='http://www.jus.uio.no/sisu/sisu/sisu_manifest.html'>http://www.jus.uio.no/sisu/sisu/sisu_manifest.html</a> @@ -3408,15 +3326,15 @@ distributable are not freely changeable. </li><b>.</b><li>named index.html or mo </dt> <dd></dd> -<dt>* Generated by: SiSU 0.66.3 of 2008w18/0 (2008-05-11) </dt> +<dt>* Generated by: SiSU 0.68.0 of 2008w29/1 (2008-07-21) </dt> <dd></dd> <dt>* Ruby version: ruby -1.8.6 (2008-03-03 patchlevel 114) [i486-linux] </dt> +1.8.7 (2008-06-20 patchlevel 22) [i486-linux] </dt> <dd></dd> -<dt>* Last Generated on: Thu May -22 20:03:01 -0400 2008 </dt> +<dt>* Last Generated on: Mon Jul 21 +02:54:35 -0400 2008 </dt> <dd></dd> <dt>* SiSU <a href='http://www.jus.uio.no/sisu'>http://www.jus.uio.no/sisu</a> diff --git a/data/doc/sisu/sisu_markup_samples/sisu_manual/_sisu/sisurc.yml b/data/doc/sisu/sisu_markup_samples/sisu_manual/_sisu/sisurc.yml index ab6d99d0..908992ee 100644 --- a/data/doc/sisu/sisu_markup_samples/sisu_manual/_sisu/sisurc.yml +++ b/data/doc/sisu/sisu_markup_samples/sisu_manual/_sisu/sisurc.yml @@ -67,7 +67,7 @@ flag: v: '-NhwpoabxXYDyv --update' # includes verbose; -m run by default #% papersize, (LaTeX/pdf) current values A4, US_letter, book_b5, book_a5, US_legal default: - papersize: 'A4' + papersize: 'A4,letter' language_file: 2 #digest: 'sha' #sha is sha256, default is md5 #multilingual: false diff --git a/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_download.ssi b/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_download.ssi index 69e51f28..864bd303 100644 --- a/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_download.ssi +++ b/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_download.ssi @@ -18,9 +18,9 @@ @date.available: 2007-08-28 -@date.modified: 2008-05-22 +@date.modified: 2008-07-21 -@date: 2008-05-22 +@date: 2008-07-21 @level: new=C; break=1; num_top=1 @@ -55,7 +55,7 @@ Download the latest version of SiSU (and SiSU markup samples):~{ Breakage and Fixes Report<br> http://www.jus.uio.no/sisu/SiSU/breakage_and_fixes.html }~ -_* {~^ sisu_0.67.0.orig.tar.gz (of 2008-05-22:20/4) }http://www.jus.uio.no/sisu/pkg/src/sisu_0.67.0.orig.tar.gz +_* {~^ sisu_0.68.0.orig.tar.gz (of 2008-07-21:29/1) }http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0.orig.tar.gz _* {~^ sisu-markup-samples_1.0.8.orig.tar.gz (of 2007-08-19:33/7 ) }http://www.jus.uio.no/sisu/pkg/src/sisu-markup-samples_1.0.8.orig.tar.gz *~sisu-markup-samples @@ -90,23 +90,23 @@ deb-src http://www.jus.uio.no/sisu/archive unstable main non-free !_ Source -_* {~^ sisu_0.67.0.orig.tar.gz }http://www.jus.uio.no/sisu/pkg/src/sisu_0.67.0.orig.tar.gz +_* {~^ sisu_0.68.0.orig.tar.gz }http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0.orig.tar.gz -_* {~^ sisu_0.67.0-1.diff.gz }http://www.jus.uio.no/sisu/pkg/src/sisu_0.67.0-1.diff.gz +_* {~^ sisu_0.68.0-1.diff.gz }http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0-1.diff.gz -_* {~^ sisu_0.67.0-1.dsc }http://www.jus.uio.no/sisu/pkg/src/sisu_0.67.0-1.dsc +_* {~^ sisu_0.68.0-1.dsc }http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0-1.dsc !_ Debs -_* {~^ sisu_0.67.0-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu_0.67.0-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_0.68.0-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu_0.68.0-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_0.67.0-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-complete_0.67.0-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_0.68.0-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-complete_0.68.0-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_0.67.0-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-pdf_0.67.0-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_0.68.0-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-pdf_0.68.0-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_0.67.0-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-postgresql_0.67.0-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_0.68.0-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-postgresql_0.68.0-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_0.67.0-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-sqlite_0.67.0-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_0.68.0-1_all.deb }http://www.jus.uio.no/sisu/archive/pool/main/s/sisu/sisu-sqlite_0.68.0-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 }~ For changelogs see: @@ -132,7 +132,7 @@ _1 http://www.jus.uio.no/sisu/sisu_markup_samples_changelog/changelog_markup_sam The RPM is generated Alien~{ http://www.kitenet.net/programs/alien/ }~ from two deb packages (sisu and sisu-doc). Dependencies are not handled, not even that of the essential Ruby. -_* {~^ sisu-0.67.0-2.noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/sisu-0.67.0-2.noarch.rpm ~{ untested, created using: alien -r sisu_0.67.0-1_all.deb }~ +_* {~^ sisu-0.68.0-2.noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/sisu-0.68.0-2.noarch.rpm ~{ untested, created using: alien -r sisu_0.68.0-1_all.deb }~ _* {~^ sisu-markup-samples_1.0.8.orig-2.noarch.rpm }http://www.jus.uio.no/sisu/pkg/rpm/sisu-markup-samples_1.0.6.orig-2.noarch.rpm ~{ <br> untested, created using alien }~ diff --git a/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_manual.ssm b/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_manual.ssm index 19324618..41fd724b 100644 --- a/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_manual.ssm +++ b/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_manual.ssm @@ -18,9 +18,9 @@ @date.available: 2002-08-28 -@date.modified: 2008-05-22 +@date.modified: 2008-07-21 -@date: 2008-05-22 +@date: 2008-07-21 @level: new=C; break=1; num_top=1 diff --git a/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_markup.sst b/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_markup.sst index 3b83eee7..32659adf 100644 --- a/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_markup.sst +++ b/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_markup.sst @@ -529,8 +529,6 @@ normal text ~[+ editors notes, numbered asterisk footnote/endnote series ]~ cont code{ -code{ - % note the endnote marker "~^" normal text~^ continues diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index 1b777bb5..f62b20ac 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -183,18 +183,18 @@ WOK @path="#{@env.path.output}/#{@md.fnb}" @freq=Hash.new(0) @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - @rxp_to=Regexp.new("<~(\\d+);(?:[oh]|[0-6]:)\\d+;\\w\\d+><#@dp:#@dp>$") - @rxp_lv1=Regexp.new('^1~') #line start markers removed, ('^1~') for exceptions <!pn!>\n\n4{{{ - @rxp_lv2=Regexp.new('^2~') - @rxp_lv3=Regexp.new('^3~') - @rxp_seg=Regexp.new('^4~(.+?)\s+') - @rxp_title=Regexp.new('^0~title\s*(.+?)\s*$') + @rxp_to=Regexp.new("#{Mx[:id_o]}~(\\d+);(?:[oh]|[0-6]:)\\d+;\\w\\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|#{Mx[:id_o]}\S+?#{Mx[:id_c]}$") + @rxp_lv1=/^#{Mx[:lv_o]}1:/ + @rxp_lv2=/^#{Mx[:lv_o]}2:/ + @rxp_lv3=/^#{Mx[:lv_o]}3:/ + @rxp_seg=/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/ + @rxp_title=Regexp.new("^#{Mx[:meta_o]}title#{Mx[:meta_c]}\s*(.+?)\s*$") @rxp_t1=Regexp.new('^T1') @rxp_t2=Regexp.new('^T2') @rxp_t3=Regexp.new('^T3') - @rxp_excluded1=/(?:https?|file|ftp):\/\/\S+/mi - @rxp_excluded0=/^(?:to\d+|\d+| |EOF|thumb_\S+|snap_\S+|_+|-+|ii+|iv|vi+|ix|xi+|xiv|xv|xvi+|xix|xx|\S+?_\S+|[\d_]+\w\S+|[\w\d]{1,2}|\d{1,3}\w?|#@dp|[0-9a-f]{16,64}|\d{2,3}x\d{2,3}|\S{0,2}sha\d|\S{0,3}\d{4}w\d\d|\b\w\d+|\d_all\b|e\.?g\.?)$/mi #this regex causes and cures a stack dump in ruby 1.9 !!! - @rgx_scanlist=%r{(?:<i>(?:[a-zA-Z0-9"\s]){2,7}</i>|<b>(?:[a-zA-Z0-9"\s]){2,7}</b>|(?:https?|file)://\S+)|code\{.+?\}code|<\S+?>|\w+}mi + @rxp_excluded1=/(?:https?|file|ftp):\/\/\S+/ + @rxp_excluded0=/^(?:#{Mx[:fa_bold_o]}|#{Mx[:fa_italics_o]})?(?:to\d+|\d+| |#{Mx[:br_endnotes]}|EOF|#{Mx[:br_eof]}|thumb_\S+|snap_\S+|_+|-+|[(]?(?:ii+|iv|vi+|ix|xi+|xiv|xv|xvi+|xix|xx)[).]?|\S+?_\S+|[\d_]+\w\S+|[\w\d]{1,2}|\d{1,3}\w?|#@dp|[0-9a-f]{16,64}|\d{2,3}x\d{2,3}|\S{0,2}sha\d|\S{0,3}\d{4}w\d\d|\b\w\d+|\d_all\b|e\.?g\.?)(?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})?$/mi #this regex causes and cures a stack dump in ruby 1.9 !!! + @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_bold_c]}|(?:https?|file)://\S+|#{Mx[:gr_o]}code#{Mx[:gr_o]}.+?#{Mx[:gr_o]}code-end#{Mx[:gr_o]}|<\S+?>|#{Mx[:id_o]}\S+?#{Mx[:id_c]}|\w+|[a-zA-Z]+}mi rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error end end @@ -231,20 +231,39 @@ WOK @seg,toy=nil,nil @word_map={} @dal_array.each do |line| - if line !~/<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/ # lines to ignore: # are added but not part of authors substantive text; 0 are mostly machine generated - if line =~@rxp_seg; @seg=line[@rxp_seg,1] + if line !~/#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #lines to ignore: # are added but not part of authors substantive text; 0 are mostly machine generated + if line =~@rxp_seg; @seg=line[@rxp_seg,1] end - if line =~@rxp_to; toy=line[@rxp_to,1] + if line =~@rxp_to; toy=line[@rxp_to,1] end if toy =~/\d+/ \ and toy !~/^0$/ for word in line.scan(@rgx_scanlist) #%take in word or other match + #word.gsub!(@rxp_clean,'') + word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'') + word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') + word.gsub!(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,'') + word.gsub!(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'') + word.gsub!(/^\S$/,'') + word=nil if word.empty? word=nil if word =~@rxp_excluded0 #watch word=nil if word =~@rxp_excluded1 #watch + word=nil if word =~/^\S$/ if word - #word.gsub!(/<\/?[i]>/,'') + word.gsub!(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' ') + word.gsub!(/#{Mx[:lv_o]}\d:\S*?#{Mx[:lv_c]}/,'') + word.gsub!(/#{Mx[:pa_o]}:i\d#{Mx[:pa_c]}/,'') + word.gsub!(/#{Mx[:id_o]}~\d+;\S+?#{Mx[:id_c]}/,'') + word.gsub!(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,'') + word.gsub!(/#{Mx[:mk_o]}(?:[0-9a-f]{32}:[0-9a-f]{32}|[0-9a-f]{64}:[0-9a-f]{64})#{Mx[:mk_c]}/,'') + word.gsub!(/#{Mx[:mk_o]}(?:[0-9a-f]{32}|[0-9a-f]{64})#{Mx[:mk_c]}/,'') + word.gsub!(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,'') + word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''); word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') + #word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_c]}/,'') #watch word.gsub!(/<\/?\S+?>/,'') + word.gsub!(/^\@+/,'') word.strip! + word.gsub!(/#{Mx[:tc_p]}.+/,'') word.gsub!(/[\.,;:"]$/,'') word.gsub!(/["]/,'') word.gsub!(/^\s*[\(]/,'') @@ -252,8 +271,12 @@ WOK word.gsub!(/^(?:See|e\.?g\.?).+/,'') word.gsub!(/^\s*[.,;:]\s*/,'') word.strip! + word.gsub!(/^\(?[a-zA-Z]\)$/,'') word.gsub!(/^\d+(st|nd|rd|th)$/,'') word.gsub!(/^(\d+\.?)+$/, '') + word.gsub(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'') + word.gsub!(/^\S$/,'') + word=nil if word =~/^\S$/ word=nil if word =~/^\s*$/ #watch if word unless word =~/[A-Z][A-Z]/ \ diff --git a/lib/sisu/v0/conf.rb b/lib/sisu/v0/conf.rb index 639847ab..5fc9343c 100644 --- a/lib/sisu/v0/conf.rb +++ b/lib/sisu/v0/conf.rb @@ -111,6 +111,7 @@ module SiSU_Initialize tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy images','') tell.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 diff --git a/lib/sisu/v0/constants.rb b/lib/sisu/v0/constants.rb index 883f1c00..68093673 100644 --- a/lib/sisu/v0/constants.rb +++ b/lib/sisu/v0/constants.rb @@ -1,9 +1,10 @@ +# coding:utf-7 =begin * Name: SiSU * Description: a framework for document structuring, publishing and search - #___# + constants * Author: Ralph Amissah @@ -59,8 +60,110 @@ ** Description: system environment, resource control and configuration details =end - -SQL_TEST_FILE=File.new('sqlite3_insert.sql','w+') - +Mx,Rx={},{} +Mx[:meta_o],Mx[:meta_c]='〔@','〕' +Mx[:lv_o_1],Mx[:lv_o_2],Mx[:lv_o_3],Mx[:lv_o_4],Mx[:lv_o_5],Mx[:lv_o_6],Mx[:lv_o_7],Mx[:lv_o_8],Mx[:lv_o_9]= + '〔1:','〔2:','〔3:','〔4:','〔5:','〔6:','〔7:','〔8:','〔9:'; +Mx[:lv_o],Mx[:lv_c]='〔','〕' +# '1~','2~','3~','4~','5~','6~','7~','8~','9~'; Mx[:lv_c]='' +Mx[:en_a_o]='【'; Mx[:en_a_c]='】' #Mx[:en_a_o]='~{'; Mx[:en_a_c]='}~' +Mx[:en_b_o]='〖'; Mx[:en_b_c]='〗' #Mx[:en_b_o]='~['; Mx[:en_b_c]=']~' +Mx[:br_line]="#{Mx[:mk_o]}br#{Mx[:mk_c]}" +Mx[:gr_o]='〔'; Mx[:gr_c]='〕' #group text mark +Mx[:id_o]='〔'; Mx[:id_c]='〕' #object id mark +Mx[:tc_o]='『'; Mx[:tc_c]='』' #table column mark +Mx[:tc_p]='┆' #table row/misc mark +Mx[:pa_o]='〔'; Mx[:pa_c]='〕' #affects paragraph mark +Mx[:mk_o]='〔'; Mx[:mk_c]='〕' #generic mark +Mx[:gl_o]='〔'; Mx[:gl_c]='〕' #glyph +Mx[:fa_o]='〔'; Mx[:fa_o_c]='¤'; Mx[:fa_c_o]='¤'; Mx[:fa_c]='〕' +Mx[:fa_bold_o]= "#{Mx[:fa_o]}b#{Mx[:fa_o_c]}"; Mx[:fa_bold_c]= "#{Mx[:fa_c_o]}b#{Mx[:fa_c]}" +Mx[:fa_italics_o]= "#{Mx[:fa_o]}i#{Mx[:fa_o_c]}"; Mx[:fa_italics_c]= "#{Mx[:fa_c_o]}i#{Mx[:fa_c]}" +Mx[:fa_underscore_o]= "#{Mx[:fa_o]}u#{Mx[:fa_o_c]}"; Mx[:fa_underscore_c]= "#{Mx[:fa_c_o]}u#{Mx[:fa_c]}" +Mx[:fa_cite_o]= "#{Mx[:fa_o]}cite#{Mx[:fa_o_c]}"; Mx[:fa_cite_c]= "#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}" +Mx[:fa_insert_o]= "#{Mx[:fa_o]}ins#{Mx[:fa_o_c]}"; Mx[:fa_insert_c]= "#{Mx[:fa_c_o]}ins#{Mx[:fa_c]}" +Mx[:fa_strike_o]= "#{Mx[:fa_o]}del#{Mx[:fa_o_c]}"; Mx[:fa_strike_c]= "#{Mx[:fa_c_o]}del#{Mx[:fa_c]}" +Mx[:fa_superscript_o]="#{Mx[:fa_o]}sup#{Mx[:fa_o_c]}"; Mx[:fa_superscript_c]="#{Mx[:fa_c_o]}sup#{Mx[:fa_c]}" +Mx[:fa_subscript_o]= "#{Mx[:fa_o]}sub#{Mx[:fa_o_c]}"; Mx[:fa_subscript_c]= "#{Mx[:fa_c_o]}sub#{Mx[:fa_c]}" +Mx[:fa_hilite_o]= "#{Mx[:fa_o]}hi#{Mx[:fa_o_c]}"; Mx[:fa_hilite_c]= "#{Mx[:fa_c_o]}hi#{Mx[:fa_c]}" +Mx[:gl_bullet]= "#{Mx[:gl_o]}●#{Mx[:gl_c]}" +#non substantive text sort: <-#> <~#> + Mx[:pa_non_object_dummy_heading]="#{Mx[:pa_o]}-##{Mx[:pa_c]}" #unnumbered paragraph, delete when not required [used in dummy headings, eg. for segmented html] (place marker at end of paragraph) + Mx[:pa_non_object_no_heading]="#{Mx[:pa_o]}~##{Mx[:pa_c]}" #unnumbered paragraph (place marker at end of paragraph) +Mx[:br_line]= "#{Mx[:mk_o]}br#{Mx[:mk_c]}" +Mx[:br_paragraph]= "#{Mx[:mk_o]}br#{Mx[:mk_c]}" +Mx[:br_nl]= "#{Mx[:mk_o]}nl#{Mx[:mk_c]}" +Mx[:br_page]= "#{Mx[:mk_o]}pb#{Mx[:mk_c]}" +Mx[:br_page_new]= "#{Mx[:mk_o]}pn#{Mx[:mk_c]}" +Mx[:br_endnotes]= "#{Mx[:mk_o]}ENDNOTES#{Mx[:mk_c]}" +Mx[:br_eof]= "#{Mx[:mk_o]}EOF#{Mx[:mk_c]}" +Mx[:lnk_o]='「'; Mx[:lnk_c]='」' +Mx[:sm_set_o]='《'; Mx[:sm_set_c]='》' +Mx[:sm_subset_o]='《 '; Mx[:sm_subset_c]='》' +#Mx[:sm_set_o]='∈ '; Mx[:sm_set_c]='∋ ' +#Mx[:sm_subset_o]='∈ '; Mx[:sm_subset_c]='∋ ' +Rx[:mx_fa_clean]= /#{Mx[:fa_o]}.+?#{Mx[:fa_c]}|#{Mx[:pa_o]}.+?#{Mx[:pa_c]}|#{Mx[:mk_o]}.+?#{Mx[:mk_c]}/ +Rx[:lv],Rx[:lv_1],Rx[:lv_2],Rx[:lv_3],Rx[:lv_4],Rx[:lv_5],Rx[:lv_6],Rx[:lv_7],Rx[:lv_8],Rx[:lv_9]= + /〔([1-9]):(\S*?)〕/,/#{Mx[:lv_o_1]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_2]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_3]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_4]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_5]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_6]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_7]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_8]}(\S*?)#{Mx[:lv_c]}/,/#{Mx[:lv_o_9]}(\S*?)#{Mx[:lv_c]}/ +Rx[:meta]=/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}/ +unless RUBY_VERSION < '1.9' + Mx[:meta_o].force_encoding('utf-8'); Mx[:meta_c].force_encoding('utf-8') + Mx[:lv_o_1].force_encoding('utf-8'); Mx[:lv_o_2].force_encoding('utf-8'); Mx[:lv_o_3].force_encoding('utf-8'); Mx[:lv_o_4].force_encoding('utf-8'); Mx[:lv_o_5].force_encoding('utf-8'); Mx[:lv_o_6].force_encoding('utf-8'); Mx[:lv_o_7].force_encoding('utf-8'); Mx[:lv_o_8].force_encoding('utf-8'); Mx[:lv_o_9].force_encoding('utf-8') + Mx[:lv_o].force_encoding('utf-8'); Mx[:lv_c].force_encoding('utf-8') + Mx[:gr_o].force_encoding('utf-8'); Mx[:gr_c].force_encoding('utf-8') + Mx[:id_o].force_encoding('utf-8'); Mx[:id_c].force_encoding('utf-8') + Mx[:tc_p].force_encoding('utf-8') + Mx[:tc_o].force_encoding('utf-8'); Mx[:tc_c].force_encoding('utf-8') + Mx[:pa_o].force_encoding('utf-8'); Mx[:pa_c].force_encoding('utf-8') + Mx[:mk_o].force_encoding('utf-8'); Mx[:mk_c].force_encoding('utf-8') + Mx[:gl_o].force_encoding('utf-8'); Mx[:gl_c].force_encoding('utf-8') + Mx[:fa_o].force_encoding('utf-8'); Mx[:fa_c].force_encoding('utf-8') + Mx[:fa_o_c].force_encoding('utf-8'); Mx[:fa_c_o].force_encoding('utf-8') + Mx[:fa_bold_o].force_encoding('utf-8'); Mx[:fa_bold_c].force_encoding('utf-8') + Mx[:fa_italics_o].force_encoding('utf-8'); Mx[:fa_italics_c].force_encoding('utf-8') + Mx[:fa_underscore_o].force_encoding('utf-8'); Mx[:fa_underscore_c].force_encoding('utf-8') + Mx[:fa_cite_o].force_encoding('utf-8'); Mx[:fa_cite_c].force_encoding('utf-8') + Mx[:fa_insert_o].force_encoding('utf-8'); Mx[:fa_insert_c].force_encoding('utf-8') + Mx[:fa_strike_o].force_encoding('utf-8'); Mx[:fa_strike_c].force_encoding('utf-8') + Mx[:fa_superscript_o].force_encoding('utf-8'); Mx[:fa_superscript_c].force_encoding('utf-8') + Mx[:fa_subscript_o].force_encoding('utf-8'); Mx[:fa_subscript_c].force_encoding('utf-8') + Mx[:fa_hilite_o].force_encoding('utf-8'); Mx[:fa_hilite_c].force_encoding('utf-8') + Mx[:gl_bullet].force_encoding('utf-8') + Mx[:pa_non_object_dummy_heading].force_encoding('utf-8'); Mx[:pa_non_object_no_heading].force_encoding('utf-8') + Mx[:br_line].force_encoding('utf-8'); Mx[:br_nl].force_encoding('utf-8') + Mx[:br_paragraph].force_encoding('utf-8') + Mx[:br_page].force_encoding('utf-8'); Mx[:br_page_new].force_encoding('utf-8') + Mx[:br_endnotes].force_encoding('utf-8') + Mx[:br_eof].force_encoding('utf-8') + Mx[:lnk_o].force_encoding('utf-8'); Mx[:lnk_c].force_encoding('utf-8') + Mx[:sm_set_o].force_encoding('utf-8'); Mx[:sm_set_c].force_encoding('utf-8') + Mx[:sm_subset_o].force_encoding('utf-8'); Mx[:sm_subset_c].force_encoding('utf-8') +# + Rx[:mx_fa_clean].force_encoding('utf-8') + Rx[:lv].force_encoding('utf-8');Rx[:lv_1].force_encoding('utf-8');Rx[:lv_2].force_encoding('utf-8');Rx[:lv_3].force_encoding('utf-8');Rx[:lv_4].force_encoding('utf-8');Rx[:lv_5].force_encoding('utf-8');Rx[:lv_6].force_encoding('utf-8');Rx[:lv_7].force_encoding('utf-8');Rx[:lv_8].force_encoding('utf-8');Rx[:lv_9].force_encoding('utf-8') + Rx[:meta].force_encoding('utf-8') +end __END__ +consider: + 〔comment〕 + 〔links?????〕 + import document? +check: + bold line + +┆┆⋮┇┊┋ +『』 +「」 +〔〕 +【】 + +· +¤ + #˝ " λ Ω β α π Ѫ Ж Я Ѳ ѳ Ф ㈣ + Ѳ ѳ Ф + ♩ ♭ ✠ ▭ ▬ ▪ +【】〖〗《》「」 + ‹ › ∗ +'〔lv1〕','〔lv2〕','〔lv3〕','〔lv4〕','〔lv5〕','〔lv6〕','〔lv7〕','〔lv8〕','〔lv9〕' +'〔 Ѳ1〕','〔 Ѳ2〕','〔 Ѳ3〕','〔 Ѳ4〕','〔 Ѳ5〕','〔Ѳ6〕','〔Ѳ7〕','〔Ѳ8〕','〔Ѳ9〕' diff --git a/lib/sisu/v0/css.rb b/lib/sisu/v0/css.rb index d1798a77..cdd05528 100644 --- a/lib/sisu/v0/css.rb +++ b/lib/sisu/v0/css.rb @@ -581,7 +581,9 @@ WOK color: #000077; } li.doc { - background: url(../image/bullet_doc.png) no-repeat 0 0; + background: url(../image/bullet_09.png) no-repeat 0px 6px; + /* background: url(../image/bullet_doc.png) no-repeat 0 0; */ + /* background: url(../../_sisu/image/bullet_09.png) no-repeat 0px 6px; */ padding-left: 16px; margin-left: 10px; margin-top: 0px; @@ -603,6 +605,7 @@ WOK text-align: left; } li.refcenter { + background: url(../image/bullet_09.png) no-repeat 0px 6px; /* background: url(../image/bullet_doc.png) no-repeat 0 0; */ background: none; padding-left: 20px; @@ -614,7 +617,8 @@ WOK text-align: center; } li.refbold { - background: url(../image/bullet_doc.png) no-repeat 0 0; + background: url(../image/bullet_09.png) no-repeat 0px 6px; + /* background: url(../image/bullet_doc.png) no-repeat 0 0; */ /* padding-left: 0px; */ padding-left: 16px; margin-left: 0; diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 3e5e11ac..cb6d70f8 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -70,7 +70,7 @@ module SiSU_DAL include SiSU_Env include SiSU_Param include SiSU_Viz - include Syntax + include SiSU_Syntax class Instantiate < SiSU_Param::Parameters::Instructions def initialize @@flag_vocab=0 @@ -199,6 +199,7 @@ module SiSU_DAL data=data.join.split("\n\n") data=expand_insertions?(data) data=SiSU_document_structure::Code.new(@md,data).code + data=substitutions_and_insertions?(data) data_new=[] data.each do |x| data_new << if x =~ /\n\n/m; x.split(/\n\n+/) @@ -206,8 +207,7 @@ module SiSU_DAL end end data=data_new.flatten - data=substitutions_and_insertions?(data) - data=Syntax::Markup.new(@md,data).songsheet + data=SiSU_Syntax::Markup.new(@md,data).songsheet data=character_check(data) data=images(data) data=SiSU_document_structure::Tables.new(@md,data).tables @@ -234,12 +234,12 @@ module SiSU_DAL para.gsub!(/^([12])~\?\s+/,'\1~ ') #conditional header for incorporated document 2004w12 para.gsub!(/^[{~}]\s*$/,'') para.gsub!(/^#{@@comment}.*/,'') #remove comment and divider #% - para.gsub!(/<~#>|~#\s*/,'<~#>') - para.gsub!(/-#\s*/,'<-#><~#>') + para.gsub!(/<~#>|~#\s*/,"#{Mx[:fa_o]}~##{Mx[:fa_c]}") + para.gsub!(/-#\s*/,"#{Mx[:fa_o]}-##{Mx[:fa_c]}#{Mx[:fa_o]}~##{Mx[:fa_c]}") #para.gsub!(/(#\{{3} arch-tag:|0\{{3}~cvs)\s+/, "0{{~rcs ") #KEEP ... ENABLE WIDER USE OF REVISION CONTROL - para.gsub!(/(~\{ )\s+/,'\1') - para.gsub!(/ \/\//,'<br />') #added 2004w29 - para.gsub!(/<br>/,'<br />') #needed by xml, xhtml etc. + para.gsub!(/(#{Mx[:en_a_o]} )\s+/,'\1'); para.gsub!(/(~\{ )\s+/,'\1') + para.gsub!(/ \/\//,"#{Mx[:br_line]}") #added 2004w29 + para.gsub!(/<br>/,"#{Mx[:br_line]}") #needed by xml, xhtml etc. #para.gsub!(/<p>/,'<p />') #consider para.gsub!(/`/,"'") para.gsub!(/\t/,' ') @@ -252,12 +252,12 @@ module SiSU_DAL para.gsub!(/\\trademark\b|\\tm\b/,'®') #non_utf8(para) para=para + "\n" - unless para =~/^<:code>/ + unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ case para when /\^~/ # endnotes #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+ sub_para=para.dup - @@endnote_array << sub_para.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/, %{~\{#{endnote_no} \\1 \}~}).strip + @@endnote_array << sub_para.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/, %{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip endnote_no+=1 para=nil if para =~/\^~ .+/ #removes 'binary' endnote now in endnote array for later insertion end @@ -383,7 +383,7 @@ module SiSU_DAL manifest="#{pre}{#{txt} }#{@u.remote}/#{url_dir}/toc.html#{note}\n\n" else puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}" - if para =~/\{(?:~\^\s+)?(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+~\{.+?\}~)?/ + if para =~/\{(?:~\^\s+)?(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/ txt,cmd,url_dir,note=$1,$2,$3,$4 manifest="{ #{txt} }../#{url_dir}/toc.html#{note}\n\n" end @@ -452,7 +452,7 @@ module SiSU_DAL tuned_file end def substitutions_and_insertions?(data) - tuned_file=[] + data_expand=[] if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content preceeds it) data[0].gsub!(/^#!\s*\/usr\/bin\/sisu/,'') data[0].gsub!(/^#!\s*\/usr\/bin\/env sisu/,'') @@ -462,16 +462,6 @@ module SiSU_DAL data[0].gsub!(/^(sisu-[\d.]+)$/,'% \1') end data.each do |para| - para=if @md.markup_version.to_f >= 0.38 - SiSU_document_structure::Structure.new(@md,para).structure_markup_normalize - else para - end - #para.gsub!(/<url:(\S+?)>/,'\1') #consider, would permit use of text hyperlinks if desired, dal_syntax more appropriate? - para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 - if para =~/^@\S+?:/ - para.gsub!(/^@(\S+?):\s+/,'0~\1 ') - para.gsub!(/^@(\S+?):([+-])\s+/,'0~\1\2 ') - end if para =~/<:insert\d+!?>/ \ and para !~/^%\s+/ @skin.select @@ -501,13 +491,25 @@ module SiSU_DAL para=[] ins.insert7.split(/\n\n/).each{|x| para << x << "\n"} end - para.each{|x| tuned_file << x } - else tuned_file << para + para.each{|x| data_expand << x } + else data_expand << para + end + data_expand.flatten! + data_expand.compact! + end + data_expand.each do |para| + para=if @md.markup_version.to_f >= 0.38 + SiSU_document_structure::Structure.new(@md,para).structure_markup_normalize + else + SiSU_document_structure::Structure.new(@md,para).structure_marks + end + #para.gsub!(/<url:(\S+?)>/,'\1') #consider, would permit use of text hyperlinks if desired, dal_syntax more appropriate? + para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 + if para =~/^@\S+?:/ + para.gsub!(/^@(\S+?):\s+/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}") + para.gsub!(/^@(\S+?):([+-])\s+/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}") end - tuned_file.flatten! - tuned_file.compact! end - tuned_file end def numbering_song(data) data=number_plaintext_para(data) @@ -524,8 +526,10 @@ module SiSU_DAL def number_plaintext_para(data) @tuned_file=[] data.each do |para| - para.gsub!(/(^|[^<][^v][^>])\n/,'\1 ') #messy, but idea is that tables should retain breaks - para.gsub!(/^/,"\n") unless para =~/¡/u + if para !~/#{Mx[:gr_o]}(?:code|group|alt|poem|verse)#{Mx[:gr_c]}|#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ + para.gsub!(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks + end + para.gsub!(/^/,"\n") unless para =~/#{Mx[:tc_p]}/u para.gsub!(/^\s+|\s$/,"\n") @tuned_file << para end @@ -557,27 +561,27 @@ module SiSU_DAL # debug 2003w46 adding revision control info if @md.flag_auto_endnotes \ and @md.flag_separate_endnotes_make - @tuned_file << "\n4~endnotes Endnotes <-#> <~0;0:0;u0>" + @tuned_file << "\n#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}Endnotes #{Mx[:gl_o]}-##{Mx[:gl_c]} #{Mx[:id_o]}~0;0:0;u0#{Mx[:id_c]}" end - @tuned_file << "\n<ENDNOTES>" + @tuned_file << "\n#{Mx[:br_endnotes]}" #DECIDE ON @tuned_file=@tuned_file.flatten end def owner_details_seg - data << '4~owner.details Owner Details' + data << "#{Mx[:lv_o]}4:owner.details#{Mx[:lv_c]}Owner Details" end def number_sub_heading(para,num,title_no) case para - when /#{num}~- /; para.gsub!(/#{num}~- /,"#{title_no} ") - when /^#{num}~#\s*/; para.gsub!(/^#{num}~#\s*/,"#{title_no} ") - when /^#{num}~[a-z_\.]+ / - para.gsub!(/^#{num}~([a-z_\.]+)\s+(.+)/i,%{#{num}~\\1 #{title_no} \\2 <:name##{title_no}>}) - when /^#{num}~\s+#{title_no}/ - para.gsub!(/^#{num}~ /,"#{num}~#{title_no} ") #where title contains title number - else para.gsub!(/^#{num}~ /,"#{num}~#{title_no} #{title_no} ") #main, where title number is to be provided + when /#{Mx[:lv_o]}#{num}:-#{Mx[:lv_c]}/; para.gsub!(/#{Mx[:lv_o]}#{num}:-#{Mx[:lv_c]}/,"#{title_no} ") + when /^#{Mx[:lv_o]}#{num}:##{Mx[:lv_c]}/; para.gsub!(/^#{Mx[:lv_o]}#{num}:##{Mx[:lv_c]}/,"#{title_no} ") + when /^#{Mx[:lv_o]}#{num}:[a-z_\.]+#{Mx[:lv_c]}/ + para.gsub!(/^#{Mx[:lv_o]}#{num}:([a-z_\.]+)#{Mx[:lv_c]}\s*(.+)/i,%{#{Mx[:lv_o]}#{num}:\\1#{Mx[:lv_c]} #{title_no} \\2 #{Mx[:fa_o]}:name##{title_no}#{Mx[:fa_c]}}) + when /^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}\s*#{title_no}/ + para.gsub!(/^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{num}:#{title_no}#{Mx[:lv_c]}") #where title contains title number + else para.gsub!(/^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{num}:#{title_no}#{Mx[:lv_c]} #{title_no} ") #main, where title number is to be provided end if @md.toc_lev_limit \ and @md.toc_lev_limit < num - para.gsub!(/^[5-8]~(?:~\S+)?\s*/,'!_ ') + para.gsub!(/^#{Mx[:lv_o]}[5-9]:\S*?#{Mx[:lv_c]}/,'!_ ') #bold line, watch end para end @@ -596,61 +600,61 @@ module SiSU_DAL if (@md.markup =~/num_top/ \ or (@md.num_top \ and @md.num_top !~/^$/)) \ - and para !~/^0~/ + and para !~/^#{Rx[:meta]}/ if (para =~/^(?:#{no1}|^#{no2}|^#{no3}#{no4})~#/ \ - and para !~/^4~endnotes?/) + and para !~/^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}/) t_not+=1 #; t_no2=0; t_no3=0 - para.gsub!(/^(#{no1})~#\s*/,"\\1~ps#{t_not} ") - para.gsub!(/^(#{no2})~#\s*/,"\\1~ps#{t_not} ") - para.gsub!(/^(#{no3})~#\s*/,"\\1~ps#{t_not} ") - para.gsub!(/^(#{no4})~#\s*/,"\\1~ps#{t_not} ") + para.gsub!(/^(#{Mx[:lv_o]}#{no1}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2") + para.gsub!(/^(#{Mx[:lv_o]}#{no2}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2") + para.gsub!(/^(#{Mx[:lv_o]}#{no3}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2") + para.gsub!(/^(#{Mx[:lv_o]}#{no4}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2") end - if para =~/#{no1}~/ + if para =~/#{Mx[:lv_o]}#{no1}:/ @subnumber=1 - @subnumber=0 if para =~/#{no1}~/ + @subnumber=0 if para =~/#{Mx[:lv_o]}#{no1}:/ end - if para =~/^[0-6]~[ \w-]/ \ - and para !~ /(?:[0-6]~[\w-]+-|4~endnotes|^[0-6]~([a-z_\.]+)\s+[\d.]+)\s/ \ - and para !~/<~#>|<-#>/ - if para =~/^#{no1}~/ + if para =~/^#{Mx[:lv_o]}[1-6]:[\w-]*#{Mx[:lv_c]}/ \ + and para !~ /(?:#{Mx[:lv_o]}[1-6]:[\w-]+-#{Mx[:lv_c]}|#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^#{Mx[:lv_o]}[1-6]:[a-z_\.]+#{Mx[:lv_c]}\s+[\d.]+)\s/ \ + and para !~/#{Mx[:fa_o]}(?:~#|-#)#{Mx[:fa_c]}/ + if para =~/^#{Mx[:lv_o]}#{no1}:/ t_no1+=1; t_no2=0; t_no3=0 title_no="#{t_no1}" if not @md.seg_names.nil? \ and not @md.seg_names.include?(title_no) - para.gsub!(/^#{no1}~\s+(\S+)#/,"#{no1}~#{title_no} \\1 #{title_no} ") #shift placement of auto-number to after first word, e.g. Article # not # Article, added on occasion of ABF (20040329) + para.gsub!(/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}\s*(\S+)#/,"#{Mx[:lv_o]}#{no1}:#{title_no}#{Mx[:lv_c]} \\1 #{title_no} ") #shift placement of auto-number to after first word, e.g. Article # not # Article, added on occasion of ABF (20040329) para.gsub!(/^#{no1}\{\s+(Article|Clause|Section)\s+#/i,%{#{no1}~#{title_no} \\1 #{title_no}. }) - unless para =~/^#{no1}~\s+[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review - para.gsub!(/^#{no1}~\s+/,"#{no1}~#{title_no} #{title_no}. ") + unless para =~/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}\s*[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review + para.gsub!(/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no1}:#{title_no}#{Mx[:lv_c]}#{title_no}. ") end @md.seg_names << title_no #else puts "warning segment name #{title_no} already exists" end - unless para =~/^#{no1}~([a-z_\.]+)\s+[A-Z]\.?\s/ #bug -> tmp fix, excludes A. B. C. lettering, but not roman numerals, is arbitrary, review required - para.gsub!(/^#{no1}~([a-z_\.]+)\s+(.+)/i,%{#{no1}~\\1 #{title_no}. \\2 <:name##{title_no}>}) + unless para =~/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)#{Mx[:lv_c]}\s*[A-Z]\.?\s/ #bug -> tmp fix, excludes A. B. C. lettering, but not roman numerals, is arbitrary, review required + para.gsub!(/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)#{Mx[:lv_c]}\s*(.+)/i, + %{#{Mx[:lv_o]}#{no1}:\\1#{Mx[:lv_c]}#{title_no}. \\2 #{Mx[:fa_o]}:name##{title_no}#{Mx[:fa_c]}}) end + para.gsub!(/^#{Mx[:lv_o]}#{no1}:##{Mx[:lv_c]}/,"#{title_no}. ") #watch para.gsub!(/^#{no1}~#\s*/,"#{title_no}. ") end - if para =~/^#{no2}~/ + if para =~/^#{Mx[:lv_o]}#{no2}:\S*?#{Mx[:lv_c]}/ t_no2+=1; t_no3=0 title_no="#{t_no1}.#{t_no2}" para=number_sub_heading(para,no2,title_no) end - if para =~/^#{no3}~/ + if para =~/^#{Mx[:lv_o]}#{no3}:\S*?#{Mx[:lv_c]}/ t_no3+=1 title_no="#{t_no1}.#{t_no2}.#{t_no3}" para=number_sub_heading(para,no3,title_no) end - elsif para =~ /^[0-6]~[\w-]+-/ # endnotes, watch2005 - para.gsub!(/^#{no1}~([a-z_\.]+)- /,"#{no1}~\\1 ") - para.gsub!(/^#{no2}~([a-z_\.]+)- /,"#{no2}~\\1 ") - para.gsub!(/^#{no3}~([a-z_\.]+)- /,"#{no3}~\\1 ") + elsif para =~/^#{Mx[:lv_o]}[1-6]:[\w-]+-#{Mx[:lv_c]}/ # endnotes, watch2005 + para.gsub!(/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no1}:\\1#{Mx[:lv_c]}") #"#{no1}~\\1 ") + para.gsub!(/^#{Mx[:lv_o]}#{no2}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no2}:\\1#{Mx[:lv_c]}") + para.gsub!(/^#{Mx[:lv_o]}#{no3}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no3}:\\1#{Mx[:lv_c]}") end elsif @md.markup =~/num_extract/ #AS DANGEROUS force enable with document, note already does this type of numbering for cisg, locate and coordinate logic, is currently misplaced in code, chengwei inspired 2004w23/4 - unless para =~ /^[0-6]~\S+/ #endnotes watch? - if para =~/^[1-6]~\s+([\d\.]+)/ #risky (must be unique) consider output to 4~~\d instead of 4~\d - name_num=$1 - para.gsub!(/^([1-6]~)\s+/,"\\1#{name_num} ") - end + if para =~/^#{Mx[:lv_o]}[1-9]:#{Mx[:lv_c]}([\d\.]+)/ #risky (must be unique) consider output to 4~~\d instead of 4~\d + name_num=$1 + para.gsub!(/^#{Mx[:lv_o]}([1-9]:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1#{name_num}#{Mx[:lv_c]}") end if @md.toc_lev_limit end @@ -663,7 +667,7 @@ module SiSU_DAL @tuned_file=[] object_array=SiSU_document_structure::OCN.new(@md,data).ocn object_array.each do |o| - @tuned_file <<= if o.ocn; "#{o.txt} <~#{o.ocn};#{o.lv};#{o.type}>" #main ocn descriptor + @tuned_file <<= if o.ocn; "#{o.txt} #{Mx[:id_o]}~#{o.ocn};#{o.lv};#{o.type}#{Mx[:id_c]}" #main ocn descriptor else o.txt end end @@ -675,8 +679,8 @@ module SiSU_DAL letter=%w( a b c d e f g h i j k l m n o p q r s t u v w x y z ) data.each do |para| if para =~/\w|\S|<|\(/ - if para !~/^%% |^0~|^4~endnotes|^<\/center>|<:ee>|<:e[:_]>|^\^~ |<:e[:_]\d+?>|^<:p[bn]>|^<:\#|<:- |<[:!]!4|^(?:alt|code|group|poem|table)\{|^\}(?:alt|code|group|poem|table)|^\}table$|<table|<\/table>|<td|<\/td>|<th|<\/th>|<tr>|<\/tr>|<hr width|<:4-endnotes>|\[endnotes\]|<:zz>|<:isbn-|<:journal-|<:conference-|<ENDNOTES?>/i #ocn here # added with Tune.code #¡ - if para=~/^[1-8]~/; number_small,letter_small=0,0 #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later) + if para !~/^%% |#{Rx[:meta]}|^0~|^#{Mx[:lv_o]}endnotes:|^4~endnotes|^<\/center>|<:ee>|<:e[:_]>|^\^~ |<:e[:_]\d+?>|^#{Mx[:fa_o]}:p[bn]#{Mx[:fa_c]}|^<:\#|<:- |<[:!]!4|#{Mx[:gr_o]}(?:alt|code|group|poem|table)#{Mx[:gr_c]}|^(?:alt|code|group|poem|table)\{|^\}(?:alt|code|group|poem|table)|^\}table$|<table|<\/table>|<td|<\/td>|<th|<\/th>|<tr>|<\/tr>|<hr width|<:4-endnotes>|\[endnotes\]|<:zz>|<:isbn-|<:journal-|<:conference-|#{Mx[:br_endnotes]}/i #ocn here # added with Tune.code #¡ + if para=~/^#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/; number_small,letter_small=0,0 #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later) end if para =~/^#[ 1]/ letter_small=0 @@ -685,7 +689,7 @@ module SiSU_DAL para.gsub!(/^#[ 1]/,"#{number_small}. ") #change 2004 end if para =~/^_# / - para.gsub!(/^_# /,"<:i1> #{letter[letter_small]}. ") #change 2004 + para.gsub!(/^_# /,"#{Mx[:fa_o]}:i1#{Mx[:fa_c]} #{letter[letter_small]}. ") #change 2004 letter_small+=1 end end @@ -717,53 +721,51 @@ module SiSU_DAL end data.each do |para| para=SiSU_document_structure::Structure.new(@md,para).structure_markup - if para =~/^[456]~ / - if para=~/^4/ \ + if para =~/^#{Mx[:lv_o]}[456]:#{Mx[:lv_c]}/ + if para=~/^#{Mx[:lv_o]}[4]:#{Mx[:lv_c]}/ \ and not @md.set_heading_seg @md.set_heading_seg=true end - if para =~/^[456]~(?:\s\S+)?\s+([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name + if para =~/^#{Mx[:lv_o]}[456]:#{Mx[:lv_c]}(?:\s*\S+)?\s+([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name pattern=$1 pattern.gsub!(/(?:[:,-]|\W)/,'.') pattern.gsub!(/\.$/,'') if not @md.seg_names.nil? \ and not @md.seg_names.include?(pattern) - para.gsub!(/^([456])~\s*/,"\\1~#{pattern} ") + para.gsub!(/^#{Mx[:lv_o]}([456]):#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1:#{pattern}#{Mx[:lv_c]}") @md.seg_names << pattern else puts 'warn, there may be a conflicting numbering scheme' if @md.cmd =~/[VM]/ end end - if para =~/^4~\s.+?;4:(\d+);/m #extract segment name from embedded document structure info + if para =~/^#{Mx[:lv_o]}4:#{Mx[:lv_c]}.+?;4:(\d+);/m #extract segment name from embedded document structure info pattern=$1 pattern.gsub!(/(?:[:,-]|\W)/,'.') pattern.gsub!(/\.$/,'') if not @md.seg_names.nil? \ and not @md.seg_names.include?(pattern) - para.gsub!(/^(4)~\s*/,"\\1~#{pattern} ") + para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1#{pattern}#{Mx[:lv_c]}") @md.seg_names << pattern else - para.gsub!(/^(4)~\s*/,"\\1~~#{pattern} ") + para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1~#{pattern}#{Mx[:lv_c]}") @md.seg_names << "~#{pattern}" end end - if para =~/^4~\s+/ #if still not segment name, provide a numerical one + if para =~/^#{Mx[:lv_o]}4:#{Mx[:lv_c]}/ #if still not segment name, provide a numerical one if not @md.seg_names.nil? \ and not @md.seg_names.include?(art_filename_auto) - para.gsub!(/^4~\s+/,%{4~_#{art_filename_auto} }) + para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,%{#{Mx[:lv_o]}\\1~#{art_filename_auto}#{Mx[:lv_c]}}) @md.seg_names << art_filename_auto else puts 'segment name (numbering) error' end art_filename_auto+=1 end end - @tuned_file << if para =~/^([1-6])~/m \ - and (@md.pagenew \ - or @md.pagebreak) + @tuned_file << if para =~/^#{Mx[:lv_o]}([1-6]):\S*?#{Mx[:lv_c]}/m \ + and (@md.pagenew or @md.pagebreak) m=$1 #watch ref~ para_tmp=[] - if @md.pagenew.inspect =~/#{m}/; para_tmp << "<:pn>\n" << para - end - if @md.pagebreak.inspect =~/#{m}/; para_tmp << "<:pb>\n" << para + if @md.pagenew.inspect =~/#{m}/; para_tmp << "#{Mx[:br_page_new]}\n" << para + elsif @md.pagebreak.inspect =~/#{m}/; para_tmp << "#{Mx[:br_page]}\n" << para end para_result=unless para_tmp.length > 0; para else para_tmp @@ -782,11 +784,11 @@ module SiSU_DAL @tuned_file=[] data.each do |para| unless @md.set_heading_top - if para !~/^(?:@\S+:|0~\S+)\s/m \ + if para !~/^(?:#{Rx[:meta]}|@\S+:|0~\S+)\s/m \ and para !~/\A\s*\Z/m @md.set_heading_top=true - head=if @md.title ; "1~ #{@md.title}" - else '1~ [no title provided]' + head=if @md.title ; "#{Mx[:lv_o]}1:#{Mx[:lv_c]} #{@md.title}" + else "#{Mx[:lv_o]}1:#{Mx[:lv_c]} [no title provided]" end @tuned_file << head end @@ -802,12 +804,12 @@ module SiSU_DAL @tuned_file=[] data.each do |para| unless @md.set_heading_seg - if para !~/^(?:@\S+:|0~\S+|[123]~)/m \ + if para !~/^(?:#{Rx[:meta]}|#{Mx[:lv_o]}[123]:\S*?#{Mx[:lv_c]})/m \ and para !~/\A\s*\Z/m \ - and para !~/<:p[bn]>/ + and para !~/#{Mx[:br_page]}|#{Mx[:br_page_new]}/ @md.set_heading_seg=true - head=if @md.title ; "4~seg [#{@md.title}]" - else '4~seg [segment]' + head=if @md.title ; "#{Mx[:lv_o]}4:seg#{Mx[:lv_c]} [#{@md.title}]" + else "#{Mx[:lv_o]}4:seg#{Mx[:lv_c]} [segment]" end @tuned_file << head end @@ -825,7 +827,7 @@ module SiSU_DAL unless @md.set_header_title if para !~/^%{1,2}\s/m \ and para !~/\A\s*\Z/m - @tuned_file << "0~title #{@md.heading_seg_first}" + @tuned_file << "#{Mx[:meta_o]}title#{Mx[:meta_c]} #{@md.heading_seg_first}" @md.title=@md.heading_seg_first @md.set_header_title=true end @@ -842,23 +844,23 @@ module SiSU_DAL data.each do |para| # manually numbered endnotes <!e(\d)!> <!e_(\d)!> --> if @md.mod.inspect =~/--no-asterisk|--no-annotate/ - para.gsub!(/~\[[*]\s.+?\]~/,'') + para.gsub!(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'') end if @md.mod.inspect =~/--no-dagger|--no-annotate/ - para.gsub!(/~\[[+]\s.+?\]~/,'') + para.gsub!(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') end - unless para =~/^<:code>/ + unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ case para # auto-numbered endnotes <!e!> <!e_!> --> - when /~\{\s+.+?\}~|~\[[*+]\s+.+?\]~/ - para.gsub!(/\s*(\}~|\]~)/,' \1') # required 2003w31 - word_mode=para.scan(/<:group>\n|\n<:group-end>|\S+/m) + when /#{Mx[:en_a_o]}\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/ + para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31 + word_mode=para.scan(/#{Mx[:gr_o]}group#{Mx[:gr_c]}\n|\n#{Mx[:gr_o]}group-end#{Mx[:gr_c]}|\S+/m) word_mode=endnote_call_number(word_mode) para=word_mode.join(' ') endnote_ref+=1 when /~\^(?:\s|$)|<:e>/ #%Note inserts endnotes previously gathered from /^(<!e[:_]!>|[-~]\{{3})/ (in earlier loop) - word_mode=para.scan(/<:group>\n|\n<:group-end>|\S+/m) + word_mode=para.scan(/#{Mx[:gr_o]}group#{Mx[:gr_c]}\n|\n#{Mx[:gr_o]}group-end#{Mx[:gr_c]}|\S+/m) word_mode=endnote_call_number(word_mode) para=word_mode.join(' ') endnote_ref+=1 @@ -870,19 +872,19 @@ module SiSU_DAL end def endnote_call_number(data) data.each do |word| - unless data =~/^<:code>/ + unless data =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ case word - when /~\{/ - unless word =~/~\{[*+]+/ - word.gsub!(/~\{/,"~\{#{@@endnote_counter} ") + when /#{Mx[:en_a_o]}/ + unless word =~/#{Mx[:en_a_o]}[*+]+/ + word.gsub!(/#{Mx[:en_a_o]}/,"#{Mx[:en_a_o]}#{@@endnote_counter} ") @@endnote_counter+=1 end - when /~\[/ - if word =~/~\[[+]/ - word.gsub!(/~\[[+]/,"~\[\+#{@@endnote_counter_dag} ") + when /#{Mx[:en_b_o]}/ + if word =~/#{Mx[:en_b_o]}[+]/ + word.gsub!(/#{Mx[:en_b_o]}[+]/,"#{Mx[:en_b_o]}\+#{@@endnote_counter_dag} ") @@endnote_counter_dag+=1 else - word.gsub!(/~\[[*]?/,"~\[\*#{@@endnote_counter_asterisk} ") + word.gsub!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@@endnote_counter_asterisk} ") @@endnote_counter_asterisk+=1 end when /~\^|<:e>/ @@ -898,106 +900,105 @@ module SiSU_DAL base_html="#{dir.url.root}/#{@md.fnb}" ocnm=ocnd=ocnv=0 ocnm+=1 - header0='<:pn>' - header1="\n1~meta Document Information (metadata) <~0;0:0;m#{ocnm}>" + header1="\n#{Mx[:lv_o_1]}meta#{Mx[:lv_c]}Document Information (metadata) #{Mx[:id_o]}~0;0:0;m#{ocnm}#{Mx[:id_c]}" ocnm+=1 - header4="\n4~metadata Metadata <~0;m#{ocnm};m#{ocnm}>" + header4="\n#{Mx[:lv_o_4]}metadata#{Mx[:lv_c]}Metadata #{Mx[:id_o]}~0;m#{ocnm};m#{ocnm}#{Mx[:id_c]}" ocnm+=1; ocnd+=1 - head_no_dc="<~0;m#{ocnm};d#{ocnd}>" + head_no_dc="#{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" ocnm+=1; ocnd+=1 - head_no_dc_tag="<~0;m#{ocnm};d#{ocnd}>" + head_no_dc_tag="#{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" data.each do |para| case para - when /^0~(title|creator|author|translator|translated_by|illustrator|illustrated_by|prepared_by|digitized_by|description|publisher|contributor|date\.created|date\.issued|date\.available|date\.valid|date\.modified|date|type|format|rights|identifier|source|language)/i + when /^#{Mx[:meta_o]}(title|creator|author|translator|translated_by|illustrator|illustrated_by|prepared_by|digitized_by|description|publisher|contributor|date\.created|date\.issued|date\.available|date\.valid|date\.modified|date|type|format|rights|identifier|source|language)#{Mx[:meta_c]}/i m=$1 ocnm+=1; ocnd+=1 @dc << case para - when /^0~title/ - "\n#{@tr.dc_title}: <u>#{@md.dc_title}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~(?:creator|author)/ - "\n#{@tr.creator}: <u>#{@md.dc_creator}</u> <~0;m#{ocnm};d#{ocnd}>" - when /0~(?:translator|translated_by)/ - "\n#{@tr.translator}: <u>#{@md.translator}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~(?:illustrator|illustrated_by)/ - "\n#{@tr.illustrator}: <u>#{@md.illustrator}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~prepared_by/ - "\n#{@tr.prepared_by}: <u>#{@md.prepared_by}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~digitized_by/ - "\n#{@tr.digitized_by}: <u>#{@md.digitized_by}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~description/ - "\n#{@tr.description}: <u>#{@md.dc_description}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~subject/ - "\n#{@tr.subject}: <u>#{@md.dc_subject}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~abstract/ - "\n#{@tr.abstract}: <u>#{@md.dc_abstract}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~publisher/ - "\n#{@tr.publisher}: <u>#{@md.dc_publisher}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~contributor/ - "\n#{@tr.contributor}: <u>#{@md.dc_contributor}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~date.created/ - "\n#{@tr.date_created}: <u>#{@md.dc_date_created}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~date.issued/ - "\n#{@tr.date_issued}: <u>#{@md.dc_date_issued}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~date.available/ - "\n#{@tr.date_available}: <u>#{@md.dc_date_available}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~date.modified/ - "\n#{@tr.date_modified}: <u>#{@md.dc_date_modified}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~date.valid/ - "\n#{@tr.date_valid}: <u>#{@md.dc_date_valid}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~date/ - "\n#{@tr.date}: <u>#{@md.dc_date}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~type/ - "\n#{@tr.type}: <u>#{@md.dc_type}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~format/ - "\n#{@tr.format}: <u>#{@md.dc_format}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~rights/ - "\n#{@tr.rights}: <u>#{@md.dc_rights}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~identifier/ - "\n#{@tr.identifier}: <u>#{@md.dc_identifier}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~source/ - "\n#{@tr.source}: <u>#{@md.dc_source}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~language/ - "\n#{@tr.language}: <u>#{@md.dc_language}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~language.original/ - "\n#{@tr.language_original}: <u>#{@md.language_original}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~relation/ - "\n#{@tr.relation}: <u>#{@md.dc_relation}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~coverage/ - "\n#{@tr.coverage}: <u>#{@md.dc_coverage}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~keywords/ - "\n#{@tr.keywords}: <u>#{@md.keywords}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~comments/ - "\n#{@tr.comments}: <u>#{@md.comments}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~cls_loc/ - "\n#{@cls_dewey}: <u>#{@md.cls_dewey}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~cls_dewey/ - "\n#{@tr.cls_dewey}: <u>#{@md.cls_dewey}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~cls_gutenberg|0~cls_pg/ - "\n#{@tr.cls_gutenberg}: <u>#{@md.cls_gutenberg}</u> <~0;m#{ocnm};d#{ocnd}>" - #"\n#{@tr.cls_gutenberg}: <u>#{@md.cls_pg}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~cls_isbn/ - "\n#{@tr.cls_isbn}: <u>#{@md.cls_isbn}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~prefix(?:_a)?/ - "\n#{@tr.prefix_a}: <u>#{@md.prefix_a}</u> <~0;m#{ocnm};d#{ocnd}>" - when /^0~prefix_b/ - "\n#{@tr.prefix_b}: <u>#{@md.prefix_b}</u> <~0;m#{ocnm};d#{ocnd}>" - else para.gsub(/^0~(#{m})\s+(.+)/m,"\n#{m.capitalize}: <u>\\2</u> <~0;m#{ocnm};d#{ocnd}>") + when /^#{Mx[:meta_o]}title#{Mx[:meta_c]}/ + "\n#{@tr.dc_title}: #{Mx[:fa_underscore_o]}#{@md.dc_title}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}(?:creator|author)#{Mx[:meta_c]}/ + "\n#{@tr.creator}: #{Mx[:fa_underscore_o]}#{@md.dc_creator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /#{Mx[:meta_o]}(?:translator|translated_by)#{Mx[:meta_c]}/ + "\n#{@tr.translator}: #{Mx[:fa_underscore_o]}#{@md.translator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}(?:illustrator|illustrated_by)#{Mx[:meta_c]}/ + "\n#{@tr.illustrator}: #{Mx[:fa_underscore_o]}#{@md.illustrator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}prepared_by#{Mx[:meta_c]}/ + "\n#{@tr.prepared_by}: #{Mx[:fa_underscore_o]}#{@md.prepared_by}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}digitized_by#{Mx[:meta_c]}/ + "\n#{@tr.digitized_by}: #{Mx[:fa_underscore_o]}#{@md.digitized_by}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}description#{Mx[:meta_c]}/ + "\n#{@tr.description}: #{Mx[:fa_underscore_o]}#{@md.dc_description}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}subject#{Mx[:meta_c]}/ + "\n#{@tr.subject}: #{Mx[:fa_underscore_o]}#{@md.dc_subject}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}abstract#{Mx[:meta_c]}/ + "\n#{@tr.abstract}: #{Mx[:fa_underscore_o]}#{@md.dc_abstract}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}publisher#{Mx[:meta_c]}/ + "\n#{@tr.publisher}: #{Mx[:fa_underscore_o]}#{@md.dc_publisher}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}contributor#{Mx[:meta_c]}/ + "\n#{@tr.contributor}: #{Mx[:fa_underscore_o]}#{@md.dc_contributor}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}date.created#{Mx[:meta_c]}/ + "\n#{@tr.date_created}: #{Mx[:fa_underscore_o]}#{@md.dc_date_created}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}date.issued#{Mx[:meta_c]}/ + "\n#{@tr.date_issued}: #{Mx[:fa_underscore_o]}#{@md.dc_date_issued}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}date.available#{Mx[:meta_c]}/ + "\n#{@tr.date_available}: #{Mx[:fa_underscore_o]}#{@md.dc_date_available}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}date.modified#{Mx[:meta_c]}/ + "\n#{@tr.date_modified}: #{Mx[:fa_underscore_o]}#{@md.dc_date_modified}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}date.valid#{Mx[:meta_c]}/ + "\n#{@tr.date_valid}: #{Mx[:fa_underscore_o]}#{@md.dc_date_valid}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}date#{Mx[:meta_c]}/ + "\n#{@tr.date}: #{Mx[:fa_underscore_o]}#{@md.dc_date}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}type#{Mx[:meta_c]}/ + "\n#{@tr.type}: #{Mx[:fa_underscore_o]}#{@md.dc_type}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}format#{Mx[:meta_c]}/ + "\n#{@tr.format}: #{Mx[:fa_underscore_o]}#{@md.dc_format}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}rights#{Mx[:meta_c]}/ + "\n#{@tr.rights}: #{Mx[:fa_underscore_o]}#{@md.dc_rights}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}identifier#{Mx[:meta_c]}/ + "\n#{@tr.identifier}: #{Mx[:fa_underscore_o]}#{@md.dc_identifier}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}source#{Mx[:meta_c]}/ + "\n#{@tr.source}: #{Mx[:fa_underscore_o]}#{@md.dc_source}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}language#{Mx[:meta_c]}/ + "\n#{@tr.language}: #{Mx[:fa_underscore_o]}#{@md.dc_language}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}language.original#{Mx[:meta_c]}/ + "\n#{@tr.language_original}: #{Mx[:fa_underscore_o]}#{@md.language_original}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}relation#{Mx[:meta_c]}/ + "\n#{@tr.relation}: #{Mx[:fa_underscore_o]}#{@md.dc_relation}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}coverage#{Mx[:meta_c]}/ + "\n#{@tr.coverage}: #{Mx[:fa_underscore_o]}#{@md.dc_coverage}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}keywords#{Mx[:meta_c]}/ + "\n#{@tr.keywords}: #{Mx[:fa_underscore_o]}#{@md.keywords}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}comments#{Mx[:meta_c]}/ + "\n#{@tr.comments}: #{Mx[:fa_underscore_o]}#{@md.comments}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}cls_loc#{Mx[:meta_c]}/ + "\n#{@cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.cls_dewey}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}cls_dewey#{Mx[:meta_c]}/ + "\n#{@tr.cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.cls_dewey}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}(?:cls_gutenberg|cls_pg)#{Mx[:meta_c]}/ + "\n#{@tr.cls_gutenberg}: #{Mx[:fa_underscore_o]}#{@md.cls_gutenberg}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + #"\n#{@tr.cls_gutenberg}: <u>#{@md.cls_pg}</u> #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}cls_isbn#{Mx[:meta_c]}/ + "\n#{@tr.cls_isbn}: #{Mx[:fa_underscore_o]}#{@md.cls_isbn}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}prefix(?:_a)?#{Mx[:meta_c]}/ + "\n#{@tr.prefix_a}: #{Mx[:fa_underscore_o]}#{@md.prefix_a}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}prefix_b#{Mx[:meta_c]}/ + "\n#{@tr.prefix_b}: #{Mx[:fa_underscore_o]}#{@md.prefix_b}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + else para.gsub(/^#{Mx[:meta_o]}(#{m})\s+(.+)/m,"\n#{m.capitalize}: #{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}") end end end ocnm+=1; ocnv+=1 - head_no_rc="<~0;m#{ocnm};v#{ocnv}>" + head_no_rc="#{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" ocnm+=1; ocnv+=1 - head_no_rc_tag="<~0;m#{ocnm};v#{ocnv}>" + head_no_rc_tag="#{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" data.each do |para| case para when /^0~(?:cvs|rcs)\+\s+/ #note the + sign to turn on use of cvs id ocnm+=1; ocnv+=1 - @cvs << "#{@tr.sc_number}: <u>#{@md.sc_number}</u> <~0;m#{ocnm};v#{ocnv}>" + @cvs << "#{@tr.sc_number}: #{Mx[:fa_underscore_o]}#{@md.sc_number}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" ocnm+=1; ocnv+=1 - @cvs << "#{@tr.sc_date}: <u>#{@md.sc_date}</u> <~0;m#{ocnm};v#{ocnv}>" + @cvs << "#{@tr.sc_date}: #{Mx[:fa_underscore_o]}#{@md.sc_date}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" ocnm+=1; ocnv+=1 - @cvs << "CVS/RCS time: <u>#{@md.sc_time}</u> <~0;m#{ocnm};v#{ocnv}>" + @cvs << "CVS/RCS time: #{Mx[:fa_underscore_o]}#{@md.sc_time}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" ocnm+=1; ocnv+=1 when /^0~cvs[+\s]/ #enable pattern above instead if you wish the default to be to include cvs tags from all documents KEEP when /^0~cvs\s+/ #enable pattern above instead if you wish the default to be to include cvs tags from all documents KEEP @@ -1007,47 +1008,45 @@ module SiSU_DAL ocnm+=1; ocnv+=1 if @md.sc_filename \ and @md.sc_filename.length > 3 - @rc << "#{@tr.sourcefile}: <u>#{@md.sc_filename}</u> <~0;m#{ocnm};v#{ocnv}>" - else @rc << "#{@tr.sourcefile}: <u>#{@md.fns}</u> <~0;m#{ocnm};v#{ocnv}>" + @rc << "#{@tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.sc_filename}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + else @rc << "#{@tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.fns}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" end ocnm+=1; ocnv+=1 if @md.file_encoding \ and @md.file_encoding.length > 3 #translate - @rc << "Filetype: <u>#{@md.file_encoding}</u> <~0;m#{ocnm};v#{ocnv}>" + @rc << "Filetype: #{Mx[:fa_underscore_o]}#{@md.file_encoding}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" end ocnm+=1; ocnv+=1 if @md.dgst #change. enable by default - @rc << "#{@tr.sourcefile_digest}, #{@md.dgst[0]} <u>#{@md.dgst[1]}</u> <~0;m#{ocnm};v#{ocnv}>" + @rc << "#{@tr.sourcefile_digest}, #{@md.dgst[0]} #{Mx[:fa_underscore_o]}#{@md.dgst[1]}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" ocnm+=1; ocnv+=1 end if @md.dgst_skin #change. enable by default - @rc << "Skin_Digest: #{@md.dgst_skin[0]} <u>#{@md.dgst_skin[1]}</u> <~0;m#{ocnm};v#{ocnv}>" + @rc << "Skin_Digest: #{@md.dgst_skin[0]} #{Mx[:fa_underscore_o]}#{@md.dgst_skin[1]}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" ocnm+=1; ocnv+=1 end - @rc << "<b>Generated</b> #{head_no_rc}" if @rc.length > 0 - @rc << "#{@tr.last_generated}: <u>#{Time.now}</u> <~0;m#{ocnm};v#{ocnv}>" + @rc << "#{Mx[:fa_bold_o]}Generated#{Mx[:fa_bold_c]} #{head_no_rc}" if @rc.length > 0 + @rc << "#{@tr.last_generated}: #{Mx[:fa_underscore_o]}#{Time.now}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" ocnm+=1; ocnv+=1 if @md.sisu_version[:version] - @rc << "#{@tr.sisu_version}: <u>#{@md.sisu_version[:project]}</u> <u>#{@md.sisu_version[:version]}</u> of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]}) <~0;m#{ocnm};v#{ocnv}>" + @rc << "#{@tr.sisu_version}: #{Mx[:fa_underscore_o]}#{@md.sisu_version[:project]}#{Mx[:fa_underscore_c]} #{Mx[:fa_underscore_o]}#{@md.sisu_version[:version]}#{Mx[:fa_underscore_c]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]}) #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" ocnm+=1; ocnv+=1 end - @rc << "#{@tr.ruby_version}: <u> #{@md.ruby_version}</u> <~0;m#{ocnm};v#{ocnv}>" + @rc << "#{@tr.ruby_version}: #{Mx[:fa_underscore_o]} #{@md.ruby_version}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" end - meta << header0 - meta << header1 - meta << header4 - meta << "Document Manifest @\n #{base_html}/#{@md.fn[:manifest]} <~0;m#{ocnm};m#{ocnm}>" - meta << "<b>Dublin Core</b> (DC) #{head_no_dc}" if @dc.length > 0 - meta << "<i>DC tags included with this document are provided here.</i> #{head_no_dc_tag}" if @dc.length > 0 + meta << Mx[:br_page_new] << header1 << header4 + meta << "Document Manifest @\n #{base_html}/#{@md.fn[:manifest]} #{Mx[:id_o]}~0;m#{ocnm};m#{ocnm}#{Mx[:id_c]}" + meta << "#{Mx[:fa_bold_o]}Dublin Core#{Mx[:fa_bold_c]} (DC) #{head_no_dc}" if @dc.length > 0 + meta << "#{Mx[:fa_italics_o]}DC tags included with this document are provided here.#{Mx[:fa_italics_c]} #{head_no_dc_tag}" if @dc.length > 0 @dc.each { |x| meta << x } - meta << "<b>Version Information</b> #{head_no_rc}" if @rc.length > 0 + meta << "#{Mx[:fa_bold_o]}Version Information#{Mx[:fa_bold_c]} #{head_no_rc}" if @rc.length > 0 if @cvs.length > 0 - meta << "<i>Note the version information provided here, is specific to the host site.</i> #{head_no_rc_tag}" + meta << "#{Mx[:fa_italics_o]}Note the version information provided here, is specific to the host site.#{Mx[:fa_italics_c]} #{head_no_rc_tag}" @cvs.each { |x| meta << x } end @rc.each { |x| meta << x } ## ENDNOTE RELATED endnote related - meta << "\n<EOF>" + meta << "\n#{Mx[:br_eof]}" meta=object_digest(meta) end def stamped(para,hash_class) @@ -1056,23 +1055,23 @@ module SiSU_DAL digest_all=hash_class.hexdigest(para) # print "#{hash_class.name}: "; puts digest_all #length==32 or 64 stripped=strip_clean_of_markup(para) digest_strip=hash_class.hexdigest(stripped) - unless para =~/<:code>/ + unless para =~/#{Mx[:fa_o]}code#{Mx[:fa_c]}/ case para - when /~\{[\d*+]+\s+.+?\}~|~\[[*+]\d+\s+.+?\]~/m + when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m en_and_para,en_and_para_digest=[],[] - para.gsub!(/\s*(\}~|\]~)/m,' \1') #watch - para_plus_en=para.scan(/.*?~\{.+?\}~|.*?~\[.+?\]~/m) - para_tail=if para =~/(?:.*?~\{.+?\}~|.*?~\[.+?\]~)+([\s\S]+)/m - /(?:.*?~\{.+?\}~|.*?~\[.+?\]~)+(.+?<~\d+;(?:\w|[0-6]:)\d+;\w\d+>)/m.match(para)[1] + para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch + para_plus_en=para.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m) + para_tail=if para =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m + /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+(.+?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]})/m.match(para)[1] else '' end para_plus_en << para_tail en_and_para_digest << endnote_digest(para_plus_en) para_new=en_and_para_digest.join(' ') - @tuned << para_new + '<' + digest_strip + ':' + digest_all + '>' unless para.nil? - else @tuned << para + '<' + digest_strip + ':' + digest_all + '>' unless para.nil? + @tuned << para_new + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil? + else @tuned << para + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil? end - else @tuned << para + '<' + digest_strip + ':' + digest_all + '>' unless para.nil? + else @tuned << para + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil? end @tuned.join end @@ -1088,7 +1087,8 @@ module SiSU_DAL data.compact! data.each do |para| para.strip! - if para=~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+>/ + if para=~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/ \ + and para !~/#{Rx[:meta]}/ #test should not be necessary remove if @env.digest.type =~/sha256/ for hash_class in [ Digest::SHA256 ] @tuned_file << stamped(para,hash_class) @@ -1108,16 +1108,16 @@ module SiSU_DAL para_bit=[] data.each do |en_plus| para_bit <<= case en_plus - when /~\{|~\[/ - if en_plus =~/~\{.+?\}~|~\[.+?\]~/ - para_txt,en_open,en_txt,en_close=/(.*?)(~\{|~\[)(.+?)(\}~|\]~)/m.match(en_plus)[1..4] + when /#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/ + if en_plus =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/ + para_txt,en_open,en_txt,en_close=/(.*?)(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m.match(en_plus)[1..4] stripped_en=strip_clean_of_markup(en_txt) digest_en_strip=if @env.digest.type =~/sha256/ Digest::SHA256.hexdigest(stripped_en) else Digest::MD5.hexdigest(stripped_en) end - para_txt + en_open + en_txt + '<' + digest_en_strip + '>' + en_close + para_txt + en_open + en_txt + Mx[:id_o] + digest_en_strip + Mx[:id_c] + en_close else puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up end else en_plus @@ -1131,12 +1131,13 @@ module SiSU_DAL s=s.gsub(/ [ ]+/,' ') s=s.gsub(/^ [ ]+/,'') s=s.gsub(/ [ ]+$/,'') - s=s.gsub(/(<\/[bi]>')[ ]+(s )/,'\1\2') + s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') + s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') end def strip_clean_of_markup(s) # used for digest, define rules, make same as in db clean #consider: <\/?[ib]>|<(?:\/ )?br>|<del>(.+?)<\/del> s=s.dup - s=s.gsub(/(?:<\/?[ib]>|<~\d+;(?:\w|[0-6]:)\d+;\w\d+>|<#@dp:#@dp>|^[1-6]~\S+|~\{\d+\s.+?\}~)/m,'') # markup and endnotes removed + s=s.gsub(/(?:<\/?[ib]>|#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}|#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|^#{Mx[:lv_o]}[1-6]:\S+?#{Mx[:lv_c]}|#{Mx[:en_a_o]}\d+\s.+?#{Mx[:en_a_c]})/m,'') # markup and endnotes removed #% same as db clean --> s=s.gsub(/<del>(.+?)<\/del>/,'DELETED(\1)') # deletions s=s.gsub(/<sup>(\d+)<\/sup>/,'[\1]') diff --git a/lib/sisu/v0/dal_doc_str.rb b/lib/sisu/v0/dal_doc_str.rb index ebaa8625..37e9be3c 100644 --- a/lib/sisu/v0/dal_doc_str.rb +++ b/lib/sisu/v0/dal_doc_str.rb @@ -71,14 +71,14 @@ module SiSU_document_structure @para end def structure_markup - @para=unless @para =~/[0-6]~/ + @para=unless @para =~/#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/ @para=case @para - when /^\s*#{@md.lv1}/; @para.sub!(/(?:<[:!]1!?>\s*)?(.+)/,'1~ \1') if @para !~/^1~/ - when /^\s*#{@md.lv2}/; @para.sub!(/(?:<[:!]2!?>\s*)?(.+)/,'2~ \1') if @para !~/^2~/ - when /^\s*#{@md.lv3}/; @para.sub!(/(?:<[:!]3!?>\s*)?(.+)/,'3~ \1') if @para !~/^3~/ - when /^\s*#{@md.lv4}/; @para.sub!(/(?:<[:!]4!?>\s*)?(.+)/,'4~ \1') if @para !~/^4~/ - when /^\s*#{@md.lv5}/; @para.sub!(/(?:<[:!]5!?>\s*)?(.+)/,'5~ \1') if @para !~/^5~/ - when /^\s*#{@md.lv6}/; @para.sub!(/(?:<[:!]6!?>\s*)?(.+)/,'6~ \1') if @para !~/^6~/ + when /^\s*#{@md.lv1}/; @para.sub!(/(?:<[:!]1!?>\s*)?(.+)/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]} \\1") if @para !~/^#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}/ + when /^\s*#{@md.lv2}/; @para.sub!(/(?:<[:!]2!?>\s*)?(.+)/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]} \\1") if @para !~/^#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}/ + when /^\s*#{@md.lv3}/; @para.sub!(/(?:<[:!]3!?>\s*)?(.+)/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]} \\1") if @para !~/^#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}/ + when /^\s*#{@md.lv4}/; @para.sub!(/(?:<[:!]4!?>\s*)?(.+)/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]} \\1") if @para !~/^#{Mx[:lv_o]}4:\S*?#{Mx[:lv_c]}/ + when /^\s*#{@md.lv5}/; @para.sub!(/(?:<[:!]5!?>\s*)?(.+)/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]} \\1") if @para !~/^#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}/ + when /^\s*#{@md.lv6}/; @para.sub!(/(?:<[:!]6!?>\s*)?(.+)/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]} \\1") if @para !~/^#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}/ else @para end else @para @@ -91,12 +91,18 @@ module SiSU_document_structure #@para.gsub!(/^5~/,'8~') #@para.gsub!(/^4~/,'7~') @para.gsub!(/^[456]~/,'!_') - @para.gsub!(/^3~/,'6~') - @para.gsub!(/^2~/,'5~') - @para.gsub!(/^1~/,'4~') - @para.gsub!(/^:?C~/,'3~') - @para.gsub!(/^:?B~/,'2~') - @para.gsub!(/^:?A~/,'1~') + @para.gsub!(/^3~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}") + @para.gsub!(/^3~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}") + @para.gsub!(/^2~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}") + @para.gsub!(/^2~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}") + @para.gsub!(/^1~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}") + @para.gsub!(/^1~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}") + @para.gsub!(/^:?C~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}") + @para.gsub!(/^:?C~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}") + @para.gsub!(/^:?B~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}") + @para.gsub!(/^:?B~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}") + @para.gsub!(/^:?A~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}") + @para.gsub!(/^:?A~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}") @para=if @para =~/^@(?:level|markup):\s/ @para.gsub!(/3/,'6') @para.gsub!(/2/,'5') @@ -110,6 +116,25 @@ module SiSU_document_structure else @para end end + def structure_marks + para=if @md.markup_version.to_f < 0.38 + @para.gsub!(/^1~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}") + @para.gsub!(/^1~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}") + @para.gsub!(/^2~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}") + @para.gsub!(/^2~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}") + @para.gsub!(/^3~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}") + @para.gsub!(/^3~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}") + @para.gsub!(/^4~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}") + @para.gsub!(/^4~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}") + @para.gsub!(/^5~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}") + @para.gsub!(/^5~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}") + @para.gsub!(/^6~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}") + @para.gsub!(/^6~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}") + @para.gsub!(/^[789]~/,'!_') + @para + else @para + end + end end class Struct def initialize(o) @@ -147,21 +172,21 @@ module SiSU_document_structure #headings=if @md.ocn.inspect =~/skip=headings/; '^(?:[A-C]|[1-9])~\S* |' #else '' #end - regex_exclude_ocn_and_node = /#{headings}^%{1,4}\s|^@\S+?:\s|^0~|^4~endnotes|^<\/center>|<:ee>|<:e[:_]>|^\^~ |<:e[:_]\d+?>|^<:p[bn]>|^<:\#|<:- |<[:!]!4|<table|<\/table>|<td|<\/td>|<th|<\/th>|<tr>|<\/tr>|<hr width|<:4-endnotes>|\[endnotes\]|<:zz>|<:isbn-|<:journal-|<:conference-|<ENDNOTES?>/i #ocn here # added with Tune.code #¡ + regex_exclude_ocn_and_node = /#{headings}^%{1,4}\s|#{Rx[:meta]}|^@\S+?:\s|^0~|^4~endnotes|^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^<\/center>|<:ee>|<:e[:_]>|^\^~ |<:e[:_]\d+?>|^#{Mx[:fa_o]}p[bn]#{Mx[:fa_c]}|^<:\#|<:- |<[:!]!4|<table|<\/table>|<td|<\/td>|<th|<\/th>|<tr>|<\/tr>|<hr width|<:4-endnotes>|\[endnotes\]|<:zz>|<:isbn-|<:journal-|<:conference-|#{Mx[:br_endnotes]}/i #ocn here # added with Tune.code #¡ regex_exclude_ocn = /^(?:alt|code|group|poem|table)\{|^\}(?:alt|code|group|poem|table)|^\}table$/ #ocn here # added with Tune.code #¡ data.each do |para| o={} if para =~/\w|\S|<|\(/ if para !~ regex_exclude_ocn_and_node if node_count_flag \ - or para=~/^1~/ + or para=~/^#{Mx[:lv_o]}1:/ node_count_flag=true end node+=1 if node_count_flag if para !~ regex_exclude_ocn # regex_exclude_large previously excluded unless para=~/<:#>|~#|-#/ # |^\s*\*\s*\*\s*\*\s*$ <-consider leaving un-numbered ocn+=1 - if para=~/^[1-8]~(?:\s+|\S)/ \ + if para=~/^#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/ \ or para =~@md.lv1 \ or para =~@md.lv2 \ or para =~@md.lv3 \ @@ -169,33 +194,33 @@ module SiSU_document_structure or para =~@md.lv5 \ or para =~@md.lv6 ocnh+=1 - if para=~/^1~(?:\s+|\S)/ \ + if para=~/^#{Mx[:lv_o]}1:(\S*?)#{Mx[:lv_c]}/ \ or para =~@md.lv1 ocnh1+=1 #heading ocn_dv,ocn_sp="1:#{ocnh1}","h#{ocnh}" - elsif para=~/^2~(?:\s+|\S)/ \ + elsif para=~/^#{Mx[:lv_o]}2:(\S*?)#{Mx[:lv_c]}/ \ or para =~@md.lv2; ocnh2+=1 ocn_dv,ocn_sp="2:#{ocnh2}","h#{ocnh}" - elsif para=~/^3~(?:\s+|\S)/ \ + elsif para=~/^#{Mx[:lv_o]}3:(\S*?)#{Mx[:lv_c]}/ \ or para =~@md.lv3; ocnh3+=1 ocn_dv,ocn_sp="3:#{ocnh3}","h#{ocnh}" - elsif para=~/^4~(?:\s+|\S)/ \ + elsif para=~/^#{Mx[:lv_o]}4:(\S*?)#{Mx[:lv_c]}/ \ or para =~@md.lv4; ocnh4+=1 ocn_dv,ocn_sp="4:#{ocnh4}","h#{ocnh}" - elsif para=~/^5~(?:\s+|\S)/ \ + elsif para=~/^#{Mx[:lv_o]}5:(\S*?)#{Mx[:lv_c]}/ \ or para =~@md.lv5; ocnh5+=1 ocn_dv,ocn_sp="5:#{ocnh5}","h#{ocnh}" - elsif para=~/^6~(?:\s+|\S)/ \ + elsif para=~/^#{Mx[:lv_o]}6:(\S*?)#{Mx[:lv_c]}/ \ or para =~@md.lv6; ocnh6+=1 ocn_dv,ocn_sp="6:#{ocnh6}","h#{ocnh}" end else ocno+=1 - if para=~/<!TZ!>/; ocnt+=1 #table + if para=~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; ocnt+=1 #table ocn_dv,ocn_sp="o#{ocno}","t#{ocnt}" - elsif para=~/^<:code>/; ocnc+=1 #code block + elsif para=~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/; ocnc+=1 #code block ocn_dv,ocn_sp="o#{ocno}","c#{ocnc}" - elsif para=~/^<:(?:group|alt|verse)>/; ocng+=1 #group, poem + elsif para=~/^#{Mx[:gr_o]}(?:group|alt|verse)#{Mx[:gr_c]}/; ocng+=1 #group, poem ocn_dv,ocn_sp="o#{ocno}","g#{ocng}" elsif para=~/\{\S+?\.(?:png|jpg|gif)\s+/m; ocni+=1 #image ocn_dv,ocn_sp="o#{ocno}","i#{ocni}" @@ -212,7 +237,7 @@ module SiSU_document_structure # ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}" #end #para.gsub!(/<~#>|<-#>/,'') if para #get rid of need - para.gsub!(/<~#>/,'') if para + para.gsub!(/#{Mx[:fa_o]}~##{Mx[:fa_c]}/,'') if para ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}" o[:txt],o[:node],o[:ocn],o[:lv],o[:type]=para,node,0,ocn_dv,ocn_sp end @@ -225,9 +250,9 @@ module SiSU_document_structure end end end - para.gsub!(/\n\n/,"\n") if para =~/<:(?:code|verse|alt|group)>/ #newlines taken out - para.gsub!(/(<:(?:code-end)>)/,"\n\\1") if para =~/<:(?:code-end)>/ #newlines added check - if para =~/<!Th?¡/u; para.gsub!(/(<!Th?¡.+?!)>/u,"\\1~#{o[:ocn]};#{o[:lv]};#{o[:type]}>") + para.gsub!(/\n\n/,"\n") if para =~/#{Mx[:gr_o]}(?:code|verse|alt|group)#{Mx[:gr_c]}/ #newlines taken out + para.gsub!(/(#{Mx[:gr_o]}(?:code-end)#{Mx[:gr_c]})/,"\n\\1") if para =~/#{Mx[:gr_o]}(?:code-end)#{Mx[:gr_c]}/ #newlines added check + if para =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u; para.gsub!(/(#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?)#{Mx[:gr_c]}/u,"\\1#{Mx[:tc_p]}~#{o[:ocn]};#{o[:lv]};#{o[:type]}#{Mx[:gr_c]}") end @o_array << Struct.new(o).structure if o end diff --git a/lib/sisu/v0/dal_doc_str_code.rb b/lib/sisu/v0/dal_doc_str_code.rb index 9596bb69..82ada040 100644 --- a/lib/sisu/v0/dal_doc_str_code.rb +++ b/lib/sisu/v0/dal_doc_str_code.rb @@ -80,30 +80,30 @@ module SiSU_document_structure_code @@counter=0 @verse_count=0 data.each do |para| - para.gsub!(/(<:(?:code|verse|alt|group)>)\s/,'\1') #double check + para.gsub!(/(#{Mx[:gr_o]}(?:code|verse|alt|group)#{Mx[:gr_c]})\s/,'\1') #double check para.gsub!(/(?:\n\s*\n)+/m,"\n") unless @@flag['code'] - if para =~/^code\{/ + if para =~/^code\{/ and not @@flag['code'] @@flag['code']=true @@counter=1 - para.gsub!(/^code\{.*/,'<:code>') + para.gsub!(/^code\{.*/,"#{Mx[:gr_o]}code#{Mx[:gr_c]}") elsif para =~/^(?:poem)\{/ \ and not @@flag['code'] @@flag['poem']=true - para.gsub!(/^(poem)\{.*/,'<:verse>') + para.gsub!(/^(poem)\{.*/,"#{Mx[:gr_o]}verse#{Mx[:gr_c]}") elsif para =~/^(?:alt|group)\{/ \ and not @@flag['code'] #group not tested, stub 2005 @@flag['group']=true - para.gsub!(/^(alt|group)\{.*/,'<:\1>') + para.gsub!(/^(alt|group)\{.*/,"#{Mx[:gr_o]}\\1#{Mx[:gr_c]}") end if @@flag['code'] if @@flag['code'] \ and para =~/^\}code/ - para.gsub!(/^\}code.*/,'<:code-end>') + para.gsub!(/^\}code.*/,"#{Mx[:gr_o]}code-end#{Mx[:gr_c]}") @@flag['code']=false end if @@flag['code'] \ - or para =~/<:code-end>/ #and para =~/\S/ - sub_array=if para !~/<:code(?:-end)?>/; para.dup + '<:br>' + or para =~/#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/ #and para =~/\S/ + sub_array=if para !~/#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}/; para.dup + "#{Mx[:br_nl]}" else para.dup end @line_mode=sub_array.scan(/.+/) @@ -117,18 +117,18 @@ module SiSU_document_structure_code and not @@flag['code'] if @@flag['poem'] \ and para =~/^\}(?:poem)/ - para.gsub!(/^\}(poem).*/,"\n<:verse-end>") + para.gsub!(/^\}(poem).*/,"\n#{Mx[:gr_o]}verse-end#{Mx[:gr_c]}") @@flag['poem']=false elsif ( @@flag['group'] \ and para =~/^\}(?:alt|group)/ ) \ and not @@flag['code'] - para.gsub!(/^\}(alt|group).*/,'<:\1-end>') + para.gsub!(/^\}(alt|group).*/,"#{Mx[:gr_o]}\\1-end#{Mx[:gr_c]}") @@flag['group']=false end if @@flag['poem'] \ or @@flag['group'] \ and para =~/\S/ \ - and para !~/<:(verse|code|alt|group)(-end)?>/ \ + and para !~/#{Mx[:gr_o]}(verse|code|alt|group)(-end)?#{Mx[:gr_c]}/ \ and not @@flag['code'] sub_array=para.dup @line_mode=sub_array.scan(/.+/) @@ -138,7 +138,7 @@ module SiSU_document_structure_code SiSU_document_structure_code::Code.new(@md,@line_mode).code_lines(type) div=if @@flag['poem'] \ and @verse_count > 0 - "\n" + '<:verse-end>' + "\n\n" + '<:verse>' + "\n" + "#{Mx[:gr_o]}verse-end#{Mx[:gr_c]}" + "\n\n" + "#{Mx[:gr_o]}verse#{Mx[:gr_c]}" else '' end @verse_count+=1 if @@flag['poem'] @@ -150,13 +150,13 @@ module SiSU_document_structure_code or @@flag['poem'] \ or @@flag['group'] @tuned_group << para if para =~/\S+/ - elsif para =~/<:(?:code|alt|group|verse)-end>/ + elsif para =~/#{Mx[:gr_o]}(?:code|alt|group|verse)-end#{Mx[:gr_c]}/ @verse_count=0 @tuned_group << para - tuned_file <<= if para =~/<:group-end>/ + tuned_file <<= if para =~/#{Mx[:gr_o]}group-end#{Mx[:gr_c]}/ @tuned_group.join("\n") else @tuned_group=@tuned_group.join - @tuned_group.gsub!(/<:br><:br>(<:code-end>)/,'\1') + @tuned_group.gsub!(/#{Mx[:br_nl]}#{Mx[:br_nl]}(#{Mx[:gr_o]}code-end#{Mx[:gr_c]})/,'\1') @tuned_group end @tuned_group=[] @@ -169,18 +169,18 @@ module SiSU_document_structure_code data=@data data.each do |line| if line =~/\S/ \ - and line !~/^code\{|^\}code|<:code.+/ + and line !~/^code\{|^\}code|#{Mx[:gr_o]}code.+/ line.gsub!(/\s\s/,' ') - line.gsub!(/^/,'<:codeline>') if type=='code' # try sort for texpdf special case + line.gsub!(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type=='code' # try sort for texpdf special case if line =~/(?:https?|file|ftp):\/\/\S+$/ - line.gsub!(/$/,' <:br>') - else line.gsub!(/$/,'<:br>') #unless type=='code' + line.gsub!(/$/," #{Mx[:br_nl]}") + else line.gsub!(/$/,"#{Mx[:br_nl]}") #unless type=='code' end if @@flag['code']; @@counter+=1 else end elsif line =~/^\s*$/ - line.gsub!(/$/,' <:br>') + line.gsub!(/$/,"#{Mx[:br_nl]}") end end end diff --git a/lib/sisu/v0/dal_doc_str_tables.rb b/lib/sisu/v0/dal_doc_str_tables.rb index a17eb63f..5b636dfa 100644 --- a/lib/sisu/v0/dal_doc_str_tables.rb +++ b/lib/sisu/v0/dal_doc_str_tables.rb @@ -97,29 +97,29 @@ module SiSU_document_structure_tables w=widths.split(/;/) tuned_file=[] tuned_file << if para =~/\{(?:t|table)~h(?:\sc\d+;)?[\d; ]*\}/ - "<!Th#{TS1} c#{@row[2].length}; #{widths}!>" + "#{Mx[:gr_o]}Th#{Mx[:tc_p]} c#{@row[2].length}; #{widths}#{Mx[:gr_c]}" elsif para =~/\{(?:t|table)(?:\sc\d+;)?[\d; ]*\}/ - "<!T#{TS1} c#{@row[2].length}; #{widths}!>" + "#{Mx[:gr_o]}T#{Mx[:tc_p]} c#{@row[2].length}; #{widths}#{Mx[:gr_c]}" end @row.each do |l| l << '' if l.length == (@row[1].length - 1) table=[] if l.length == @row[1].length - table << '<!' #'<tr>' + table << Mx[:tc_o] #'<tr>' n= -1 l.each do |c| n +=1 #'<td>' + c + '</td>' table << if c =~/\A(?:\n)?\s*\Z/ - "#{TS1}#{TS1}#{w[n]}#{TS1}" + ' ' + "#{Mx[:tc_p]}#{Mx[:tc_p]}#{w[n]}#{Mx[:tc_p]}" + ' ' else - "#{TS1}#{TS1}#{w[n]}#{TS1}" + c.strip + "#{Mx[:tc_p]}#{Mx[:tc_p]}#{w[n]}#{Mx[:tc_p]}" + c.strip end end - table << '!>' #'</tr>' + table << Mx[:tc_c] tuned_file << table.join end end - tuned_file << '<!TZ!>' #'</table>' + tuned_file << "#{Mx[:gr_o]}TZ#{Mx[:gr_c]}" #'</table>' tuned_file=tuned_file.compact.join("\n") end def tables @@ -141,13 +141,13 @@ module SiSU_document_structure_tables instructions=$1 @@column=instructions.split(/;\s*/) @@columns=@@column[0] - para.gsub!(/^table\{~h\s+(c\d+?;.+?)$/,"<!Th#{TS1} \\1!>") - para.gsub!(/^table\{\s+(c\d+?;.+?)$/,"<!T#{TS1} \\1!>") + para.gsub!(/^table\{~h\s+(c\d+?;.+?)$/,"#{Mx[:gr_o]}Th#{Mx[:tc_p]} \\1#{Mx[:gr_c]}") + para.gsub!(/^table\{\s+(c\d+?;.+?)$/,"#{Mx[:gr_o]}T#{Mx[:tc_p]} \\1#{Mx[:gr_c]}") @@flag['table_to']=true end if @@flag['table_to'] \ and para =~/\}table/ - para.gsub!(/^\}table\s*$/,"<!TZ!>\n") + para.gsub!(/^\}table\s*$/,"#{Mx[:gr_o]}TZ#{Mx[:gr_c]}\n") para.gsub!(/\n/,' ') #newlines taken out para.strip! @tuned_table << para @@ -164,13 +164,13 @@ module SiSU_document_structure_tables @@line_mode=sub_array.scan(/.+/u) Tables.new(@md,@@line_mode).tr_td para=@@line_mode.join - para.gsub!(/(.*\S+.*)\Z/m,'<!\1!>') unless para =~/<!Th?#{TS1}/u + para.gsub!(/(.*\S+.*)\Z/m,"#{Mx[:tc_o]}\\1#{Mx[:tc_c]}") unless para =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u end para.gsub!(/\n/,' ') para.strip! @tuned_table << para else - para.gsub!(/\n/,' ') unless para =~/<:(?:code|verse|alt|group)>/ + para.gsub!(/\n/,' ') unless para =~/#{Mx[:gr_o]}(?:code|verse|alt|group)#{Mx[:gr_c]}/ para.strip! @tuned_file << para end @@ -182,11 +182,11 @@ module SiSU_document_structure_tables data=@data data.each do |line| if @@counter <= @@columns.to_i \ - and line !~/(\}T\s*$|<:table[-_](close|end)>|<!TZ!>)/ + and line !~/(\}T\s*$|#{Mx[:gr_o]}:table[-_](close|end)#{Mx[:gr_c]}|#{Mx[:gr_o]}TZ#{Mx[:gr_c]})/ #if line.encoding.inspect =~/Encoding:ASCII-8BIT/ # line=line.force_encoding('utf-8') #end - line.gsub!(/(.+)/,"#{TS1}#{TS1}#{@@column[@@counter]}#{TS1}\\1") unless line =~/<!Th?#{TS1}/u + line.gsub!(/(.+)/,"#{Mx[:tc_p]}#{Mx[:tc_p]}#{@@column[@@counter]}#{Mx[:tc_p]}\\1") unless line =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u @@counter+=1 end end diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index 22ec72b0..c3bd8a7d 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -58,7 +58,7 @@ ** Description: Syntax for markup, input markup syntaxes, determined here =end -module Syntax +module SiSU_Syntax class Words def initialize(line,md,mkp) @line,@md,@mkp=line,md,mkp @@ -71,11 +71,11 @@ module Syntax @data_new=[] url_and_stub=SiSU_Env::Info_env.new.url @output_url="#{url_and_stub.remote}" - @http_m='\{.+?\}(?:https?|file)://\S+|(?:https?|file):\S+|\.\.\/\S+|\S+?\.png\b|[*]~\S+|^0~.+|<:(?:code|group|alt|verse)(?:-end)?>|<:br>' + @http_m=%r{\{.+?\}(?:https?|file)://\S+|(?:https?|file):\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/]' tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)} - tail_m_bold=%q{(?:(?:<\/i>)?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?} - bold_line=%q{^!_\s.+?(?:<br>|\n|$)} + tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?} + bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)} @line_scan_ital=if defined? @md.make_italic[:str] \ and defined? @vz.markup_make_italic[:str] /#@http_m|#{bold_line}|#@manmkp_ital#{tail_m_ital}|(?:#{@md.make_italic[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/ @@ -114,6 +114,8 @@ module Syntax end def pre(line) line=line.dup + line.gsub!(/^0~(\S+)/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}") + line.gsub!(/^@(\S+?):/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}") if line =~/\{(?:t|table)(?:~h)?\s*c?[\d; ]*\}/; line.gsub!(/(\n)/,';;\1') #markup for alternative tables end line @@ -124,7 +126,7 @@ module Syntax and @md.make_italic[:str]) \ or (defined? @vz.markup_make_italic[:str] \ and @vz.markup_make_italic[:str]) - line= if line !~/^(?:0~|%{1,4}\s|<:code)/ #!~/^(?:[0-6]~|!_|%+\s)/ + line= if line !~/^(?:#{Rx[:meta]}|#{Mx[:gr_o]}code)/ #!~/^(?:[0-6]~|!_|%+\s)/ word=line.scan(@line_scan_ital) word.flatten! word.compact! #reinstated @@ -133,10 +135,10 @@ module Syntax unless /#@manmkp_ital|#@http_m/.match(w) if defined? @md.make_italic[:regx] \ and @md.make_italic[:regx] - w.gsub!(@md.make_italic[:regx],'<i>\1</i>') + w.gsub!(@md.make_italic[:regx],"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") elsif defined? @vz.markup_make_italic \ and @vz.markup_make_italic - w.gsub!(@vz.markup_make_italic,'<i>\1</i>') + w.gsub!(@vz.markup_make_italic,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") end end line_array << w @@ -148,10 +150,10 @@ module Syntax line end def embolden(given) - given.gsub!(/(?:^!_|^[7-9]~)\s+(.+?)(<br>)/,'<b>\1</b>\2') - given.gsub!(/(?:^!_|^[7-9]~)\s+(.+?)\s+((?:[*]~\S+\s*)+)/,'<b>\1</b> \2') - given.gsub!(/(?:^!_|^[7-9]~)\s+(.+?)\s*([~-]#)$/,'<b>\1</b> \2') - given.gsub!(/(?:^!_\s+|^[7-9]~\s+)(.*)?\s*$/,'<b>\1</b>') + given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)(<br>)/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") + given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") + given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") + given.gsub!(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end def wordlist_bold(line) line=line.dup @@ -159,7 +161,7 @@ module Syntax and @md.make_bold[:str]) \ or (defined? @vz.markup_make_bold[:str] \ and @vz.markup_make_bold[:str]) - line=if line !~/^(?:[0-9]~|%+\s|<:code)/ + line=if line !~/^(?:#{Rx[:meta]}|#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}|%+\s|#{Mx[:gr_o]}code)/ line_array=[] word=line.scan(@line_scan_bold) word.flatten! @@ -168,13 +170,13 @@ module Syntax unless /#@manmkp_bold|#@http_m/.match(w) if defined? @md.make_bold[:regx] \ and @md.make_bold[:regx] #document header: 0~bold [bold word list] - w.gsub!(@md.make_bold[:regx],'<b>\1</b>') + w.gsub!(@md.make_bold[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") elsif defined? @vz.markup_make_bold \ and @vz.markup_make_bold #defaults and skin adjusted bold word list - w.gsub!(@vz.markup_make_bold,'<b>\1</b>') + w.gsub!(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end else - if w =~ /(?:^!_|^[7-9]~)\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! + if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! end end line_array << w @@ -183,8 +185,8 @@ module Syntax else line end else - if line !~/^(?:[0-9]~|%+\s)/ \ - and line =~ /(?:^!_|^[7-9]~)\s+/ + if line !~/^(?:#{Mx[:lv_o]}[0-9]:\S*?#{Mx[:lv_c]}|%+\s)/ \ + and line =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/ embolden(line) end end @@ -218,107 +220,126 @@ module Syntax # # #numbered (list) level 1 # _# #numbered (list) level 2 line=line.dup - if line !~/^0~|<:codeline>|<:code-end>/ + if line !~/^#{Mx[:meta_o]}|#{Mx[:gr_o]}codeline#{Mx[:gr_c]}|#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/ #special characters: ~ { } < > - _ / also used : ^ ! # line_array=[] line.gsub!(/^%{1,4} .+/mi,'') #remove comments - word=line.scan(/\S+|\n/) unless line =~/^(?:0~\S|%+\s)/ + word=line.scan(/\S+|\n/) unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit if word word.each do |w| # _ - / # | : ! ^ ~ - unless w =~/^[0-9]~|~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table/ - w.gsub!(/\\~/,'~') #escaped special character - w.gsub!(/~/,'~') + unless w =~/^#{Mx[:lv_o]}[0-9]:\S*?#{Mx[:lv_c]}|~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table/ + w.gsub!(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character + #w.gsub!(/~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") end - w.gsub!(/^\<$/,'<') #escaped special character - w.gsub!(/^\>$/,'>') #escaped special character + w.gsub!(/^\<$/,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character + w.gsub!(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character line_array << w end line=line_array.join(' ') line=line.strip end - line.gsub!(/^(1~\??) @title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 #{@md.title} - #{@md.subtitle},<br />\\2#{@md.dc_creator}") + line.gsub!(/~\{(.+?)\}~/m,"#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}") + line.gsub!(/~\[(.+?)\]~/m,"#{Mx[:en_b_o]}\\1#{Mx[:en_b_c]}") + line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 #{@md.title} - #{@md.subtitle},<br />\\2#{@md.dc_creator}") line.gsub!(/^(1~\??) @title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}") # - line.gsub!(/^([23]~\??) (?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 \\2#{@md.dc_creator}") # - line.gsub!(/<((?:https?|file):\/\/\S+?)>/,'< \1 >') #catch problem markup - line.gsub!(/\}\.\.\/(\S+)/,"\}#@output_url/\\1") #means you are not supporting relative links (only relevant in html), converted to static here + line.gsub!(/^(#{Mx[:lv_o]}[23]:\??#{Mx[:lv_c]}) (?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 \\2#{@md.dc_creator}") # + line.gsub!(/<((?:https?|file):\/\/\S+?)>/,'< \1 >') #catch problem markup + line.gsub!(/\}\.\.\/(\S+)/,"\}#@output_url/\\1") #means you are not supporting relative links (only relevant in html), converted to static here line.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }http://www.jus.uio.no/sisu') #adjustment 2005w30 line.gsub!(/<!(\S+)!>/,'<:\1>') #escaped special character - line.gsub!(/\\~/,'~') #escaped special character - line.gsub!(/\\\{/,'{') #escaped special character - line.gsub!(/\\\}/,'}') #escaped special character - line.gsub!(/\\\<</,'<<') #escaped special character - line.gsub!(/\\\>>/,'>>') #escaped special character - line.gsub!(/\\\</,'<') #escaped special character - line.gsub!(/\\\>/,'>') #escaped special character - line.gsub!(/\\\_/,'_') #escaped special character - line.gsub!(/\\\-/,'-') #escaped special character - line.gsub!(/\\\+/,'+') #escaped special character - line.gsub!(/\\\//,'/') #escaped special character - line.gsub!(/\\\#/,'#') #escaped special character - line.gsub!(/\\\&/,'&') #& #escaped special character - line.gsub!(/\\\|/,'|') #not really a sisu special character but made available as possibility - line.gsub!(/\\\:/,':') #not really a sisu special character but made available as possibility - line.gsub!(/\\\!/,'!') #not really a sisu special character but made available as possibility - line.gsub!(/\\\^/,'^') #not really a sisu special character but made available as possibility - line.gsub!(/\\\,/,',') #not really a sisu special character but made available as possibility + line.gsub!(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\<</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\>>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}") #& #escaped special character + line.gsub!(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility + line.gsub!(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility + line.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility + line.gsub!(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility + line.gsub!(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility #ADD --> - line.gsub!(/\\\\/,'\') #escaped special character - line.gsub!(/\\\*/,'*') #escaped special character - line.gsub!(/\\\!/,'!') #escaped special character - line.gsub!(/(?:^| )\*~([a-z0-9._-]+)/i,' <:name#\1>') #html name marker <a name="\\1"></a> - line.gsub!(/^([56]~)(\S+)(.+)/,'\1\2 \3 <:name#\2>') #html name marker <a name="\\1"></a>, however at present takes you to correct position within sub-toc, will nneed to clean from sub-toc leaving in main body only - line.gsub!(/(^| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s[^~]|$))/,'\1{ \2 }\3\4 ~{ \3 }~ ') #text url endnote url shortcut {~^ [text] }http://url is { [text] }http://url ~{ http://url }~ [plus adjustment for commas] #means for this class, non-object, un-numbered ~# will not work # shortcut should not be used in conjunction with rebgular matches #reversed order, and addition of no-tilde.. - line.gsub!(/(^| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s+~\{(.+?)\}~/,'\1{ \2 }\3 ~{ \3 \4 }~') # watch - line.gsub!(/<:?br>/,'<br />') #xml requires - # depreciated --> - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)e\{(.+?)\}e/,'\1<b>\2</b>') #emphasis - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)b\{(.+?)\}b/,'\1<b>\2</b>') #bold - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)u\{(.+?)\}u/,'\1<u>\2</u>') #underscore - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)c\{(.+?)\}c/,'\1<cite>\2</cite>') #cite /blockquote? - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)i\{(.+?)\}i/,'\1<i>\2</i>') #italics + line.gsub!(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}") #escaped special character + line.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character + line.gsub!(/(?:^| )\*~([a-z0-9._-]+)/i," #{Mx[:mk_o]}:name#\\1#{Mx[:mk_c]}") #html name marker <a name="\\1"></a> + line.gsub!(/^(#{Mx[:lv_o]}[56]:(\S+?)#{Mx[:lv_c]})\s*(.+)/,"\\1 \\3 #{Mx[:mk_o]}:name#\\2#{Mx[:mk_c]}") #html name marker <a name="\\1"></a>, however at present takes you to correct position within sub-toc, will nneed to clean from sub-toc leaving in main body only + line.gsub!(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ') + if line=~/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m + line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ ([^}]+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,"\\1{ \\2 }\\3 #{Mx[:en_a_o]} \\3 \\4 #{Mx[:en_a_c]}") # watch + end + if line=~/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m + line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m,"\\1{ \\2 }\\3\\4 #{Mx[:en_a_o]} \\3 #{Mx[:en_a_c]} ") + #text url endnote url shortcut {~^ [text] }http://url is { [text] }http://url #{Mx[:en_a_o]} http://url #{Mx[:en_a_c]} [plus adjustment for commas] + #means for this class, non-object, un-numbered ~# will not work # shortcut should not be used in conjunction with rebgular matches #reversed order, and addition of no-tilde.. + end + #line.gsub!(/(^| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s+~\{(.+?)\}~/,'\1{ \2 }\3 ~{ \3 \4 }~') # watch + line.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> ') + # depreciated -->#{Mx[:fa_c]} + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)e\{(.+?)\}e/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)b\{(.+?)\}b/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)u\{(.+?)\}u/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)c\{(.+?)\}c/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote? + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)i\{(.+?)\}i/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics # depreciated ^ - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)!\{(.+?)\}!/,'\1<em>\2</em>') #emphasis - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)\*\{(.+?)\}\*/,'\1<b>\2</b>') #bold - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)_\{(.+?)\}_/,'\1<u>\2</u>') #underscore - line.gsub!(/(^|\s+|['"]| |[\(\[]|\(|\>)\/\{(.+?)\}\//,'\1<i>\2</i>') #italics - line.gsub!(/(^|\s+|['"]| |\(|\>)\"\{(.+?)\}\"/,'\1<cite>\2</cite>') #cite /blockquote? - line.gsub!(/(^|[^\\])\^\{(.+?)\}\^/,'\1<sup>\2</sup>') #superscript - line.gsub!(/(^|\s+|['"]| |\(|\>|\S)9\{(.+?)\}9/,'\1<sup>\2</sup>') #superscript - line.gsub!(/(^|[^\\]),\{(.+?)\},/,'\1<sub>\2</sub>') #subscript - line.gsub!(/(^|\s+|['"]| |\(|\>)6\{(.+?)\}6/,'\1<sub>\2</sub>') #subscript - line.gsub!(/(^|\s+|['"]| |\(|\>)\+\{(.+?)\}\+/,'\1<ins>\2</ins>') #inserted text - line.gsub!(/(^|\s+|['"]| |\(|\>)v\{(.+?)\}v/,'\1<ins>\2</ins>') #inserted text - line.gsub!(/(^|\s+|['"]| |\(|\>)-\{(.+?)\}-/,'\1<del>\2</del>') #strikethrough - deleted text - line.gsub!(/(^|\s+|['"]| |\(|\>)x\{(.+?)\}x/,'\1<del>\2</del>') #deleted text - line.gsub!(/(^|\s+|['"]| |\(|\>)\*(\S+?)\*/,'\1<b>\2</b>') #bold single word, watch - line.gsub!(/(^|\s+|['"]| |\(|\>)\!(\S+?)\!/,'\1<b>\2</b>') #bold single word, watch - line.gsub!(/(^|\s+|['"]| |\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([^a-zA-Z0-9]|[ ,.;:'"~$]|$)/,'\1<i>\2</i>\3') #italics single word, watch - line.gsub!(/(^|\s+|['"]| |\(|\>)_(\S+?)_([.,!'")]?(?:\s|$))/,'\1<u>\2</u>\3') #underscore single word, watch (made more complicated by url decoration escape tag (_url)) - line.gsub!(/(^|\s+)-([^{]\S+?)-( |$)/,'\1<del>\2</del>\3') #underscore single word, watch - line.gsub!(/(^|\s+|['"]| |\(|\>|\d+)\^(\S+?)\^/,'\1<sup>\2</sup>') #superscript single word, watch digit added - line.gsub!(/<[:e]\s+(.+?)!?>/,'~{ \1 }~') # not tested - line.gsub!(/^\s*_([1-9])(\*+)\s*/,'<:i\1> _* ') #bullets, shortcut - line.gsub!(/^\s*_([1-9])\s+/,'<:i\1> ') #indent - line.gsub!(/(?:<br>|<br \/>)\s*_[12]\s+/,'<br> ') #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ') - line.gsub!(/<:?br>/,'<br />') #adjustment 2004w41, from # line.gsub!(/<br>/,'<br />') + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)!\{(.+?)\}!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)\*\{(.+?)\}\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)_\{(.+?)\}_/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote? + line.gsub!(/(^|[^\\])\^\{(.+?)\}\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |\(|\>|\S)9\{(.+?)\}9/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript + line.gsub!(/(^|[^\\]),\{(.+?)\},/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #strikethrough - deleted text + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #deleted text + line.gsub!(/(^|#{Mx[:gl_c]}|\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!(/(^|#{Mx[:gl_c]}|\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!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([^a-zA-Z0-9]|[ ,.;:'"~$]|$)/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3") #italics single word, watch + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_([.,!'")]?(?:\s|$))/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}\\3") #underscore single word, watch (made more complicated by url decoration escape tag (_url)) + line.gsub!(/(^|#{Mx[:gl_c]}|\s+)-([^{]\S+?)-( |$)/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}\\3") #underscore single word, watch + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added + line.gsub!(/<[:e]\s+(.+?)!?>/,"#{Mx[:en_a_o]} \\1 #{Mx[:en_a_c]}") #not tested + line.gsub!(/^\s*_\*\s*/,"#{Mx[:gl_bullet]}") #bullets, shortcut + #line.gsub!(/^\s*_(\*+)\s*/,"#{Mx[:gl_bullet]}") #bullets, shortcut + line.gsub!(/^\s*_([1-9])\*\s*/,"#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut + #line.gsub!(/^\s*_([1-9])(\*+)\s*/,"#{Mx[:fa_o]}:i\\1#{Mx[:fa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}") #bullets, shortcut + line.gsub!(/^\s*_([1-9])\s+/,"#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #indent + line.gsub!(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ') ##added #line.gsub!(/(?:^!_\s+|^[7-9]~\s+|<:b>)(.*)?([~-]#)$/i,'<b>\1</b> \2') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! - #line.gsub!(/(?:^!_\s+|^[7-9]~\s+|<:b>)(.*)?\s*$/i,'<b>\1</b>') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! - #line.gsub!(/(?:(?:^| )!_ |^[7-9]~ |<:b>)(.*)\n/mi,'<b>\1</b> ') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! + #line.gsub!(/(?:^!_\s+|^[7-9]~\s+|<:b>)(.*)?\s*$/i,'<b>\1</b>') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! + #line.gsub!(/(?:(?:^| )!_ |^[7-9]~ |<:b>)(.*)\n/mi,'<b>\1</b> ') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! #line.gsub!(/^_" (.*)\n/i,'<blockquote>\1</blockquote> ') #blockquotes #introduce KEEP - line.gsub!(/<:hi>/,'<span style="background-color: rgb(255,240,196)">') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) - line.gsub!(/<:\/hi>/,'</span>') - line.gsub!(/(<:verse>.+)/m,"\\1\n") + line.gsub!(/<:hi>/,"#{Mx[:fa_hilite_o]}") #'<span style="background-color: rgb(255,240,196)">') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) + line.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'</span>') + #line.gsub!(/<:hi>/, + #line.gsub!(/<:\/hi>/,'</span>') + line.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n") line.gsub!(/[ ]+($)/,'\1') - if line =~/(<:(?:verse|group)>)/; line.gsub!(/(<:(?:verse|group)>)/i,"\\1\n") #cosmetic - else line.gsub!(/(<br \/>)/i,"\\1\n") + #line.gsub!(/\{(.+?)\}(https?:\S+)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked (text or image) + #line.gsub!(/\{(.+?)\}(image)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image + ##semantic + #line.gsub!(/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m,"\\1#{Mx[:sm_set_o]}\\2#{Mx[:sm_set_c]}\\1") + #line.gsub!(/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/,"#{Mx[:sm_subset_o]}\\1#{Mx[:sm_subset_c]}\\2") + if line =~/(#{Mx[:gr_o]}(?:verse|group)#{Mx[:gr_c]})/; line.gsub!(/(#{Mx[:gr_o]}(?:verse|group)#{Mx[:gr_c]})/i,"\\1\n") #cosmetic + else line.gsub!(/<br \/>/i,"#{Mx[:br_line]}\n") end - elsif line =~/^<:code(?:-end)?>|<:codeline>/ # /^<:code>/ #should be enough # underscore used as escape for angle brackets + elsif line =~/^#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}|#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/ # /^<:code>/ #should be enough # underscore used as escape for angle brackets line.gsub!(/([<>])/,'_\1') line.gsub!(/_<:(\S+?)_>/,'<:\1>') #convert <:\S+> back, clumsy line.gsub!(/_<(br(?: \/)?)_>/,'<\1>') #convert <br> <br /> back, clumsy - line.gsub!(/(^|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert <br> <br /> back, clumsy - line.gsub!(/<:codeline>/,"\n ") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n") + line.gsub!(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert <br> <br /> back, clumsy + line.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n ") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n") else # 0~ end line @@ -341,32 +362,32 @@ module Syntax # +2 <!i2!> puts 'tech' @data.each do |line| - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)e\{(.+?)\}e/,'\1<b>\2</b>') #emphasis - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)b\{(.+?)\}b/,'\1<b>\2</b>') #bold - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)u\{(.+?)\}u/,'\1<u>\2</u>') #underscore - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)c\{(.+?)\}c/,'\1<cite>\2</cite>') #cite - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)i\{(.+?)\}i/,'\1<i>\2</i>') #italics - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)!\{(.+?)\}!/,'\1<em>\2</em>') #emphasis - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)\*\{(.+?)\}\*/,'\1<b>\2</b>') #bold - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)_\{(.+?)\}_/,'\1<u>\2</u>') #underscore - line.gsub!(/(^|\s+|['"]|[\(\[]|\(|\>)\/\{(.+?)\}\//,'\1<i>\2</i>') #italics - line.gsub!(/(^|\s+|['"]|\(|\>)\"\{(.+?)\}\"/,'\1<cite>\2</cite>') - line.gsub!(/(^|\s+|['"]|\(|\>|\S)\^\{(.+?)\}\^/,'\1<sup>\2</sup>') - line.gsub!(/(^|\s+|['"]|\(|\>|\S)9\{(.+?)\}9/,'\1<sup>\2</sup>') - line.gsub!(/(^|\s+|['"]|\(|\>),\{(.+?)\},/,'\1<sub>\2</sub>') - line.gsub!(/(^|\s+|['"]|\(|\>)6\{(.+?)\}6/,'\1<sub>\2</sub>') - line.gsub!(/(^|\s+|['"]|\(|\>)\+\{(.+?)\}\+/,'\1<ins>\2</ins>') - line.gsub!(/(^|\s+|['"]|\(|\>)v\{(.+?)\}v/,'\1<ins>\2</ins>') - line.gsub!(/(^|\s+|['"]|\(|\>)-\{(.+?)\}-/,'\1<del>\2</del>') - line.gsub!(/(^|\s+|['"]|\(|\>)x\{(.+?)\}x/,'\1<del>\2</del>') - line.gsub!(/(^|\s+|['"]|\(|\>)\*(\S+?)\*/,'\1<b>\2</b>') #bold single word, watch - line.gsub!(/(^|\s+|['"]|\(|\>)\!(\S+?)\!/,'\1<b>\2</b>') #bold single word, watch - line.gsub!(/(^|\s+|['"]|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/,'\1<i>\2</i>\3') #italics single word, watch - line.gsub!(/(^|\s+|['"]|\(|\>)_(\S+?)_/,'\1<u>\2</u>') #underscore single word, watch - line.gsub!(/(^|\s+|['"]|\(|\>|\d+)\^(\S+?)\^/,'\1<sup>\2</sup>') #superscript single word, watch digit added - line.gsub!(/^\s*_([1-9])(\*+)\s*/,'<:i\1> _* ') # bullets, shortcut - line.gsub!(/^\s*_([1-9])\s+/,'<:i\1> ') - line.gsub!(/<:?br>/,'<br />') + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_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/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)c\{(.+?)\}c/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite + 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#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^\{(.+?)\}\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)9\{(.+?)\}9/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>),\{(.+?)\},/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") + 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 + 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])/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3") #italics single word, watch + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore single word, watch + line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^(\S+?)\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #check #superscript single word, watch digit added + line.gsub!(/^\s*_\([1-9]\)\(\*\+\)\s*/,"#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}") # bullets, shortcut + line.gsub!(/^\s*_\([1-9]\)\s+/,"#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") + line.gsub!(/(?:<:?br>|<br \/>)\s*_[12]\s+/,"#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ') end @data end diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb index cb68ffd6..1e788f8e 100644 --- a/lib/sisu/v0/db_import.rb +++ b/lib/sisu/v0/db_import.rb @@ -138,20 +138,20 @@ module SiSU_DB_import end def special_character_escape(string) string.gsub!(/'/,"''") #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'") - string.gsub!(/<:br>/,"<br />\n") - string.gsub!(/<:(?:code|alt|group|verse)(?:-end)?>/,'') - string.gsub!(/<:name#\S+?>/,'') + string.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"<br />\n") + string.gsub!(/#{Mx[:gr_o]}(?:code|alt|group|verse)(?:-end)?#{Mx[:gr_c]}/,'') + string.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'') string.gsub!(/\{\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)\}\S+/,'[image: \1] \2') string.gsub!(/\{\s*(.+?)\s*\}(?:https?|file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2') end def strip_markup(string) #define rules, make same as in dal clean - string.gsub!(/<sup>(\d+)<\/sup>/,'[\1]') - string.gsub!(/<:i[12]>/,'') + string.gsub!(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]') + string.gsub!(/#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/,'') string.gsub!(/(?: \\;)+/,' ') - string.gsub!(/<!T[h]?¡.+?!>/u,"[TABLE]\n") #tables - string.gsub!(/<!¡¡\d+(.+?)!>/u,'\1') #tables - string.gsub!(/¡¡\d+¡/u,' ') #tables - string.gsub!(/¡/u,' ') #tables tidy later + string.gsub!(/#{Mx[:gr_o]}T[h]?#{Mx[:tc_p]}.+?#{Mx[:gr_c]}/u,"[TABLE]\n") #tables #CHECK should take whole table + string.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}\d+(.+)#{Mx[:tc_c]}/u,'\1') #tables + string.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' ') #tables + string.gsub!(/#{Mx[:tc_p]}/u,' ') #tables tidy later string.gsub!(/<.+?>/,'') string.gsub!(/\{.+?\.(?:png|jpg|gif).+?\}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search string.gsub!(/\s\s+/,' ') @@ -375,23 +375,30 @@ module SiSU_DB_import @col[:en_z]=nil dal_array.each do |data| #data.gsub!(/<[biu]>(.+?)<\/[biu]>/,'\1') # remove bold, italics, underscore - data.gsub!(/<b>(.+?)<\/b>/,'\1') # remove bold, italics, underscore - data.gsub!(/<i>(.+?)<\/i>/,'\1') # remove bold, italics, underscore - data.gsub!(/<u>(.+?)<\/u>/,'\1') # remove bold, italics, underscore - #data.gsub!(/<:name#\S+?>/,'') + data.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') + #data.gsub!(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphaisis_c]}/,'\1') + data.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') + data.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + data.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1') + data.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1') + data.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1') + data.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1') + data.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') + data.gsub!(/#{Mx[:gl_o]}(●)#{Mx[:gl_c]}\s*/,'\1 ') + data.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'') @col[:seg]=@@seg - if data =~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}>/m # regular text + if data =~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m # regular text notedata=data.dup - if data[/^([123])~\s+(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/] + if data[/^#{Mx[:lv_o]}([123]):\S*?#{Mx[:lv_c]}\s*(.+?)#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})#{Mx[:id_c]}/m] @col[:lev],txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6,$7 @col[:lid]+=1 - if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/ + if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/ endnotes(txt).range - if txt =~/~\{.+?\}~/; @en << endnotes(txt).standard + if txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard end - if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk + if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk end - if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus + if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_o]}/; @en_pls << endnotes(txt).plus end txt=endnotes(txt).clean_text end @@ -413,7 +420,7 @@ module SiSU_DB_import when /3/; @col[:lv3]+=1 end @col[:lev]=@col[:plaintext]=@col[:body]='' - elsif data[/^4~(.+?)\s+(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/] + elsif data[/^#{Mx[:lv_o]}4:(\S*?)#{Mx[:lv_c]}\s*(.+?)#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})#{Mx[:id_c]}/] @@seg,txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6,$7 @col[:seg]=@@seg @col[:lv4]+=1 @@ -426,13 +433,13 @@ module SiSU_DB_import end @env=SiSU_Env::Info_env.new(@md.fns) @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html" - if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/ + if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/ endnotes(txt).range - if txt =~ /~\{.+?\}~/; @en << endnotes(txt).standard + if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard end - if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk + if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk end - if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus + if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus end txt=endnotes(txt).clean_text(@base_url) end @@ -449,9 +456,9 @@ module SiSU_DB_import t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file) t.tuple @col[:lev]=@col[:plaintext]=@col[:body]='' - elsif data[/^5~(?:~\S+)?(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/] # header lev5 seg level + elsif data[/^#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*(.+?)#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})#{Mx[:id_c]}/] # header lev5 seg level txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6 - re=/^5~(.+?)\s+/ + re=/^#{Mx[:lv_o]}5:(\S*?)#{Mx[:lv_c]}/ @@seg_full=re.match(data)[1] if data=~re #create? @@seg ||='' #nil # watch @col[:seg]=@@seg @@ -465,13 +472,13 @@ module SiSU_DB_import end @env=SiSU_Env::Info_env.new(@md.fns) @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html" - if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/ + if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/ endnotes(txt).range - if txt =~ /~\{.+?\}~/; @en << endnotes(txt).standard + if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard end - if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk + if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk end - if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus + if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus end txt=endnotes(txt).clean_text(@base_url) end @@ -488,9 +495,9 @@ module SiSU_DB_import t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file) t.tuple @col[:lev]=@col[:plaintext]=@col[:body]='' - elsif data[/^6~(?:~\S+)?(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/] # header lev6 seg level + elsif data[/^#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*(.+?)#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})#{Mx[:id_c]}/] # header lev6 seg level txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6 - re=/^6~(.+?)\s+/ + re=/^#{Mx[:lv_o]}6:(\S*?)#{Mx[:lv_c]}/ @@seg_full=re.match(data)[1] if data=~re #create? @@seg ||='' #nil # watch @col[:seg]=@@seg @@ -504,13 +511,13 @@ module SiSU_DB_import end @env=SiSU_Env::Info_env.new(@md.fns) @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html" - if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/ + if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/ endnotes(txt).range - if txt =~ /~\{.+?\}~/; @en << endnotes(txt).standard + if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard end - if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk + if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk end - if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus + if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus end txt=endnotes(txt).clean_text(@base_url) end @@ -530,21 +537,21 @@ module SiSU_DB_import else #% regular text @col[:lid]+=1 txt='' - txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=(/(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/m).match(data).captures + txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=(/(.+?)#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})#{Mx[:id_c]}/m).match(data).captures @hname=if @col[:seg] \ and not @col[:seg].to_s.empty? - @@hname=@col[:seg].to_s + @@hname=@col[:seg].to_s else @@hname end @env=SiSU_Env::Info_env.new(@md.fns) @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html" - if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/ + if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/ endnotes(txt).range - if txt =~ /~\{.+?\}~/; @en << endnotes(txt).standard + if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard end - if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk + if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk end - if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus + if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus end txt=endnotes(txt).clean_text(@base_url) end @@ -562,12 +569,10 @@ module SiSU_DB_import end if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last end - @col[:body]=if txt=~/<!T[h]?¡.+?!~\d+;\w\d+;\w\d+>/ #watch + @col[:body]=if txt=~/#{Mx[:gr_o]}T[h]?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/ #watch SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).html_table - elsif txt=~/<:i1>/ - SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).indent1 - elsif txt=~/<:i2>/ - SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).indent2 + elsif txt=~/^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/ + SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).indent($1) else SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).norm end @@ -580,11 +585,11 @@ module SiSU_DB_import @col[:en_a]=@col[:en_z]=nil @col[:lev]=@col[:plaintext]=@col[:body]='' end - if notedata =~ /~\{.+?\}~/ #% import into database endnotes tables - endnote_array=notedata.scan(/~\{.+?\}~/) + if notedata =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/ #% import into database endnotes tables + endnote_array=notedata.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/) endnote_array.each do |inf| - if inf[/~\{\d+.+?<[0-9a-f]{#{@@dl}}>\}~/] # dal new endnotes 2003w31/1 - if inf[/~\{(\d+)(.+?)<([0-9a-f]{#{@@dl}})>\}~/] # dal new endnotes 2003w31/1 + if inf[/#{Mx[:en_a_o]}\d+.+?#{Mx[:id_o]}[0-9a-f]{#{@@dl}}#{Mx[:id_c]}#{Mx[:en_a_c]}/] # dal new endnotes 2003w31/1 + if inf[/#{Mx[:en_a_o]}(\d+)(.+?)#{Mx[:id_o]}([0-9a-f]{#{@@dl}})#{Mx[:id_c]}#{Mx[:en_a_c]}/] # dal new endnotes 2003w31/1 nr,txt,digest_clean=$1,$2,$3 end @id_n+=1 @@ -620,11 +625,11 @@ module SiSU_DB_import end word_mode=notedata.scan(/\S+/) end - if notedata =~ /~\[\*.+?\]~/ #% import into database endnotes tables - endnote_array=notedata.scan(/~\[\*.+?\]~/) + if notedata =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/ #% import into database endnotes tables + endnote_array=notedata.scan(/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/) endnote_array.each do |inf| - if inf[/~\[\*\d+.+?<[0-9a-f]{#{@@dl}}>\]~/] # dal new endnotes 2003w31/1 - if inf[/~\[[*](\d+)(.+?)<([0-9a-f]{#{@@dl}})>\]~/] # dal new endnotes 2003w31/1 + if inf[/#{Mx[:en_b_o]}\*\d+.+?#{Mx[:id_o]}[0-9a-f]{#{@@dl}}#{Mx[:id_c]}#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1 + if inf[/#{Mx[:en_b_o]}[*](\d+)(.+?)#{Mx[:id_o]}([0-9a-f]{#{@@dl}})#{Mx[:id_c]}#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1 nr,txt,digest_clean=$1,$2,$3 end @id_n+=1 @@ -661,11 +666,11 @@ module SiSU_DB_import end word_mode=notedata.scan(/\S+/) end - if notedata =~ /~\[\+.+?\]~/ #% import into database endnotes tables - endnote_array=notedata.scan(/~\[\+.+?\]~/) + if notedata =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/ #% import into database endnotes tables + endnote_array=notedata.scan(/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/) endnote_array.each do |inf| - if inf[/~\[\+\d+.+?<[0-9a-f]{#{@@dl}}>\]~/] # dal new endnotes 2003w31/1 - if inf[/~\[[+](\d+)(.+?)<([0-9a-f]{#{@@dl}})>\]~/] # dal new endnotes 2003w31/1 + if inf[/#{Mx[:en_b_o]}\+\d+.+?#{Mx[:id_o]}[0-9a-f]{#{@@dl}}#{Mx[:id_c]}#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1 + if inf[/#{Mx[:en_b_o]}[+](\d+)(.+?)#{Mx[:id_o]}([0-9a-f]{#{@@dl}})#{Mx[:id_c]}#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1 nr,txt,digest_clean=$1,$2,$3 end @id_n+=1 @@ -710,38 +715,38 @@ module SiSU_DB_import def endnotes(txt) @txt=txt def standard - x=if @txt =~ /~\{.+?\}~/; @txt.scan(/~\{(\d+).+?\}~/) + x=if @txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @txt.scan(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/) else nil end end def asterisk - x=if @txt =~/~\[\*.+?\]~/; @txt.scan(/~\[[*](\d+).+?\]~/) + x=if @txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @txt.scan(/#{Mx[:en_b_o]}[*](\d+).+?#{Mx[:en_b_c]}/) else nil end end def plus - x=if @txt =~/~\[\+.+?\]~/; @txt.scan(/~\[[+](\d+).+?\]~/) + x=if @txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @txt.scan(/#{Mx[:en_b_o]}[+](\d+).+?#{Mx[:en_b_c]}/) else nil end end def clean_text(base_url=nil) if base_url - @txt.gsub!(/~\{(\d+).+?\}~/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}) - @txt.gsub!(/~\[([*]\d+).+?\]~/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}) - @txt.gsub!(/~\[([+]\d+).+?\]~/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}) + @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}) + @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}) + @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}) else - @txt.gsub!(/~\{(\d+).+?\}~/,'<sup>\1</sup>') - @txt.gsub!(/~\[([*]\d+).+?\]~/,'<sup>\1</sup>') - @txt.gsub!(/~\[([+]\d+).+?\]~/,'<sup>\1</sup>') + @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,'<sup>\1</sup>') + @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>') + @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>') end @txt end def range @col[:en_a]=@col[:en_z]=nil - if @txt =~ /~\{.+?\}~|~\[([*]\d+).+?\]~|~\[([+]\d+).+?\]~/ + if @txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}|#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/ word_array=@txt.scan(/\S+/) word_array.each do |w| - if w[/~[{\[][*+]?(\d+)\s+.+?[}\]]~/] # not tested since change 2003w31 + if w[/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/] # not tested since change 2003w31 @col[:en_a]=$1 unless @col[:en_a] @col[:en_z]=@col[:en_a].dup unless @col[:en_a] @col[:en_z]=$1 if @col[:en_a] diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index ef33be04..4129893a 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -151,6 +151,193 @@ module SiSU_Viz end def js_old end + def semantic_tags + def default + #:f => 'firstname', + #:m => 'middlename', + #:l => 'lastname', + #:ed => 'editor', #editor? + #:v => 'version', #edition + { + :pub => 'publication', + :conv => 'convention', + :vol => 'volume', + :pg => 'page', + :cty => 'city', + :org => 'organization', + :uni => 'university', + :dept => 'department', + :fac => 'faculty', + :inst => 'institute', + :co => 'company', + :com => 'company', + :conv => 'convention', + :dt => 'date', + :y => 'year', + :m => 'month', + :d => 'day', + :ti => 'title', + :au => 'author', + :ed => 'editor', #editor? + :v => 'version', #edition + :n => 'name', + :fn => 'firstname', + :mn => 'middlename', + :ln => 'lastname', + :in => 'initials', + :qt => 'quote', + :ct => 'cite', + :ref => 'reference', + :ab => 'abreviation', + :def => 'define', + :desc => 'description', + :trans => 'translate', + } + end + self + end + #% decorate + def decorate_italics + 'title|article|book|journal' + end + def decorate_bold + end + def decorate_uppercase + 'surname' + end + #% semantic + def sem_title #dc 1 + 'title' + end + def sem_article + 'article' + end + def sem_book + 'book' + end + def sem_journal + 'journal' + end + def sem_fullname # (contains: firstname, surname) #issues arise as contains surname etc. + 'fullname' + end + def sem_first + 'first' + end + def sem_surname + 'surname' + end + def sem_middle + 'middle' + end + def sem_creator #dc 2 # == fullname (contains: firstname, surname) + 'creator' + end + def sem_author # == fullname (contains: firstname, surname) + 'author' + end + def sem_editor # == fullname (contains: firstname, surname) + 'editor' + end + def sem_illustrator # == fullname (contains: firstname, surname) + 'illustrator' + end + def sem_translator # == fullname (contains: firstname, surname) + 'translator' + end + def sem_isbn # 10 or 13 + 'isbn' + end + def sem_isbn_10 + 'isbn10' + end + def sem_isbn_13 + 'isbn13' + end + def sem_loc # library of congress + 'loc' + end + def sem_dewey + 'dewey' + end + def sem_pg # project gutenberg number + 'pg' + end + def sem_subject #dc 3 + 'subject' + end + def sem_date #dc 7 + 'date' + end + def sem_date_created + 'date_created' + end + def sem_date_issued + 'date_issued' + end + def sem_date_available + 'date_available' + end + def sem_date_valid + 'date_valid' + end + def sem_date_modified + 'date_modified' + end + def sem_type #dc 8 + 'type' + end + def sem_description #dc 4 + 'description' + end + def sem_publisher #dc 5 + 'publisher' + end + def sem_contributor #dc 6 + 'contributor' + end + def sem_format #dc 9 + 'format' + end + def sem_identifier #dc 10 + 'identifier' + end + def sem_source #dc 11 + 'source' + end + def sem_language #dc 12 + 'language' + end + def sem_relation #dc 13 + 'source' + end + def sem_coverage #dc 14 + 'coverage' + end + def sem_rights #dc 15 + 'rights' + end + def sem_copyright + 'copyright' + end + def sem_license + 'license' + end + def sem_prepared_by + 'prepared_by' + end + def sem_digitized_by + 'digitized_by' + end + def sem_keywords + 'keywords' + end + def sem_comments + 'comments' + end + def sem_abstract + 'abstract' + end #% path def path_stylesheet_home %{ <link rel="stylesheet" href="./#{@dir.path.style}/homepage.css" type="text/css" />} @@ -1934,7 +2121,7 @@ WOK end def landscape def w - 234 + 242 end def h 166 @@ -1976,10 +2163,10 @@ WOK def b5 def portrait def w - 126 + 140 end def h - 180 + 210 end def img_px 356 @@ -2003,10 +2190,10 @@ WOK def a5 def portrait def w - 100 + 112 end def h - 144 + 170 end def img_px 280 diff --git a/lib/sisu/v0/digests.rb b/lib/sisu/v0/digests.rb index 0c859010..9510a12a 100644 --- a/lib/sisu/v0/digests.rb +++ b/lib/sisu/v0/digests.rb @@ -150,11 +150,14 @@ module SiSU_Digest_view data.each do |para| x=nil y,para_endnotes=[],[] - if para =~/<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#@dl}):([0-9a-f]{#@dl})>/ + if para =~/#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#@dl}):([0-9a-f]{#@dl})#{Mx[:id_c]}/ ocn,h1,h2,d_clean,d_all=$1,$2,$3,$4,$5 @ocn=ocn unless ocn.to_i == 0 - if para=~/~\{[\d*+]+.+?<[0-9a-f]{#@dl}>\}~/ - para_endnotes << para.scan(/~[{\[]([\d*+]+).+?<([0-9a-f]{#@dl})>[}\]]~/) + para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') + para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') + para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') + if para=~/#{Mx[:en_a_o]}[\d*+]+.+?#{Mx[:id_o]}[0-9a-f]{#@dl}#{Mx[:id_c]}#{Mx[:en_a_c]}/ + para_endnotes << para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+).+?#{Mx[:id_o]}([0-9a-f]{#@dl})#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) end ima=[] if para !~/^%+\s/ \ @@ -163,21 +166,21 @@ module SiSU_Digest_view else image=nil end x=case para - when /^0~title/ + when /^#{Mx[:meta_o]}title#{Mx[:meta_c]}/ "\n" + ' '*0 +'@' + ' '*9 - when /^0~subtitle/ + when /^#{Mx[:meta_o]}subtitle#{Mx[:meta_c]}/ "\n" + ' '*1 +'@' + ' '*8 - when /^1~/ + when /^#{Mx[:lv_o]}1:/ "\n" + ' '*2 +':A ' + ' '*6 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all - when /^2~/ + when /^#{Mx[:lv_o]}2:/ "\n" + ' '*3 +':B ' + ' '*5 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all - when /^3~/ + when /^#{Mx[:lv_o]}3:/ "\n" + ' '*4 +':C ' + ' '*4 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all - when /^4~/ + when /^#{Mx[:lv_o]}4:/ "\n" + ' '*5 +'1' + ' '*4 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all - when /^5~/ + when /^#{Mx[:lv_o]}5:/ "\n" + ' '*6 +'2' + ' '*3 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all - when /^6~/ + when /^#{Mx[:lv_o]}6:/ "\n" + ' '*7 +'3' + ' '*2 +'- ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all else if para =~/MD5\(\S+?\.sst\)=\s*<u>([0-9a-f]{#@dl})<\/u>/ #watch @@ -248,20 +251,20 @@ module SiSU_Digest_view m_ruby_version=rgx_txt(@tr.ruby_version) case para when /#{m_dc_title}: / - @t=/#{m_dc_title}: (.+?)<~\d;(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#@dl}:[0-9a-f]{#@dl}>/.match(para)[1].gsub(/<\/?u>/,'').strip + @t=/#{m_dc_title}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#@dl}:[0-9a-f]{#@dl}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip when /#{m_creator}: / - @c=/#{m_creator}: (.+?)<~\d;(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#@dl}:[0-9a-f]{#@dl}>/.match(para)[1].gsub(/<\/?u>/,'').strip + @c=/#{m_creator}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#@dl}:[0-9a-f]{#@dl}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip when /#{m_sourcefile_digest}.+?<u>/ #watch dgst_extra="\n" + ' '*21 +'source' +' '*4 + @md.dgst[1] + ' '*34 + @md.fns when /Skin_Digest: / dgst_extra="\n" + ' '*21 + 'skin' +' '*6 + @md.dgst_skin[1] + ' '*34 + /(skin_\S+?\.rb)/.match(@md.dgst_skin[0])[1] when /#{m_sisu_version}: / - @v=/#{m_sisu_version}: (.+?)<~\d;(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#@dl}:[0-9a-f]{#@dl}>/.match(para)[1].gsub(/<\/?u>/,'').strip + @v=/#{m_sisu_version}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#@dl}:[0-9a-f]{#@dl}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip when /#{m_last_generated}: / - @g=/#{m_last_generated}: (.+?)<~\d;(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#@dl}:[0-9a-f]{#@dl}>/.match(para)[1].gsub(/<\/?u>/,'').strip + @g=/#{m_last_generated}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#@dl}:[0-9a-f]{#@dl}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip # 'doc last generated' when /#{m_ruby_version}: / - @r=/#{m_ruby_version}: (.+?)<~\d;(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#@dl}:[0-9a-f]{#@dl}>/.match(para)[1].gsub(/<\/?u>/,'').strip + @r=/#{m_ruby_version}: (.+?)#{Mx[:id_o]}~\d;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#@dl}:[0-9a-f]{#@dl}#{Mx[:id_c]}/.match(para)[1].gsub(/<\/?u>/,'').strip end dgst_extra ||='' "\n" + prefix +' - ' + ocn + ' '*(10-ocn.length) + d_clean + ' ' + d_all + dgst_extra + "\n" @@ -306,27 +309,27 @@ module SiSU_Digest_view ocn,endnotes=nil,nil data.each do |para| x=case para - when /^0~/; l[0] +=1 - if para =~/^0~title/; '' #' '*0 +'@ == headers' + "\n" + ' '*0 +'headings:' + when /^#{Mx[:meta_o]}/; l[0] +=1 + if para =~/^#{Mx[:meta_o]}title#{Mx[:meta_c]}/; '' #' '*0 +'@ == headers' + "\n" + ' '*0 +'headings:' end - when /^1~/; l[1] +=1 + when /^#{Mx[:lv_o]}1:/; l[1] +=1 ' '*0 +':A' - when /^2~/; l[2] +=1 + when /^#{Mx[:lv_o]}2:/; l[2] +=1 ' '*1 +':B' - when /^3~/; l[3] +=1 + when /^#{Mx[:lv_o]}3:/; l[3] +=1 ' '*2 +':C' - when /^4~/; l[4] +=1 + when /^#{Mx[:lv_o]}4:/; l[4] +=1 ' '*3 +'1' - when /^5~/; l[5] +=1 + when /^#{Mx[:lv_o]}5:/; l[5] +=1 ' '*4 +'2' - when /^6~/; l[6] +=1 + when /^#{Mx[:lv_o]}6:/; l[6] +=1 ' '*5 +'3' else nil end - if para =~/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#@dl}:[0-9a-f]{#@dl}>/ + if para =~/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#@dl}:[0-9a-f]{#@dl}#{Mx[:id_c]}/ ocn=$1 unless $1.to_i == 0 end - if para =~/~[{\[]([\d*+]+).+?<[0-9a-f]{#@dl}>[}\]]~/ + if para =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+).+?#{Mx[:id_o]}[0-9a-f]{#@dl}#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/ endnotes=$1 unless $1.to_i == 0 end dal_structure_tree("#{x}\n") if x and not x.empty? diff --git a/lib/sisu/v0/help.rb b/lib/sisu/v0/help.rb index acbae57b..22736aac 100644 --- a/lib/sisu/v0/help.rb +++ b/lib/sisu/v0/help.rb @@ -1425,7 +1425,7 @@ WOK sudo ruby ./sisu-install setup if rant is installed on your system you may instead run: sudo rant base - + for further options: ./sisu-install -T diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index 208b7409..5b9639dd 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -75,6 +75,7 @@ module SiSU_HTML require "#{SiSU_lib}/html_tune" include SiSU_Tune require "#{SiSU_lib}/shared_xml" + require "#{SiSU_lib}/shared_structure" class Source def initialize(opt) @opt=opt @@ -180,52 +181,7 @@ module SiSU_HTML @tuned_file_array end end - class Split_text_object - include SiSU_Viz - include SiSU_HTML_Format_type - @@dp=nil - attr_reader :format,:text,:ocn,:scroll_lev_para_ocn,:seg_lev_para_ocn - def initialize(md,para) - @md,@para=md,para - @format,@ocn='null','null' - #@format,@ocn=nil,nil - @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - end - def lev_segname_para_ocn #needs work 2003w29 - if @para =~/^\d~.+?<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - if @para[/^([1-6])~(\S+)\s+(\S.+?)<~(\d+);(?:[ohmu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m] - @format,segname,@text,@ocn=$1,$2,$3,$4 - @format="#@format~#{segname}" # - elsif @para[/^([1-6]~)\s+(\S.+?)<~(\d+);(?:[ohmu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m] - @format,@text,@ocn=$1,$2,$3 - end - else - if @para[/^(?:<:i([1-9])>\s*_\*)\s+(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m] - @format,@text,@ocn="_#{$1}\*",$2,$3,$4 - elsif @para[/^(_\*)\s+(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m] - @format,@text,@ocn=$1,$2,$3 - elsif @para[/<:(i[1-9])>\s*(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m] - @format,@text,@ocn=$1,$2,$3 - elsif @para[/<:(code|alt|verse|group)>(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m] - @format,@text,@ocn=$1,$2,$3 - elsif @para[/(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m] - @text,@ocn=$1,$2 #,$3 - end - if @para !~/<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$|^$/ #added 2002w06 - @text=@para[/(.+?)/m,1] - end - if @para[/^(\d)~\S*\s+(.+)/m] - @format,@text=$1,$2 - end - end - @seg_lev_para_ocn=if @para[/.+<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/] - SiSU_HTML_Format_type::Format_seg.new(@md,@format,@text,@ocn) - end - @scroll_lev_para_ocn=if @para[/.+<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/] - SiSU_HTML_Format_type::Format_scroll.new(@md,@format,@text,@ocn) - end - self - end + class Split_text_object <SiSU_Structure::Split_text_object end class Links_guide @links_guide_toc=[] @@ -266,18 +222,18 @@ module SiSU_HTML @scr_endnotes << format_head_scroll.title_endnote @data.each do |para| pg=para.dup - unless pg =~/^<:code>/ - if pg =~/~[{\[][\d*+]+ <a name="_[\d*+]+"/ \ - and not pg =~/^<:code>/ - endnote_array=[] - if pg=~/~\{[\d*+].+?\}\~/m - endnote_array << pg.scan(/~\{[\d*+]+(.+?)\}\~/m) + unless pg =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ + if pg =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="_[\d*+]+"/ \ + and not pg =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ + endnote_array=[] #(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}) + if pg=~/#{Mx[:en_a_o]}[\d*+].+?#{Mx[:en_a_c]}/m + endnote_array << pg.scan(/#{Mx[:en_a_o]}[\d*+]+(.+?)#{Mx[:en_a_c]}/m) end - if pg=~/~\[[\d*]+\s.+?\]\~/m - endnote_array << pg.scan(/~\[[\d*]+(.+?)\]\~/m) + if pg=~/#{Mx[:en_b_o]}[\d*]+\s.+?#{Mx[:en_b_c]}/m + endnote_array << pg.scan(/#{Mx[:en_b_o]}[\d*]+(.+?)#{Mx[:en_b_c]}/m) end - if pg=~/~\[[\d+]+\s.+?\]\~/m - endnote_array << pg.scan(/~\[[\d+]+(.+?)\]\~/m) + if pg=~/#{Mx[:en_b_o]}[\d+]+\s.+?#{Mx[:en_b_c]}/m + endnote_array << pg.scan(/#{Mx[:en_b_o]}[\d+]+(.+?)#{Mx[:en_b_c]}/m) end endnote_array.flatten.each do |note| format_scroll=SiSU_HTML_Format_type::Format_scroll.new(@md,note) @@ -297,7 +253,7 @@ module SiSU_HTML @data,@md=data,md @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - @pat_heading=/^(?:[1-6]~\S*)?(.*)<~(\d+);(?:[hm]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + @pat_heading=/^(?:#{Mx[:lv_o]}[1-6]:\S*?#{Mx[:lv_c]}\s*)?(.*)#{Mx[:id_o]}~(\d+);(?:[hm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @pat_strip_heading_name=/<a name="h?\d.*?">(.+?)<\/a>/ @tell=SiSU_Screen::Ansi.new(@md.cmd) end @@ -306,22 +262,22 @@ module SiSU_HTML toc=nil @@firstseg=nil @data.each do |para| - if para =~/^([1-6]~|4~!)/ + if para =~/^(?:#{Mx[:lv_o]}[1-6]:|4~!)/ para_toc=para.dup - para_toc.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>\s+~[{\[].+?[}\]]~/m,'') #remove endnotes from toc + para_toc.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>\s*(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,'') #remove endnotes from toc toc=case para_toc - when /^\s*1~(\S+)?/; Toc.new(para_toc,@md).level_1 - when /^\s*2~(\S+)?/; Toc.new(para_toc,@md).level_2 - when /^\s*3~(\S+)?/; Toc.new(para_toc,@md).level_3 - when /^\s*4~(\S+)?/; Toc.new(para_toc,@md).level_4 - when /^\s*5~(\S+)?/; Toc.new(para_toc,@md).level_5 - when /^\s*6~(\S+)?/; Toc.new(para_toc,@md).level_6 + when /^\s*#{Mx[:lv_o]}1:\S*/; Toc.new(para_toc,@md).level_1 + when /^\s*#{Mx[:lv_o]}2:\S*/; Toc.new(para_toc,@md).level_2 + when /^\s*#{Mx[:lv_o]}3:\S*/; Toc.new(para_toc,@md).level_3 + when /^\s*#{Mx[:lv_o]}4:\S+/; Toc.new(para_toc,@md).level_4 + when /^\s*#{Mx[:lv_o]}5:\S*/; Toc.new(para_toc,@md).level_5 + when /^\s*#{Mx[:lv_o]}6:\S*/; Toc.new(para_toc,@md).level_6 when /^\s*4~!/; Toc.new(para_toc).level_crosslink else end if @@firstseg.nil? \ - and para=~/^4~\S+?/ - @@firstseg=/^4~(\S+)?/.match(para)[1] + and para=~/^#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}/ + @@firstseg=/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/.match(para)[1] end if toc begin @@ -374,11 +330,11 @@ WOK end def level_1 para=@data - unless para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + unless para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ para.gsub!(@pat_strip_heading_name,'\1') end para[@pat_heading] - linkname,link=$1,$2 if $& + linkname,link=$1.strip,$2 if $& if link \ and link !~/#/ #% keep eye on link p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) @@ -390,26 +346,26 @@ WOK end toc={} format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) - toc[:seg]=if para =~/^\d~meta\s+Document Information/ + toc[:seg]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/ format_toc.lev0 else format_toc.lev1 end - title=if para =~/(<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)$/ + title=if para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/ m=/#{$1}/ para.gsub!(m,'') - if para=~/^\d~meta\s+Document Information/ + if para=~/^#{Mx[:lv_o]}\d:meta#{Mx[:lv_c]}\s*Document Information/ %{<a href="#docinfo">#{linkname}</a>} else linkname end else @@toc[:scr] << '<br />' - link=if para =~/<~[1-9];([0-6]):\d+;\w\d+><#@dp:#@dp>$/; $1 + link=if para =~/#{Mx[:id_o]}~[1-9];([0-6]):\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/; $1 else '' end %{<b><a href="##{link}">#{linkname}</a></b>} end format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) - toc[:scr]=if para =~/^\d~meta\s+Document Information/ + toc[:scr]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/ format_toc.lev0 else format_toc.lev1 end @@ -417,11 +373,11 @@ WOK end def level_2 para=@data - unless para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + unless para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ para.gsub!(@pat_strip_heading_name,'\1') end para[@pat_heading] - linkname,link=$1,$2 if $& + linkname,link=$1.strip,$2 if $& if link \ and link !~/#/ p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) @@ -429,7 +385,7 @@ WOK format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,linkname) toc={} toc[:seg]=format_toc.lev2 - if para =~/(<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)$/ + if para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/ m=/#{$1}/ para.gsub!(m,'') title=linkname @@ -444,7 +400,7 @@ WOK para.gsub!(@pat_strip_heading_name,'\1') para.gsub(/(.*?)<a name="(\d+)"><\/a>(.*)/,'\1') #2002w42 altered gsub! - problematic? - suspect para[@pat_heading] - linkname,link=$1,$2 if $& + linkname,link=$1.strip,$2 if $& if link \ and link !~/#/ p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) @@ -452,7 +408,7 @@ WOK format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,linkname) toc={} toc[:seg]=format_toc.lev3 - if para =~/(<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)$/ + if para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/ m=/#{$1}/ para.gsub!(m,'') title=linkname @@ -465,19 +421,19 @@ WOK def level_4 para=@data unless para =~/~metadata/ - unless para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + unless para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ para.gsub!(@pat_strip_heading_name,'\1') para[@pat_heading] - linkname,link=$1,$2 if $& + linkname,link=$1.strip,$2 if $& p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link end - para.gsub!(/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,'') - if para =~/^4~/ - seg_link=para.gsub(/^\s*4~(\S+)\s+(.+?)$/, + para.gsub!(/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') + if para =~/^#{Mx[:lv_o]}4:/ + seg_link=para.gsub(/^\s*#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}\s*(.+?)$/, %{ <a href="#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}" target="_top"> \\2 </a> }) - @@seg_url=para[/^4~(\S+).+?$/,1] + @@seg_url=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?$/,1] elsif para =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ seg_link=para.gsub(/^\s*(#{@md.lv4}\s+)\s*(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, %{<a href="#{@md.fnl[:pre]}\\2#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}" } + @@ -487,7 +443,7 @@ WOK format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,seg_link) toc={} toc[:seg]=format_toc.lev4 - if para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ m=/#{$1}/ para.gsub!(m,'') title=linkname @@ -500,17 +456,17 @@ WOK end def level_5 para=@data - if para !~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + if para !~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ para.gsub!(@pat_strip_heading_name,'\1') end para[@pat_heading] - linkname,link=$1,$2 if $& + linkname,link=$1.strip,$2 if $& if link \ and link !~/#/ p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) end toc={} - if para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ m=/#{$1}/ para.gsub!(m,'') title=linkname @@ -528,17 +484,17 @@ WOK end def level_6 para=@data - if para !~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + if para !~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ para.gsub!(@pat_strip_heading_name,'\1') end para[@pat_heading] - linkname,link=$1,$2 if $& + linkname,link=$1.strip,$2 if $& if link \ and link !~/#/ p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) end toc={} - if para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ m=/#{$1}/ para.gsub!(m,'') title=linkname @@ -671,7 +627,7 @@ WOK def publish scroll=[] hr='<center><hr width=90% /></center>' - scroll << @scr_toc << hr << @scr_body << hr << @scr_endnotes << hr << @scr_metadata << @scr_owner_details << @scr_tails + scroll << @scr_toc << hr << @scr_body << @scr_endnotes << hr << @scr_metadata << @scr_owner_details << @scr_tails scroll.flatten!.compact! end end @@ -690,6 +646,7 @@ WOK @data.each do |para| para.strip! para.gsub!(/<:.+?>/,'') + para.gsub!(/#{Rx[:mx_fa_clean]}/,'') unless para =~/\A\s*\Z/ @filename_html_scroll.puts para,"\n" end @@ -703,7 +660,7 @@ WOK @filename_html_index=@my_make.file_html_index(@md) @data.each do |para| para.strip! - para.gsub!(/<!.+?!>|<~\d+;(?:[ohm]|[0-6]:)\d+;\w\d+><#@dp:#@dp>/,'') + para.gsub!(/<!.+?!>|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|#{Mx[:id_o]}~\d+;(?:[ohm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') unless para =~/\A\s*\Z/ @filename_html_segtoc.puts para,"\n" @filename_html_index.puts para,"\n" diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 525ef50d..03d97a8d 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -960,7 +960,8 @@ WOK end def endnote_mark %{<p class="center" id="endnotes"> -<a href="#top"><hr></a></p>} #revisit +<a href="#top"><hr width=90% /></a> +</p>} #revisit end end class Format_text_object @@ -969,10 +970,10 @@ WOK attr_accessor :md,:one,:two,:three,:parablock,:table,:link,:linkname,:format,:paranum,:p_num,:para_id,:headname,:margin,:paragraph,:table,:banner,:url,:icon,:font,:one_stripped def initialize(md='',*txt) @md,@one,@two,@three=md,txt[0],txt[1],txt[2] - rgx=/^[1-6-]~/ + rgx=/^#{Mx[:lv_o]}\d:\S*?#{Mx[:lv_c]}/ @one_stripped=@one.gsub(rgx,'') if @one =~rgx @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - rgx=/~[{\[][\d*+]+\s+(.+?)<#@dp>[}\]]~/ #problem introduced + rgx=/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/ #problem introduced @one_stripped=@one.gsub(rgx,'\1') if @one =~rgx #problem introduced @link,@linkname=txt[0],txt[1] @format,parablock=txt[0],txt[1] @@ -989,7 +990,7 @@ WOK @para_id=Paragraph_id_ocn.new(@md,@paranum) #used by table version end @headname='' - if @format =~ /\d~(\S+)/ + if @format=~/^\d:(\S+)/ #need more reliable marker #if @format =~ /#{Rx[:lv]}/ headname=$1 #format[/\d~(\S+)/m,1] @headname=if headname =~/^[a-zA-Z]/; %{<a name="#{headname}" id="#{headname}"></a>} #consider: h_#{headname} else %{<a name="h#{headname}" id="h#{headname}"></a>} @@ -1045,12 +1046,12 @@ WOK end def gsub_body case @one - when /^(?:<:i[1-9]>\s*)?\((i+|iv|v|vi+|ix|x|xi+)\)/ + when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\((i+|iv|v|vi+|ix|x|xi+)\)/ @one.gsub!(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>') - @one.gsub!(/^(<:i[1-9]>)\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1<b>(\2)</b>') - when /^(?:<:i[1-9]>\s*)?\(?(\d|[a-z])+\)/ + @one.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1<b>(\2)</b>') + when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\(?(\d|[a-z])+\)/ @one.gsub!(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>') - @one.gsub!(/^(<:i[1-9]>)\s*\((\d+|[a-z])+\)/,'\1<b>(\2)</b>') + @one.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1<b>(\2)</b>') when /^\s*\d{1,3}\.\s/ @one.gsub!(/^\s*(\d+\.)/,'<b>\1</b>') when /^\s*[A-Z]\.\s/ @@ -1069,7 +1070,7 @@ WOK def bold_header @one.gsub!(/[1-9]~(\S+)/,'<a name="\1"></a>') @one.gsub!(/[1-9]~/,'') - @one.gsub!(/<~0;[um]\d+;[um]\d+><#@dp:#@dp>\s*$/i,'') #watch & do differently + @one.gsub!(/#{Mx[:id_o]}~0;[um]\d+;[um]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}\s*$/i,'') #watch & do differently %{<p class="bold"> #@one </p> diff --git a/lib/sisu/v0/html_format_css.rb b/lib/sisu/v0/html_format_css.rb index db381e63..ace6983b 100644 --- a/lib/sisu/v0/html_format_css.rb +++ b/lib/sisu/v0/html_format_css.rb @@ -352,10 +352,10 @@ module SiSU_HTML_Format_type else @one end note='' - if one =~/(~[{\[].+?[}\]]~\s*)/m #this is a clumsy fix, revisit and address upstream + if one =~/((?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*)/m #this is a clumsy fix, revisit and address upstream note=$1 note.gsub!(/[\n\s]+/m,' ') - one.gsub!(/~[{\[].+?[}\]]~\s*/m,' ') + one.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') one.gsub!(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+"> <sup>\d+<\/sup> /m,'') end %{<#@tag class="#@class"> @@ -384,7 +384,7 @@ module SiSU_HTML_Format_type #{@vz.table_close}} end def header_sub - @parablock.gsub!(/~[{\[].+?[}\]]~\s*/m,' ') + @parablock.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') %{#{@vz.margin_css} #{@headname} <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} diff --git a/lib/sisu/v0/html_scroll.rb b/lib/sisu/v0/html_scroll.rb index 97a1a02e..0bbac4fa 100644 --- a/lib/sisu/v0/html_scroll.rb +++ b/lib/sisu/v0/html_scroll.rb @@ -84,39 +84,39 @@ module SiSU_HTML_scroll @rcdc=false @scr={ :body=>[],:metadata=>[],:owner_details=>[] } data.each do |para| - if para =~/^\d~endnotes\s+Endnotes/ - para.gsub!(/Endnotes.+/,'') - end - if para =~/^\d~meta\s+Document Information/ + #if para =~/^#{Mx[:lv_o]}\d:endnotes#{Mx[:lv_c]}\s*Endnotes/ + ## para.gsub!(/Endnotes.+/,'') + #end + if para =~/^#{Mx[:lv_o]}\d:meta#{Mx[:lv_c]}\s*Document Information/ para.gsub!(/(Document Information(?: \(metadata\))?)/,'\1<a name="docinfo"></a>') end - if para =~/^\d~metadata\s+Metadata/ + if para =~/^#{Mx[:lv_o]}\d:metadata#{Mx[:lv_c]}\s*Metadata/ para.gsub!(/(Metadata)/,'\1<a name="metadata"></a>') end if @rcdc==false \ - and (para =~/^\d~metadata/ or para =~/^1~meta\s+Document Information/) + and (para =~/^#{Mx[:lv_o]}:metadata#{Mx[:lv_c]}/ or para =~/^#{Mx[:lv_o]}1:meta#{Mx[:lv_c]}\s*Document Information/) @rcdc=true end - if para !~/(^0~|<ENDNOTES>|<EOF>)/ - unless para =~/^<:code>/; para.gsub!(/~[{\[].+?[}\]]~\s+/m,' ') + if para !~/(^#{Rx[:meta]}|#{Mx[:br_endnotes]}|#{Mx[:br_eof]})/ + unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/; para.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') end - if para =~/.+?<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - paranum=para[/.+?<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,1] + if para =~/.+?#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + paranum=para[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,1] @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) end - @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).lev_segname_para_ocn - m=/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).html_scroll + m=/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|_[1-9]?\*|<:i[1-9]>\s*_\*|null/ + format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ #watch case @sto.format - when /^1~\S*/; para=@sto.scroll_lev_para_ocn.heading_body1 - when /^2~\S*/; para=@sto.scroll_lev_para_ocn.heading_body2 - when /^3~\S*/; para=@sto.scroll_lev_para_ocn.heading_body3 - when /^4~\S+/; para=@sto.scroll_lev_para_ocn.heading_body4 # work on see Split_text_object4 - when /^5~\S*/; para=@sto.scroll_lev_para_ocn.heading_body5 - when /^6~\S*/; para=@sto.scroll_lev_para_ocn.heading_body6 - when /^_\*$/; para=@sto.scroll_lev_para_ocn.bullet - when /^_([1-9])\*$/ #indent with bullet + when /^1:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body1 + when /^2:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body2 + when /^3:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body3 + when /^4:\S+?/; para=@sto.scroll_lev_para_ocn.heading_body4 # work on see Split_text_object4 + when /^5:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body5 + when /^6:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body6 + when /^#{Mx[:gl_bullet]}/; para=@sto.scroll_lev_para_ocn.bullet + when /^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}#{Mx[:gl_bullet]}/ #indent with bullet format_txt_obj.gsub_body para=@sto.scroll_lev_para_ocn.format('li',"i#{$1}") when /^i([1-9])$/ #indent @@ -130,26 +130,26 @@ module SiSU_HTML_scroll if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ format_txt_obj.gsub_body para=@sto.scroll_lev_para_ocn.para - if para =~/<!Th?.+/ # tables come as single block + if para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block table=SiSU_HTML_shared::Table.new(para) para=table.table_split end end end - elsif para =~/^[1-9]~\S*/ \ - and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/^#{Mx[:lv_o]}[1-9]:/ \ + and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_c]}#@dp:#@dp#{Mx[:id_c]}$/ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,para) para=format_txt_obj.bold_header elsif para =~/Endnotes?/ \ - and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'<br /><a name="notes">Note</a>') para=format_txt_obj.bold_para elsif para =~/Owner Details/ \ - and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'<br /><a name="owner.details">Owner Details</a>') @scr[:owner_details]=format_txt_obj.bold_para para='' - elsif para =~/(.*)<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>(.*)/ #watch + elsif para =~/(.*)#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/ #watch one,two=$1,$2 format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) para=format_seg.no_paranum @@ -162,9 +162,8 @@ module SiSU_HTML_scroll one,two=/(.*)<:center>(.*)/.match(para).captures format_scroll=SiSU_HTML_Format_type::Format_scroll.new(@md,one,two) end - para.gsub!(/<!.+!>/,' ') - para.gsub!(/^<:\S?>/,'') - para.gsub!(/<:\S?>/,' ') + para.gsub!(/^#{Rx[:mx_fa_clean]}/,' '); para.gsub!(/^<:\S?>/,'') + para.gsub!(/#{Rx[:mx_fa_clean]}/,' '); para.gsub!(/<:\S?>/,' '); para.gsub!(/<!.+!>/,' ') para.strip! unless @rcdc; @scr[:body] << para unless para =~/\A\s*\Z/ else @scr[:metadata] << para diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index a2d06ed9..a15c302e 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -103,9 +103,9 @@ module SiSU_HTML_seg @h_sfx=@md.sfx if @md.file_type =~/html/ @h_sfx='.html' if @md.file_type =~/html/ #used in creating file, not to be omitted. data.each do |para| - if para =~/^4~/ - @@seg_name << para[/^4~(\S+)/,1] - seg_name=para[/^4~(\S+)/,1] + if para =~/^#{Mx[:lv_o]}4:/ + @@seg_name << para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/,1] + seg_name=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/,1] @@seg_ad[seg_name]=para[/.+?<:\d\s+(.+)\s*?>/,1] #watch end end @@ -116,36 +116,36 @@ module SiSU_HTML_seg tell.segmented unless @md.cmd =~/q/ flagend='y' data.each do |para| - if para =~/^4~.+/ #watch - if para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - @@header4=para.to_s[/^4~(?:\S+\s+)?(.+?)<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,1] - else @@header4=para.to_s[/^4~(?:\S+\s+)?(.+)/,1] + if para =~/^#{Mx[:lv_o]}4:/ #watch + if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + @@header4=para.to_s[/^#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}(.+?)#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,1] + else @@header4=para.to_s[/^#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}(.+)/,1] end @@is4=newfile=1 end - if para =~/^3~.+/ - @@header3=para.to_s[/^3~(?:~\S+\s+)?(.+)/,1] + if para =~/^#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}/ + @@header3=para.to_s[/^#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}\s*?(.+)/,1] @@is4,@@is3=0,1 end - if para =~/^2~.+/ - @@header2=para.to_s[/^2~(?:~\S+\s+)?(.+)/,1] + if para =~/^#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}/ + @@header2=para.to_s[/^#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}\s*?(.+)/,1] @@is4,@@is3,@@is2=0,0,1 end - if para =~/^1~.+/ - @@header1=para.to_s[/^1~(?:~\S+\s+)?(.+)/,1] + if para =~/^#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}/ + @@header1=para.to_s[/^#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}\s*?(.+)/,1] @@is4,@@is3,@@is2,@@is1=0,0,0,1 end if (@@is1 && !@@is2 && !@@is3 && !@@is4) - unless para =~/^1~/; head1=$_ #; + unless para =~/^#{Mx[:lv_o]}1:/; head1=$_ #; end end if @@is4 == 1 \ - or para =~/^<ENDNOTES>|^<EOF>/ + or para =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ if newfile == 1 \ - or para =~/^<ENDNOTES>|^<EOF>/ + or para =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ newfile=0 - if para =~/^4~\S+/ \ - or para =~/^<ENDNOTES>|^<EOF>/ # @@level4 + if para =~/^#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}/ \ + or para =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ # @@level4 if tracking != 0 mkdir_p(@md.dir_out) unless FileTest.directory?(@md.dir_out) #bug - added specifically for nav! not needed by regular seg, check !!! Seg.new('',@md).tail @@ -174,8 +174,8 @@ module SiSU_HTML_seg tracking=tracking + 1 end m=para[/.+?<a name="(\d+)">.*/]; @@get_hash_to=$1 if m # changed 2002w42, again w44 ! & again 2003w16 - m=para[/^4~(\S+)/]; @@get_hash_fn=$1 if m - para=if para =~/<!Th?¡\s+c|<:(?:code|alt|verse|group)>/um; para.split(/\n/) + m=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/]; @@get_hash_fn=$1 if m + para=if para =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s*c|#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/um; para.split(/\n/) else para end if para.class == String @@ -195,7 +195,7 @@ module SiSU_HTML_seg end def header_art(para) format_head_seg=SiSU_HTML_Format_type::Head_seg.new(@md) - if para =~/^[0-6]~/ #2004w27/5 + if para =~/^#{Mx[:lv_o]}[1-6]:/ #2004w27/5 if @@tracker < @@seg_total-1; @@seg[:dot_nav]=format_head_seg.dot_control_pre_next else @@seg[:dot_nav]=format_head_seg.dot_control_pre end @@ -204,7 +204,7 @@ module SiSU_HTML_seg @@seg[:title]=format_head_seg.head << ads.div.major end def head(para) - clean=/<!.*?!>|<:.*?>|<~\d+;(?:[ohum]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + clean=/<!.*?!>|#{Mx[:gr_o]}:.*?#{Mx[:gr_c]}|<:.*?>|#{Mx[:id_o]}~\d+;(?:[ohum]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ format_head_seg=SiSU_HTML_Format_type::Head_seg.new(@md) if @@tracker < @@seg_total-1 if @@tracker == 0; @@segtocband=format_head_seg.toc_next2 #if format_head_seg.toc_next2 @@ -218,7 +218,7 @@ module SiSU_HTML_seg @@seg[:tocband] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) @@seg[:headers] << format_head_seg.seg_head_escript if SiSU_HTML_Format_type::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug @@seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@dc_creator).gsub(clean,'') - paranum=if @@header1[/.+?<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/]; $1 + paranum=if @@header1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) @@ -228,7 +228,7 @@ module SiSU_HTML_seg end if @@is2 == 1 header2=@@header2 - paranum=if header2[/.+?<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/]; $1 + paranum=if header2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) @@ -238,7 +238,7 @@ module SiSU_HTML_seg end if @@is3 == 1 header3=@@header3 - paranum=if header3[/.+?<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/]; $1 + paranum=if header3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) @@ -248,7 +248,7 @@ module SiSU_HTML_seg end if @@is4 == 1 header4=@@header4 - paranum=if header4[/.+?<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/]; $1 + paranum=if header4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) @@ -261,47 +261,48 @@ module SiSU_HTML_seg def markup(para) @debug=[] format_head_seg=SiSU_HTML_Format_type::Head_seg.new(@md) - if para !~/^0~/ - m=para[/.+?<~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/] + if para !~/^#{Rx[:meta]}/ + m=para[/.+?#{Mx[:id_o]}~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] if m paranum=m[1].to_s @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) end - if para =~/<:(?:code|alt|verse|group)>/m \ + if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/m \ or @@flag_alt==true - if para =~/<:(?:code|alt|verse|group)>/m + if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/m @group_collect=[] #unless @group_collect.class == Array - @group_collect << @vz.margin_txt_0 + para.gsub(/<:(?:code|alt|verse|group)-end>/m,'') #watch ! + @group_collect << @vz.margin_txt_0 + para.gsub(/#{Mx[:gr_o]}(?:code|alt|verse|group)-end#{Mx[:gr_c]}/m,'') #watch ! @@flag_alt=true elsif @@flag_alt==true - @group_collect << if para !~/<:(?:code|alt|verse|group)-end>/m # neither ideal nor necessary sort later + @group_collect << if para !~/#{Mx[:gr_o]}(?:code|alt|verse|group)-end#{Mx[:gr_c]}/m # neither ideal nor necessary sort later para else - para.gsub(/<:(?:code|alt|verse|group)-end>/m,'') + para.gsub(/#{Mx[:gr_o]}(?:code|alt|verse|group)-end#{Mx[:gr_c]}/m,'') end end - if para =~/<:(?:code|alt|verse|group)-end>/m + if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)-end#{Mx[:gr_c]}/m para=@group_collect.flatten.join @@flag_alt=false @group_collect=[] end end - if para !~/^[0-9]~/ - if para =~/(.*)<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>(.*)/ + if para !~/^#{Mx[:lv_o]}[1-9]:|#{Rx[:meta]}/ + if para =~/(.*)#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/ one,two=$1,$2 format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) para=format_seg.no_paranum end end - if para[/<~(\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+><#@dp:#@dp)>$/] - @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).lev_segname_para_ocn - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|_[1-9]?\*|<:i[1-9]>\s*_\*|null/ + if para[/#{Mx[:id_o]}~(\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp)#{Mx[:id_c]}$/] + @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).html_seg + format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ #watch para=case @sto.format # work area 2003w29 ||@|def lev_segname_para_ocn| - when /^4~\S+/; @sto.seg_lev_para_ocn.header4 # work on see Split_text_object - when /^5~(?:~\S+)?/; @sto.seg_lev_para_ocn.header5 - when /^6~(?:~\S+)?/; @sto.seg_lev_para_ocn.header6 - when /^_\*$/; @sto.seg_lev_para_ocn.bullet - when /^_([1-9])\*$/ #indent levels 1-9 with bullet + when /^4:/; @sto.seg_lev_para_ocn.header4 # work on see Split_text_object + when /^5:/; @sto.seg_lev_para_ocn.header5 + when /^6:/; @sto.seg_lev_para_ocn.header6 + when /^#{Mx[:gl_bullet]}/ + @sto.seg_lev_para_ocn.bullet + when /^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}#{Mx[:gl_bullet]}/ #indent levels 1-9 with bullet format_txt_obj.gsub_body para=@sto.seg_lev_para_ocn.format('li',"i#{$1}") when /^i([1-9])$/ #indent levels 1-9 @@ -313,18 +314,18 @@ module SiSU_HTML_seg @sto.seg_lev_para_ocn.code when /null/ if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ \ - and para !~/^<!TZ!>/ + and para !~/^#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ format_txt_obj.gsub_body @sto.seg_lev_para_ocn.para elsif para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ \ - and para =~/^<!TZ!>/ + and para =~/^#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ format_txt_obj.gsub_body @sto.seg_lev_para_ocn.table_end else para end else para end - elsif para =~/¡|<!T[hZ]?/u + elsif para =~/#{Mx[:tc_p]}|#{Mx[:gr_o]}T[hZ]?/u table=SiSU_HTML_shared::Table.new(para) para=table.table end @@ -332,10 +333,11 @@ module SiSU_HTML_seg para.gsub!(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{@md.sfx}#_\\1">}) #endnote- twice #removed file type end if para !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/ - if para[/(.*)<~0;(?:u|[0-6]:)\d+;\w\d+><#@dp:#@dp>(.*)/] #% watch u & m? + if para[/(.*)#{Mx[:id_o]}~0;(?:u|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/] #% watch u & m? one,two=$1,$2 format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) - para=format_seg.seg_no_paranum #% undefined +#FIX --> not that undefined, rather is not needed, should not be visited, and remove + #para=format_seg.seg_no_paranum #% undefined end para.gsub!(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with <!e_!> #?? workpoint if para =~/<a name="_\d+" href="#-\d+"> <sup>/ #endnote- note- @@ -343,8 +345,8 @@ module SiSU_HTML_seg para=format_seg.no_paranum end end - if para =~/^4~\S+|4~!/ - para.gsub!(/4~\S+|<:[-_\w\d]?(-.+?-)?>|4~!.+/,'') #sort seg headers + if @sto.format=~/4:\S+/ + para.gsub!(/^\s*4:\S+\s*|<:[-_\w\d]?(-.+?-)?>|4~!.+/m,'') #sort seg headers @@seg[:main] << para @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc else @@ -398,39 +400,39 @@ module SiSU_HTML_seg data.each do |para| para.gsub!(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1') if @md.flag_auto_endnotes - if para =~/^[1234]~/ \ + if para =~/^#{Mx[:lv_o]}[1234]:/ \ and not @@fn.empty? @@seg_endnotes[@@fn]=[] @@seg_endnotes[@@fn] << @@seg_endnotes_array - @@seg_endnotes_array=[] if para=~/^4~/ - @@fns_previous=@md.fns if para=~/^1~meta/ + @@seg_endnotes_array=[] if para=~/^#{Mx[:lv_o]}4:/ + @@fns_previous=@md.fns if para=~/^#{Mx[:lv_o]}1:meta#{Mx[:lv_c]}/ end - if para =~/^4~/ #% EXTRACTION OF SUB-TOCs + if para =~/^#{Mx[:lv_o]}4:/ #% EXTRACTION OF SUB-TOCs @@seg_subtoc[@@fn]=@@seg_subtoc_array @@seg_subtoc_array=[] end - if para =~/^4~/ #% SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs - if para !~/^4~metadata/ - m=para[/^4~(\S+).+?<~(\d+);(?:[oh]|4:)\d+;\w\d+><#@dp:#@dp>$/] + if para =~/^#{Mx[:lv_o]}4:/ #% SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs + if para !~/^#{Mx[:lv_o]}4:metadata#{Mx[:lv_c]}/ + m=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?#{Mx[:id_o]}~(\d+);(?:[oh]|4:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] end if m; @@fn,@@to_lev4=$1,$2 if m # changed 2004w07 #endnotes and sub-tocs else - if para !~/^4~metadata/ - m=para[/^4~(\S+)/] + if para !~/^#{Mx[:lv_o]}4:metadata#{Mx[:lv_c]}/ + m=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/] @@fn,@@to_lev4=$1,'nonum' if m # changed 2005w13 else @@fn='' end end end end - if para =~/^[56]~\S*\s+(.+)?<~(\d+);(?:h|[56]:)\d+;\w\d+><#@dp:#@dp>$/ + if para =~/^#{Mx[:lv_o]}[56]:\S*?#{Mx[:lv_c]}\s*(.+)?#{Mx[:id_o]}~(\d+);(?:h|[56]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ para.gsub!(/ <\/a>/,' ') case para # series changed 2002w42 - when /^5~\S*\s+(.+)?<~(\d+);(?:h|[56]:)\d+;\w\d+><#@dp:#@dp>$/ #remove [u]? req by pg texts, revist + when /^#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*(.+)?#{Mx[:id_o]}~(\d+);(?:h|[56]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #remove [u]? req by pg texts, revist one,two=$1,$2 format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) para=format_seg.subtoc_lev5 - when /^6~\S*\s+(.+)?<~(\d+);(?:h|[56]:)\d+;\w\d+><#@dp:#@dp>$/ + when /^#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*(.+)?#{Mx[:id_o]}~(\d+);(?:h|[56]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ one,two=$1,$2 format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) para=format_seg.subtoc_lev6 @@ -438,27 +440,27 @@ module SiSU_HTML_seg @@seg_subtoc_array << para end if @md.flag_auto_endnotes - if para =~/~[{\[][\d*+]+ <a name="_[\d*+]+"/ \ - and not para =~/^<:code>/ # endnote- + if para =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="_[\d*+]+"/ \ + and not para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ # endnote- endnote_array=[] - if para=~/~\{.+?\}\~/m - endnote_array << para.scan(/~\{.+?\}\~/m) + if para=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m + endnote_array << para.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m) end - if para=~/~\[[*]\d+\s.+?\]\~/m - endnote_array << para.scan(/~\[[*]\d+\s.+?\]\~/m) + if para=~/#{Mx[:en_b_o]}[*]\d+\s.+?#{Mx[:en_b_c]}/m + endnote_array << para.scan(/#{Mx[:en_b_o]}[*]\d+\s.+?#{Mx[:en_b_c]}/m) end - if para=~/~\[[+]\d+\s.+?\]\~/m - endnote_array << para.scan(/~\[[+]\d+\s.+?\]\~/m) + if para=~/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m + endnote_array << para.scan(/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m) end endnote_array.flatten!.compact! #check compacting endnote_array.each do |note| note_match=note.dup note_match_seg=note.dup - e_n=note_match_seg[/(?:~\{[\d*+]+|~\[[*+]\d+)\s+(.+?)[}\]]~/m,1] + e_n=note_match_seg[/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,1] try=e_n.split(/<br \/>/) try.each do |e| format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,e) - note_match=if e =~/<:i[1-9]>/ + note_match=if e =~/#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}/ format_seg.endnote_body_seg_tail_indent else format_seg.endnote_body_seg_tail end @@ -466,14 +468,14 @@ module SiSU_HTML_seg end try.join('<br \/>') #% creation of separate end segment/page of all endnotes referenced back to reference segment - m=/(?:~\{[\d*+]+|~\[[*+]\d+)\s+(.+?href=")(#-[\d*+]+".+)[}\]]~/mi + m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(#-[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi one=note_match_seg[m,1] #note~ [a name] two=note_match_seg[m,2] #note- format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408 @@seg[:endnote_all] << note_match_all_seg end - para.gsub!(/~[{\[].+?[}\]]~\s*/m,' ') + para.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') end end end diff --git a/lib/sisu/v0/html_table.rb b/lib/sisu/v0/html_table.rb index 556c46be..1aed4f5d 100644 --- a/lib/sisu/v0/html_table.rb +++ b/lib/sisu/v0/html_table.rb @@ -102,39 +102,39 @@ module SiSU_HTML_table m=@parablock[/<!f(.+?)!>/,1] @@tablefoot << m if m @parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if @parablock =~/<!Th¡/u - if @parablock =~/<!Th?¡.+?!~(\d+);\w\d+;\w\d+>/u; @parablock=table_head($1) + @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u + if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head($1) end - if @parablock =~/<!TZ!>/ + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - if @parablock =~/<!TZ!>/; @parablock=table_end + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock=table_end end end if @@tablehead == 1 - if @parablock =~/¡¡/u - if @parablock =~/<!¡¡(\d+?)¡/u - @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1,true)) + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u + if @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true)) end - if @parablock =~/¡¡(\d+?)¡/u - @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1,true)) + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true)) end - if @parablock =~/!>/ - @parablock.gsub!(/!>/,table_row_close(true)) + if @parablock =~/#{Mx[:tc_c]}/ + @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close(true)) end @@tablehead=0 end @parablock else - if @parablock =~/<!¡¡(\d+?)¡/u - @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1)) + if @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1)) end - if @parablock =~/¡¡(\d+?)¡/u - @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1)) + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1)) end - if @parablock =~/!>/ - @parablock.gsub!(/!>/,table_row_close) + if @parablock =~/#{Mx[:tc_c]}/ + @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close) end @parablock end diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 8cd8841e..11976af9 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -101,6 +101,8 @@ module SiSU_Tune @html=html end def clean + @html.gsub!(/#{Mx[:gl_o]}(#[0-9]+)#{Mx[:gl_c]}/u,'&\1;') + @html.gsub!(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;') @html.gsub!(/¢/u,'¢') # ¢ @html.gsub!(/£/u,'£') # £ @html.gsub!(/¥/u,'¥') # ¥ @@ -208,9 +210,7 @@ module SiSU_Tune tell.txt_grey unless @md.cmd =~/q/ data=Tune.new(@data,@md).endnotes_html data=Tune.new(data,@md).url_markup - if @sys.locale =~/utf-?8/i - data=Tune.new(data,@md).utf8_markup - end + data=Tune.new(data,@md).markup if @md.cmd =~/M/ #Hard Output Tune Optional on/off here data=Output.new(data,@md).hard_output Output.new(data,@md).marshal @@ -224,22 +224,30 @@ module SiSU_Tune data=@data @tuned_file=[] data.each do |para| - para.gsub!(/(\d~(\S+))/,'\1<a name="H#\2">#\2.</a> ') + para.gsub!(/#{Mx[:lv_o]}\d:(\S?)#{Mx[:lv_c]}/,'\0<a name="H#\1">#\1.</a> ') @tuned_file << para end end - def utf8_markup + def markup @tuned_file=[] @data.each do |para| #@utf8.new(para).html #@utf8.html(@para) - if @sys.locale =~/utf-?8/i # instead ucs for utf8 #require 'iconv' ? Iñtërnâtiônàlizætiøn - #¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûü - #¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷ - ##para.gsub!(//, '&#;') - ##para.gsub!(//, '&;') - para=SiSU_Tune::Clean_html.new(para).clean - end + para.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;') + para.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') + para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') + para.gsub!(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'<p><hr width=90% /></p>') # else clean '' + para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') + para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') + para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') + para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>') + para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>') + para.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>') + para.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>') + para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') + para.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>') + para.gsub!(/<(p|br)>/,'<\1 />') + para=SiSU_Tune::Clean_html.new(para).clean @tuned_file << para end end @@ -287,12 +295,10 @@ module SiSU_Tune data=@data @tuned_file=[] data.each do |para| - para.gsub!(/<:name\#(\S+?)>/,'<a name="\1"></a>') + #para.gsub!(/#{Mx[:mk_o]}name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>') para.gsub!(/<-#>/,'') - para.gsub!(/<:p[bn]>/,'') - para.gsub!(/<(p|br)>/,'<\1 />') - para.gsub!(/<:br>/,'<br />') - unless para =~/^<:code>/ + #para.gsub!(/<(p|br)>/,'<\1 />') + unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ if para =~/<::\s+/ #watch para.gsub!(/<::\s+(\S+?)\s+!>/, %{<img src="#{@env.url.images}/c_\\1.png" alt="\\1" width="14" height="14" align="bottom" border="0">}) @@ -308,11 +314,11 @@ module SiSU_Tune %{<img src="#{@env.url.images_local}/\\1" naturalsizeflag="0" align="bottom" border="0">}) end if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/ - @word_mode=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|\S+/) + @word_mode=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|\S+/u) words=urls(@word_mode) para.gsub!(/.+/m,words) end - if (para !~/^0~|^<:code>/) + if (para !~/^#{Mx[:meta_o]}|^#{Mx[:gr_o]}code#{Mx[:gr_c]}/) para.gsub!(/\\copyright/i,%{<sup>©</sup>}) if (para !~/\<:ad\s+\.\.\//) para.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/, @@ -327,11 +333,11 @@ module SiSU_Tune para.gsub!(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> ') if para =~/\b\S+\@\S+?\.\S+/ \ and para !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/ - para.gsub!(/\b(\S+\@\S+?\.\S+)(\s)/,'<<a href="mailto:\1">\1</a>>\2') + para.gsub!(/([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,'<<a href="mailto:\1">\1</a>>') end para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url - para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration + para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration if para =~/..\/\S+/ \ and para !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ para.gsub!(/(\.\.\/\S+)/,'<a href="\1">\1</a>') @@ -349,14 +355,14 @@ module SiSU_Tune data=@data @tuned_file=[] data.each do |para| - unless para =~/^<:code>/ - para.gsub!(/(~[{])(\d+) (.+?) <#@dp>([}]~)/, + unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ + para.gsub!(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?) #{Mx[:id_o]}#@dp#{Mx[:id_c]}(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/, ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- '\1\2 <a name="_\2" href="#-\2"> <sup>\2.</sup></a> \3 \4') #endnote- note- (careful may have switched) - para.gsub!(/(~\[)([*+]\d+) (.+?) <#@dp>(\]~)/, + para.gsub!(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?) #{Mx[:id_o]}#@dp#{Mx[:id_c]}(#{Mx[:en_b_c]})/, ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- '\1\2 <a name="_\2" href="#-\2"> <sup>\2.</sup></a> \3 \4') #endnote- note- (careful may have switched) - para.gsub!(/(~\{)([*+]+) (.+?) <#@dp>(\}~)/, + para.gsub!(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?) #{Mx[:id_o]}#@dp#{Mx[:id_c]}(#{Mx[:en_a_c]})/, ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- '\1\2 <a name="_\2" href="#-\2"> <sup>\2</sup></a> \3 \4') #endnote- note- (careful may have switched) end diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb index af93c736..b3815828 100644 --- a/lib/sisu/v0/hub.rb +++ b/lib/sisu/v0/hub.rb @@ -419,8 +419,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end if @opt.cmd =~/[hHz]/; op('html','html') #% -h -H -z html css end - if @opt.cmd =~/A/; op('air','air') #% #-A - end + #if @opt.cmd =~/A/; op('air','air') #% #-A + #end if @opt.cmd =~/a/; op('plaintext','plaintext') #% -a #-A -f -e -E plaintext -a creates ms-dos type; -A creates unix type, plaintext file end if @opt.cmd =~/g/; op('wikispeak','wikispeak') #% -g wiki diff --git a/lib/sisu/v0/manifest.rb b/lib/sisu/v0/manifest.rb index 4861097e..6bdfdae4 100644 --- a/lib/sisu/v0/manifest.rb +++ b/lib/sisu/v0/manifest.rb @@ -182,14 +182,64 @@ module SiSU_Manifest id,file='HTML, full length document',@md.fn[:doc] summarize(id,file,img) end - if FileTest.file?("#@base_path/#{@md.fn[:pdf_p]}")==true + #if FileTest.file?("#@base_path/#{@md.fn[:pdf_p]}")==true + # img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> ' + # id,file="full length document (PDF portrait / vertical - recommended for printing), size #{@md.papersize_array[0]}",@md.fn[:pdf_p] + # summarize(id,file,img) + #end + #if FileTest.file?("#@base_path/#{@md.fn[:pdf_l]}")==true + # img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> ' + # id,file="full length document (PDF landscape / horizontal - recommended for screen viewing), size #{@md.papersize_array[0]}",@md.fn[:pdf_l] + # summarize(id,file,img) + #end + if FileTest.file?("#@base_path/#{@md.fn[:pdf_p_letter]}")==true img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> ' - id,file='PDF document portrait/vertical (recommended for printing)',@md.fn[:pdf_p] + id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_letter] summarize(id,file,img) end - if FileTest.file?("#@base_path/#{@md.fn[:pdf_l]}")==true + if FileTest.file?("#@base_path/#{@md.fn[:pdf_l_letter]}")==true img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> ' - id,file='PDF document landscape/horizontal (recommended for screen viewing)',@md.fn[:pdf_l] + id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_letter] + summarize(id,file,img) + end + if FileTest.file?("#@base_path/#{@md.fn[:pdf_p_a4]}")==true + img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> ' + id,file="PDF, A4 size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_a4] + summarize(id,file,img) + end + if FileTest.file?("#@base_path/#{@md.fn[:pdf_l_a4]}")==true + img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> ' + id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_a4] + summarize(id,file,img) + end + if FileTest.file?("#@base_path/#{@md.fn[:pdf_p_a5]}")==true + img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> ' + id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_a5] + summarize(id,file,img) + end + if FileTest.file?("#@base_path/#{@md.fn[:pdf_l_a5]}")==true + img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> ' + id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_a5] + summarize(id,file,img) + end + if FileTest.file?("#@base_path/#{@md.fn[:pdf_p_b5]}")==true + img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> ' + id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_b5] + summarize(id,file,img) + end + if FileTest.file?("#@base_path/#{@md.fn[:pdf_l_b5]}")==true + img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> ' + id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_b5] + summarize(id,file,img) + end + if FileTest.file?("#@base_path/#{@md.fn[:pdf_p_legal]}")==true + img='<img border="0" height="18" width="15" src="../_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> ' + id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)",@md.fn[:pdf_p_legal] + summarize(id,file,img) + end + if FileTest.file?("#@base_path/#{@md.fn[:pdf_l_legal]}")==true + img='<img border="0" height="15" width="18" src="../_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> ' + id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)",@md.fn[:pdf_l_legal] summarize(id,file,img) end if FileTest.file?("#@base_path/#{@md.fn[:odf]}")==true diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb index e267de48..06878094 100644 --- a/lib/sisu/v0/manpage.rb +++ b/lib/sisu/v0/manpage.rb @@ -68,6 +68,7 @@ module SiSU_manpage require "#{SiSU_lib}/manpage_format" include Format require "#{SiSU_lib}/shared_txt" + require "#{SiSU_lib}/shared_structure" pwd=Dir.pwd @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' @@ -100,54 +101,6 @@ module SiSU_manpage end end private - class Split_text_object <Source - require "#{SiSU_lib}/manpage_format" - include SiSU_Viz - include Format - @@alt_id_count=0 - @@dp=nil - attr_reader :format,:lev,:text,:ocn,:lev_para_ocn - def initialize(para) - @para=para - @format,@ocn='null','null' - @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - end - def lev_segname_para_ocn - @text=nil - if @para =~/^(\d~|<:.+?>).+?<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - if /^(([1-6])~(\S+))\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@lev,segname,@text,@ocn=$1,$2,$3,$4,$5 - elsif /^(([1-6])~)\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@lev,@text,@ocn=$1,$2,$3,$4 - elsif /<:(.+?)>\s*(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@text,@ocn=$1,$2,$3 - elsif /^(([1-6])~(\S+))\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;[um]\d+><#@dp:#@dp>$/m.match(@para) - @@alt_id_count+=1 - @format,@lev,segname,@text,@ocn=$1,$2,$3,$4,"x#{@@alt_id_count}" - elsif /^(([1-6])~)\s+(\S.+?)<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @@alt_id_count+=1 - @format,@lev,@text,@ocn=$1,$2,$3,"x#{@@alt_id_count}" - end - else - if /(.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @text,@ocn=$1,$2 - end - if @para !~/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$|^$/ #added 2002w06 - @text=/(.+?)/m.match(@para)[1] - end - if /^((\d)~(?:~\S+)?)\s+(.+)/m.match(@para) - @format,@lev,@text=$1,$2,$3 - end - end - format=@format.dup - @lev_para_ocn=if @para =~/.+<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - Format::Format_text_object.new(format,@text,@ocn) - else - Format::Format_text_object.new(format,@text,"<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>") - end - self - end - end class Scroll <Source require "#{SiSU_lib}/defaults" require "#{SiSU_lib}/shared_txt" @@ -159,7 +112,7 @@ module SiSU_manpage @url_brace=SiSU_Viz::Skin.new.url_decoration @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - @regx=/^(?:(?:<:p[bn]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m # 2004w18 pb pn removal added + @regx=/^(?:(?:#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]})?\s*(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m # 2004w18 pb pn removal added @tab="\t" @br="\n" @@dostype='unix endnotes' @@ -171,12 +124,12 @@ module SiSU_manpage end # Used for extraction of endnotes from paragraphs def extract_endnotes(para='') - notes=para.scan(/~[{\[]([\d*+]+\s+.+?)\s*<#@dp>[}\]]~/) + notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m) @n=[] notes.each do |n| #high cost to deal with <br> appropriately within manpage, consider n=n.dup.to_s - if n =~/<br(?: \/)?>/ - fix = n.split(/<br(?: \/)?>/) #watch #added + if n =~/#{Mx[:br_line]}/ + fix = n.split(/\s*#{Mx[:br_line]}+\s*/) #watch #added fix.each do |x| unless x.empty?; @n << x end @@ -201,7 +154,7 @@ module SiSU_manpage GSUB ) else - wrap.gsub!(/^(.+)\Z/m, <<GSUB + wrap.gsub!(/^\s*(.+)\Z/m, <<GSUB \\1 GSUB ) @@ -267,9 +220,9 @@ WOK lv=nil if lv == 0 wrapped=if para[@regx] paragraph=para[@regx,2] - if paragraph =~/<:i([1-9])>/ + if paragraph =~/#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/ m=$1.to_i - paragraph.gsub!(/<:i#{m}>/,'') + paragraph.gsub!(/#{Mx[:pa_o]}:i#{m}#{Mx[:pa_c]}/,'') util=SiSU_text_utils::Wrap.new(paragraph,78,m*2) else util=SiSU_text_utils::Wrap.new(paragraph,78,0) end @@ -277,6 +230,7 @@ WOK w.gsub!(/^(\\\.)/,' \1') w end + #wrapped.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/m,"\n\n") if wrapped if lv times=wrapped.length times=78 if times > 78 @@ -312,106 +266,107 @@ WOK table_message='[table omitted, see other document formats]' fix=[] data.each do |para| - para.gsub!(/<!Th?¡.+/um,"#@br#{table_message}") + para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#@br#{table_message}") para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check - para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down - para.gsub!(/<sup>(.+?)<\/sup>/,'^\1^') - para.gsub!(/<sub>(.+?)<\/sub>/,'[\1]') - para.gsub!(/<i>(.+?)<\/i>/,'<:br>.I \1<:br>') - para.gsub!(/\A<b>(.+?)<\/b><br \/>/m,'<:br>.BI \1<:br>') - para.gsub!(/<b>(.+?)<\/b>/,'<:br>.B \1<:br>') - para.gsub!(/<u>(.+?)<\/u>/,'<:br>.I \1<:br>') - unless para =~/<:code>/ + para.gsub!(/#{Mx[:gl_bullet]}\s*/,'* ') # bullet markup, marked down + para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^') + para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]') + para.gsub!(/\A\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}#{Mx[:br_line]}/m,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}") + para.gsub!(/\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}") + para.gsub!(/\A\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}#{Mx[:br_line]}/m,"#{Mx[:br_line]}.BI \\1#{Mx[:br_line]}") + para.gsub!(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,"#{Mx[:br_line]}.B \\1#{Mx[:br_line]}") + para.gsub!(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}") + unless para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/ para.gsub!(/(?:^|\s)\{(.+?)\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1 #{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3") - para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3") + para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3") @manpage[:endnotes]=extract_endnotes(para) - para.gsub!(/~[{\[]([\d*+]+)\s+(?:.+?)[}\]]~/,'[^\1]') # endnote marker marked up - para.gsub!(/&/,'&') - para.gsub!(/!/,'!') - para.gsub!(/#/,'#') - para.gsub!(/*/,'*') - para.gsub!(/-/,'-') - para.gsub!(///,'/') - para.gsub!(/_/,'_') - para.gsub!(/{/,'{') - para.gsub!(/}/,'}') - para.gsub!(/~/,'~') - para.gsub!(/©/,'©') + para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_a_c]}/m,'[^\1]') # endnote marker marked up + para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_b_c]}/m,'[^\1]') # endnote marker marked up + #para.gsub!(/~[{\[]([\d*+]+)\s+(?:.+?)[}\]]~/,'[^\1]') # endnote marker marked up + para.gsub!(/#{Mx[:gl_o]}#amp#{Mx[:gl_c]}/,'&') ##{Mx[:gl_o]}#095#{Mx[:gl_c]} + para.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') + para.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') + para.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') + para.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') + para.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') + para.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') + para.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{') + para.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}') + para.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~') + para.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©') end para.gsub!(/(^| |\s|\*)\\\*/,'\1\\\\\*') #man page requires para.gsub!(/\s\.(\S+)/,' \\.\1') para.gsub!(/(\n\.)(\S\S\S+)/m,'\1\\.\2') para.gsub!(/-/,'\-') #manpages use this para.gsub!(/~/,'~') if para #manpages use this - if para =~/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/ - if para =~/<:code>/ #code-block: angle brackets special characters + if para =~/#{Mx[:gr_o]}(?:group|verse|alt|code)(?:-end)?#{Mx[:gr_c]}(?:\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_c]}#@dp:#@dp#{Mx[:id_c]})?/ + if para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/ #code-block: angle brackets special characters para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _< para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_< #para.gsub!(/(?![}])_([<>])/m,'\1') # _> _< }_< end - para.gsub!(/<br(?: \/)?>/,"\n\n.P\n\n") # watch - para.gsub!(/<:(?:group|verse|alt)(?:\\-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,'') - para.gsub!(/<:code>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,"\n\n.nf\n\n") - para.gsub!(/<:code\\-end>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,"\n\n.fi\n\n") + para.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/,"\n\n.BR\n\n") # watch + para.gsub!(/#{Mx[:gr_o]}(?:group|verse|alt)(?:\\-end)?#{Mx[:gr_c]}(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,'') + para.gsub!(/#{Mx[:gr_o]}code#{Mx[:gr_c]}(?:\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,"\n\n.nf\n\n") + para.gsub!(/#{Mx[:gr_o]}code\\-end#{Mx[:gr_c]}(?:\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,"\n\n.fi\n\n") else - para.gsub!(/<br(?: \/)?>/,"\n\n") #watch introduces a bug + para.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n") #unless para =~/#{Mx[:lv_o]}\d:/ #watch introduces a bug end blit=para.scan(/\[[^\]]+\]|[^\[]+/) blit_array=[] blit.each do |x| if x =~/^\[/ x.gsub!(/\s+/,' \ ') #manpages use this - elsif x =~/\.(?:TP|BI)\s/ - x.gsub!(/\s+/,' \ ') #manpages use this else x end blit_array << x end - para = blit_array.join - para.gsub!(/\s\\\s+(<:br>|<br(?: \/)?>)/,'\1') #a messy solution - para.gsub!(/\s(\[)/,' \ \1') #manpages use this - para.gsub!(/<:p[bn]>/,'') # remove page breaks - para.gsub!(/^\s*<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,'') # remove empty lines - check - para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') + para=blit_array.join + para.gsub!(/#{Mx[:gl_o]}:name#\S+?#{Mx[:gl_c]}/mi,'') #added + para.gsub!(/\s\\\s+(#{Mx[:br_line]}|#{Mx[:br_nl]})/,'\1') #a messy solution + para.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks + para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') # remove empty lines - check + para.gsub!(/(^|#{Mx[:gl_c]}|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1') - para.gsub!(/<:name#\S+?>/,'') # remove name links + para.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links para.gsub!(/ /,' ') # decide on para.gsub!(/(["''])/,"\\\\\\1") # quotation marks need escape para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") para.gsub!(/^(?:^|[^_\\])\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') wordlist=para.scan(/\S+/) - if para =~/^0~(\S+)\s+(.+?)\Z/m # for headers + if para =~/^#{Rx[:meta]}\s*(.+?)\Z/m # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta if d_meta; manpage_metadata(d_meta) end end - if para !~/(^0~|<ENDNOTES>|<EOF>)/ + if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change paranum=para[@regx,3] @p_num=Format::Paragraph_number.new(paranum) end - @sto=Split_text_object.new(para).lev_segname_para_ocn + @sto=SiSU_Structure::Split_text_object.new(@md,para).txt ### problem in scroll, it appears tables are getting paragraph numbers - m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m \ and para=~/\S+/ para=case @sto.format - when /^(1)~(?:(\S+))?/ + when /^(1):(\S*)/ manpage_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body1 - when /^(2)~(?:(\S+))?/ + when /^(2):(\S*)/ manpage_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body2 - when /^(3)~(?:(\S+))?/ + when /^(3):(\S*)/ manpage_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body3 - when /^(4)~(\S+)/ # work on see SiSU_text_parts::Split_text_object + when /^(4):(\S+)/ # work on see SiSU_text_parts::Split_text_object manpage_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body4 - when /^(5)~(?:(\S+))?/ + when /^(5):(\S*)/ manpage_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body5 - when /^(6)~(?:(\S+))?/ + when /^(6):(\S*)/ manpage_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body6 #when /^(i1)$/ @@ -440,17 +395,17 @@ WOK elsif para =~/#{table_message}/ @manpage[:body] << para << @br elsif para =~/(Note|Endnotes?)/ \ - and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ elsif para =~/(MetaData)/ \ - and para =~/<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info ####suspect visit + and para =~/#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info ####suspect visit #formatMono=MonoSiSU.new('<br /><a name="metadata">MetaData</a>') #para=formatMono.bold_para elsif para.include? 'Owner Details' \ - and para !~/<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #formatMono=MonoSiSU.new('<br /><a name="owner.details">Owner Details</a>') #@@manpage[:owner_details]=formatMono.bold_para #para='' - elsif para =~/(¡|<!Th?)/u #tables ! + elsif para =~/(#{Mx[:tc_p]}|#{Mx[:gr_o]}Th?)/u #tables ! elsif para =~/(.*)<!#!>(.*)/ one,two=$1,$2 format_text=Format_text_object.new(one,two) @@ -461,7 +416,7 @@ WOK para='' end case para - when /<:i[1-9]>/ + when /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/ if para =~/.*<:#>.*$/m format_text=Format_text_object.new(para,'') para=format_text.scr_indent_one_no_paranum @@ -475,10 +430,14 @@ WOK format_text=Format_text_object.new(one,two) para=format_text.center end - para.gsub!(/~/,'~') if para #manpages use this - para.gsub!(/{/,'{') if para #manpages use this + para.gsub!(/\s(\[)/m,' \ \1') if para #manpages use this + para.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})/,"\n\n") if para + para.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~') if para #manpages use this + para.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{') if para #manpages use this + para.gsub!(/#{Mx[:pa_o]}\S+#{Mx[:pa_c]}/,' ') if para ## Clean Prepared Text para.gsub!(/<!.+!>/,' ') if para ## Clean Prepared Text para.gsub!(/<:\S+>/,' ') if para ## Clean Prepared Text + para end end @manpage diff --git a/lib/sisu/v0/manpage_format.rb b/lib/sisu/v0/manpage_format.rb index 978cc6b4..02fbf216 100644 --- a/lib/sisu/v0/manpage_format.rb +++ b/lib/sisu/v0/manpage_format.rb @@ -81,10 +81,10 @@ module Format def initialize(one,two,three) one.gsub!(/\.(html|pdf|php)/,'') if one =~/\.\.\/\S+/ @one,@two,@three=one,two,three - rgx=/^[1-6-]~/ + rgx=/^#{Mx[:lv_o]}[1-6-]:/ @one.gsub!(rgx,'') if @one =~rgx @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - rgx=/~\{[\d*+]+\s+(.+?)<#@dp>\}~/ + rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/ @one.gsub!(rgx,'\1') if @one =~rgx @link,@linkname=one,two @vz=SiSU_Env::Get_init.instance.skin diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 1883bdba..09c67ff6 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -68,6 +68,7 @@ module SiSU_ODF require "#{SiSU_lib}/odf_format" include SiSU_ODF_format require "#{SiSU_lib}/shared_txt" + require "#{SiSU_lib}/shared_structure" @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 class Source require 'zlib' @@ -100,55 +101,6 @@ module SiSU_ODF end end private - class Split_text_object <Source - require "#{SiSU_lib}/odf_format" - include SiSU_Viz - include SiSU_ODF_format - @@dp=nil - @@alt_id_count=0 - attr_reader :format,:lev,:text,:ocn,:lev_para_ocn - def initialize(para) - @para=para - @format,@ocn='null','null' - #@format,@ocn=nil,nil - @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - end - def lev_segname_para_ocn - @text=nil - if @para =~/^(\d~|<:.+?>).+?<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - if /^(([1-6])~(\S+))\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@lev,segname,@text,@ocn=$1,$2,$3,$4,$5 - elsif /^(([1-6])~)\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@lev,@text,@ocn=$1,$2,$3,$4 - elsif /<:(.+?)>\s*(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@text,@ocn=$1,$2,$3 - elsif /^(([1-6])~(\S+))\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;[um]\d+><#@dp:#@dp>$/m.match(@para) - @@alt_id_count+=1 - @format,@lev,segname,@text,@ocn=$1,$2,$3,$4,"x#{@@alt_id_count}" - elsif /^(([1-6])~)\s+(\S.+?)<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @@alt_id_count+=1 - @format,@lev,@text,@ocn=$1,$2,$3,"x#{@@alt_id_count}" - end - else - if /(.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @text,@ocn=$1,$2 - end - if @para !~/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$|^$/ - @text=/(.+?)/im.match(@para)[1] - end - if /^((\d)~(?:~\S+)?)\s+(.+)/m.match(@para) - @format,@lev,@text=$1,$2,$3 - end - end - format=@format.dup - @lev_para_ocn=if @para =~/.+<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - SiSU_ODF_format::Format_text_object.new(format,@text,@ocn) - else - SiSU_ODF_format::Format_text_object.new(format,@text,"<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>") - end - self - end - end class Scroll <Source require "#{SiSU_lib}/defaults" require "#{SiSU_lib}/shared_txt" @@ -160,8 +112,8 @@ module SiSU_ODF @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - @regx=/^(?:(?:<:p[bn]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - @serial=/\s*<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>\s*/ + @regx=/^(?:(?:#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]})?\s*(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + @serial=/\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}\s*/ @tab="\t" @url_brace=SiSU_Viz::Skin.new.url_decoration @br=if @md.cmd =~/M/; "\n" @@ -176,12 +128,12 @@ module SiSU_ODF end # Used for extraction of endnotes from paragraphs def extract_endnotes(para='') - notes=para.scan(/~\{(\d+\s+.+?)\s*<#@dp>\}~/) + notes=para.scan(/#{Mx[:en_a_o]}(\d+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/) @n=[] notes.each do |n| #high cost to deal with <br> appropriately within odf, consider n=n.dup.to_s - if n =~/<:?br(?: \/)?>/ - fix=n.split(/<:?br(?: \/)?>/) #watch #added + if n =~/#{Mx[:br_line]}/ + fix=n.split(/#{Mx[:br_line]}/) #watch #added fix.each do |x| if x =~/\S+/; @n << x end @@ -210,8 +162,8 @@ module SiSU_ODF end def heading(para,no) para.gsub!(@serial,'') - para.gsub!(/<:name#\S+?>/,'') - para.gsub!(/^([1-6])~\S*\s/,'') + para.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'') + para.gsub!(/^#{Mx[:lv_o]}(\d):\S*?#{Mx[:lv_c]}\s*/,'') m=/#{$1}/ breakpage='' if @md.fns \ @@ -307,19 +259,19 @@ module SiSU_ODF def normal(para) #P1 - P3 para.gsub!(@serial,'') para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, - %{<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>\\2}) #http ftp matches escaped, no decoration + '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>\2') #http ftp matches escaped, no decoration para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>\3') #special case \{ e.g. \}http://url - para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, + para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, %{\\1#{@url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\2">\\2</text:a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration #para.gsub!(/\b((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, also works #%{#{@url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@url_brace.xml_close}\\2}) #http ftp matches with decoration para.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, %{#{@url_brace.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@url_brace.xml_close}}) para=case para - when /^<:i([1-9])>\s/m + when /^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/m m=$1 - para.gsub!(/^<:i#{m}>\s/m,'') + para.gsub!(/^#{Mx[:pa_o]}:i#{m}#{Mx[:pa_c]}/m,'') %{<text:p text:style-name="P1#{m}">#{para}</text:p>} else %{<text:p text:style-name="P1">#{para}</text:p>} end @@ -331,24 +283,24 @@ module SiSU_ODF end def footnote(para) @astx||=10000 - para.gsub!(/<#@dp>([}\]]~)/,'\1') + para.gsub!(/#{Mx[:id_o]}#@dp#{Mx[:id_c]}(#{Mx[:en_a_c]}|#{Mx[:en_a_c]})/,'\1') #para.gsub!(/<br \/><:i[1-9]>/,'<br />') - if para =~/~\{\d+\s+/ - para=para.gsub(/~\{(\d+)\s+(.+?)\}~/,'<text:note text:id="ftn\1" text:note-class="footnote"><text:note-citation>\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>') + if para =~/#{Mx[:en_a_o]}\d+\s+/ + para=para.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,'<text:note text:id="ftn\1" text:note-class="footnote"><text:note-citation>\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>') end - if para=~/~\[[*+]\d+\s/ #editor notes, squre bracket series - asterisk=para.scan(/~\[([*+]\d+)\s+(.+?)\]~/) + if para=~/#{Mx[:en_b_o]}[*+]\d+\s/ #editor notes, squre bracket series + asterisk=para.scan(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/) asterisk.each do |x| a=x[0].gsub(/([*+])/,"\\\\\\1") - para=para.gsub(/~\[(#{a})\s+(.+?)\]~/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>}) + para=para.gsub(/#{Mx[:en_b_o]}(#{a})\s+(.+?)#{Mx[:en_b_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>}) @astx+=1 end end - if para=~/~\{[*+]+\s/ - asterisk=para.scan(/~\{([*+]+)\s+(.+?)\}~/) + if para=~/#{Mx[:en_a_o]}[*+]+\s/ + asterisk=para.scan(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/) asterisk.each do |x| a=x[0].gsub(/([*+])/,"\\\\\\1") - para=para.gsub(/~\{(#{a})\s+(.+?)\}~/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>}) + para=para.gsub(/#{Mx[:en_a_o]}(#{a})\s+(.+?)#{Mx[:en_a_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>}) @astx+=1 end end @@ -358,15 +310,16 @@ module SiSU_ODF para.gsub!(/&nbsp;| /,' ') para.gsub!(/</,'<'); para.gsub!(/>/,'>') para.gsub!(/<(text:span text:style-name="T[1-5]"|\/text:span)>/,'<\1>') #works, not ideal + para.gsub!(/#{Mx[:br_line]}/,'<br />') para.gsub!(/<br(?:\s+\/)?>/,'<br />') #para.gsub!(/\s\s/,'  ') para end def poem(para) #P4 #same as group para.gsub!(@serial,'') - para.gsub!(/<:verse(?:-end)?>\s*/m,'') + para.gsub!(/#{Mx[:gr_o]}verse(?:-end)?#{Mx[:gr_c]}\s*/m,'') parray=[] - para.split(/<:?br(?: \/)?>/).each do |parablock| + para.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock| parablock=group_clean(parablock) parray << %{<text:p text:style-name="P4">#{parablock}</text:p>} if parablock =~/\S+/ end @@ -374,9 +327,9 @@ module SiSU_ODF end def group(para) #P4 #same as verse para.gsub!(@serial,'') - para.gsub!(/<:group(?:-end)?>\s*/m,'') + para.gsub!(/#{Mx[:gr_o]}group(?:-end)?#{Mx[:gr_c]}\s*/m,'') parray=[] - para.split(/<:?br(?: \/)?>/).each do |parablock| + para.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock| parablock=group_clean(parablock) parablock.gsub!(/<text:a xlink:type="simple" xlink:href="(.+?)">/m,'<text:a xlink:type="simple" xlink:href="\1">') parablock.gsub!(/<(\/text:a)>/,'<\1>') @@ -390,21 +343,21 @@ module SiSU_ODF end def code(para) #P5 para.gsub!(@serial,'') - para.gsub!(/<:code(?:-end)?>\s*/m,'') + para.gsub!(/#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}\s*/m,'') para.gsub!(/\s\s/,'  ') parray=[] - para.split(/<:?br(?: \/)?>/).each do |parablock| + para.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock| parablock=group_clean(parablock) parablock.gsub!(/^\s*$/,'<br />') parablock.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, - %{<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>\\2}) #http ftp matches escaped, no decoration + '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>\2') #http ftp matches escaped, no decoration parray << %{<text:p text:style-name="P5">#{parablock}</text:p>} if parablock =~/\S+/ end para=parray.join + '<text:p text:style-name="Standard"/>' para end def table(para) # - if para =~/<!Th?.+/ # tables come as single block + if para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block table=SiSU_ODF_format::Table.new(@md,para) para=table.table_split end @@ -414,7 +367,7 @@ module SiSU_ODF n=lv - 1 n3=lv + 2 lv=nil if lv == 0 - para=unless para=~/^<:code>/ + para=unless para=~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ para=if para =~/\{\s*\S+?\.(?:png|jpg|gif)\s.+?\}(?:(?:https?|file|ftp):\S+|image)/; image(para) elsif para =~/\{.+?\}(?:(?:https?|file|ftp):\S+|image)/; text_link(para) else para @@ -431,16 +384,16 @@ module SiSU_ODF when 5; heading(para,'5') << @br*2 when 6; heading(para,'6') << @br*2 end - elsif para =~ /<:verse(?:-end)?>/ + elsif para =~ /#{Mx[:gr_o]}verse(?:-end)?#{Mx[:gr_c]}/ @@odf[:body] << poem(para) @@odf[:body] << @br*2 - elsif para =~ /<:group(?:-end)?>/ + elsif para =~ /#{Mx[:gr_o]}group(?:-end)?#{Mx[:gr_c]}/ @@odf[:body] << group(para) @@odf[:body] << @br*2 - elsif para =~ /<:code(?:-end)?>/ + elsif para =~ /#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}/ @@odf[:body] << code(para) @@odf[:body] << @br*2 - elsif para =~ /<!Th?/ #elsif para =~ /<!Th?¡/u + elsif para =~ /#{Mx[:gr_o]}Th?/ #elsif para =~ /<!Th?¡/u @@odf[:body] << table(para) @@odf[:body] << @br*2 else @@ -457,7 +410,7 @@ module SiSU_ODF wordlist end def markup(data) # Used for major markup instructions - safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`¡]/u + safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`#{Mx[:tc_p]}]/u dir=SiSU_Env::Info_env.new(@md.fns) @data_mod,@endnotes,@level,@cont,@copen,@odf_contents_close=Array.new(6){[]} @rcdc=false @@ -474,10 +427,10 @@ module SiSU_ODF word=para.scan(/\S+|\n/) if word word.each do |w| # _ - / # | : ! ^ ~ - unless w =~/<~\S+?;\S+?;\S+?><#@dp:#@dp>|<[:!][^<>]+?>|^<\/?(?:del|ins|sub|sup|cite)>$/ + unless w =~/#{Mx[:id_o]}~\S+?;\S+?;\S+?#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|#{Mx[:gr_o]}.+?#{Mx[:gr_c]}|<[:!][^<>]+?>/ w.gsub!(/^<([^<>][^<>][^<>][^<>]+?)>$/,'<\1>') #refix end - unless para =~/^(?:0~|%+ )/m + unless para =~/^(?:#{Rx[:meta]}|%+ )/m w.gsub!(/&#(?:126|152);/,'~') #126 usual if w !~/&\S{1,7};/ \ or w =~/ / @@ -489,24 +442,32 @@ module SiSU_ODF para=para_array.join(' ') para=para.strip end - if para =~/<:code>/ #code-block: angle brackets special characters + if para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/ #code-block: angle brackets special characters para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>') para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>') end - para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xlink:href="Pictures/bullet_09.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> ') # bullet_09.png + para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') + para.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>') + para.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>') + para.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'') + para.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;') + para.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') + para.gsub!(/#{Mx[:mk_o]}[~-]##{Mx[:mk_c]}/,'') + para.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}\s*)?#{Mx[:gl_bullet]}/,'\1<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xlink:href="Pictures/bullet_09.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> ') # bullet_09.png #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1<text:span text:style-name="T6">●</text:span> ') #bullet #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1● ') # bullet utf8, make smaller if used #para.gsub!(/^_\*\s+/,'<text:span text:style-name="T6">●</text:span> ') #bullet - para.gsub!(/^(<:i[1-9]>)\s+_\*\s+/,'\1 <text:span text:style-name="T6">·</text:span> ') #bullet - para.gsub!(/<:?br>/,'<br />') - para.gsub!(/<:p[bn]>/,'<text:p text:style-name="P8"> </text:p>') + para.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})\s*#{Mx[:gl_bullet]}/,'\1 <text:span text:style-name="T6">·</text:span> ') #bullet + para.gsub!(/^#{Mx[:gl_bullet]}/,'<text:span text:style-name="T6">·</text:span> ') #bullet + para.gsub!(/#{Mx[:br_line]}/,'<br />') + para.gsub!(/#{Mx[:br_page]}|#{Mx[:br_page_new]}/,'<text:p text:style-name="P8"> </text:p>') para.gsub!(/©/,'©') #too arbitrary para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check - para.gsub!(/<b>(.+?)<\/b>/,'<text:span text:style-name="T1">\1</text:span>') - para.gsub!(/<i>(.+?)<\/i>/,'<text:span text:style-name="T2">\1</text:span>') - para.gsub!(/<u>(.+?)<\/u>/,'<text:span text:style-name="T3">\1</text:span>') - para.gsub!(/<sup>(.+?)<\/sup>/,'<text:span text:style-name="T4">\1</text:span>') - para.gsub!(/<sub>(.+?)<\/sub>/,'<text:span text:style-name="T5">\1</text:span>') + para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<text:span text:style-name="T1">\1</text:span>') + para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<text:span text:style-name="T2">\1</text:span>') + para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<text:span text:style-name="T3">\1</text:span>') + para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<text:span text:style-name="T4">\1</text:span>') + para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<text:span text:style-name="T5">\1</text:span>') para.gsub!(/`/,"'") para.gsub!(//u,'-') para.gsub!(/·/u,'*') @@ -520,10 +481,10 @@ module SiSU_ODF para.gsub!(/\44/,'$') #$ watch #para.gsub!(/^·/,'_*') #$ watch #para.gsub!(/·/,'*') #$ watch - para.gsub!(/<:p[bn]>/,'') # remove page breaks - para.gsub!(/^\s*<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>/,'') # remove empty lines + para.gsub!(/#{Mx[:br_page]}|#{Mx[:br_page_new]}/,'') # remove page breaks + para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') # remove empty lines para.gsub!(/<a href=".+?">(.+?)<\/a>/,'\1') - para.gsub!(/<:name#\S+?>/,'') # remove name links + para.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links # para.gsub!(/<a href=".+?">(.+?)<\/a>/im,'\1') #para.gsub!(/ /,' ') # decide on #para.gsub!(/\{(\S+?\.(?:png|jpg)) .+?\}(?:http:\/\/\S+|image)/," [ \\1 ]") #"[ #{@env.url.images_local}\/\\1 ]") @@ -533,38 +494,44 @@ module SiSU_ODF #para.gsub!(/^(\{\S+?\.(?:png|jpg)\s+.+?"(.*?)"\s*\}\S+)/,"\\1 \n [image: \"\\2\"]") wordlist=para.scan(/\S+/) para=tidywords(wordlist).join(' ').strip - if para =~/^0~(\S+)\s+(.+?)\Z/m # for headers + if para =~/^#{Rx[:meta]}(\S+)\s+(.+?)\Z/m # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta if d_meta; odf_metadata(d_meta) end end @rcdc=true if @rcdc==false \ - and (para =~/~metadata/ or para =~/1~meta\s+Document Information/) - if para !~/(^0~|<ENDNOTES>|<EOF>)/ + and (para =~/~metadata/ or para =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/) + if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change paranum=para[@regx,3] @p_num=SiSU_ODF_format::Paragraph_number.new(paranum) end - @sto=Split_text_object.new(para).lev_segname_para_ocn + @sto=SiSU_Structure::Split_text_object.new(@md,para).odt #<office:annotation><dc:date>yyyy-mm-ddT00:00:00</dc:date><text:p>#{ocn}</text:p></office:annotation> #followed immediately by paragraph closure ### problem in scroll, it appears tables are getting paragraph numbers unless @rcdc - m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m \ and para=~/\S+/ para=case @sto.format - when /^(1)~(?:(\S+))?/; odf_structure(para,$1,@sto.ocn,$2) + when /^(1):(\S*)/ + odf_structure(para,$1,@sto.ocn,$2) para - when /^(2)~(?:(\S+))?/; odf_structure(para,$1,@sto.ocn,$2) + when /^(2):(\S*)/ + odf_structure(para,$1,@sto.ocn,$2) para - when /^(3)~(?:(\S+))?/; odf_structure(para,$1,@sto.ocn,$2) + when /^(3):(\S*)/ + odf_structure(para,$1,@sto.ocn,$2) para - when /^(4)~(\S+)/; odf_structure(para,$1,@sto.ocn,$2) + when /^(4):(\S+)/ # work on see Split_text_object + odf_structure(para,$1,@sto.ocn,$2) # work on see SiSU_text_parts::Split_text_object para - when /^(5)~(?:(\S+))?/; odf_structure(para,$1,@sto.ocn,$2) + when /^(5):(\S*)/ + odf_structure(para,$1,@sto.ocn,$2) para - when /^(6)~(?:(\S+))?/; odf_structure(para,$1,@sto.ocn,$2) + when /^(6):(\S*)/ + odf_structure(para,$1,@sto.ocn,$2) para #@sto.lev_para_ocn.heading_body6 #when /^(i1)$/ @@ -610,12 +577,14 @@ module SiSU_ODF if para =~ /^(4)~(\S+)/ odf_structure(para,$1,@sto.ocn,$2) para - elsif para =~/<~(\d+);m\d+;[mdv]\d+><#@dp:#@dp>$/ + elsif para =~/#{Mx[:id_o]}~(\d+);m\d+;[mdv]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ odf_structure(para,nil,nil,nil) #watch may be problematic para end end para.gsub!(/<!.+!>/,' ') if para ## Clean Prepared Text + para.gsub!(/#{Mx[:gr_o]}.+?#{Mx[:gr_c]}/,' ') if para ## CHECK Clean Prepared Text + para.gsub!(/#{Mx[:tc_o]}.+?#{Mx[:tc_c]}/,' ') if para ## CHECK Clean Prepared Text para.gsub!(/<:\S+>/,' ') if para ## Clean Prepared Text end end @@ -668,7 +637,6 @@ module SiSU_ODF %{<style:style style:name="P8" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-before="page"/></style:style>#@br} + %{<style:style style:name="P9" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:break-after="page"/></style:style>#@br} + %{<style:style style:name="P10" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false"/></style:style>#@br} + # P1 - %{<style:style style:name="P11" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="1cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>#@br} + %{<style:style style:name="P12" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="2cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>#@br} + %{<style:style style:name="P13" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-top="0.199cm" fo:margin-bottom="0.199cm" fo:line-height="150%" fo:margin-left="3cm" fo:margin-right="0cm" fo:text-align="justify" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false"/></style:style>#@br} + diff --git a/lib/sisu/v0/odf_format.rb b/lib/sisu/v0/odf_format.rb index 3a6d0d94..05e4a918 100644 --- a/lib/sisu/v0/odf_format.rb +++ b/lib/sisu/v0/odf_format.rb @@ -81,10 +81,10 @@ module SiSU_ODF_format def initialize(one,two,three) one.gsub!(/\.(html|pdf|php)/,'') if one =~/\.\.\/\S+/ @one,@two,@three=one,two,three - rgx=/^[1-6-]~/ + rgx=/^#{Mx[:lv_o]}[1-6-]:/ @one.gsub!(rgx,'') if @one =~rgx @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - rgx=/~\{\d+\s+(.+?)<#@dp>\}~/ + rgx=/#{Mx[:en_a_o]}\d+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/ @one.gsub!(rgx,'\1') if @one =~rgx @link,@linkname=one,two @vz=SiSU_Env::Get_init.instance.skin @@ -178,45 +178,45 @@ module SiSU_ODF_format end def table @parablock='' if @parablock =~/^<!$/ - @parablock.gsub!(/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>/,'') + @parablock.gsub!(/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') m=@parablock[/<!f(.+?)!>/,1] @@tablefoot << m if m @parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if @parablock =~/<!Th¡/u - @@table_counter+=1 if @parablock =~/<!Th?¡/u - if @parablock =~/<!Th¡\s+c(\d+).+?!~\d+;\w\d+;\w\d+>/u; @parablock=table_head(@@table_counter,$1,true) - elsif @parablock =~/<!T¡\s+c(\d+).+?!~\d+;\w\d+;\w\d+>/u; @parablock=table_head(@@table_counter,$1) + @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u + @@table_counter+=1 if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u + if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}\s+c(\d+).+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head(@@table_counter,$1,true) + elsif @parablock =~/#{Mx[:gr_o]}T#{Mx[:tc_p]}\s+c(\d+).+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head(@@table_counter,$1) end - if @parablock =~/<!TZ!>/ + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - if @parablock =~/<!TZ!>/; @parablock=table_end + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock=table_end end end if @@tablehead == 1 - if @parablock =~/¡¡/u - if @parablock =~/<!¡¡(\d+?)¡/u - @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1,true)) + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u + if @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true)) end - if @parablock =~/¡¡(\d+?)¡/u - @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1,true)) + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true)) end - if @parablock =~/!>/ - @parablock.gsub!(/!>/,table_row_close(true)) + if @parablock =~/#{Mx[:tc_c]}/ + @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close(true)) end @@tablehead=0 end @parablock else - if @parablock =~/<!¡¡(\d+?)¡/u - @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1)) + if @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1)) end - if @parablock =~/¡¡(\d+?)¡/u - @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1)) + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1)) end - if @parablock =~/!>/ - @parablock.gsub!(/!>/,table_row_close) + if @parablock =~/#{Mx[:tc_c]}/ + @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close) end @parablock end @@ -224,8 +224,12 @@ module SiSU_ODF_format end def table_split @new_content=[] - @one.split(/\s*<!/).each do |parablock| - table=Table.new(@md,"<!#{parablock}") + @one.split(/\s*#{Mx[:tc_o]}/).each do |parablock| + table=if parablock =~/#{Mx[:gr_o]}/ + Table.new(@md,"#{parablock}") + else + Table.new(@md,"#{Mx[:tc_o]}#{parablock}") + end @new_content << table.table end @new_content.join diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index f9d15a22..43b2d862 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -119,7 +119,7 @@ module SiSU_Param @doc={ :lv=>[] } @doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','','' @@publisher='SiSU scribe' - attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:man_section,:man_name,:man_synopsis,:ec,:opt,:sem_tag + attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:man_section,:man_name,:man_synopsis,:ec,:opt,:sem_tag def initialize(fns_array,opt) @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@sfx=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@dc_title=@html_title=@subtitle=@subtitle_tex=@creator_home=@dc_creator=@translator=@illustrator=@prepared_by=@digitized_by=@dc_subject=@dc_description=@dc_publisher=@dc_contributor=@dc_date=@dc_date_created=@dc_date_issued=@dc_date_available=@dc_date_valid=@dc_date_modified=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@dc_type=@dc_format=@dc_identifier=@dc_source=@dc_language=@language_original=@dc_relation=@dc_coverage=@dc_rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_auto_heading_num=@make_bold=@make_italic=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@file_size=@firstseg=@programs=@creator_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@man_synopsis=nil @man_section=1 @@ -132,6 +132,7 @@ module SiSU_Param @markup=@markup_instruction #use @markup_instruction @doc,@fn,@make_italic,@make_bold,@tag_hash,@ec={},{},{},{},{},{},{} @flv,@lang,@seg_names,@tags,@tag_array,@tag_a,@ec[:image],@ec[:audio],@ec[:multimedia]=Array.new(9){[]} + @papersize_array=[] @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/ @rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg @@ -419,17 +420,17 @@ module SiSU_Param @toc=[ @toc ] if @toc == String #@toc.each {|x| x.gsub!(/\{/,'\{') } #FIX~ lv1=@toc[0] ||='1~ ' #some arbitrary changes made - @lv1=/^#{lv1}\b/ + @lv1=/^#{lv1}/ lv2=@toc[1] ||='2~ ' - @lv2=/^#{lv2}\b/ + @lv2=/^#{lv2}/ lv3=@toc[2] ||='3~ ' - @lv3=/^#{lv3}\b/ + @lv3=/^#{lv3}/ lv4=@toc[3] ||='4~ ' - @lv4=/^#{lv4}\b/ + @lv4=/^#{lv4}/ lv5=@toc[4] ||='5~ ' - @lv5=/^#{lv5}\b/ + @lv5=/^#{lv5}/ lv6=@toc[5] ||='6~ ' - @lv6=/^#{lv6}\b/ + @lv6=/^#{lv6}/ when /^(?:0~(?:level|page|markup)|@(?:level|page|markup):)\s+(.+?)$/m #% processing revisit..., use syntax 0~level new=1,2,3; break=4 if para =~/(?:0~|@)(?:markup|level|page):?\s+(.+?)\Z/m page_break_str=$1 @@ -548,12 +549,12 @@ module SiSU_Param @man_synopsis= x[/synopsis=(.+)/m,1] if x =~/synopsis=.+/ end end - @lv1 ||=/^1~/ - @lv2 ||=/^2~/ - @lv3 ||=/^3~/ - @lv4 ||=/^4~/ - @lv5 ||=/^5~/ - @lv6 ||=/^6~/ + @lv1 ||=/^#{Mx[:lv_o]}1:/ + @lv2 ||=/^#{Mx[:lv_o]}2:/ + @lv3 ||=/^#{Mx[:lv_o]}3:/ + @lv4 ||=/^#{Mx[:lv_o]}4:/ + @lv5 ||=/^#{Mx[:lv_o]}5:/ + @lv6 ||=/^#{Mx[:lv_o]}6:/ else #% if para =~ /^(?:1|:?A)~/ #% processing if para=~/^:?A~/ @@ -696,6 +697,7 @@ module SiSU_Param or @mod.inspect =~/--(?:a4|letter|legal|book|a5|b5)\b/i #command line config/header override @papersize=determine_papersize(@mod.inspect) end + @papersize_array=@papersize.scan(/(?:a4|letter|legal|book|a5|b5)/i) if @sys.openssl !=false skin=if @doc_skin; SiSU_Env::Info_skin.new(@opt,@doc_skin).select else SiSU_Env::Info_skin.new(@opt).select @@ -836,12 +838,12 @@ module SiSU_Param end end @lnk=@lnk.compact if @lnk - @lv1 ||=/^1~/ - @lv2 ||=/^2~/ - @lv3 ||=/^3~/ - @lv4 ||=/^4~/ - @lv5 ||=/^5~/ - @lv6 ||=/^6~/ + @lv1 ||=/^#{Mx[:lv_o]}1:/ + @lv2 ||=/^#{Mx[:lv_o]}2:/ + @lv3 ||=/^#{Mx[:lv_o]}3:/ + @lv4 ||=/^#{Mx[:lv_o]}4:/ + @lv5 ||=/^#{Mx[:lv_o]}5:/ + @lv6 ||=/^#{Mx[:lv_o]}6:/ if @doc_skin tell=SiSU_Screen::Ansi.new(@cmd,"doc_skin <- #@doc_skin") tell.txt_grey if @cmd =~/v/ diff --git a/lib/sisu/v0/particulars.rb b/lib/sisu/v0/particulars.rb index ce12fc31..8ae4f66e 100644 --- a/lib/sisu/v0/particulars.rb +++ b/lib/sisu/v0/particulars.rb @@ -1,9 +1,10 @@ +# coding:utf-8 =begin * Name: SiSU * Description: a framework for document structuring, publishing and search - #___# + particulars, composite information about document being processed * Author: Ralph Amissah diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index 2cf26b93..b89a6252 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -68,6 +68,7 @@ module SiSU_Plaintext require "#{SiSU_lib}/plaintext_format" include Format require "#{SiSU_lib}/shared_txt" + require "#{SiSU_lib}/shared_structure" pwd=Dir.pwd @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' @@ -111,54 +112,6 @@ module SiSU_Plaintext end end private - class Split_text_object <Source - require "#{SiSU_lib}/plaintext_format" - include SiSU_Viz - include Format - @@alt_id_count=0 - @@dp=nil - attr_reader :format,:lev,:text,:ocn,:lev_para_ocn - def initialize(para) - @para=para - @format,@ocn='null','null' - @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - end - def lev_segname_para_ocn - @text=nil - if @para =~/^(\d~|<:.+?>).+?<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - if /^(([1-6])~(\S+))\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@lev,segname,@text,@ocn=$1,$2,$3,$4,$5 - elsif /^(([1-6])~)\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@lev,@text,@ocn=$1,$2,$3,$4 - elsif /<:(.+?)>\s*(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@text,@ocn=$1,$2,$3 - elsif /^(([1-6])~(\S+))\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;[um]\d+><#@dp:#@dp>$/m.match(@para) - @@alt_id_count+=1 - @format,@lev,segname,@text,@ocn=$1,$2,$3,$4,"x#{@@alt_id_count}" - elsif /^(([1-6])~)\s+(\S.+?)<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @@alt_id_count+=1 - @format,@lev,@text,@ocn=$1,$2,$3,"x#{@@alt_id_count}" - end - else - if /(.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @text,@ocn=$1,$2 - end - if @para !~/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$|^$/ #added 2002w06 - @text=/(.+?)/m.match(@para)[1] - end - if /^((\d)~(?:~\S+)?)\s+(.+)/m.match(@para) - @format,@lev,@text=$1,$2,$3 - end - end - format=@format.dup - @lev_para_ocn=if @para =~/.+<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - Format::Format_text_object.new(format,@text,@ocn) - else - Format::Format_text_object.new(format,@text,"<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>") - end - self - end - end class Scroll <Source require "#{SiSU_lib}/defaults" require "#{SiSU_lib}/shared_txt" @@ -170,7 +123,7 @@ module SiSU_Plaintext @url_brace=SiSU_Viz::Skin.new.url_decoration @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - @regx=/^(?:(?:<:p[bn]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m # 2004w18 pb pn removal added + @regx=/^(?:(?:#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]})?\s*(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m # 2004w18 pb pn removal added @tab="\t" @br=if md.mod.inspect =~ /--footnote/ \ and md.mod.inspect =~ /--dos/ @@ -198,12 +151,12 @@ module SiSU_Plaintext end # Used for extraction of endnotes from paragraphs def extract_endnotes(para='') - notes=para.scan(/~[{\[]([\d*+]+\s+.+?)\s*<#@dp>[}\]]~/) + notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) @n=[] notes.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider n=n.dup.to_s - if n =~/<br(?: \/)?>/ - fix = n.split(/<br(?: \/)?>/) #watch #added + if n =~/#{Mx[:br_line]}|#{Mx[:br_nl]}/ + fix = n.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/) #watch #added fix.each do |x| unless x.empty?; @n << x end @@ -283,11 +236,11 @@ WOK lv=nil if lv == 0 wrapped=if para[@regx] paragraph=para[@regx,2] - if paragraph =~/<:i([1-9])>/ + if paragraph =~/#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/ m=$1.to_i - paragraph.gsub!(/<:i#{m}>/,'') + paragraph.gsub!(/#{Mx[:pa_o]}:i#{m}#{Mx[:pa_c]}/,'') util=SiSU_text_utils::Wrap.new(paragraph,78,m*2) - else util=SiSU_text_utils::Wrap.new(paragraph,78,0) + else util=SiSU_text_utils::Wrap.new(paragraph.gsub(/#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/,''),78,0) end util.line_wrap end @@ -322,83 +275,89 @@ WOK table_message='[table omitted, see other document formats]' fix=[] data.each do |para| - para.gsub!(/<!Th?¡.+/um,"#@br#{table_message}") - para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check - para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down - para.gsub!(/<sup>(.+?)<\/sup>/,'^\1^') - para.gsub!(/<sub>(.+?)<\/sub>/,'[\1]') - para.gsub!(/<i>(.+?)<\/i>/,'/\1/') - para.gsub!(/<b>(.+?)<\/b>/,'*\1*') - para.gsub!(/<u>(.+?)<\/u>/,'_\1_') - unless para =~/<:code>/ + para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#@br#{table_message}") + para.gsub!(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,'') # remove dummy headings (used by html) #check + para.gsub!(/#{Mx[:gl_bullet]}\s*/,'* ') # bullet markup, marked down + para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*\1*') + para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/\1/') + para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]') + para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_\1_') + para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^') + para.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+\1+') + para.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"') + para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'-\1-') + unless para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/ para.gsub!(/\{(.+?)\}((?:https?|file|ftp):\/\/\S+|image)/,'\1 [link:] \2') - para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3") + para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3") para.gsub!(/_((?:https?|file|ftp):\/\/\S+)/,'\1') extract_endnotes(para) - para.gsub!(/~[{\[]([\d*+]+)\s+(?:.+?)[}\]]~/,'[^\1]') # endnote marker marked up - para.gsub!(/&/,'&') - para.gsub!(/!/,'!') - para.gsub!(/#/,'#') - para.gsub!(/*/,'*') - para.gsub!(/-/,'-') - para.gsub!(///,'/') - para.gsub!(/_/,'_') - para.gsub!(/{/,'{') - para.gsub!(/}/,'}') - para.gsub!(/~/,'~') - para.gsub!(/©/,'©') + para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]') # endnote marker marked up + para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]') # endnote marker marked up + para.gsub!(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<') + para.gsub!(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>') + para.gsub!(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&') + para.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') + para.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') + para.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') + para.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') + para.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') + para.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') + para.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{') + para.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}') + para.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~') + para.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©') end - if para =~/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/ - if para =~/<:code>/ #code-block: angle brackets special characters + if para =~/#{Mx[:gr_o]}(?:group|verse|alt|code)(?:-end)?#{Mx[:gr_c]}(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/ ##{Mx[:gr_o]}codeline#{Mx[:gr_c]} + if para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/ #code-block: angle brackets special characters para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _< para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_< end - para.gsub!(/<br(?: \/)?>/,"\n") # watch - para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,'') - else para.gsub!(/<br(?: \/)?>/,"\n\n") # watch introduces a bug + para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n") # watch + para.gsub!(/#{Mx[:gr_o]}(?:group|verse|alt|code)(?:-end)?#{Mx[:gr_c]}(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,'') + else para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n") # watch introduces a bug end - para.gsub!(/<:p[bn]>/,'') # remove page breaks - para.gsub!(/^\s*<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,'') # remove empty lines - check - para.gsub!(/(^|\s)[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') + para.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks + para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') # remove empty lines - check + para.gsub!(/(^|#{Mx[:gl_c]}|\s)[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1') - para.gsub!(/<:name#\S+?>/,'') # remove name links + para.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') # remove name links para.gsub!(/ /,' ') # decide on para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") para.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') #para.gsub!(/^\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') wordlist=para.scan(/\S+/) - if para =~/^0~(\S+)\s+(.+?)\Z/m # for headers + if para =~/^#{Rx[:meta]}\s*(.+?)\Z/m # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta if d_meta; plaintext_metadata(d_meta) end end - if para !~/(^0~|<ENDNOTES>|<EOF>)/ + if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change paranum=para[@regx,3] @p_num=Format::Paragraph_number.new(paranum) end - @sto=Split_text_object.new(para).lev_segname_para_ocn + @sto=SiSU_Structure::Split_text_object.new(@md,para).txt ### problem in scroll, it appears tables are getting paragraph numbers - m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m \ and para=~/\S+/ para=case @sto.format - when /^(1)~(?:(\S+))?/ + when /^(1):(\S*?)/ plaintext_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body1 - when /^(2)~(?:(\S+))?/ + when /^(2):(\S*?)/ plaintext_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body2 - when /^(3)~(?:(\S+))?/ + when /^(3):(\S*?)/ plaintext_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body3 - when /^(4)~(\S+)/ # work on see SiSU_text_parts::Split_text_object + when /^(4):(\S+?)/ # work on see SiSU_text_parts::Split_text_object plaintext_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body4 - when /^(5)~(?:(\S+))?/ + when /^(5):(\S*?)/ plaintext_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body5 - when /^(6)~(?:(\S+))?/ + when /^(6):(\S*?)/ plaintext_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body6 #when /^(i1)$/ @@ -427,17 +386,17 @@ WOK elsif para =~/#{table_message}/ @plaintext[:body] << para << @br elsif para =~/(Note|Endnotes?)/ \ - and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ elsif para =~/(MetaData)/ \ - and para =~/<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info ####suspect visit + and para =~/#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info ####suspect visit #formatMono=MonoSiSU.new('<br /><a name="metadata">MetaData</a>') #para=formatMono.bold_para elsif para.include? 'Owner Details' \ - and para !~/<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #formatMono=MonoSiSU.new('<br /><a name="owner.details">Owner Details</a>') #@plaintext[:owner_details]=formatMono.bold_para #para='' - elsif para =~/(¡|<!Th?)/u #tables ! + elsif para =~/(#{Mx[:tc_p]}|#{Mx[:gr_o]}Th?)/u #tables ! check elsif para =~/(.*)<!#!>(.*)/ one,two=$1,$2 format_text=Format_text_object.new(one,two) @@ -446,7 +405,7 @@ WOK para='' if (para =~/<a name="n\d+">/ \ and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote case para - when /<:i[1-9]>/ + when /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/ if para =~/.*<:#>.*$/m format_text=Format_text_object.new(para,'') para=format_text.scr_indent_one_no_paranum @@ -460,6 +419,7 @@ WOK format_text=Format_text_object.new(one,two) para=format_text.center end + para.gsub!(/#{Mx[:id_o]}.+?#{Mx[:id_c]}/,' ') if para ## Clean Prepared Text para.gsub!(/<!.+!>/,' ') if para ## Clean Prepared Text para.gsub!(/<:\S+>/,' ') if para ## Clean Prepared Text end diff --git a/lib/sisu/v0/plaintext_format.rb b/lib/sisu/v0/plaintext_format.rb index 1840daa6..e957d3a3 100644 --- a/lib/sisu/v0/plaintext_format.rb +++ b/lib/sisu/v0/plaintext_format.rb @@ -81,10 +81,10 @@ module Format def initialize(one,two,three) one.gsub!(/\.(html|pdf|php)/,'') if one =~/\.\.\/\S+/ @one,@two,@three=one,two,three - rgx=/^[1-6-]~/ + rgx=/^#{Rx[:lv]}/ @one.gsub!(rgx,'') if @one =~rgx @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - rgx=/~\{[\d*+]+\s+(.+?)<#@dp>\}~/ + rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/ @one.gsub!(rgx,'\1') if @one =~rgx @link,@linkname=one,two @vz=SiSU_Env::Get_init.instance.skin diff --git a/lib/sisu/v0/response.rb b/lib/sisu/v0/response.rb index ba3c1a82..cce90d49 100644 --- a/lib/sisu/v0/response.rb +++ b/lib/sisu/v0/response.rb @@ -69,7 +69,7 @@ module SiSU_Response elsif response == 'no'; false elsif response =~/^quit|exit$/; exit else puts "[please type: 'yes', 'no' or 'quit']" - answer?(ask) + response?(ask) end ans end diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index 106a56af..a930821e 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -130,15 +130,16 @@ module SiSU_Format_Shared @words=@words.join(' ') end def markup(para) - if para !~/^<:code>/ + if para !~/^#{Mx[:gr_o]}:code#{Mx[:gr_c]}/ if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/ wm=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|\S+/) words=urls(wm) para.gsub!(/.+/m,words) end + para.gsub!(/#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/m,'') para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url - para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration + para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration else para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>') #code-block: angle brackets special characters para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>') @@ -175,13 +176,9 @@ GSUB @content=markup(@content) %{#{@tab*1}<p class="norm" id="#@ocn" type="substantive">\n#{@tab*2}#@content\n#{@tab*1}</p>\n} end - def indent1 + def indent(t) @content=markup(@content) - %{#{@tab*1}<p class="indent1" id="#@ocn" type="substantive">\n#{@tab*2}#@content\n#{@tab*1}</p>\n} - end - def indent2 - @content=markup(@content) - %{#{@tab*1}<p class="indent2" id="#@ocn" type="substantive">\n#{@tab*2}#@content\n#{@tab*1}</p>\n} + %{#{@tab*1}<p class="indent#{t}" id="#@ocn" type="substantive">\n#{@tab*2}#@content\n#{@tab*1}</p>\n} end def para_table %{<p class="norm" align="left"><font #{@vz.font_small} #{@vz.font_color} #{@vz.font_face}>} @@ -195,40 +192,40 @@ GSUB m=parablock[/<!f(.+?)!>/,1] @@tablefoot<<m if m parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if parablock =~/<!Th¡/u - parablock.gsub!(/<!Th?¡.+?!~(\d+)>/, + @@tablehead=1 if parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u + parablock.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+)#{Mx[:gr_c]}/, #%{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"><tr><td valign="top" align="justify"><p class="norm" id="\\1"> </p> </td><td>\n} + %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">}) - if parablock =~/<!TZ!>/ + if parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << %{<p align="center"><font size=2><i>#{x}</i></font></p>\n}} @@tablefoot=[] - parablock.gsub!(/<!TZ!>/, + parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/, %{#{@vz.table_close}\n}) # + #%{#{tablefoot}}) end if @@tablehead == 1 - if parablock =~/¡¡/u - parablock.gsub!(/<!¡¡(\d+?)¡/u, + if parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u + parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{\n<tr>} + %{\n<td width="\\1%" valign="top">} + %{#{para_table}<b>}) - parablock.gsub!(/¡¡(\d+?)¡/u, + parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{</b></td><td width="\\1%" valign="top">} + %{#{para_table}<b>}) - parablock.gsub!(/!>/, '</b></td></tr>') - @@tablehead=0 #if parablock =~/!>/ + parablock.gsub!(/#{Mx[:tc_c]}/, '</b></td></tr>') + @@tablehead=0 end parablock else - parablock.gsub!(/<!¡¡(\d+?)¡/u, + parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{\n<tr>} + %{\n<td width="\\1%" valign="top">} + %{#{para_table}}) - parablock.gsub!(/¡¡(\d+?)¡/u, + parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{</td><td width="\\1%" valign="top">} + %{#{para_table}}) - parablock.gsub!(/!>/, '</td></tr>') + parablock.gsub!(/#{Mx[:tc_c]}/, '</td></tr>') parablock end @new_content << parablock diff --git a/lib/sisu/v0/shared_structure.rb b/lib/sisu/v0/shared_structure.rb new file mode 100644 index 00000000..f7b78e0e --- /dev/null +++ b/lib/sisu/v0/shared_structure.rb @@ -0,0 +1,151 @@ +# coding:utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + shared document structure + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, + 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see <http://www.gnu.org/licenses/>. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + <http://www.fsf.org/licensing/licenses/gpl.html> + <http://www.gnu.org/copyleft/gpl.html> + + <http://www.jus.uio.no/sisu/gpl.fsf/toc.html> + <http://www.jus.uio.no/sisu/gpl.fsf/doc.html> + <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt> + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + <http://www.jus.uio.no/sisu> + <http://www.sisudoc.org> + + * Download: + <http://www.jus.uio.no/sisu/SiSU/download.html> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Structure + class Split_text_object + include SiSU_Viz + #include SiSU_HTML_Format_type + @@dp=nil + attr_reader :format,:text,:ocn,:scroll_lev_para_ocn,:seg_lev_para_ocn,:lev_para_ocn + def initialize(md,para) + @md,@para=md,para + @format,@ocn='null','null' + #@format,@ocn=nil,nil + @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern + end + def lev_segname_para_ocn + if @para =~/^#{Mx[:lv_o]}\d:.+?#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + if @para[/^#{Mx[:lv_o]}([1-6]):(\S+?)#{Mx[:lv_c]}\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m] + @format,segname,@text,@ocn=$1,$2,$3,$4 + #@format="#@format:#{segname}" # + elsif @para[/^#{Mx[:lv_o]}([1-6]):#{Mx[:lv_c]}\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m] + @format,@text,@ocn=$1,$2,$3 + end + else + if @para[/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}#{Mx[:gl_bullet]})\s*(.+?)#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m] + @format,@text,@ocn=$1,$2,$3,$4 #watch and work on + elsif @para[/^(#{Mx[:gl_bullet]})\s*(.+?)#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m] + @format,@text,@ocn=$1,$2,$3 + elsif @para[/#{Mx[:pa_o]}:(i[1-9])#{Mx[:pa_c]}\s*(.+?)#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m] + @format,@text,@ocn=$1,$2,$3 #consider + elsif @para[/#{Mx[:gr_o]}(code|alt|verse|group)#{Mx[:gr_c]}(.+?)#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m] + @format,@text,@ocn=$1,$2,$3 + elsif @para[/(.+?)#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m] + @text,@ocn=$1,$2 #,$3 + end + if @para !~/#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$|^$/ #added 2002w06 + @text=@para[/(.+?)/m,1] + end + if @para[/^#{Mx[:lv_o]}(\d):\S*?#{Mx[:lv_c]}\s+(.+)/m] + @format,@text=$1,$2 + end + end + @format="#@format:#{segname}" if @format =~/^[1-6]$/ + self + end + def html_seg + lev_segname_para_ocn + @seg_lev_para_ocn=if @para[/.+#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] + SiSU_HTML_Format_type::Format_seg.new(@md,@format,@text,@ocn) + end + self + end + def html_scroll + lev_segname_para_ocn + @scroll_lev_para_ocn=if @para[/.+#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] + SiSU_HTML_Format_type::Format_scroll.new(@md,@format,@text,@ocn) + end + self + end + def xml + require "#{SiSU_lib}/shared_xml" + lev_segname_para_ocn + @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + SiSU_XML_format::Format_scroll.new(@md,@format,@text,"x#@ocn") + else + SiSU_XML_format::Format_scroll.new(@md,@format,@text,"#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}") + end + self + end + def odt + lev_segname_para_ocn + @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + SiSU_ODF_format::Format_text_object.new(format,@text,@ocn) + else + SiSU_ODF_format::Format_text_object.new(format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}") + end + self + + end + def txt + lev_segname_para_ocn + #format=@format.dup + @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + Format::Format_text_object.new(@format,@text,@ocn) + else + Format::Format_text_object.new(@format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}") + end + self + end + end +end +__END__ diff --git a/lib/sisu/v0/shared_txt.rb b/lib/sisu/v0/shared_txt.rb index aaa2d4d7..484a5f05 100644 --- a/lib/sisu/v0/shared_txt.rb +++ b/lib/sisu/v0/shared_txt.rb @@ -74,7 +74,7 @@ module SiSU_text_utils line=0 out=[] out[line]='' - @para.gsub!(/<:br>/,"\n\n") + @para.gsub!(/#{Mx[:br_nl]}/,"\n\n") words=@para.scan(/\n\n|\S+/m) while words != '' word=words.shift @@ -116,7 +116,7 @@ module SiSU_text_utils end class Header_scan def initialize(md,para) - @regxcl=/<~\d+;\w\d+;\w\d+><(?:[0-9a-f]{32}|[0-9a-f]{64}):(?:[0-9a-f]{32}|[0-9a-f]{64})>/ + @regxcl=/#{Mx[:id_o]}~\d+;\w\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}(?:[0-9a-f]{32}|[0-9a-f]{64}):(?:[0-9a-f]{32}|[0-9a-f]{64})#{Mx[:id_c]}/ para=para.gsub(@regxcl,'').dup @md,@p=md,para end @@ -155,122 +155,68 @@ module SiSU_text_utils end self end - def start_is_zero + def start_is_match meta=case @p - when /^0~(title)\s+(.+?)$/; header($1,@md.dc_title,'meta','dc') #dc 1 - #when /^0~(subtitle)\s+(.+?)$/; header($1,$2) - when /^0~(creator|author)\s+(.+?)$/; header('creator',$2,'meta','dc') #dc 2 - when /^0~(subject)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 3 - when /^0~(description)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 4 - when /^0~(publisher)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 5 - when /^0~(contributor)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 6 - when /^0~(date)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 7 - when /^0~(date\.created)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(date\.issued)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(date\.available)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(date\.valid)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(date\.modified)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(type)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 8 - when /^0~(format)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 9 - when /^0~(identifier)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 10 - when /^0~(source)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 11 - when /^0~(language)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 12 - when /^0~(relation)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 13 - when /^0~(coverage)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 14 - when /^0~(rights)\s+(.+?)$/; header($1,$2,'meta','dc') #dc 15 - when /^0~(keywords)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(copyright)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(translator|translated_by)\s+(.+?)$/; header('translator',$2,'meta','extra') - when /^0~(illustrator|illustrated_by)\s+(.+?)$/; header('illustrator',$2,'meta','extra') - when /^0~(prepared_by)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(digitized_by)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(comments?)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(abstract)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(tags?)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(catalogue)\s+(.+?)$/; header($1,$2,'meta','extra') - when /^0~(class(?:ify)?_loc)\s+(.+?)$/; header('classify_loc',$2,'meta','extra') - when /^0~(class(?:ify)?_dewey)\s+(.+?)$/; header('classify_dewey',$2,'meta','extra') - when /^0~(class(?:ify)?_pg)\s+(.+?)$/; header('classify_pg',$2,'meta','extra') - when /^0~(class(?:ify)?_isbn)\s+(.+?)$/; header('classify_isbn',$2,'meta','extra') - when /^0~(toc|structure)\s+(.+?)$/; header('structure',$2,'meta','extra') - when /^0~(toc|structure)\s+(.+?)$/; header('structure',$2,'proc','instruct') - when /^0~(level|page|markup)\s+(.+?)$/; header('markup',$2,'process','instruct') - when /^0~(bold)\s+(.+?)$/; header($1,$2,'process','instruct') - when /^0~(italics|itali[sz]e)\s+(.+?)$/; header('italicize',$2,'process','instruct') - when /^0~(vocabulary|wordlist)\s+(.+?)$/; header('vocabulary',$2,'process','instruct') - when /^0~(skin)\s+(.+?)$/; header($1,$2,'process','instruct') - when /^0~(css|stylesheet)\s+(.+?)$/; header('css',$2,'process','instruct') - when /^0~(links)\s+(.+?)$/; header($1,$2,'process','instruct') - when /^0~(prefix)\s+(.+?)$/; header($1,$2,'process','instruct') - when /^0~(suffix)\s+(.+?)$/; header($1,$2,'process','instruct') - when /^0~(information)\s+(.+?)$/; header($1,$2,'process','instruct') - when /^0~(contact)\s+(.+?)$/; header($1,$2,'process','instruct') - when /^0~(rcs|cvs)\s+(.+?)$/; header('version',$2,'process','instruct') - else nil - end - end - def start_is_at - meta=case @p - when /^@(title):\s+(.+?)$/; header($1,@md.dc_title,'meta','dc') #dc 1 + when /^#{Mx[:meta_o]}(title)#{Mx[:meta_c]}\s*(.+?)$/; header($1,@md.dc_title,'meta','dc') #dc 1 #when /^@(subtitle):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(creator|author):\s+(.+?)$/; header('creator',$2,'meta','dc') #dc 2 - when /^@(subject):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 3 - when /^@(description):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 4 - when /^@(publisher):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 5 - when /^@(contributor):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 6 - when /^@(date):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 7 - when /^@(date\.created):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(date\.issued):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(date\.available):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(date\.valid):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(date\.modified):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(type):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 8 - when /^@(format):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 9 - when /^@(identifier):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 10 - when /^@(source):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 11 - when /^@(language):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 12 - when /^@(relation):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 13 - when /^@(coverage):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 14 - when /^@(rights):\s+(.+?)$/; header($1,$2,'meta','dc') #dc 15 - when /^@(keywords):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(copyright):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(translator|translated_by):\s+(.+?)$/; header('translator',$2) - when /^@(illustrator|illustrated_by):\s+(.+?)$/; header('illustrator',$2) - when /^@(prepared_by):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(digitized_by):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(comments?):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(abstract):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(tags?):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(catalogue):\s+(.+?)$/; header($1,$2,'meta','extra') - when /^@(class(?:ify)?_loc):\s+(.+?)$/; header('classify_loc',$2,'meta','extra') - when /^@(class(?:ify)?_dewey):\s+(.+?)$/; header('classify_dewey',$2,'meta','extra') - when /^@(class(?:ify)?_pg):\s+(.+?)$/; header('classify_pg',$2,'meta','extra') - when /^@(class(?:ify)?_isbn):\s+(.+?)$/; header('classify_isbn',$2,'meta','extra') - when /^@(toc|structure):\s+(.+?)$/; header('structure',$2,'process','instruct') - when /^@(level|page|markup):\s+(.+?)$/; header('markup',$2,'process','instruct') - when /^@(bold):\s+(.+?)$/; header($1,$2,'process','instruct') - when /^@(italics|itali[sz]e):\s+(.+?)$/; header('italicize',$2,'process','instruct') - when /^@(vocabulary|wordlist):\s+(.+?)$/; header('vocabulary',$2,'process','instruct') - when /^@(skin):\s+(.+?)$/; header($1,$2,'process','instruct') - when /^@(css|stylesheet):\s+(.+?)$/; header('css',$2,'process','instruct') - when /^@(links):\s+(.+?)$/; header($1,$2,'process','instruct') - when /^@(prefix):\s+(.+?)$/; header($1,$2,'process','instruct') #add a & b - when /^@(suffix):\s+(.+?)$/; header($1,$2,'process','instruct') - when /^@(information):\s+(.+?)$/; header($1,$2,'process','instruct') - when /^@(contact):\s+(.+?)$/; header($1,$2,'process','instruct') - when /^@(rcs|cvs):\s+(.+?)$/; header('version',$2,'process','instruct') + when /^#{Mx[:meta_o]}(creator|author)#{Mx[:meta_c]}\s*(.+?)$/; header('creator',$2,'meta','dc') #dc 2 + when /^#{Mx[:meta_o]}(subject)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 3 + when /^#{Mx[:meta_o]}(description)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 4 + when /^#{Mx[:meta_o]}(publisher)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 5 + when /^#{Mx[:meta_o]}(contributor)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 6 + when /^#{Mx[:meta_o]}(date)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 7 + when /^#{Mx[:meta_o]}(date\.created)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(date\.issued)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(date\.available)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(date\.valid)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(date\.modified)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(type)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 8 + when /^#{Mx[:meta_o]}(format)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 9 + when /^#{Mx[:meta_o]}(identifier)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 10 + when /^#{Mx[:meta_o]}(source)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 11 + when /^#{Mx[:meta_o]}(language)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 12 + when /^#{Mx[:meta_o]}(relation)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 13 + when /^#{Mx[:meta_o]}(coverage)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 14 + when /^#{Mx[:meta_o]}(rights)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','dc') #dc 15 + when /^#{Mx[:meta_o]}(keywords)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(copyright)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(translator|translated_by)#{Mx[:meta_c]}\s*(.+?)$/; header('translator',$2) + when /^#{Mx[:meta_o]}(illustrator|illustrated_by)#{Mx[:meta_c]}\s*(.+?)$/; header('illustrator',$2) + when /^#{Mx[:meta_o]}(prepared_by)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(digitized_by)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(comments?)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(abstract)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(tags?)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(catalogue)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'meta','extra') + when /^#{Mx[:meta_o]}(class(?:ify)?_loc)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_loc',$2,'meta','extra') + when /^#{Mx[:meta_o]}(class(?:ify)?_dewey)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_dewey',$2,'meta','extra') + when /^#{Mx[:meta_o]}(class(?:ify)?_pg)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_pg',$2,'meta','extra') + when /^#{Mx[:meta_o]}(class(?:ify)?_isbn)#{Mx[:meta_c]}\s*(.+?)$/; header('classify_isbn',$2,'meta','extra') + when /^#{Mx[:meta_o]}(toc|structure)#{Mx[:meta_c]}\s*(.+?)$/; header('structure',$2,'process','instruct') + when /^#{Mx[:meta_o]}(level|page|markup)#{Mx[:meta_c]}\s*(.+?)$/; header('markup',$2,'process','instruct') + when /^#{Mx[:meta_o]}(bold)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(italics|itali[sz]e)#{Mx[:meta_c]}\s*(.+?)$/; header('italicize',$2,'process','instruct') + when /^#{Mx[:meta_o]}(vocabulary|wordlist)#{Mx[:meta_c]}\s*(.+?)$/; header('vocabulary',$2,'process','instruct') + when /^#{Mx[:meta_o]}(skin)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(css|stylesheet)#{Mx[:meta_c]}\s*(.+?)$/; header('css',$2,'process','instruct') + when /^#{Mx[:meta_o]}(links)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(prefix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') #add a & b + when /^#{Mx[:meta_o]}(suffix)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(information)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(contact)#{Mx[:meta_c]}\s*(.+?)$/; header($1,$2,'process','instruct') + when /^#{Mx[:meta_o]}(rcs|cvs)#{Mx[:meta_c]}\s*(.+?)$/; header('version',$2,'process','instruct') else nil end end def dublin - out=if @p =~/^0~\S+\s/; start_is_zero - elsif @p =~/^@\S+:[+-]?\s/; start_is_at + out=if @p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ + start_is_match else nil end end def meta - out=if @p =~/^0~\S+\s/; start_is_zero - elsif @p =~/^@\S+:[+-]?\s/; start_is_at + out=if @p =~/^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ + start_is_match else nil end end @@ -287,30 +233,30 @@ module SiSU_text_parts_flatfile @@dl ||=SiSU_Env::Info_env.new.digest.length end def lev_segname_para_ocn - if @para =~/^(\d~|<:.+?>).+?<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}>.*/ - if /^([1-6])~(\S+)\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}>/m.match(@para) + if @para =~/^(?:#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}|<:.+?>).+?#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}.*/ + if /^(#{Mx[:lv_o]}([1-6]):(\S+?)#{Mx[:lv_c]})\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m.match(@para) @format,segname,@text,@ocn=$1,$2,$3,$4 @format="#@format~#{segname}" # - elsif /^([1-6]~)\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}>/m.match(@para) + elsif /^(#{Mx[:lv_o]}([1-6]):#{Mx[:lv_c]})\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m.match(@para) @format,@text,@ocn=$1,$2,$3 - elsif /<:(.+?)>\s*(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}>/m.match(@para) + elsif /<:(.+?)>\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m.match(@para) @format,@text,@ocn=$1,$2,$3 - elsif /^([1-6])~(\S+)\s+(\S.+?)<~(0);(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}>/m.match(@para) + elsif /^(#{Mx[:lv_o]}([1-6]):(\S+?)#{Mx[:lv_c]})\s*(\S.+?)#{Mx[:id_o]}~(0);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m.match(@para) @@alt_id_count+=1 @format,segname,@text,@ocn=$1,$2,$3,"x#{@@alt_id_count}" @format="#@format~#{segname}" # - elsif /^([1-6]~)\s+(\S.+?)<~(0);(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}>/m.match(@para) + elsif /^(#{Mx[:lv_o]}([1-6]):#{Mx[:lv_c]})\s*(\S.+?)#{Mx[:id_o]}~(0);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m.match(@para) @@alt_id_count+=1 @format,@text,@ocn=$1,$2,"x#{@@alt_id_count}" end else - if /(.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}>/m.match(@para) + if /(.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m.match(@para) @text,@ocn=$1,$2 end - if @para !~/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}>|^$/ #added 2002w06 + if @para !~/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}|^$/ #added 2002w06 @text=/(.+?)/m.match(@para)[1] end - if /^(\d)~\S*\s+(.+)/m.match(@para) + if /^(#{Mx[:lv_o]}([1-9]):\S*?#{Mx[:lv_c]})\s*(.+)/m.match(@para) @format,@text=$1,$2 end end diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index c93eff5b..3c34e67f 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -59,75 +59,27 @@ =end module SiSU_text_parts - class Split_text_object + require "#{SiSU_lib}/shared_structure" + class Split_text_object < SiSU_Structure::Split_text_object require "#{SiSU_lib}/param" require "#{SiSU_lib}/xml_format" include SiSU_Viz include SiSU_XML_format @@alt_id_count=0 @@dp=nil - attr_reader :format,:text,:ocn,:lev_para_ocn - def initialize(md,para) - @md,@para=md,para - @format,@ocn='null','null' - #@format,@ocn=nil,nil - @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - end - def lev_segname_para_ocn #using shared_txt instead, watch #% watch closely - if @para =~/^(\d~|<:.+?>).+?<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - if /^([1-6])~(\S+)\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,segname,@text,@ocn=$1,$2,$3,$4 - @format="#@format~#{segname}" # - elsif /^([1-6]~)\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@text,@ocn=$1,$2,$3 - elsif /<:(.+?)>\s*(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@text,@ocn=$1,$2,$3 - elsif /^([1-6])~(\S+)\s+(\S.+?)<~(0);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @@alt_id_count+=1 - @format,segname,@text,@ocn=$1,$2,$3,"x#{@@alt_id_count}" - @format="#@format~#{segname}" # - elsif /^([1-6]~)\s+(\S.+?)<~(0);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @@alt_id_count+=1 - @format,@text,@ocn=$1,$2,"x#{@@alt_id_count}" - elsif /^(?:<:i([1-9])>\s*_\*)\s+(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@text,@ocn="_#{$1}\*",$2,$3,$4 - elsif /^(_\*)\s+(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@text,@ocn=$1,$2,$3 - elsif /<:(i[1-9])>\s*(.+?)<~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @format,@text,@ocn=$1,$2,$3 - end - else - if /(.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) - @text,@ocn=$1,$2 - end - if @para !~/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$|^$/ #added 2002w06 - @text=/(.+?)/m.match(@para)[1] - end - if /^(\d)~\S*\s+(.+)/m.match(@para) - @format,@text=$1,$2 - end - end - @lev_para_ocn=if @para =~/.+<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - SiSU_XML_format::Format_scroll.new(@md,@format,@text,@ocn) - else - SiSU_XML_format::Format_scroll.new(@md,@format,@text,"<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>") - end - self - end def lev_segname_para - if @para =~/^(\d~|<:.+?>).+/ - if /^([1-6])~(\S+)\s+(\S.+)/m.match(@para) + if @para =~/^#{Mx[:lv_o]}(?:\d:|<:.+?>).+/ + if /^#{Mx[:lv_o]}([1-6]):(\S+?)#{Mx[:lv_c]}\s*(\S.+)/m.match(@para) @format,segname,@text=$1,$2,$3 - @format="#@format~#{segname}" # - elsif /^([1-6]~)\s+(\S.+)/m.match(@para) + elsif /^#{Mx[:lv_o]}([1-6]):#{Mx[:lv_c]}\s*(\S.+)/m.match(@para) @format,@text=$1,$2 elsif /<:(.+?)>\s*(\S.+?)/m.match(@para) @format,@text=$1,$2 - elsif /^([1-6])~(\S+)\s+(\S.+?)/m.match(@para) + elsif /^#{Mx[:lv_o]}([1-6]):(\S+?)#{Mx[:lv_c]}\s*(\S.+?)/m.match(@para) @@alt_id_count+=1 @format,segname,@text=$1,$2,$3 - @format="#@format~#{segname}" # - elsif /^([1-6]~)\s+(\S.+?)/m.match(@para) + #@format="#@format:#{segname}" # + elsif /^#{Mx[:lv_o]}([1-6]):#{Mx[:lv_c]}\s*(\S.+?)/m.match(@para) @@alt_id_count+=1 @format,@text=$1,$2 end @@ -135,17 +87,19 @@ module SiSU_text_parts if /(.+?)/m.match(@para) @text=$1 end - if @para !~/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$|^$/ #added 2002w06 + if @para !~/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$|^$/ #added 2002w06 @text=/(.+?)/m.match(@para)[1] end if /^(\d)~\S*\s+(.+)/m.match(@para) @format,@text=$1,$2 end end - @lev_para_ocn=if @para =~/.+<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + @format="#@format:#{segname}" # +#follow this search beneath for heading_body1-6 + @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ SiSU_XML_format::Format_scroll.new(@md,@format,@text,@ocn) else - SiSU_XML_format::Format_scroll.new(@md,@format,@text,"<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>") + SiSU_XML_format::Format_scroll.new(@md,@format,@text,"#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}") end self end @@ -396,19 +350,40 @@ module SiSU_XML_munge def markup(para='') wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 para=tidywords(wordlist).join(' ').strip - para.gsub!(/(^|\s+)<\s+/,'\1< '); para.gsub!(/\s+>(\s+|$)/,' >\1') - para.gsub!(/<:pb>\s*/,'') + para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') + para.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'') + para.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;') + para.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') + para.gsub!(/(^|#{Mx[:gl_c]}|\s+)<\s+/,'\1< '); para.gsub!(/\s+>(\s+|$)/,' >\1') + #para.gsub!(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphasis_c]}/,'<em>\1</em>') #reinstate + para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') + para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') + para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') + para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>') + para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>') + para.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>') + para.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>') + para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') + para.gsub!(/<:pb>\s*/,'') #Fix para.gsub!(/<+[-~]#>+/,'') - para.gsub!(/<0;\w\d+;[um]\d+><#@dp:#@dp>/,'') - if para !~/^<:code>/ + para.gsub!(/#{Mx[:id_o]}0;\w\d+;[um]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') + if para !~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ #embeds a red-bullet image --> + para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') + para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') + para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') + para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') + para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') + para.gsub!(/#{Mx[:br_page]}\s*/,'') + para.gsub!(/#{Mx[:br_page_new]}\s*/,'') + para.gsub!(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,''); para.gsub!(/<[-~]#>/,'') para.gsub!(/(?:^|[^_\\])\{\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?\}(https?:\/\/\S+)/, %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1" width="\\2" height="\\3" />[\\1] \\4}) para.gsub!(/(?:^|[^_\\])\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/, %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1"/>\\1}) - para.gsub!(/(^|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, + para.gsub!(/(^|#{Mx[:gl_c]}|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, '\1<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\3">\2</link>\4') #watch, compare html_tune - para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, + para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, %{\\1#{@url_brace.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\2">\\2</link>#{@url_brace.xml_close}\\3}) para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>\2') #escaped urls not linked, deal with later @@ -429,7 +404,7 @@ module SiSU_XML_munge para.gsub!(/<br(\s*\/)?>/,'<br />') para.gsub!(/<:pb>\s*/,'') para.gsub!(/<[-~]#>/,'') - para.gsub!(/(^|\s)&\s+/,'\1& ') #sort + para.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& ') #sort para.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/, "<image.path>#{@dir.url.images_local}\/\\1</image.path>") @@ -452,7 +427,7 @@ module SiSU_XML_munge para.gsub!(/<:\S+?>/,'') #<-- temporary para.gsub!(/<[-~]#>/,'') - para.gsub!(/(^|\s)&\s+/,'\1& ') #sort + para.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& ') #sort para.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/, "<image.path>#{@dir.url.images_local}\/\\1</image.path>") @@ -728,4 +703,3 @@ module SiSU_Tables require "#{SiSU_lib}/xml_tables" end __END__ - diff --git a/lib/sisu/v0/sst_do_inline_footnotes.rb b/lib/sisu/v0/sst_do_inline_footnotes.rb index 3ee301f2..5cfd38da 100644 --- a/lib/sisu/v0/sst_do_inline_footnotes.rb +++ b/lib/sisu/v0/sst_do_inline_footnotes.rb @@ -68,7 +68,7 @@ module SiSU_Convert_footnotes include SiSU_Env include SiSU_Param include SiSU_Viz - include Syntax + include SiSU_Syntax class Instantiate < SiSU_Param::Parameters::Instructions @@flag={} #Beware!! def initialize @@ -337,7 +337,7 @@ module SiSU_Convert_footnotes # debug 2003w46 adding revision control info if @md.flag_auto_endnotes \ and @md.flag_separate_endnotes_make - @tuned_file << "\n1~endnotes Endnotes <~0;0:0;u0>" #prob numbering, revisit + @tuned_file << "\n1~endnotes Endnotes #{Mx[:id_o]}~0;0:0;u0#{Mx[:id_c]}" #prob numbering, revisit end @tuned_file << "\n<ENDNOTES>" @tuned_file @@ -469,7 +469,7 @@ module SiSU_Convert_footnotes end def strip_clean_of_markup(s) # used for digest, define rules, make same as in db clean s=s.dup - s=s.gsub(/(?:<\/?[ib]>|<~\d+;(?:\w|[0-6]:)\d+;\w\d+>|<#@dp:#@dp>|^:[A-C]~\S+|^[1-6]~\S+|~\{\d+\s.+?\}~)/,'') # markup and endnotes removed + s=s.gsub(/(?:<\/?[ib]>|#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}|#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|^:[A-C]~\S+|^[1-6]~\S+|~\{\d+\s.+?\}~)/,'') # markup and endnotes removed #% same as db clean --> s=s.gsub(/<del>(.+?)<\/del>/,'DELETED(\1)') # deletions s=s.gsub(/<sup>(\d+)<\/sup>/,'[\1]') diff --git a/lib/sisu/v0/sst_to_s_xml_dom.rb b/lib/sisu/v0/sst_to_s_xml_dom.rb index 1bf9a561..23143ed8 100644 --- a/lib/sisu/v0/sst_to_s_xml_dom.rb +++ b/lib/sisu/v0/sst_to_s_xml_dom.rb @@ -135,7 +135,7 @@ module SiSU_simple_xml_model_dom def initialize(data='',particulars='') @data,@env,@md=data,particulars.env,particulars.md @vz=SiSU_Env::Get_init.instance.skin - @regx=/^(?:(?:<:p[bn]>\s*)?(?::?[A-C]|\d~)(?:(\S+))?\s+)?(.+)/ + @regx=/^(?:#{Mx[:mk_o]}:p[bn]#{Mx[:mk_c]}\s*)?(?:#{Mx[:lv_o]}[1-9]:(\S*)#{Mx[:lv_c]})?(.+)/ @tab="\t" if @md @trans=SiSU_XML_munge::Trans.new(@md) @@ -155,13 +155,14 @@ module SiSU_simple_xml_model_dom para.gsub!(/~\[([*+])\s+(.+?)\]~/, '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') end - def xml_markup(para='') + def xml_clean(para='') para.gsub!(/~\[([*+])\s+(.+?)\]~/, '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') para.gsub!(/~\{([*+]+)\s+(.+?)\}~/, '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') para.gsub!(/~\{(.+?)\}~/, '<endnote><note>\1</note></endnote> ') + para.gsub!(/#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/,'') #Danger, watch end def xml_head(meta) txt=meta.text @@ -367,11 +368,14 @@ WOK para.gsub!(/ /,' ') para=SiSU_document_structure::Structure.new(@md,para).structure @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 - if para =~/\A(?:@|0~)(\S+?):?\s+(.+?)\Z/m + para.gsub!(/^0~(\S+)/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}") + para.gsub!(/^@(\S+?):/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}") + if para =~/\A#{Mx[:lv_o]}@(\S+?)#{Mx[:lv_c]}\s*(.+?)\Z/m # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta if d_meta; xml_head(d_meta) end end + para='' if para=~/#{Mx[:lv_o]}@\S+?#{Mx[:lv_c]}/ if @rcdc==false \ and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) @rcdc=true @@ -382,28 +386,28 @@ WOK if para !~/^(?:%\s|0~|@\S+?:)/ format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|null/ case @sto.format - when /^(1)~(\S+)?/ - xml_markup(para) + when /^(1):(\S*)/ + xml_clean(para) xml_structure($1,para,$2) para=@sto.lev_para_ocn.heading_body1 - when /^(2)~(\S+)?/ - xml_markup(para) + when /^(2):(\S*)/ + xml_clean(para) xml_structure($1,para,$2) para=@sto.lev_para_ocn.heading_body2 - when /^(3)~(\S+)?/ - xml_markup(para) + when /^(3):(\S*)/ + xml_clean(para) xml_structure($1,para,$2) para=@sto.lev_para_ocn.heading_body3 - when /^(4)~(\S+)?/ - xml_markup(para) + when /^(4):(\S*)/ + xml_clean(para) xml_structure($1,para,$2) para=@sto.lev_para_ocn.heading_body4 - when /^(5)~(\S+)?/ - xml_markup(para) + when /^(5):(\S*)/ + xml_clean(para) xml_structure($1,para,$2) para=@sto.lev_para_ocn.heading_body5 - when /^(6)~(\S+)?/ - xml_markup(para) + when /^(6):(\S*)?/ + xml_clean(para) xml_structure($1,para,$2) para=@sto.lev_para_ocn.heading_body6 #when /^(i1)$/i @@ -427,19 +431,20 @@ WOK # end else if para =~ /<:verse>/ - poem_structure(para) + para=poem_structure(para) elsif para =~ /<:group>/ - group_structure(para) + para=group_structure(para) elsif para =~ /<:code>/ para.gsub!(/</,'<') para.gsub!(/>/,'>') - code_structure(para) + para=code_structure(para) elsif para =~/<!Th?.+/ # tables come as single block #work area 2005w13 + #elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13 table=SiSU_Tables::Table_xml.new(para) para=table.table_split @@xml[:body] << table_structure(para) else #xml_structure - xml_markup(para) + xml_clean(para) if para[@regx] \ and para[@regx,2] @@xml[:body] << %{#{@tab*6}<object>} << "\n" @@ -450,11 +455,11 @@ WOK end elsif para =~/(Note|Endnotes?)/ elsif para =~/(MetaData)/ \ - and para =~/<~\d+;[m]\d+;\w\d+><#{@@dp}:#{@@dp}>$/ #debug 2003w46 add rc info + and para =~/#{Mx[:id_o]}~\d+;[m]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@@dp}:#{@@dp}#{Mx[:id_c]}$/ #debug 2003w46 add rc info format_scroll=Format_scroll.new(@md,'<br /><a name="metadata">MetaData</a>') para=format_scroll.bold_para elsif para =~/(Owner Details)/ \ - and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#{@@dp}:#{@@dp}>$/ + and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@@dp}:#{@@dp}#{Mx[:id_c]}$/ format_scroll=Format_scroll.new(@md,'<br /><a name="owner.details">Owner Details</a>') @@xml[:owner_details]=format_scroll.bold_para para='' @@ -484,10 +489,10 @@ WOK format_text=Format_text_object.new(one,two) para=format_text.center end - else end para.gsub!(/<:\S+?>/,'') para.gsub!(/<!.+!>/,' ') + para end end @content_flag=true @@ -563,6 +568,7 @@ WOK para.gsub!(/_\{(.+?)\}_/,'<underscore>\1</underscore>') para.gsub!(/-\{(.+?)\}-/,'<strike>\1</strike>') # do { links }http://url + #para.gsub!(/#{Mx[:gl_o]}\S+?#{Mx[:gl_c]}/,'') #Danger, watch para.gsub!(/<:\S+?>/,'') para.gsub!(/<!.+?!>/,'') para="#{para}\n" unless para.empty? diff --git a/lib/sisu/v0/sst_to_s_xml_node.rb b/lib/sisu/v0/sst_to_s_xml_node.rb index 76e30b60..ed7f4b10 100644 --- a/lib/sisu/v0/sst_to_s_xml_node.rb +++ b/lib/sisu/v0/sst_to_s_xml_node.rb @@ -142,7 +142,7 @@ module SiSU_simple_xml_model_node def initialize(data='',particulars='') @data,@env,@md=data,particulars.env,particulars.md @vz=SiSU_Env::Get_init.instance.skin - @regx=/^(?:(?:<:p[bn]>\s*)?(?::?[A-C]~|\d~)(?:(\S+))?\s+)?(.+)/ + @regx=/^(?:#{Mx[:mk_o]}:p[bn]#{Mx[:mk_c]}\s*)?(?:#{Mx[:lv_o]}[1-9]:(\S*)#{Mx[:lv_c]})?(.+)/ @tab="\t" if @md @trans=SiSU_XML_munge::Trans.new(@md) @@ -159,16 +159,16 @@ module SiSU_simple_xml_model_node end protected def embedded_endnotes(para='') - para.gsub!(/~\{(.+?)\}~/,'<endnote symbol="norm">\1</endnote> ') - para.gsub!(/~\[([*+])\s+(.+?)\]~/,'<endnote symbol="\1">\2</endnote> ') + para.gsub!(/#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/,'<endnote symbol="norm">\1</endnote> ') + para.gsub!(/#{Mx[:en_b_o]}([*+])\s+(.+?)#{Mx[:en_b_c]}/,'<endnote symbol="\1">\2</endnote> ') end def xml_head(meta) txt=meta.text - txt.gsub!(/\/{(.+?)}\//,'<i>\1</i>') - txt.gsub!(/[*!]{(.+?)}[*!]/,'<b>\1</b>') - txt.gsub!(/_{(.+?)}_/,'<u>\1</u>') - txt.gsub!(/-{(.+?)}-/,'<del>\1</del>') - txt.gsub!(/<br(?: \/)?>/,'<br />') + txt.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') + txt.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') + txt.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') + txt.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') + txt.gsub!(/#{Mx[:br_line]}|#{Mx[:br_paragraph]}/,'<br />') txt.gsub!(/ & /,' and ') @@xml[:head] <<<<WOK #{@tab}<header class="#{meta.attrib}"> @@ -273,13 +273,13 @@ WOK else puts 'error' end end - def node_structure(o='',para='',lv='',hname='') #extracted endnotes - if o.ocn - lv=lv.to_i - lv=nil if lv == 0 - build_relationships(o,lv) - end - end + #def node_structure(o='',para='',lv='',hname='') #extracted endnotes + # if o.ocn + # lv=lv.to_i + # lv=nil if lv == 0 + # build_relationships(o,lv) + # end + #end def xml_structure(o='',para='',lv='',hname='') #extracted endnotes if o.ocn puts para if lv and @md.cmd =~/M/ @@ -397,6 +397,10 @@ WOK @@xml[:body] << "#{@tab*0}</object>" << "\n" #if para[@regx] @endnotes=[] end + def xml_clean(para) + para.gsub!(/#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/,'') + para + end def markup data=[] @data=@data.join.split("\n\n") @@ -404,7 +408,7 @@ WOK @data.each do |para| data << SiSU_document_structure::Structure.new(@md,para).structure end - data=Syntax::Markup.new(@md,data).songsheet + data=SiSU_Syntax::Markup.new(@md,data).songsheet data=SiSU_document_structure::Tables.new(@md,data).tables obj=SiSU_document_structure::OCN.new(@md,data).ocn obj.compact! @@ -429,58 +433,69 @@ WOK para=SiSU_sem::Tags.new(para,@md).rm.all para=@trans.markup_light(para) @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 - if para =~/\A(?:@|0~)(\S+?):?\s+(.+?)\Z/m # for headers + if para =~/\A#{Mx[:lv_o]}@(\S+?)#{Mx[:lv_c]}\s*(.+?)\Z/m # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta if d_meta; xml_head(d_meta) end end end end + #obj.each do |o| + # para=o.txt unless o.txt =~/^%% / #comments are lost, consider + # if para + # para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') + # para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') + # para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') + # para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') + # para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_paragraph]}/,'<br />') + # if @rcdc==false \ + # and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) + # if para !~/(^0~|^@\S+?:|^\s*$|<ENDNOTES>|<EOF>)/ + # @rcdc=true + # end + # @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para + # unless @rcdc + # format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|null/ + # case @sto.format + # when /^(1):(\S*)/ + # node_structure(o,para,$1,$2) + # when /^(2):(\S*)/ + # node_structure(o,para,$1,$2) + # when /^(3):(\S*)/ + # node_structure(o,para,$1,$2) + # when /^(4):(\S*)/ # work on see Split_text_object + # node_structure(o,para,$1,$2) + # when /^(5):(\S*)/ + # node_structure(o,para,$1,$2) + # when /^(6):(\S*)/ + # node_structure(o,para,$1,$2) + # else + # if para =~ /<:verse>/ + # node_structure(o,para) + # elsif para =~ /<:group>/ + # node_structure(o,para) + # elsif para =~ /<:code>/ + # node_structure(o,para) + # elsif para =~/<!Th?.+/ # tables come as single block #work area 2005w13 + # #elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13 + # table=SiSU_Tables::Table_xml.new(para) + # para=table.table_split + # node_structure(o,para) + # else node_structure(o,para,nil,nil) + # end + # end + # end + # end + # end + #end obj.each do |o| para=o.txt unless o.txt =~/^%% / #comments are lost, consider if para - if @rcdc==false \ - and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) - if para !~/(^0~|^@\S+?:|^\s*$|<ENDNOTES>|<EOF>)/ - @rcdc=true - end - @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para - unless @rcdc - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|null/ - case @sto.format - when /^(1)~(\S+)?/ - node_structure(o,para,$1,$2) - when /^(2)~(\S+)?/ - node_structure(o,para,$1,$2) - when /^(3)~(\S+)?/ - node_structure(o,para,$1,$2) - when /^(4)~(\S+)?/ # work on see Split_text_object - node_structure(o,para,$1,$2) - when /^(5)~(\S+)?/ - node_structure(o,para,$1,$2) - when /^(6)~(\S+)?/ - node_structure(o,para,$1,$2) - else - if para =~ /<:verse>/ - node_structure(o,para) - elsif para =~ /<:group>/ - node_structure(o,para) - elsif para =~ /<:code>/ - node_structure(o,para) - elsif para =~/<!Th?.+/ # tables come as single block #work area 2005w13 - table=SiSU_Tables::Table_xml.new(para) - para=table.table_split - node_structure(o,para) - else node_structure(o,para,nil,nil) - end - end - end - end - end - end - obj.each do |o| - para=o.txt unless o.txt =~/^%% / #comments are lost, consider - if para + para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') + para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') + para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') + para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') + para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_paragraph]}/,'<br />') if @rcdc==false \ and (para =~/~metadata/ \ or para =~/^1~meta\s+Document Information/) @@ -491,22 +506,28 @@ WOK unless @rcdc format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|null/ case @sto.format - when /^(1)~(\S+)?/ + when /^(1):(\S*)/ + xml_clean(para) xml_structure(o,para,$1,$2) para=@sto.lev_para_ocn.heading_body1 - when /^(2)~(\S+)?/ + when /^(2):(\S*)/ + xml_clean(para) xml_structure(o,para,$1,$2) para=@sto.lev_para_ocn.heading_body2 - when /^(3)~(\S+)?/ + when /^(3):(\S*)/ + xml_clean(para) xml_structure(o,para,$1,$2) para=@sto.lev_para_ocn.heading_body3 - when /^(4)~(\S+)?/ # work on see Split_text_object + when /^(4):(\S*)/ # work on see Split_text_object + xml_clean(para) xml_structure(o,para,$1,$2) para=@sto.lev_para_ocn.heading_body4 - when /^(5)~(\S+)?/ + when /^(5):(\S*)/ + xml_clean(para) xml_structure(o,para,$1,$2) para=@sto.lev_para_ocn.heading_body5 - when /^(6)~(\S+)?/ + when /^(6):(\S*)/ + xml_clean(para) xml_structure(o,para,$1,$2) para=@sto.lev_para_ocn.heading_body6 else @@ -519,6 +540,7 @@ WOK para.gsub!(/>/,'>') code_structure(o,para) elsif para =~/<!Th?.+/ # tables come as single block #work area 2005w13 + #elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13 table=SiSU_Tables::Table_xml.new(para) para=table.table_split table_structure(o,para) @@ -603,6 +625,7 @@ WOK def xml @sisu=[] @data.each do |para| + #para.gsub!(/#{Mx[:gl_o]}\S+?#{Mx[:gl_c]}/,'') #Danger, watch para.gsub!(/<:\S+?>/,'') para.gsub!(/<!.+?!>/,'') para="#{para}\n" unless para.empty? diff --git a/lib/sisu/v0/sst_to_s_xml_sax.rb b/lib/sisu/v0/sst_to_s_xml_sax.rb index e7765d33..4b3ca7c8 100644 --- a/lib/sisu/v0/sst_to_s_xml_sax.rb +++ b/lib/sisu/v0/sst_to_s_xml_sax.rb @@ -137,7 +137,7 @@ module SiSU_simple_xml_model_sax def initialize(data='',particulars='') @data,@env,@md=data,particulars.env,particulars.md @vz=SiSU_Env::Get_init.instance.skin - @regx=/^(?:(?:<:p[bn]>\s*)?(?::?[A-C]~|\d~)(?:(\S+))?\s+)?(.+)/ + @regx=/^(?:#{Mx[:mk_o]}:p[bn]#{Mx[:mk_c]}\s*)?(?:#{Mx[:lv_o]}[1-9]:(\S*)#{Mx[:lv_c]})?(.+)/ @tab="\t" if @md @trans=SiSU_XML_munge::Trans.new(@md) @@ -206,7 +206,7 @@ WOK @@xml[:body] << "#{@tab*1}" << "\n" if para[@regx] @@xml[:body] << if lv; %{#{@tab*1}<text class="h#{lv}">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} << "\n" elsif wrapped =~/\A%%?\s+/; %{<!--\n#{@tab*1}<text class="comment">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n-->\n} # comments - else %{#{@tab*1}<text class="norm">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} # main text, contents, body KEEP + else %{#{@tab*1}<text class="norm">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} # main text, contents, body KEEP end #@@xml[:body] << "#{@tab*1}<text>\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n" # main text, contents, body KEEP @@xml[:body] << "#{@endnotes}" if @endnotes # main text, endnotes KEEP @@ -252,9 +252,12 @@ WOK x.gsub!(/&/,'&') unless x =~/&\S+;/ end end + def xml_clean(para) + para.gsub!(/#{Mx[:gl_o]}[1-9]:\S*?#{Mx[:gl_c]}/,'') #Danger, watch + para + end def markup data=[] - #@data=@data.join.split("\n\n") dir=SiSU_Env::Info_env.new(@md.fns) xml_sc(@md) @endnotes,@level,@cont,@copen,@xml_contents_close=[],[],[],[],[] @@ -262,7 +265,7 @@ WOK (0..6).each { |x| @cont[x]=@level[x]=false } (4..6).each { |x| @xml_contents_close[x]='' } @data.each do |para| - data << SiSU_document_structure::Structure.new(@md,para).structure + data << SiSU_document_structure::Structure.new(@md,para).structure #takes on Mx marks end data.each do |para| if para !~/^\s*(?:%+ |<:code>)/ @@ -275,11 +278,14 @@ WOK end para=@trans.markup_light(para) @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 - if para =~/\A(?:@|0~)(\S+?):?\s+(.+?)\Z/m # for headers + para.gsub!(/^0~(\S+)/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}") + para.gsub!(/^@(\S+?):/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}") + if para =~/\A#{Mx[:lv_o]}@(\S+?)#{Mx[:lv_c]}\s*(.+?)\Z/m # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta if d_meta; xml_head(d_meta) end end + para='' if para=~/#{Mx[:lv_o]}@\S+?#{Mx[:lv_c]}/ if @rcdc==false \ and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) @rcdc=true @@ -287,24 +293,30 @@ WOK if para !~/(^0~|^@\S+?:|^\s*$|<ENDNOTES>|<EOF>)/ @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para unless @rcdc - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|null/ + format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ case @sto.format - when /^(1)~(\S+)?/ + when /^(1):(\S*)/ + xml_clean(para) xml_structure(para,$1,$2) para=@sto.lev_para_ocn.heading_body1 - when /^(2)~(\S+)?/ + when /^(2):(\S*)/ + xml_clean(para) xml_structure(para,$1,$2) para=@sto.lev_para_ocn.heading_body2 - when /^(3)~(\S+)?/ + when /^(3):(\S*)/ + xml_clean(para) xml_structure(para,$1,$2) para=@sto.lev_para_ocn.heading_body3 - when /^(4)~(\S+)?/ # work on see Split_text_object + when /^(4):(\S*)/ # work on see Split_text_object + xml_clean(para) xml_structure(para,$1,$2) para=@sto.lev_para_ocn.heading_body4 - when /^(5)~(\S+)?/ + when /^(5):(\S*)/ + xml_clean(para) xml_structure(para,$1,$2) para=@sto.lev_para_ocn.heading_body5 - when /^(6)~(\S+)?/ + when /^(6):(\S*)/ + xml_clean(para) xml_structure(para,$1,$2) para=@sto.lev_para_ocn.heading_body6 #when /^(i1)$/i @@ -328,17 +340,18 @@ WOK # end else if para =~ /<:verse>/ - poem_structure(para) + para=poem_structure(para) elsif para =~ /<:group>/ - group_structure(para) + para=group_structure(para) elsif para =~ /<:code>/ para.gsub!(/</,'<') para.gsub!(/>/,'>') - code_structure(para) + para=code_structure(para) + #elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13 elsif para =~/<!Th?.+/ # tables come as single block #work area 2005w13 table=SiSU_Tables::Table_xml.new(para) para=table.table_split - table_structure(para) + para=table_structure(para) else xml_structure(para,nil,nil) end end @@ -367,7 +380,9 @@ WOK end para.gsub!(/<:\S+?>/,'') para.gsub!(/<!.+!>/,'') ## Clean Prepared Text #bugwatch reinstate + para end + para end 6.downto(4) do |x| y=x - 1; v=x - 3 @@ -419,6 +434,7 @@ WOK def xml @sisu=[] @data.each do |para| + #para.gsub!(/#{Mx[:gl_o]}\S+?#{Mx[:gl_c]}/,'') #Danger, watch para.gsub!(/<:\S+?>/,'') para.gsub!(/<!.+?!>/,'') para="#{para}\n" unless para.empty? diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 3d01729e..a259d991 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -380,7 +380,8 @@ module SiSU_Env @@flv ||=document_language_versions_found[:f] unless @@fns =~/\S+?\.zip/ @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' - else @@fnb + '.sst.zip' + elsif @fnb; @@fnb + '.sst.zip' + else '' # e.g. termsheet end end else m=/(.+?)\.((?:-|ssm\.)?sst|ssm)$/ @@ -491,6 +492,16 @@ module SiSU_Env :xhtml => filename(code,'scroll','.xhtml'), :pdf_l => filename(code,'landscape','.pdf'), :pdf_p => filename(code,'portrait','.pdf'), + :pdf_l_a4 => filename(code,'landscape.a4','.pdf'), + :pdf_p_a4 => filename(code,'portrait.a4','.pdf'), + :pdf_l_a5 => filename(code,'landscape.a5','.pdf'), + :pdf_p_a5 => filename(code,'portrait.a5','.pdf'), + :pdf_l_b5 => filename(code,'landscape.b5','.pdf'), + :pdf_p_b5 => filename(code,'portrait.b5','.pdf'), + :pdf_l_letter => filename(code,'landscape.letter','.pdf'), + :pdf_p_letter => filename(code,'portrait.letter','.pdf'), + :pdf_l_legal => filename(code,'landscape.legal','.pdf'), + :pdf_p_legal => filename(code,'portrait.legal','.pdf'), :toc => filename(code,'toc','.html'), :doc => filename(code,'doc','.html'), :index => filename(code,'index','.html'), @@ -665,14 +676,8 @@ module SiSU_Env end @texpdf end - def latex2pdf(md=nil) #convert from latex to pdf + def latex2pdf(md,papersize='a4') #convert from latex to pdf tell=((@cmd =~/[MVv]/) ? '' : '> /dev/null' ) - papersize='a4' - papersize=if md and defined? md.papersize and not md.papersize.empty? \ - and md.papersize =~/(?:a4|letter|legal|book|a5|b5)\b/ - md.papersize - else papersize - end mode='batchmode' #mode='nonstopmode' program_ref="\n\t\tSee http://www.tug.org/applications/pdftex/\n\t\tOn Debian this is is included in tetex-extra" @@ -2045,8 +2050,8 @@ WOK is end def papersize # paper settings, default overidden in param if set within document - if defined? @rc['default']['papersize']; @rc['default']['papersize'].downcase - else defaults[:papersize].downcase + if defined? @rc['default']['papersize']; @rc['default']['papersize'].downcase + else defaults[:papersize].downcase end end def odf_structure @@ -3130,6 +3135,11 @@ WOK dest="#{@env.path.webserv}/_sisu/image" cp_images(src,dest) end + def cp_webserver_images_local #this should not have been necessary + src=@env.path.image_source + dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + cp_images(src,dest) + end def cp_base_images #fix images src="#{@env.path.share}/image" dest="#{@env.path.webserv}/_sisu/image_sys" diff --git a/lib/sisu/v0/texinfo.rb b/lib/sisu/v0/texinfo.rb index 2b10c04c..adcba123 100644 --- a/lib/sisu/v0/texinfo.rb +++ b/lib/sisu/v0/texinfo.rb @@ -160,11 +160,11 @@ module SiSU_TexInfo data.each do |para| # DEBUG 2003w16 this is a kludge, because i could not get parameters # from param, Sort out ... revert to more elegant solution - if para =~ /<!Th?¡\s+c/u + if para =~ /#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c/u @@flag['tables']='y' # KLUDGE get from param end para.gsub!(/<:p[bn]>/,'') - para.gsub!(/(^|\s)\{(.+?)\}((?:https?|file):\/\/\S+)/,'\1(\2 [linked to:] \3)') + para.gsub!(/(^|#{Mx[:gl_c]}|\s)\{(.+?)\}((?:https?|file):\/\/\S+)/,'\1(\2 [linked to:] \3)') do_mono=TexInfoFormat::Texinfo.new(para,@md) @tex_file << do_mono.spec_char end @@ -176,10 +176,10 @@ module SiSU_TexInfo @tex_file=[] data.each do |para| # BUG bug -> have problems with endnotes in headers - if para =~ /\\~@\{\d+\s+/ #if para =~ /<!e\s+/ # watch - para.gsub!(/\s*\\~@\{(?:\d+)\s+(.+?)<#@dp>@\}\\~/m,' @footnote{ \1} ') - elsif para =~ /\\~@\{\*+\s+/ #if para =~ /<!e\s+/ # watch - para.gsub!(/\s*\\~@\{(\*+)\s+(?:.+?)<#@dp>@\}\\~/m,' @footnote{ \1} ') + if para =~ /#{Mx[:en_a_o]}\d+\s+/ #if para =~ /<!e\s+/ # watch + para.gsub!(/\s*#{Mx[:en_a_o]}(?:\d+)\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/m,' @footnote{ \1} ') + elsif para =~ /#{Mx[:en_a_o]}\*+\s+/ #if para =~ /<!e\s+/ # watch + para.gsub!(/\s*#{Mx[:en_a_o]}(\*+)\s+(?:.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/m,' @footnote{ \1} ') end @tex_file << para end @@ -190,16 +190,16 @@ module SiSU_TexInfo @tex_file=[] @@counting=0 data.each do |para| - if para =~ /<:code>/ + if para =~ /#{Mx[:gr_o]}code#{Mx[:gr_c]}/ @@flag['code']=true @@counting=1 end - if para =~ /<:verse>/ + if para =~ /#{Mx[:gr_o]}verse#{Mx[:gr_c]}/ @@flag['poem']=1 end if @@flag['code'] if @@flag['code'] \ - and para =~ /<:code[-_](?:end|close)>/ #watch change not tested 200501 + and para =~ /#{Mx[:gr_o]}code[-_](?:end|close)#{Mx[:gr_c]}/ #watch change not tested 200501 @@flag['code']=false end if @@flag['code'] \ @@ -211,7 +211,7 @@ module SiSU_TexInfo end elsif @@flag['poem']==1 if @@flag['poem']==1 \ - and para =~ /<:verse[-_](?:end|close)>/ #watch change not tested 200501 + and para =~ /#{Mx[:gr_o]}verse[-_](?:end|close)#{Mx[:gr_c]}/ #watch change not tested 200501 @@flag['poem']=0 end if @@flag['poem']==1 \ @@ -229,7 +229,7 @@ module SiSU_TexInfo data=@data data.each do |line| if line =~ /\S/ \ - and line !~ /<:(code|verse).+/ + and line !~ /#{Mx[:gr_o]}(code|verse).+/ if @@flag['code'] line.gsub!(/^\s*(.+)/m, "\\noindent \\marginpar\[left-text\]{\\begin{tiny}#{@@counting}\\end{tiny}}\\1\\") @@counting+=1 if @@flag['code'] @@ -243,7 +243,7 @@ module SiSU_TexInfo @tex_file=[] @@tableheader=0 data.each do |para| - if para =~ /¡|<!T/ui + if para =~ /#{Mx[:tc_p]}|#{Mx[:gr_o]}T/ui do_mono=TexInfoFormat::Texinfo.new(para,@md) para=do_mono.longtable # using longtable latex package end @@ -264,21 +264,21 @@ module SiSU_TexInfo @submenu,@subsubmenu={},{} data.each do |para| para.gsub!(/\s*<:name#example>\s*/,' ') - if para =~ /^[1-3]\\+~\S*(.+?)\s*$/ + if para =~ /^#{Mx[:lv_o]}[1-3]:\S*?#{Mx[:lv_c]}\s*(.+?)\s*$/ toc=TexInfoFormat::Texinfo.new($1,@md) texinfo_menu << toc.menu - elsif para =~ /^[4-6]\\+~(?:\S+)?\s+(.+?)\s*$/ + elsif para =~ /^#{Mx[:lv_o]}[4-6]:\S*?#{Mx[:lv_c]}\s*(.+?)\s*$/ toc=TexInfoFormat::Texinfo.new($1,@md) texinfo_menu << toc.menu case para - when /^[4]\\+~\S+\s+(.+?)\s*$/ + when /^#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*(.+?)\s*$/ n_menu+=1 @submenu[n_menu]=[] - when /^[5]\\+~\S+\s+(.+?)\s*$/ + when /^#{Mx[:lv_o]}5:\S+?#{Mx[:lv_c]}\s*(.+?)\s*$/ n_submenu+=1 @subsubmenu[n_menu]=[] @submenu[n_menu] << toc.menu - when /^[6]\\+~\S+\s+(.+?)\s*$/ + when /^#{Mx[:lv_o]}6:\S+?#{Mx[:lv_c]}\s*(.+?)\s*$/ n_submenu+=1 @subsubmenu[n_submenu]=[] @subsubmenu[n_submenu] << toc.menu @@ -299,14 +299,14 @@ module SiSU_TexInfo data.each do |para| mono=TexInfoFormat::Texinfo.new(para,@md) case para - when /^1\\+/; mono.level1 - when /^2\\+/; mono.level2 - when /^3\\+/; mono.level3 - when /^4\\+~/ + when /^#{Mx[:lv_o]}1:/; mono.level1 + when /^#{Mx[:lv_o]}2:/; mono.level2 + when /^#{Mx[:lv_o]}3:/; mono.level3 + when /^#{Mx[:lv_o]}4:/; mono.level4 n_menu+=1 @@do_submenu,@@do_subsubmenu=1,1 - when /^5\\+/ + when /^#{Mx[:lv_o]}5:/; n_submenu+=1 @@do_subsubmenu=1 if @@do_submenu==1 @@ -315,7 +315,7 @@ module SiSU_TexInfo @@do_submenu=0 else mono.level5 end - when /^6\\+/ + when /^#{Mx[:lv_o]}6:/; if @@do_submenu==1 menu=TexInfoFormat::Texinfo.new(@subsubmenu[n_menu],@md) para="#{menu.subsubmenu}#{mono.level6}" @@ -339,9 +339,7 @@ module SiSU_TexInfo if para !~/\S/ para=nil else - para.gsub!(/<\\~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,'<\1>') - #para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/,'<\1>') - #para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/,'<\1>') + para.gsub!(/#{Mx[:id_o]}\\~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'<\1>') para end end @@ -369,7 +367,7 @@ module SiSU_TexInfo no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3); data.each do |para| if @md.markup =~ /num_top/i \ - and para !~ /0\\+/ + and para !~ /#{Rx[:meta]}/ if para =~ /^[1-6]\\+(?:~\S+)?\s*<!h-.+?-!>/ \ and para !~ /<:\d-endnotes>/ header=para[/<!h-(.+?)-!>/m, 1].gsub!(/-/m,'.') @@ -390,9 +388,9 @@ module SiSU_TexInfo @tex_file=[] paranumber=0 data.each do |para| - if para =~/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/ \ - and para !~ /<EOF>/ - parablock,paranum=/(.+?)<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/im.match(para)[1,2] + if para =~/#{Mx[:id_o]}\\~(\d+);\w\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/ \ + and para !~ /#{Mx[:br_eof]}/ + parablock,paranum=/(.+?)#{Mx[:id_o]}\\~(\d+);\w\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/im.match(para)[1,2] do_duo=TexInfoFormat::DuoTex.new(parablock,paranum) ###is BUG para=do_duo.paraNum if parablock end diff --git a/lib/sisu/v0/texinfo_format.rb b/lib/sisu/v0/texinfo_format.rb index 5bcdf04d..42d62960 100644 --- a/lib/sisu/v0/texinfo_format.rb +++ b/lib/sisu/v0/texinfo_format.rb @@ -237,7 +237,7 @@ WOK "@bye" end def clean(para) - para.gsub!(/<\\~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,'<\1>') + para.gsub!(/#{Mx[:id_o]}\\~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'<\1>') para.gsub!(/\s*[,:]\s*/,' - ') para.gsub!(/<:#>/,'') para.strip! @@ -249,21 +249,21 @@ WOK "* #{para}::" end def level1 - @para.gsub!(/[1]\\+~/,'') + @para.gsub!(/#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}\s*/,'') para=clean(@para) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" @para.gsub!(/.+/,"#{para}") end def level2 - @para.gsub!(/[2]\\+~/,'') + @para.gsub!(/#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}\s*/,'') para=clean(@para) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" @para.gsub!(/.+/,"#{para}") end def level3 - @para.gsub!(/[3]\\+\~/,'') + @para.gsub!(/#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}\s*/,'') para=clean(@para) nd=para.gsub(/@footnote\{.+?\}\s+/,'') #para=para.gsub(/(.+?)\s*(@footnote\{.+?\})\s*(.+)$/,"\\1 \\3\n\\2") @@ -272,21 +272,21 @@ WOK @para.gsub!(/.+/,"#{para}") end def level4 - @para.gsub!(/[4]\\+~\S+/,'') + @para.gsub!(/#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*/,'') para=clean(@para) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" @para.gsub!(/.+/,"#{para}") end def level5 - @para.gsub!(/[5]\\+~\S+/,'') + @para.gsub!(/#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*/,'') para=clean(@para) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" @para.gsub!(/.+/,"#{para}") end def level6 - @para.gsub!(/[6]\\+~\S+/,'') + @para.gsub!(/#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*/,'') para=clean(@para) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" @@ -313,16 +313,16 @@ WOK @para.gsub!(/<:i2>(.*)/,'\1') end def spec_char # special characters - @para.gsub!(/<EOF>/i,'') - @para.gsub!(/©/,'(c)') - @para.gsub!(/&(lt|#060);/,'<'); @para.gsub!(/&(gt|#062);/,'>') - @para.gsub!(/{/,'{'); @para.gsub!(/}/,'}') - @para.gsub!(/&#(126|152);/i,'~') - @para.gsub!(/!/,'!') - @para.gsub!(/#/,'#') - @para.gsub!(/*/,'*') - @para.gsub!(///,'/') - @para.gsub!(/_/,'_') + @para.gsub!(/#{Mx[:br_eof]}/i,'') + @para.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'(c)') + @para.gsub!(/#{Mx[:gl_o]}#(?:lt|060)#{Mx[:gl_c]}/,'<'); @para.gsub!(/#{Mx[:gl_o]}(gt|#062)#{Mx[:gl_c]}/,'>') + @para.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'); @para.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}') + @para.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~') + @para.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') + @para.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') + @para.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') + @para.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') + @para.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') @para.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ') @para.gsub!(/\\/,'\\backslash ') @para.gsub!(/<:pb>/,'\\newpage') @@ -375,9 +375,9 @@ WOK def longtable @end_table="\\end{longtable}" @row_break='\\\\\\' - if @para[/<!Th?¡\s+c(\d+);(.+?)!>/ui] + if @para[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] #CHECK !> closure no_of_cols,cols_width=$1,$2 - @@tableheader=1 if @para =~ /<!Th/i + @@tableheader=1 if @para =~ /#{Mx[:gr_o]}Th/i @w=cols_width.split(/;\s+/) @@number_of_cols=no_of_cols @colW=[] @@ -390,17 +390,17 @@ WOK @colW=@colW.join @@start_table="\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{longtable}[hb]#@colW\n" - @para.gsub!(/<!Th?¡\s+c\d+?;.+!>/u,"#{@@start_table}") + @para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") end - if @para =~/<!TZ!>/ - @para.gsub!(/<!TZ!>/," #@end_table") + if @para =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @para.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table") end - @para.gsub!(/<!¡/u,'') + @para.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') if @@tableheader==1 - if @para =~/¡\d+?¡(.+?)(?:¡|!)/u + if @para =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u tablefoot=para[/\<!f(.+?)!\>/,1] @para.gsub!(/\<!f(.+?)!\>/,'') - @para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u, + @para.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u, "{\\begin{tiny} {\\bfseries \\1}\\end{tiny}}&") @para.gsub!(/&>\s*$/, " #@row_break \\hline\\endhead #@row_break") @@ -409,8 +409,8 @@ WOK @@number_of_cols=0 end else - if @para =~/¡\d+?¡(.+?)(?:¡|!)/u - @para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,"\\begin{tiny}\\1\\end{tiny}&") + if @para =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u + @para.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&") @para.gsub!(/&>\s*$/," #@row_break") end end @@ -423,7 +423,7 @@ WOK @end_table="\\end{tabular}" @row_break='\\\\\\\\' @break_page="#@row_break\n#@row_break \n" - if @para[/<!Th?¡\s+c(\d+);(.+?)!>/ui] + if @para[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] no_of_cols,cols_width=$1,$2 @w=cols_width.split(/;\s+/) @colW=[] @@ -432,13 +432,13 @@ WOK @colW << "p{#{col_w}cm}" if col_w end @@start_table="\\begin{tabular}{#@colW}\n" - @para.gsub!(/<!Th?¡\s+c\d+?;.+!>/u,"#{@@start_table}") + @para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") end - if @para =~/<!TZ!>/ - @para.gsub!(/<!TZ!>/,"#@end_table") + if @para =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @para.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#@end_table") @@table_pg_break_counter=1 end - if @para =~/<!¡/u + if @para =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u if @@table_pg_break_counter==28 # taken from 34 ideal for portrait to 28 which suits landscape @para = "\n\n#@end_table \n" + @@ -446,14 +446,14 @@ WOK "#{@@start_table}\n" @@table_pg_break_counter=1 else - @para.gsub!(/<!¡/u,'') + @para.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') @@table_pg_break_counter+=1 tablefoot=@para[/\<!f(.+?)!\>/] @para.gsub!(/\<!f(.+?)!\>/,'') end end - if @para =~/¡\d+?¡(.+?)(?:¡|!)/u - @para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,"\\begin{tiny}\\1\\end{tiny}&") + if @para =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u + @para.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&") @para.gsub!(/&>\s*$/,"#@row_break") end @para diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index 1d37b588..8d951dfb 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -72,7 +72,7 @@ module SiSU_TeX @@tabular="{tabular}" @@column_instruct=@@squigle_close=@@tex_line_mode=@@tex_word_mode=@@line_mode='' @@tex_debug_counter=@@table_pagebreak_counter=@@tex_footnote_call_counter=@@tex_table_flag=@@tex_counter=@@tex_column=@@tex_columns=@@tex_columns=@@counting=0 - @@tex_pattern_margin_number="\\\\begin\\\{tiny\\\}~\\\\end\\\{tiny\\\}\\\{\\\\marginpar.+?\s+" + @@tex_pattern_margin_number=/\\\\begin\\\{tiny\\\}~\\\\end\\\{tiny\\\}\\\{\\\\marginpar.+?\s+/ #@@tex_pattern_margin_number="\\\\marginpar.+?\s+" @@n=@@tableheader=@@rights=nil @@date ||=SiSU_Env::Info_date.new @@ -116,12 +116,10 @@ module SiSU_TeX tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{path}/#{@md.fnb}/#{@md.fn[:pdf_p]}") tell.flow if @opt.cmd =~/[MVv]/ @md=@particulars.md - my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) + SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) $flag=@md.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format @dir_o="#{@env.path.output}/#{@opt.fnb}" directories - filename_index="#{@md.txt_path}/pdf" - newfilename=filename_index #% needed needs to be reprogrammed !!! SiSU_Env::Info_skin.new(@md).select dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here @@ -160,33 +158,49 @@ module SiSU_TeX def initialize(md,env) @md,@env=md,env end - def latex_do(texfilename) + def latex_do(texfilename,papersize) @texfilename=texfilename @@n_lpdf=@@n_lpdf+1 - tell=SiSU_Screen::Ansi.new(@md.cmd,'portrait ->') + tell=SiSU_Screen::Ansi.new(@md.cmd,"#{papersize} portrait ->") tell.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/ - 2.times { |i| cmd.latex2pdf(@md) unless ("#{tex_fn_base}.tex" !~/\w+/) } + 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,'landscape ->') + tell=SiSU_Screen::Ansi.new(@md.cmd,"#{papersize} landscape ->") tell.dark_grey_title_hi if @md.cmd =~/[MVv]/ cmd=SiSU_Env::System_call.new("#{tex_fn_base}.landscape.tex",'',@md.cmd) tell.grey_open - 2.times { |i| cmd.latex2pdf(@md) unless ("#{tex_fn_base}.landscape.tex" !~/\w+/) } + if "#{tex_fn_base}" =~/\w+/ \ + and "#{papersize}" =~/\w+/ + 2.times { |i| cmd.latex2pdf(@md,papersize) } + end tell.p_off unless @md.cmd =~/q/ pwd=Dir.pwd portrait_pdf="#{pwd}/#{tex_fn_base}.pdf" landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf" + case papersize + when /a4/; pdf_p=@md.fn[:pdf_p_a4]; pdf_l=@md.fn[:pdf_l_a4] + when /a5/; pdf_p=@md.fn[:pdf_p_a5]; pdf_l=@md.fn[:pdf_l_a5] + when /b5/; pdf_p=@md.fn[:pdf_p_b5]; pdf_l=@md.fn[:pdf_l_b5] + when /letter/; pdf_p=@md.fn[:pdf_p_letter]; pdf_l=@md.fn[:pdf_l_letter] + when /legal/; pdf_p=@md.fn[:pdf_p_legal]; pdf_l=@md.fn[:pdf_l_legal] + else pdf_p=@md.fn[:pdf_p_a4]; pdf_l=@md.fn[:pdf_l_a4] + end if FileTest.file?(portrait_pdf) - cp(portrait_pdf,"#@dir_sisu/#{@md.fnb}/#{@md.fn[:pdf_p]}") + cp(portrait_pdf,"#@dir_sisu/#{@md.fnb}/#{pdf_p}") rm(portrait_pdf) + else p "here #{__FILE__} #{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.cmd.inspect =~/M/ end if FileTest.file?(landscape_pdf) - cp(landscape_pdf,"#@dir_sisu/#{@md.fnb}/#{@md.fn[:pdf_l]}") + cp(landscape_pdf,"#@dir_sisu/#{@md.fnb}/#{pdf_l}") rm(landscape_pdf) + else p "here #{__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/ @@ -198,25 +212,50 @@ module SiSU_TeX @tex_f_no=0 info={} if FileTest.file?(@env.source_file_with_path) - if @md.fns =~/\.(?:-|ssm\.)?sst$/ - @dirout=SiSU_Env::Info_env.new(@md.fns) - case @md.fns - when /\.(?:-|ssm\.)?sst$/ - if FileTest.directory?(@env.path.tex)==true - Dir.chdir(@env.path.tex) - @dir_sisu=@dirout.path.output - texfile=@md.fns.gsub(/$/,'.tex') - texfile=texfile.gsub(/~/,'-') - if File.exist?(texfile) \ - and File.size(texfile) > 0 - @tex_f_no+=1 - latex_do(texfile) - else - puts "\tzero file size #{@env.path.tex}/#{@md.fns}" + @md.papersize_array.each do |ps| + if @md.fns =~/\.(?:-|ssm\.)?sst$/ + @dirout=SiSU_Env::Info_env.new(@md.fns) + case @md.fns + when /\.(?:-|ssm\.)?sst$/ + if FileTest.directory?(@env.path.tex)==true + Dir.chdir(@env.path.tex) + @dir_sisu=@dirout.path.output + texfile=@md.fns.gsub(/$/,".#{ps}.tex") + texfile=texfile.gsub(/~/,'-') + if File.exist?(texfile) \ + and File.size(texfile) > 0 + @tex_f_no+=1 + latex_do(texfile,ps) + else + puts "\tzero file size #{@env.path.tex}/#{texfile}" + end end end end end + outputdir="#@dir_sisu/#{@md.fnb}" + case @md.papersize_array[0] #default pdf + when /a4/; pdf_p=@md.fn[:pdf_p_a4]; pdf_l=@md.fn[:pdf_l_a4] + when /a5/; pdf_p=@md.fn[:pdf_p_a5]; pdf_l=@md.fn[:pdf_l_a5] + when /b5/; pdf_p=@md.fn[:pdf_p_b5]; pdf_l=@md.fn[:pdf_l_b5] + when /letter/; pdf_p=@md.fn[:pdf_p_letter]; pdf_l=@md.fn[:pdf_l_letter] + when /legal/; pdf_p=@md.fn[:pdf_p_legal]; pdf_l=@md.fn[:pdf_l_legal] + else pdf_p=@md.fn[:pdf_p_a4]; pdf_l=@md.fn[:pdf_l_a4] + end + if FileTest.file?("#{outputdir}/#{pdf_p}") + system(" + cd #{outputdir} + rm portrait.pdf + ln -s #{pdf_p} portrait.pdf + ") + end + if FileTest.file?("#{outputdir}/#{pdf_l}") + system(" + cd #{outputdir} + rm landscape.pdf + ln -s #{pdf_l} landscape.pdf + ") + end else tell=SiSU_Screen::Ansi.new(@md.cmd,"FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped") tell.warn @@ -232,7 +271,14 @@ module SiSU_TeX #include SiSU_Param @@tex_backslash ||="\\\\" @@tilde='\\\\\\~' #?? debug crazy - @@tex_head={ :p => nil, :l => nil } + @@tex_head={ + 'a4'=>{:p => nil, :l => nil}, + 'a5'=>{:p => nil, :l => nil}, + 'b5'=>{:p => nil, :l => nil}, + 'letter'=>{:p => nil, :l => nil}, + 'legal'=>{:p => nil, :l => nil}, + 'book'=>{:p => nil, :l => nil} + } @@flag_alt,@@flag_group,@@flag_code=false,false,false @@dp,@@prefix_b=nil,nil def initialize(particulars) @@ -260,30 +306,30 @@ module SiSU_TeX tell.txt_grey unless @md.cmd =~/q/ if @md.dc_rights use=@md.dc_rights.dup #dup is necessary, else contents of :rights changed - do_mono=SiSU_TeX_Pdf::Format_text_object.new(@md,use) + sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,use) copymark=if @md.creator_copymark; '{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} ' else '' end copymark='Copyright {\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} ' - copyright=do_mono.special_characters_safe.gsub(/^\s*Copyright \(C\)/, copymark) + copyright=sp_char.special_characters_safe.gsub(/^\s*Copyright \(C\)/, copymark) @@rights||="\n #{@@tex_backslash*2}[3]\\ \\linebreak #{copyright}" end if @md.prefix_b - do_mono=SiSU_TeX_Pdf::Format_text_object.new(@md,@md.prefix_b) - prefix_b=do_mono.special_characters_safe + sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,@md.prefix_b) + prefix_b=sp_char.special_characters_safe @@prefix_b="\n #{@@tex_backslash*2}[3]\\ \\linebreak \\ #{prefix_b}\n" unless @@prefix_b end data=pre(data) data=footnote(data) if @md.flag_tables - data=tables(data) + data=tables(data) end ocn=if @md.markup.inspect =~/no_ocn/ \ or @md.mod.inspect =~/--no-ocn/ \ or @skin_no_ocn false - else true - end + else true + end data=number_paras(data,ocn) data=markup(data) output(data) @@ -298,22 +344,22 @@ module SiSU_TeX # DEBUG 2003w16 this is a kludge, because i could not get parameters # from param, Sort out ... revert to more elegant solution # even more of a kludge as had to insert newlines where code is used not satisfactory, think about - para=if para =~/<:br>|\n/; para.split(/<:br>|\n/) + para=if para =~/#{Mx[:br_nl]}|\n/; para.split(/#{Mx[:br_nl]}|\n/) else para end if para.class == String - @md.flag_tables=true if para =~/<!Th?¡\s+c/u - do_mono=SiSU_TeX_Pdf::Format_text_object.new(@md,para) - @tex_file << do_mono.special_characters + @md.flag_tables=true if para =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c/u + sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,para) + @tex_file << sp_char.special_characters elsif para.class == Array para.each do |grp| - @md.flag_tables=true if grp =~/<!Th?¡\s+c/u - do_mono=SiSU_TeX_Pdf::Format_text_object.new(@md,grp) - @tex_file << do_mono.special_characters + @md.flag_tables=true if grp =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c/u + sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,grp) + @tex_file << sp_char.special_characters end end end - data=@tex_file.delete_if {|x| x =~/^\s*0#{@@tilde}/} + data=@tex_file.delete_if {|x| x =~/^\s*#{Rx[:meta]}/} @tex_file end def footnote(data) @@ -321,29 +367,34 @@ module SiSU_TeX data.each do |para| # EMBEDDED FOOTNOTES / ENDNOTES should be straightforward but not quite a synch. footnote=[] - if para =~/~\\\{[\d*+]+\s|\\\~\[([*+]\d+)\s/ # note escape not necessary in front of ~ has implications for many other matches #debug note - para.gsub!(/\\~\\\{(\d+)\s+(.+?)<#@dp>\\\}\\~/m,"\\footnote[\\1]{%\n \\2} ") #removed space before \\footnote 2004w21, watch - para.gsub!(/\\~\[([*+]\d+)\s+(.+?)<#@dp>\]\\~/m,"\\FootnoteA{\\1}{%\n \\2} ") #work on asterisk footnotes - para.gsub!(/\\~\\\{([*+]+)\s+(.+?)<#@dp>\\\}\\~/m,"\\FootnoteA{\\1}{%\n \\2} ") #work on asterisk footnotes + if para =~/#{Mx[:en_a_o]}[\d*+]+\s|#{Mx[:en_b_o]}([*+]\d+)\s/ # note escape not necessary in front of ~ has implications for many other matches #debug note + para.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/m,"\\footnote[\\1]{%\n \\2} ") #removed space before \\footnote 2004w21, watch + para.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ") #work on asterisk footnotes + para.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ") #work on asterisk footnotes end @tex_file << para end @tex_file end def tables_hash(md,para) - para_p=para.dup #visit - do_mono_l=SiSU_TeX_Pdf::Format_text_object.new(md,para) - do_mono_p=SiSU_TeX_Pdf::Format_text_object.new(md,para_p) - block={ - :l => do_mono_l.longtable_landscape, - :p => do_mono_p.longtable_portrait - } + @block={} + @para=para + @md.papersize_array.each do |ps| + @@tableheader={ ps => { :p => 0, :l => 0 }} + para,para_p=@para.dup,@para.dup #visit + format_l=SiSU_TeX_Pdf::Format_text_object.new(md,para,ps) + format_p=SiSU_TeX_Pdf::Format_text_object.new(md,para_p,ps) + @block[ps]={ + :l => format_l.longtable_landscape, + :p => format_p.longtable_portrait + } + end + @block end def tables(data) - @@tableheader={ :p => 0, :l => 0 } @tex_file=[] data.each do |para| - @tex_file << if para =~/¡|<!T/u + @tex_file << if para =~/#{Mx[:tc_p]}|#{Mx[:gr_o]}T/u tables_hash(@md,para) #Hash result else para end @@ -361,31 +412,31 @@ module SiSU_TeX def markup_common(para) tex_f=nil mono=SiSU_TeX_Pdf::Format_text_object.new(@md,para) - if para =~/<:(?:code|alt|verse|group)>/ \ + if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/ \ or @@flag_alt - if para =~/<:(?:code|alt|verse|group)>/ + if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/ @lineone=case para - when /<:(?:alt|verse|group)>/; para - when /<:code>/; "#{@tex.paraskip_small} \\begin{scriptsize} " + para + when /#{Mx[:gr_o]}(?:alt|verse|group)#{Mx[:gr_c]}/; para + when /#{Mx[:gr_o]}code#{Mx[:gr_c]}/; "#{@tex.paraskip_small} \\begin{scriptsize} " + para else 'error' #should never occur end end if para =~/<=curly/ #takes care of escaped curly braces, expand - do_mono=SiSU_TeX_Pdf::Format_text_object.new(@md,para) - para=do_mono.special_characters_curly(para) + sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,para) + para=sp_char.special_characters_curly(para) end - regx=/<:((?:code|alt|verse|group)(?:-end)?)>/m + regx=/#{Mx[:gr_o]}((?:code|alt|verse|group)(?:-end)?)#{Mx[:gr_c]}/m + x=nil x=regx.match(para)[1] if para =~regx - x=$1 - para.gsub!(/\n<:(?:code|alt|verse|group)>\n/m,'') + para.gsub!(/\n#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}\n/m,'') para=enclose(para,'code') unless para =~/^$/ if x =~/(?:alt|verse|group)/; @@flag_alt=true if x =~/group/; @@flag_group=true end elsif x =~/code/; @@flag_alt,@@flag_code=true,true - elsif @@flag_alt; + elsif @@flag_alt if para =~ /\}(?:https?|file|ftp)/m - para=mono.http #(@orientation) + para=SiSU_TeX_Pdf::Format_text_object.new(@md,para,'a4').http end @group_collect << para #<< "\n\n" end @@ -400,67 +451,84 @@ module SiSU_TeX group_collect=[] group_collect << '\begin{footnotesize} ' unless @@flag_code @group_collect.each do |x| - x.gsub!(/(<:\S+>|<!.*?!>|<!>)/,' ') + x.gsub!(/(<:\S+>|#{Mx[:id_o]}.*?#{Mx[:id_c]}|#{Mx[:tc_o]}.*?#{Mx[:tc_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') #Mx fix x=x.split(/ \\\\ /) group_collect << x end group_collect << ' \end{footnotesize} ' unless @@flag_code @group_collect=group_collect.flatten - @lineone.gsub!(/(<:\S+>|<!.*?!>|<!>)/,' ') + @lineone.gsub!(/(<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') #@group_collect.each{ |x| x.gsub!(/(.#{@@tilde}\S*\s*|<:\S+>|<!.*?!>|<!>)/,' ') } - #@lineone.gsub!(/(.#{@@tilde}\S*\s*|<:\S+>|<!.*?!>|<!>)/,' ') insert=[] - if para =~/<:code-end>/m + insert=if para =~/#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/m insert << y + @lineone << @group_collect << ' \end{scriptsize}' << " #{@tex.paraskip_normal}" else insert << y + @lineone << @group_collect end + para.gsub!(/(<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') @@flag_alt,@@flag_group,@@flag_code=false,false,false @group_collect=[] - para.gsub!(/(<:\S+>|<!.*?!>|<!>)/,' ') - #para.gsub!(/(.#{@@tilde}\S*\s*|<:\S+>|<!.*?!>|<!>)/,' ') #@tex_file << insert.flatten - tex_f = insert.flatten + tex_f=insert.flatten end + para=tex_f else - if para =~ /\}(?:https?|file|ftp)/ - para=mono.http #(@orientation) - end + #if para =~ /\}(?:https?|file|ftp)/ + # para=mono.http #(@orientation) + #end case para - when /^1#{@@tilde}/; mono.level1 - when /^2#{@@tilde}/; mono.level2 - when /^3#{@@tilde}/; mono.level3 - when /^4#{@@tilde}/; mono.level4 - when /^5#{@@tilde}/; mono.level5 - when /^6#{@@tilde}/; mono.level6 - when /^<:i([1-9])>/; mono.indent($1) - when /<:=/; mono.symbol_graphic #watch - when /^\s*<:image\s+/; mono.image - when /\}image/; mono.png + when /^#{Mx[:lv_o_1]}/; mono.level1 + when /^#{Mx[:lv_o_2]}/; mono.level2 + when /^#{Mx[:lv_o_3]}/; mono.level3 + when /^#{Mx[:lv_o_4]}/; mono.level4 + when /^#{Mx[:lv_o_5]}/; mono.level5 + when /^#{Mx[:lv_o_6]}/; mono.level6 + when /^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/; mono.indent($1) + when /<:=/; mono.symbol_graphic #watch + when /^\s*<:image\s+/; mono.image + when /\}image/; mono.png else para.strip! para=enclose(para) unless para =~/^$/ end - para.gsub!(/(\.#{@@tilde}\S*\s*|<:\S+>|<!.*?!>|<!>)/,' ') #% tread with care + para.gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,' \\\\\\\\ ') #% tread with care + para.gsub!(/(\.#{@@tilde}\S*\s*|<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') #% tread with care #para.gsub!(/(.#{@@tilde}(?:\\~\S+)?\s*|<:\S+>|<!.*?!>|<!>)/,' ') #KEEP reference, problem escaping open curly braces \{ if para =~/<=curly/ #takes care of escaped curly braces, expand - do_mono=SiSU_TeX_Pdf::Format_text_object.new(@md,para) - para=do_mono.special_characters_curly(para) + sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,para) + para=sp_char.special_characters_curly(para) + end + para + end + if para =~ /\}(?:https?|file|ftp)/ + para=if para !~/\.(?:png|jpg|gif)/ + SiSU_TeX_Pdf::Format_text_object.new(@md,para,'a4').http + else + @block={} + @md.papersize_array.each do |ps| + image=SiSU_TeX_Pdf::Format_text_object.new(@md,para,ps).http + @block[ps]={ + :l => image, + :p => image + } + end + @block end - tex_f = para end - tex_f + para end def markup(data) @tex_file=[] md={} #% document headers watch special characters in title & subtitle: glark "\{\{~(sub)?title.+?[$&%#_\{\}]" *.(lm|er)?? - home=@vz.txt_home.gsub(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>|\\\\/,' - ') #no line splitting in heading neither html nor latex - title=@md.title.gsub(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>|\\\\/,' - ') #no line splitting in heading neither html nor latex - subtitle=@md.subtitle.gsub(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>|\\\\/,' - ') if @md.subtitle #no line splitting in heading neither html nor latex - orient_portrait=SiSU_TeX_Pdf::Format_text_object.new(@md,'portrait',"#{home}: - #{title} #{subtitle}") - orient_landscape=SiSU_TeX_Pdf::Format_text_object.new(@md,'landscape',"#{home}: - #{title} #{subtitle}") - @@tex_head[:p]=orient_portrait.document_head_with_orientation - @@tex_head[:l]=orient_landscape.document_head_with_orientation + home=@vz.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex + title=@md.title.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex + subtitle=@md.subtitle.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') if @md.subtitle #no line splitting in heading neither html nor latex + @md.papersize_array.each do |ps| + orient_portrait=SiSU_TeX_Pdf::Format_head.new(@md,ps,'portrait',"#{home}: - #{title} #{subtitle}") + orient_landscape=SiSU_TeX_Pdf::Format_head.new(@md,ps,'landscape',"#{home}: - #{title} #{subtitle}") + @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation + @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation + end @tex_file <<<<WOK #{@tex.header}#{@tex.footer} \\tolerance=500 @@ -481,8 +549,8 @@ WOK @tex_file << x x=nil if @md.dc_creator - do_mono=SiSU_TeX_Pdf::Format_text_object.new(@md,@md.dc_creator) - creator=do_mono.special_characters + sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,@md.dc_creator) + creator=sp_char.special_characters @tex_file << if @md.creator_home <<WOK @@ -533,10 +601,26 @@ WOK if para.class == String para=markup_common(para) elsif para.class == Hash - para={ - :p => markup_common(para[:p]), - :l => markup_common(para[:l]) - } + if ( para['a4'] or para['a5'] or para['b5'] \ + or para['letter'] or para['legal']) + @md.papersize_array.each do |ps| + if para[ps] + if (para[ps][:p] and para[ps][:l]) + para[ps]={ + :p => markup_common(para[ps][:p]), + :l => markup_common(para[ps][:l]) + } + else p "here #{__FILE__} #{__LINE__}" if @md.cmd.inspect =~/M/ + end + end + end + elsif (para[:p] and para[:l]) + para = { + :p => markup_common(para[:p]), + :l => markup_common(para[:l]) + } + else p "here #{__FILE__} #{__LINE__}" if @md.cmd.inspect =~/M/ + end end @tex_file << para end @@ -553,7 +637,7 @@ WOK url=%<#{l[:url]}> url.gsub!(/(?:\\)*([$&~%_#}{^])/,"\\\\\\1") #latex special chars s_lnk=l[:say] - s_lnk.gsub!(/(<br>|<br \/>|<p>|<p \/>)/,'') + s_lnk.gsub!(/\s*(#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]})\s*/,' \\\\\\\\ ') s_lnk.gsub!(/(?:\\)*([$&~%_#}{^])/,"\\\\\\1") #latex special chars if url !~/^\.(\.)?\// s_lnk_url=%<\\begin{scriptsize}\\href{#{url}}{#{url}}\\end{scriptsize}> # note this bit of dereferencing magic @@ -589,77 +673,116 @@ WOK @tex_file << "\n\\end{document}" end def number_paras_numbering(para,ocn) - if para =~/<\\~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ \ - and para !~/\\end\{longtable\}|<EOF>/ #catch <!TZ!> - m=/(.+?)<\\~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m + if para =~/#{Mx[:id_o]}\\~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ \ + and para !~/\\end\{longtable\}|#{Mx[:br_eof]}/ #catch <!TZ!> + m=/(.+?)#{Mx[:id_o]}\\~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m parablock=para[m,1] paranum=if ocn; para[m,2] else '' end do_duo=SiSU_TeX_Pdf::Format_text_object.new(@md,parablock,paranum) para=do_duo.para_num if parablock - elsif para =~/^<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ #2005 this is added for tables, rationalise - m=/<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m + elsif para =~/^#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #2005 this is added for tables, rationalise + m=/#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m paranum=para[m,1] - para.gsub!(/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>/,'') + para.gsub!(/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') para="\\marginpar{\\begin{tiny}#{paranum}\\end{tiny}}" + para - elsif para =~/^<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+>/ #extra 2005 this is added for tables, rationalise - m=/<~(\d+);[oh]\d+;\w\d+>/m + elsif para =~/^#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/ #extra 2005 this is added for tables, rationalise + m=/#{Mx[:id_o]}~(\d+);[oh]\d+;\w\d+#{Mx[:id_c]}/m paranum=para[m,1] - para.gsub!(/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+>/,'') + para.gsub!(/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/,'') para="\\marginpar{\\begin{tiny}#{paranum}\\end{tiny}}" + para elsif para =~/\\end\{longtable\}/ #catch <!TZ!> - para.gsub!(/<\\~\d+>|<\\~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+><#@dp:#@dp>/,'') - para.gsub!(/<\\~\d+>|<\\~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+>/,'') #extra + para.gsub!(/#{Mx[:id_o]}\\~\d+#{Mx[:id_c]}|#{Mx[:id_o]}\\~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') + para.gsub!(/#{Mx[:id_o]}\\~\d+#{Mx[:id_c]}|#{Mx[:id_o]}\\~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/,'') #extra end para end def number_paras(data,ocn) tex_file=[] data.each do |para| - para=if para.class == Hash \ - and (para[:p] and para[:l]) - para = { - :p => number_paras_numbering(para[:p],ocn), - :l => number_paras_numbering(para[:l],ocn) - } + para=if para.class == Hash + if ( para['a4'] or para['a5'] or para['b5'] \ + or para['letter'] or para['legal']) + @para={} + @md.papersize_array.each do |ps| + if para[ps] + if (para[ps][:p] and para[ps][:l]) + @para[ps]={ + :p => number_paras_numbering(para[ps][:p],ocn), + :l => number_paras_numbering(para[ps][:l],ocn) + } + else p "here #{__FILE__} #{__LINE__}" if @md.cmd.inspect =~/M/ + end + end + end + elsif (para[:p] and para[:l]) + @para = { + :p => number_paras_numbering(para[:p],ocn), + :l => number_paras_numbering(para[:l],ocn) + } + else p "here #{__FILE__} #{__LINE__}" if @md.cmd.inspect =~/M/ + end else #elsif para.class == String - number_paras_numbering(para,ocn) + @para=number_paras_numbering(para,ocn) end - tex_file << para + tex_file << @para end tex_file end def output(array) array.flatten! array.compact! + @array=array fns_l=@md.fns.gsub(/~/,'-') #this is a sorry fix, but necessary as it appears latex programs like not ~ - filename_tex_landscape=File.new("#{@env.path.tex}/#{fns_l}.landscape.tex",'w+') - filename_tex_portrait=File.new("#{@env.path.tex}/#{fns_l}.tex",'w+') - filename_tex_portrait << @@tex_head[:p] - filename_tex_landscape << @@tex_head[:l] - array.each do |para| - case para - when String - para.gsub!(/^\s+/,'') - if para !~/\A\s*\Z/ - filename_tex_portrait.puts para,"\n" - filename_tex_landscape.puts para,"\n" - end - when Hash - para[:p].gsub!(/^\s+/,'') - para[:l].gsub!(/^\s+/,'') - if para[:p] !~/\A\s*\Z/ - filename_tex_portrait.puts para[:p],"\n" - end - if para[:l] !~/\A\s*\Z/ - filename_tex_landscape.puts para[:l],"\n" + @md.papersize_array.each do |ps| + filename_tex_landscape=File.new("#{@env.path.tex}/#{fns_l}.#{ps}.landscape.tex",'w+') + filename_tex_portrait=File.new("#{@env.path.tex}/#{fns_l}.#{ps}.tex",'w+') + filename_tex_portrait << @@tex_head[ps][:p] + filename_tex_landscape << @@tex_head[ps][:l] + array.each do |para| + case para + when String + para.gsub!(/^\s+/,'') + if para !~/\A\s*\Z/ + filename_tex_portrait.puts para,"\n" + filename_tex_landscape.puts para,"\n" + end + when Hash + if para[ps] and (para[ps][:p] and para[ps][:l]) + para[ps][:p].gsub!(/^\s+/,'') if para[ps][:p] + para[ps][:l].gsub!(/^\s+/,'') if para[ps][:l] + if para[ps][:p] !~/\A\s*\Z/ + filename_tex_portrait.puts para[ps][:p],"\n" + end + if para[ps][:l] !~/\A\s*\Z/ + filename_tex_landscape.puts para[ps][:l],"\n" + end + elsif (para[:p] and para[:l]) + para[:p].gsub!(/^\s+/,'') if para[:p] + para[:l].gsub!(/^\s+/,'') if para[:l] + if para[:p] !~/\A\s*\Z/ + filename_tex_portrait.puts para[:p],"\n" + end + if para[:l] !~/\A\s*\Z/ + filename_tex_landscape.puts para[:l],"\n" + end + else p "here #{__FILE__} #{__LINE__}" if @md.cmd.inspect =~/M/ + end end end + array=@array + filename_tex_portrait.close + filename_tex_landscape.close end - filename_tex_portrait.close - filename_tex_landscape.close - @@tex_head={} #@@tex_head={ :p => nil, :l => nil } + @@tex_head={ + 'a4'=>{:p => nil, :l => nil}, + 'a5'=>{:p => nil, :l => nil}, + 'b5'=>{:p => nil, :l => nil}, + 'letter'=>{:p => nil, :l => nil}, + 'legal'=>{:p => nil, :l => nil}, + 'book'=>{:p => nil, :l => nil} + } array=[] end end diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index ee457ca3..0fa439f0 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -61,215 +61,22 @@ module SiSU_TeX_Pdf @@table_pg_break_counter=1 include SiSU_Viz - class Use_TeX - attr_accessor :url,:txt,:date - def initialize(md) - @md=md - @vz=SiSU_Env::Get_init.instance.skin - @date=SiSU_Env::Info_date.new # #{@date.year} - @copymark='{\\begin{footnotesize}\\raisebox{1ex}{\\copyright}\\end{footnotesize}}' - @url_brace=SiSU_Viz::Skin.new.url_decoration - end - def skip - "\n\\vspace*{\\smallskipamount} \n" - end - def paraskip_normal - '\setlength{\parskip}{1ex plus0.5ex minus0.2ex}' - end - def paraskip_small - '\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}' - end - def skip_small - #"\\smallskip{}" - end - def skip_small_vspace - "\n\\vspace*{\\smallskipamount} \n" - end - def skip_small_footnote - #"\n\\smallskip{}\n" - end - def skip_medium - "\n\\medskip{}\n\n" - end - def skip_dummy - "\n" - end - def header - "\\lhead[ ]{ }\n" + - "\\chead[ \\fancyplain{} \\bfseries \\footnotesize \\leftmark ]{ \\fancyplain{} \\bfseries \\footnotesize \\rightmark }\n" + - "\\rhead[ ]{ }\n" - end - def footer - base_prog_txt=if @md.base_program - case @md.base_program - when /kdissert/i; " \\\\ \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert}" - else '' - end - else '' - end - "\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@vz.url_sisu}}{#{@vz.txt_signature}}#{base_prog_txt}}\n" + - "\\cfoot[\\href{#{@vz.url_home}}{#{@vz.url_txt}}]{\\href{#{@vz.url_home}}{#{@vz.url_txt}}}\n" + - "\\rfoot[\\tiny \\href{#{@vz.url_sisu}}{#{@vz.txt_signature}}]{\\textrm{\\thepage}}\n" - end - def site - "\\href{#{@vz.url_home}}{#{@vz.url_txt}}" - end - def sitename #owners site, eg freeculture, free.for.all, gutenberg etc. - "\\href{#{@vz.url_home}}{#{@vz.txt_home}}" - end - def owner_chapter - "Contact Details for Original Promulgating Authority" - end - #BOOK standard dimensions - 229x156 - def newpage(orientation) - case orientation - when /landscape/ # using longtable latex package -<<WOK -\\clearpage -WOK - when /portrait/ -<<WOK -\\newpage -WOK - end - end - def sisu_rights - v=SiSU_Env::Info_version.new.get_version - base_prog_txt=if @md.base_program - case @md.base_program - when /kdissert/i; "\n\\\\ This document prepared using \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert \\ http://freehackers.org/~tnagy/kdissert/ } \\\\ Kdissert is Document Mapping software by Thomas Nagy" - else '' - end - else '' - end -<<WOK -\\\\ ~ -{\\begin{footnotesize}#{base_prog_txt} -\\\\ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\begin{tiny}[ #{v[:project]} #{v[:version]} of #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} -\\\\ Copyright #@copymark 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved. -\\\\ SiSU is software for document structuring, publishing and search (with object citation numbering), \\href{http://www.sisudoc.org}{www.sisudoc.org} -\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later, #{@url_brace.tex_open}\\href{http://www.fsf.org/licenses/gpl.html}{http://www.fsf.org/licenses/gpl.html}#{@url_brace.tex_close}. -{\\end{footnotesize} -\\\\ -WOK - end - def doc_sc_info_footnote_full -<<WOK -\\footnote{%\nGenerated by \\href{http://www.jus.uio.no/sisu}{SiSU \\ www.jus.uio.no/sisu }\\ \\newline \\scriptsize{Document version information: \\emph{sourcefile} \\uline{#{@md.fnstex}}; \\emph{version} \\uline{#{@md.sc_number}}; \\emph{date} \\uline{#{@md.sc_date}}; \\emph{time} \\uline{#{@md.sc_time}}}} -WOK - end - def doc_sc_info_footnote_brief - " \\footnote{%\nGenerated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\ \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} \\newline \\href{http://www.sisudoc.org}{www.sisudoc.org} \\\n}" - end - def doc_sc_info - v=SiSU_Env::Info_version.new.get_version -<<WOK -\\\\ -{\\begin{footnotesize} -Document version information: \\\\ -\\emph{sourcefile} \\uline{#{@md.fnstex}}; \\emph{version} \\uline{#{@md.sc_number}}; \\emph{date} \\uline{#{@md.sc_date}}; \\emph{time} \\uline{#{@md.sc_time}} \\\\ -Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu }\\- version information: \\\\ -\\uline{ #{v[:project]} #{v[:version]} of #{v[:date_stamp]}} -\\end{footnotesize}}& -WOK - end - def doc_no_sc_info - v=SiSU_Env::Info_version.new.get_version -<<WOK -\\\\ -{\\begin{small} -Document information: \\\\ -\\emph{sourcefile} \\uline{#{@md.fnstex}} \\\\ -Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\ version information: \\ -\\uline{ #{v[:project]} #{v[:version]} of #{v[:date_stamp]}} - -\\end{small}}& -WOK - end - def manifest_info - url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') - fn=@md.fn[:manifest].gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') -<<WOK -{\\begin{footnotesize} -\\\\ For alternative output formats of this document check: -\\\\ #{@url_brace.tex_open}\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{fn}}{#{@vz.url_root_http}/#{url}/#{fn}}\\end{scriptsize}#{@url_brace.tex_close} -\\end{footnotesize}}& -WOK - end - def endnotes #not used should be inserted before MetaData section which preceeds doc_tail, but is "part of document" -<<WOK -\\subsection*{Endnotes} -\\addcontentsline{toc}{section}{Endnotes} -\\ -\\listofendnotes -WOK - end - def doc_tail - dir=SiSU_Env::Info_env.new(@md.fns) - base_html="#{dir.url.root}/#{@md.fnb}" - v=SiSU_Env::Info_version.new.get_version - 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 " - end - url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') -<<WOK -\\subsection*{Information on this document copy and an unofficial List of Some web related information and sources} -\\addcontentsline{toc}{section}{Information on this document copy and an unofficial List of Some web related information and sources} -\\\\ -\"Support Open Standards and Software Libre for the Information Technology Infrastructure\" RA\\subsubsection*{Information on this document copy #{site}} -\\addcontentsline{toc}{subsection}{Information on this document copy} -{\\begin{footnotesize} -\\\\ Generated by \\href{http://www.jus.uio.no/sisu/}{SiSU} found at \\href{http://www.jus.uio.no/sisu/}{www.jus.uio.no/sisu} \\begin{tiny}[ #{v[:project]} #{v[:version]} #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.sisudoc.org}{www.sisudoc.org}. SiSU is software for document structuring, publishing and search (using SiSU: object citation numbering, markup, meta-markup, and system) Copyright #@copymark 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved. -\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later (\\href{http://www.fsf.org/licenses/gpl.html}{www.fsf.org/licenses/gpl.html}). {\\end{footnotesize} -{\\begin{small} -\\\\ W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{#{sisu_ico}}SiSU 1997, current #{@date.year_static}. \\\\ #{sitename} presentations at \\begin{bfseries}#{site}\\end{bfseries} \\\\ \\\\ #{@md.title} \\textbf{pdf} versions can be found at: \\\\ -{\\end{small} -\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}\\end{scriptsize} \\\\ -\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}\\end{scriptsize} \\\\ -\\\\\n#{@md.title} \\textbf{html} versions may be found at: \\\\ -\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:toc]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:toc]}}\\end{scriptsize} or \\\\ -\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:doc]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:doc]}}\\end{scriptsize} -\\\\ -\\\\ -\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}{SiSU Manifest} of document output and metadata may be found at: \\\\ -\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}{#{@vz.url_root_http}/#{url}/#{@md.fnl[:pre]}sisu\\_manifest#{@md.fnl[:mid]}.html#{@md.fnl[:post]}}\\end{scriptsize} -\\\\ -\\\\ - #{sitename} found at: \\begin{bfseries}#{site}\\end{bfseries}\\subsubsection*{Links that may be of interest at #{@vz.txt_home} and elsewhere:} -\\addcontentsline{toc}{subsection}{Links that may be of interest} -WOK - end - def mail_tail #not retested, the old mail_tail is commented out and appended to this program - dir=SiSU_Env::Info_env.new(@md.fns) -<<WOK -\\subsection*{Mail sender details} -\\addcontentsline{toc}{subsection}{Mail sender details} -\\\\ -Mail from: ralph@amissah.com\\\\ -44 20 8789 3452\\\\ -44 77 9669 4448 -\\\\ - \"Support Open Standards and Open Sources for the Information Technology Infrastructure\" RA -\\subsubsection*{Information on this document copy #{site}\\copyright} -Presentations' look and feel generated by \\href{http://www.jus.uio.no/sisu/}{SiSU Scribe} \\href{http://www.jus.uio.no/sisu/}{http://www.jus.uio.no/sisu/} programmed in Ruby on Debian/Gnu/Linux by Copyright \\copyright Ralph Amissah, W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{\\includegraphics*[width=35pt]{#{dir.path.image_source_tex}/sisu.png}}for #{sitename}. SiSU Scribe (sisu information structuring unit) produces Electronic Documents, i.e. it generates structured output for use in a number of file formats, including the pdf file produced here. -WOK - end - end class Format_text_object require 'iconv' require "#{SiSU_lib}/defaults" - attr_accessor :string,:string1,:string,:orientation,:url,:dir,:tex + attr_accessor :string,:string1,:orientation,:url,:dir,:tex @@sys=SiSU_Env::System_call.new @@tex_backslash="\\\\" @@tilde='\\\\\\~' #?? debug crazy - @@tex_pattern_margin_number="\\\\begin\\\{tiny\\\}~\\\\end\\\{tiny\\\}\\\{\\\\marginpar.+?\s+" - @@tableheader={ :p => 0, :l => 0 } + @@tex_pattern_margin_number=/\\begin\{tiny\}~\\end\{tiny\}\{\\marginpar.+?\}\}\}/ + @@tableheader={ + 'a4' => { :p => 0, :l => 0 }, + 'a5' => { :p => 0, :l => 0 }, + 'b5' => { :p => 0, :l => 0 }, + 'letter' => { :p => 0, :l => 0 }, + 'legal' => { :p => 0, :l => 0 } + } @@sys=SiSU_Env::System_call.new - @@flag_code=false @@dp=nil def initialize(md,string,string1=nil) @md,@string,@string1=md,string,string1 @@ -283,13 +90,14 @@ WOK @tx=SiSU_Env::Get_init.instance.tex @url_brace=SiSU_Viz::Skin.new.url_decoration @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine + @ps=string1 if string1=~/(?:a4|letter|legal|book|a5|b5)/i end def longtable_landscape @end_table='\end{longtable}' @row_break='\\\\\\' - if @string[/<!Th?¡\s+c(\d+);(.+?)!\\~(\d+;\w\d+;\w\d+)>/u] + if @string[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:tc_p]}\\~(\d+;\w\d+;\w\d+)#{Mx[:gr_c]}/u] no_of_cols,cols_width,ocn=$1,$2,$3 - tw=case @md.papersize + tw=case @ps when /a4/i; @tx.a4.landscape.w #European default, SiSU default when /letter/i; @tx.letter.landscape.w #U.S. default when /legal/i; @tx.legal.landscape.w #U.S. alternative @@ -298,9 +106,10 @@ WOK else @tx.a4.landscape.w #default currently A4 end textwidth=(tw.to_i/2) - 24 - @@tableheader[:l]=1 if @string =~/<!Th/ + @@tableheader[@ps][:l]=1 if @string =~/#{Mx[:gr_o]}Th/ w=cols_width.split(/;\s*/) - @@number_of_cols=no_of_cols + @@number_of_cols=no_of_cols ||=@@number_of_cols + #@@number_of_cols=0 unless @@number_of_cols.to_i > 0 @colW=[] @colW << '{' w.each do |x| @@ -311,39 +120,40 @@ WOK end @colW << '}' @colW=@colW.join - @start_table="<~#{ocn}>\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + + @start_table="#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{tiny}\n\\begin{longtable}#@colW\n" - @string.gsub!(/<!Th?¡\s+c\d+?;.+!\\~\d+;\w\d+;\w\d+>/u,@start_table) + @string.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,@start_table) end - if @string =~/<!TZ!>/ - @string.gsub!(/<!TZ!>/," #@end_table\n\\end{tiny}") + if @string =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @string.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table\n\\end{tiny}") end - @string.gsub!(/<!¡/u,'') - if @@tableheader[:l] == 1 - if @string =~/¡\d+?¡(.+?)(?:¡|!)/u + @string.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') + if @@tableheader[@ps][:l] == 1 + if @string =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u tablefoot=@string[/\<!f(.+?)!\>/,1] @string.gsub!(/\<!f(.+?)!\>/,'') - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,'\bfseries \1&') - @string.gsub!(/&>\s*$/," #@row_break \\hline\\endhead #@row_break") + @string.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\bfseries \1&') + @string.gsub!(/&\s*$/," #@row_break \\hline\\endhead #@row_break") @string="#@string \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot - @@tableheader[:l],@@number_of_cols=0,0 + @@tableheader[@ps][:l]=0 + #@@tableheader[@ps][:l],@@number_of_cols=0,0 end else - if @string =~/¡\d+?¡(.+?)(?:¡|!)/u - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,'\1&') - @string.gsub!(/&>\s*$/," #@row_break") + if @string =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u + @string.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,'\1&') + @string.gsub!(/&\s*$/," #@row_break") end end - @string=if ocn; "<~#{ocn}>" + @string + @string=if ocn; "#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}" + @string else @string end end def longtable_portrait @end_table='\end{longtable}' @row_break='\\\\\\' - if @string[/<!Th?¡\s+c(\d+);(.+?)!\\~(\d+;\w\d+;\w\d+)>/u] + if @string[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:tc_p]}\\~(\d+;\w\d+;\w\d+)#{Mx[:gr_c]}/u] no_of_cols,cols_width,ocn=$1,$2,$3 - tw=case @md.papersize + tw=case @ps when /a4/i; @tx.a4.portrait.w #European default, SiSU default when /letter/i; @tx.letter.portrait.w #U.S. default when /legal/i; @tx.legal.portrait.w #U.S. alternative @@ -352,9 +162,9 @@ WOK else @tx.a4.portrait.w #default currently A4 end textwidth=tw.to_i - 20 - @@tableheader[:p]=1 if @string =~/<!Th/ + @@tableheader[@ps][:p]=1 if @string =~/#{Mx[:gr_o]}Th/ w=cols_width.split(/;\s*/) - @@number_of_cols=no_of_cols + @@number_of_cols=no_of_cols ||=@@number_of_cols @colW=[] @colW << '{' w.each do |x| @@ -366,30 +176,31 @@ WOK end @colW << '}' @colW=@colW.join - @start_table="<~#{ocn}>\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + + @start_table="#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{tiny}\n\\begin{longtable}#@colW\n" - @string.gsub!(/<!Th?¡\s+c\d+?;.+!\\~\d+;\w\d+;\w\d+>/u,"#@start_table") + @string.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,"#@start_table") end - if @string =~/<!TZ!>/ - @string.gsub!(/<!TZ!>/," #@end_table\n\\end{tiny}") + if @string =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @string.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table\n\\end{tiny}") end - @string.gsub!(/<!¡/u,'') - if @@tableheader[:p] == 1 - if @string =~/¡\d+?¡(.+?)(?:¡|!)/u + @string.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') + if @@tableheader[@ps][:p] == 1 + if @string =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u tablefoot=@string[/\<!f(.+?)!\>/,1] @string.gsub!(/\<!f(.+?)!\>/,'') - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,'\bfseries \1&') - @string.gsub!(/&>\s*$/," #@row_break \\hline\\endhead #@row_break") + @string.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\bfseries \1&') + @string.gsub!(/&\s*$/," #@row_break \\hline\\endhead #@row_break") @string="#@string \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot - @@tableheader[:p],@@number_of_cols=0,0 + @@tableheader[@ps][:p]=0 + #@@tableheader[@ps][:p],@@number_of_cols=0,0 end else - if @string =~/¡\d+?¡(.+?)(?:¡|!)/u - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,'\1&') - @string.gsub!(/&>\s*$/," #@row_break") + if @string =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u + @string.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\1&') + @string.gsub!(/&\s*$/," #@row_break") end end - @string=if ocn; "<~#{ocn}>" + @string + @string=if ocn; "#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}" + @string else @string end end @@ -399,7 +210,7 @@ WOK @end_table="\\end{tabular}" @row_break='\\\\\\\\' @break_page="#@row_break\n#@row_break \n" - if @string[/<!Th?¡\s+c(\d+);(.+?)!>/u] + if @string[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/u] no_of_cols,cols_width=$1,$2 @w=cols_width.split(/;\s*/) @colW=[] @@ -408,391 +219,49 @@ WOK @colW << "p{#{col_w}cm}" if col_w end @start_table="\\begin{tabular}{#@colW}\n" - @string.gsub!(/<!Th?¡\s+c\d+?;.+!>/u,"#@start_table}") + @string.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#@start_table}") end - if @string =~/<!TZ!>/ - @string.gsub!(/<!TZ!>/,"#@end_table") + if @string =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @string.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#@end_table") @@table_pg_break_counter=1 end - if @string =~/<!¡/u + if @string =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u if @@table_pg_break_counter == 28 # taken from 34 ideal for portrait to 28 which suits landscape @string="\n\n#@end_table \n#@break_page#@start_table\n" @@table_pg_break_counter=1 else - @string.gsub!(/<!¡/u,'') + @string.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') @@table_pg_break_counter+=1 tablefoot=@string[/\<!f(.+?)!\>/,1] @string.gsub!(/\<!f(.+?)!\>/,'') end end - if @string =~/¡\d+?¡(.+?)(?:¡|!)/u - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,"\\1&") - @string.gsub!(/&>\s*$/,"#@row_break") + if @string =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u + @string.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u,"\\1&") + @string.gsub!(/&\s*$/,"#@row_break") end @string end - def pdftex_special_characters_1(string) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list - #p @@utf_8.list - #@string=Iconv.conv('ISO-8859-1', 'UTF-8', @string) - word=string.scan(/\S+|\n/) #unless line =~/^(?:0~\S|%+\s)/ - para_array=[] - string=if word - word.each do |w| # _ - / # | : ! ^ ~ - unless string =~/^(?:0~|%+ |<!Th?¡ )/um - w.gsub!(/[\\]?~/,'<=tilde>') unless w=~/^[1-6]~|~\{|\}~|~\[|\]~|^\^~\s|~\^|\*~\S+|~#|\{t~|<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ - w.gsub!(/&#(?:126|152);/,'<=tilde>') #126 usual - #w.gsub!(/&#(?:126|152);/,'<=tilde>') unless w=~/https?:\/\/\S+/ #126 usual - w.gsub!(/\\?\|||/,'<=pipe>') #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX - end - para_array << w - end - string=para_array.join(' ') - string=string.strip - string - else '' - end - string.gsub!(/<~\d+;(?:\w|[0-6]:)\d+;[umdv]\d+><#@dp:#@dp>/,'') - string.gsub!(/.+?<-#>/,'') - string.gsub!(/<EOF>/,'') - string.gsub!(/<ENDNOTES?>/,'') - #problem sequence -> - string.gsub!(/&(?:nbsp);/,'<=hardspace>') # < SiSU special character also LaTeX - string.gsub!(/&(?:lt|#060);/,'<=lt>') # < SiSU special character also LaTeX - string.gsub!(/&(?:gt|#062);/,'<=gt>') # > SiSU special character also LaTeX - string.gsub!(/{/,'<=curlyopen>') # { SiSU special character also LaTeX - string.gsub!(/}/,'<=curlyclose>') # } SiSU special character also LaTeX - string.gsub!(/&#(?:126|152);/,'<=tilde>') # ~ SiSU special character also LaTeX - string.gsub!(/#/,'\#') # # SiSU special character also LaTeX - string.gsub!(/!/,'!') # ! SiSU not really special sisu character but done, also LaTeX - string.gsub!(/*/,'*') # * should you wish to escape astrisk e.g. describing \*{bold}* - string.gsub!(/-/,'-') # - SiSU special character also LaTeX - string.gsub!(/+/,'+') # + SiSU special character also LaTeX - string.gsub!(/,/,',') # + SiSU special character also LaTeX - string.gsub!(/&/,'<=amp>') #unless @string=~/<:code>/ # / SiSU special character also LaTeX - string.gsub!(///,'<=slash>') # / SiSU special character also LaTeX - string.gsub!(/\/,'<=backslash>') # \ SiSU special character also LaTeX - string.gsub!(/_/,'<=underscore>') # _ SiSU special character also LaTeX - string.gsub!(/|/,'|') # | SiSU not really special sisu character but done, also LaTeX - string.gsub!(/:/,':') # : SiSU not really special sisu character but done, also LaTeX - string.gsub!(/^|\^/,'<=caret>') # ^ SiSU not really special sisu character but done, also LaTeX - string.gsub!(/\#/,'<=hash>') - ##watch placement, problem sequence ^ - string.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ') - string.gsub!(/<:pb>/,'\newpage') - string.gsub!(/<:pn>/,'\clearpage') - string.gsub!(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript - string - end - def pdftex_special_characters_2(string) - string.gsub!(/œ/,'\oe ') - string.gsub!(/\$/,'\$') - string.gsub!(/\#/,'\#') - string.gsub!(/\%/,'\%') - string.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes - if string !~/^\s*<:image|\}:image\s/ - string.gsub!(/_/,'\_') - end - string.gsub!(/\{/,'\{') - string.gsub!(/\}/,'\}') - string.gsub!(/ /,'~') # ~ character for hardspace - # sequence important must appear after removal of { and } - string.gsub!(/&\S+?;/,'') #hmmm - # sequence imortant place before removal of & - if string=~/<:code>/; @@flag_code=true - elsif string=~/<:code-end>/; @@flag_code=false - end - if @@flag_code; string.gsub!(/&/,'{\\\&}') - else string.gsub!(/(\s+&\s+)/,' and ') - end - string.gsub!(/§/u,'\S') #latex: space between next character not preserved? #string.gsub!(/§ /,'\S ') - string.gsub!(/£/u,'\pounds') - string.gsub!(/&\S+?;/,' ') - string.gsub!(/<a href=".+?">/,' ') - string.gsub!(/<\/a>/,' ') - string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case - string.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url - string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration - unless @@flag_code - string.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start - else #code-block: angle brackets special characters, note _ already escaped - string.gsub!(/\\_</,'{\UseTextSymbol{OML}{<}}') - string.gsub!(/\\_>/,'{\UseTextSymbol{OML}{>}}') - end - string.gsub!(/<:ee>/,'') - string.gsub!(/<!>/,' ') - #proposed change, insert, but may be redundant - string.gsub!(/ \/><:i[12]>(.+?)(?:\}~|<br)/,' \begin{ParagraphIndent}{0.01\columnwidth}\1\end{ParagraphIndent} ') # footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder - string.gsub!(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") # Work Area - string.gsub!(/<b>(.+?)<\/b>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/<em>(.+?)<\/em>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/<(bold|strong)>(.+?)<\/(bold|strong)>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/<i>(.+?)<\/i>/,'\emph{\1}') - string.gsub!(/<italic>(.+?)<\/italic>/,'\emph{\1}') - string.gsub!(/<u>(.+?)<\/u>/,'\uline{\1}') # ulem - string.gsub!(/<cite>(.+?)<\/cite>/,"``\\1''") # quote - string.gsub!(/<ins>(.+?)<\/ins>/,'\uline{\1}') # ulem - string.gsub!(/<del>(.+?)<\/del>/,'\sout{\1}') # ulem - string.gsub!(/<sub>(.+?)<\/sub>/,"\$_{\\textrm{\\1}}\$") - string.gsub!(/<sup>(.+?)<\/sup>/,"\$^{\\textrm{\\1}}\$") - unless @@flag_code - string.gsub!(/"(.+?)"/,'“\1”') # quote marks / quotations open & close " need condition exclude for code - string.gsub!(/\s+"/,' “') # open " - string.gsub!(/^([1-6-]#{@@tilde}\S*|<.+?>)?\s*"/,'\1“') # open " - string.gsub!(/"(\s|\.|,|:|;)/,'”\1') # close " - string.gsub!(/"([1-6-]#{@@tilde}\S*|<.+?>)?\s*$/,'”\1') # close " - string.gsub!(/"(\.|,)/,'”') # close " - string.gsub!(/\s+'/,' `') # open ' - string.gsub!(/^([1-6-]#{@@tilde}\S*|<.+?>)?\s*'/,'\1`') # open ' - end - string.gsub!(/^(<:i[1-9]>)?\s*\\_\*\s*/,'\1 \begin{math} \bullet \end{math}~~') #bullets - added 2004w17 watch \\_ - string.gsub!(/(<font.*?>|<\/font>)/,'') - string.gsub!(/\s*<sup>(\S+?)<\/sup>/,'^\1') - string.gsub!(/(<sup>|<\/sup>)/,'') - string - end - def pdftex_special_characters_3(string) - string.gsub!(/<br(\s*[^\/][^>])/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder - string.gsub!(/([^<][^b][^r]\s+)\/>/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder - #problem sequence (another kludge) -> - string.gsub!(/<=lt>/,'{\UseTextSymbol{OML}{<}}') - string.gsub!(/<=gt>/,'{\UseTextSymbol{OML}{>}}') - #string.gsub!(/<=lt>/,'\<') - #string.gsub!(/<=gt>/,'\>') - string.gsub!(/<=underscore>/,'\_') - string.gsub!(/(\href\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text - string.gsub!(/<=tilde>/,'{\~~}') - string.gsub!(/<=pipe>/,'{\textbar}') - string.gsub!(/<=caret>/,'{\^{~}}') - #string.gsub!(/<=caret>/,'\^{}') - string.gsub!(/<=exclaim>/,'\Verbatim{!}') - string.gsub!(/<=hash>/,'{\#}') - #string.gsub!(/<=hash>/,'{\UseTextSymbol{OT1}{#}}') - #string.gsub!(/<=slash>/,'{\slash}') - string.gsub!(/<=hardspace>/,'{~}') #changed ... 2005 - string.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005 - #string.gsub!(/<=amp>/,'{\UseTextSymbol{OT1}{&}}') - string.gsub!(/<=slash>/,'{/}') - string.gsub!(/<=backslash>/,'{\textbackslash}') - #string.gsub!(/<=asterisk>/,'*') - #string.gsub!(/<=exclaim>/,'!') - #string.gsub!(/<=asterisk>/,'{\ast}') - #string.gsub!(/<=copymark>/,"^{\\copyright} ") # watch has been problematic - #copymark='{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} ' - string.gsub!(/<=copymark>\s*(.+)?\s+(<\\~\d+;\w(?:[0-6]:)?\d+;\w\d+><#@dp:#@dp>)/,"^\\copyright \\textnormal{\\1} \\2") # watch likely to be problematic - string - end - def xetex_special_characters_1(string) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list - #p @@utf_8.list - #string=Iconv.conv('ISO-8859-1', 'UTF-8', @string) - word=string.scan(/\S+|\n/) #unless line =~/^(?:0~\S|%+\s)/ - para_array=[] - string=if word - word.each do |w| # _ - / # | : ! ^ ~ - unless string =~/^(?:0~|%+ |<!Th?¡ )/um - w.gsub!(/[\\]?~/,'<=tilde>') unless w=~/^[1-6]~|~\{|\}~|~\[|\]~|^\^~\s|~\^|\*~\S+|~#|\{t~|<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ - w.gsub!(/&#(?:126|152);/,'<=tilde>') #126 usual - #w.gsub!(/&#(?:126|152);/,'<=tilde>') unless w=~/https?:\/\/\S+/ #126 usual - w.gsub!(/\\?\|||/,'<=pipe>') #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX - end - para_array << w - end - string=para_array.join(' ') - string=string.strip - string - else '' - end - string.gsub!(/<~\d+;(?:\w|[0-6]:)\d+;[umdv]\d+><#@dp:#@dp>/,'') - string.gsub!(/.+?<-#>/,'') - string.gsub!(/<EOF>/,'') - string.gsub!(/<ENDNOTES?>/,'') - #problem sequence -> - string.gsub!(/&(?:nbsp);/,'<=hardspace>') # < SiSU special character also LaTeX - string.gsub!(/&(?:lt|#060);/,'<=lt>') # < SiSU special character also LaTeX - string.gsub!(/&(?:gt|#062);/,'<=gt>') # > SiSU special character also LaTeX - string.gsub!(/{/,'<=curlyopen>') # { SiSU special character also LaTeX - string.gsub!(/}/,'<=curlyclose>') # } SiSU special character also LaTeX - string.gsub!(/&#(?:126|152);/,'<=tilde>') # ~ SiSU special character also LaTeX - string.gsub!(/#/,'\#') # # SiSU special character also LaTeX - string.gsub!(/!/,'!') # ! SiSU not really special sisu character but done, also LaTeX - string.gsub!(/*/,'*') # * should you wish to escape astrisk e.g. describing \*{bold}* - string.gsub!(/-/,'-') # - SiSU special character also LaTeX - string.gsub!(/+/,'+') # + SiSU special character also LaTeX - string.gsub!(/,/,',') # + SiSU special character also LaTeX - string.gsub!(/&/,'<=amp>') #unless @string=~/<:code>/ # / SiSU special character also LaTeX - string.gsub!(///,'<=slash>') # / SiSU special character also LaTeX - string.gsub!(/\/,'<=backslash>') # \ SiSU special character also LaTeX - string.gsub!(/_/,'<=underscore>') # _ SiSU special character also LaTeX - string.gsub!(/|/,'|') # | SiSU not really special sisu character but done, also LaTeX - string.gsub!(/:/,':') # : SiSU not really special sisu character but done, also LaTeX - string.gsub!(/^|\^/,'<=caret>') # ^ SiSU not really special sisu character but done, also LaTeX - string.gsub!(/\#/,'<=hash>') - ##watch placement, problem sequence ^ - string.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ') - string.gsub!(/<:pb>/,'\newpage') - string.gsub!(/<:pn>/,'\clearpage') - string.gsub!(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript - string - end - def xetex_special_characters_2(string) - string.gsub!(/œ/,'\oe ') - string.gsub!(/\$/,'\$') - string.gsub!(/\#/,'\#') - string.gsub!(/\%/,'\%') - string.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes - if string !~/^\s*<:image|\}:image\s/ - string.gsub!(/_/,'\_') - end - string.gsub!(/\{/,'\{') - string.gsub!(/\}/,'\}') - string.gsub!(/ /,'~') # ~ character for hardspace - # sequence important must appear after removal of { and } - string.gsub!(/&\S+?;/,'') #hmmm - # sequence imortant place before removal of & - if string=~/<:code>/; @@flag_code=true - elsif string=~/<:code-end>/; @@flag_code=false - end - if @@flag_code; string.gsub!(/&/,'{\\\&}') - else string.gsub!(/(\s+&\s+)/,' and ') - end - string.gsub!(/§/u,'\S') #latex: space between next character not preserved? #string.gsub!(/§ /,'\S ') - string.gsub!(/£/u,'\pounds') - string.gsub!(/&\S+?;/,' ') - string.gsub!(/<a href=".+?">/,' ') - string.gsub!(/<\/a>/,' ') - string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case - string.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url - string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration - unless @@flag_code - string.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start - else #code-block: angle brackets special characters, note _ already escaped - string.gsub!(/\\_</,'{\UseTextSymbol{OML}{<}}') - string.gsub!(/\\_>/,'{\UseTextSymbol{OML}{>}}') - end - string.gsub!(/<:ee>/,'') - string.gsub!(/<!>/,' ') - #proposed change, insert, but may be redundant - string.gsub!(/ \/><:i[12]>(.+?)(?:\}~|<br)/,' \begin{ParagraphIndent}{0.01\columnwidth}\1\end{ParagraphIndent} ') # footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder - string.gsub!(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") # Work Area - string.gsub!(/<b>(.+?)<\/b>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/<em>(.+?)<\/em>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/<(bold|strong)>(.+?)<\/(bold|strong)>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/<i>(.+?)<\/i>/,'\emph{\1}') - string.gsub!(/<italic>(.+?)<\/italic>/,'\emph{\1}') - string.gsub!(/<u>(.+?)<\/u>/,'\uline{\1}') # ulem - string.gsub!(/<cite>(.+?)<\/cite>/,"``\\1''") # quote - string.gsub!(/<ins>(.+?)<\/ins>/,'\uline{\1}') # ulem - string.gsub!(/<del>(.+?)<\/del>/,'\sout{\1}') # ulem - string.gsub!(/<sub>(.+?)<\/sub>/,"\$_{\\textrm{\\1}}\$") - string.gsub!(/<sup>(.+?)<\/sup>/,"\$^{\\textrm{\\1}}\$") - unless @@flag_code - string.gsub!(/"(.+?)"/,'“\1”') # quote marks / quotations open & close " need condition exclude for code - string.gsub!(/\s+"/,' “') # open " - string.gsub!(/^([1-6-]#{@@tilde}\S*|<.+?>)?\s*"/,'\1“') # open " - string.gsub!(/"(\s|\.|,|:|;)/,'”\1') # close " - string.gsub!(/"([1-6-]#{@@tilde}\S*|<.+?>)?\s*$/,'”\1') # close " - string.gsub!(/"(\.|,)/,'”') # close " - string.gsub!(/\s+'/,' `') # open ' - string.gsub!(/^([1-6-]#{@@tilde}\S*|<.+?>)?\s*'/,'\1`') # open ' - end - #string.gsub!(/^(<:i[1-9]>)?\s*\\_\*\s*/,'\1 \begin{math} \bullet \end{math}~~') #bullets - added 2004w17 watch \\_ - string.gsub!(/^(<:i[1-9]>)?\s*\\_\*\s*/,'\1 ● ~~') - string.gsub!(/(<font.*?>|<\/font>)/,'') - string.gsub!(/\s*<sup>(\S+?)<\/sup>/,'^\1') - string.gsub!(/(<sup>|<\/sup>)/,'') - string - end - def xetex_special_characters_3(string) - string.gsub!(/<br(\s*[^\/][^>])/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder - string.gsub!(/([^<][^b][^r]\s+)\/>/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder - #problem sequence (another kludge) -> - string.gsub!(/<=lt>/,'{\UseTextSymbol{OML}{<}}') - string.gsub!(/<=gt>/,'{\UseTextSymbol{OML}{>}}') - #string.gsub!(/<=lt>/,'\<') - #string.gsub!(/<=gt>/,'\>') - string.gsub!(/<=underscore>/,'\_') - string.gsub!(/(\href\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text - string.gsub!(/<=tilde>/,'{\~~}') - string.gsub!(/<=pipe>/,'{\textbar}') - string.gsub!(/<=caret>/,'{\^{~}}') - #string.gsub!(/<=caret>/,'\^{}') - string.gsub!(/<=exclaim>/,'\Verbatim{!}') - string.gsub!(/<=hash>/,'{\#}') - #string.gsub!(/<=hash>/,'{\UseTextSymbol{OT1}{#}}') - #string.gsub!(/<=slash>/,'{\slash}') - string.gsub!(/<=hardspace>/,'{~}') #changed ... 2005 - string.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005 - #string.gsub!(/<=amp>/,'{\UseTextSymbol{OT1}{&}}') - string.gsub!(/<=slash>/,'{/}') - string.gsub!(/<=backslash>/,'{\textbackslash}') - #string.gsub!(/<=asterisk>/,'*') - #string.gsub!(/<=exclaim>/,'!') - #string.gsub!(/<=asterisk>/,'{\ast}') - #string.gsub!(/<=copymark>/,"^{\\copyright} ") # watch has been problematic - #copymark='{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} ' - string.gsub!(/<=copymark>\s*(.+)?\s+(<\\~\d+;\w(?:[0-6]:)?\d+;\w\d+><#@dp:#@dp>)/,"^\\copyright \\textnormal{\\1} \\2") # watch likely to be problematic - string - end - def special_characters_curly(string) - string.gsub!(/<=curlyopen>/,'\{') - string.gsub!(/<=curlyclose>/,'\}') - string - end - - - def special_characters_unsafe_1(string) #depreciated, make obsolete - # some substitutions are sequence sensitive, rearrange with care. - string.gsub!(/\\backslash (copyright|clearpage|newpage)/,"\\\\\\1") #kludge bad solution, find out where tail is sent through specChar ! - string - end - def special_characters #special characters - some substitutions are sequence sensitive, rearrange with care. - string=@string - case @tex2pdf - when /pdf/ - string=pdftex_special_characters_1(string) unless string.nil? - string=special_characters_unsafe_1(string) unless string.nil? #pdftex_special_characters_unsafe_1(@string) - string=pdftex_special_characters_2(string) unless string.nil? - string=pdftex_special_characters_3(string) unless string.nil? - when /xe/ - string=xetex_special_characters_1(string) unless string.nil? - string=special_characters_unsafe_1(string) unless string.nil? #xetex_special_characters_unsafe_1(@string) - string=xetex_special_characters_2(string) unless string.nil? #issues with xetex - string=xetex_special_characters_3(string) unless string.nil? - end - @string=string - end - def special_characters_safe #special characters - some substitutions are sequence sensitive, rearrange with care. - string=@string - case @tex2pdf - when /pdf/ - string=pdftex_special_characters_1(@string) unless string.nil? - string=pdftex_special_characters_2(@string) unless string.nil? - #special_characters_3(@string) - when /xe/ - string=xetex_special_characters_1(@string) unless string.nil? - string=xetex_special_characters_2(@string) unless string.nil? # remove this to start with, causes issues - end - @string=string - end - def heading_major(para,lev) + def heading_major(para,lev) #\emph{ title=@md.title para.strip! if para para.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1') cont_ln=para.dup - cont_ln.gsub!(/#{@@tex_pattern_margin_number}/,'') - cont_ln.gsub!(/#{lev}#{@@tilde}(?:\S+)?\s+/,'') + cont_ln.gsub!(@@tex_pattern_margin_number,'') + cont_ln.gsub!(/#{Mx[:lv_o]}#{lev}:\S*?#{Mx[:lv_c]}\s*/,'') if para =~/\\[Ff]ootnote/ #and para =~/^[1-6]#{@@tilde}/ # removing footnotes from headings! cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ') cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ') end - para.gsub!(/(#{@md.lev}.*)\n?$/m,"\\part*{\\1} + para.gsub!(/(#{@md.lev}.*)\n?$/m, #apparently not used @md.lev does not exist + "\\part*{\\1} \\addcontentsline{toc}{section}{#{cont_ln}} -\\markboth{#{title}}\n") if (para !~/#{lev}#{@@tilde}/) - para.gsub!(/^#{lev}#{@@tilde}\s*(.*)\n?$/m, +\\markboth{#{title}}\n") if (para !~/#{Mx[:lv_o]}#{lev}:/) + para.gsub!(/^#{Mx[:lv_o]}#{lev}:\S*?#{Mx[:lv_c]}\s*(.*)\n?$/m, "\\part*{\\1} \\addcontentsline{toc}{section}{#{cont_ln}} \\markboth{#{title}}\n") +para end def level1 heading_major(@string,1) @@ -807,14 +276,14 @@ WOK @string.strip! if @string @string.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1') cont_ln=@string.dup - cont_ln.gsub!(/#{@@tex_pattern_margin_number}/,'') + cont_ln.gsub!(@@tex_pattern_margin_number,'') cont_ln.gsub!(/#{@@tex_backslash*2}/,"#{@@tex_backslash*4}") # added w42 - cont_ln.gsub!(/4#{@@tilde}\S+\s+/,'') + cont_ln.gsub!(/#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*/,'') cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 title=@md.title @string.gsub!(/#{@md.lv4}\s+(#{@md.lv4})/m,'\1') - if @string =~/4#{@@tilde}endnotes|<:4-endnotes>/ + if @string =~/#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|<:4-endnotes>/ # watch exclusion removes endnotes marker from pdf 2003w03 @string.gsub!(/.+/m,'') end @@ -822,12 +291,12 @@ WOK cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ') cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ') end - if @string !~/4#{@@tilde}/ + if @string !~/#{Mx[:lv_o]}4:/ @string.gsub!(/(#{@md.lv4}.*)\n?$/m,"\\subsubsection*{\\1} \\addcontentsline{toc}{subsection}{#{cont_ln}} \\markright{#{title}}") else - @string.gsub!(/^\s*4#{@@tilde}\S+\s*(.*)?\n?$/m,"\\subsubsection*{\\1} + @string.gsub!(/^\s*#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*(.*)?\n?$/m,"\\subsubsection*{\\1} \\addcontentsline{toc}{subsection}{#{cont_ln}} \\markright{#{title}}") end @@ -838,8 +307,8 @@ WOK @string.strip! if @string @string.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1') cont_ln=@string.dup - cont_ln.gsub!(/#{@@tex_pattern_margin_number}/,'') - cont_ln.gsub!(/5#{@@tilde}\S*\s+/,'') + cont_ln.gsub!(@@tex_pattern_margin_number,'') + cont_ln.gsub!(/#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*/,'') cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 cont_ln.gsub!(/\\\&/,' and ') #revisit: tmp bugfix 200507, substitutes & with 'and' in toc, needed e.g. for AT&T, see ffa @@ -848,12 +317,13 @@ WOK cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ') cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ') end - if @string !~/5#{@@tilde}/ + if @string !~/#{Mx[:lv_o]}5:/ @string.gsub!(/(#{@md.lv5}.*?)\n?$/m,"\\subsubsection*{\\1} \\addcontentsline{toc}{subsubsection}{#{cont_ln} \\\\ }") else - @string.gsub!(/^\s*5#{@@tilde}\S*\s*(.*)?\n?$/m,"\\subsubsection*{\\1} + @string.gsub!(/^\s*#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*(.*)?\n?$/m, + "\\subsubsection*{\\1} \\addcontentsline{toc}{subsubsection}{#{cont_ln} \\\\ }") end @@ -864,8 +334,8 @@ WOK @string.strip! if @string @string.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1') cont_ln=@string.dup - cont_ln.gsub!(/#{@@tex_pattern_margin_number}/,'') - cont_ln.gsub!(/6#{@@tilde}\S*\s+/,'') + cont_ln.gsub!(@@tex_pattern_margin_number,'') + cont_ln.gsub!(/#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*/,'') cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 @string.gsub!(/#{@md.lv6}\s+(#{@md.lv6})/m,'\1') @@ -874,8 +344,8 @@ WOK cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ') end @string.gsub!(/(#{@md.lv6}.*)\n?$/m, - "\\subsubsection*{\\1}") if (@string !~/6#{@@tilde}/) - @string.gsub!(/^\s*6#{@@tilde}\S*\s*(.*)?\n?$/m, + "\\subsubsection*{\\1}") if (@string !~/#{Mx[:lv_o]}6:/) + @string.gsub!(/^\s*#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*(.*)?\n?$/m, '\subsubsection*{\1}') @string.gsub!(/#{@md.lv6}\s*(.marginpar)/m,'\1') #end BUGWATCH @@ -892,7 +362,7 @@ WOK when /8/; '70mm' when /9/; '80mm' end - @string.gsub!(/<:i#{lev}>\s*(.*)/m, + @string.gsub!(/#{Mx[:pa_o]}:i#{lev}#{Mx[:pa_c]}\s*(.*)/m, "\\begin{ParagraphIndent}{#{indent}}\\1 \\end{ParagraphIndent}}") end @@ -951,7 +421,6 @@ WOK end hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace caption="{\\\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" if c - #caption="{\\\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c[1]}\\end{scriptsize}&}" if c image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") dir.path.image_source_local_tex @@ -999,16 +468,16 @@ WOK z[/(\d+)x\d*/,1] else 200 end - dm=case @md.papersize - when /a4/; @tx.a4 - when /letter/; @tx.letter - when /legal/; @tx.legal - when /b5/; @tx.b5 - when /a5/; @tx.a5 - else @tx.a4 + dm=case @ps # @md.papersize + when /a4/; @tx.a4.landscape.img_px + when /letter/; @tx.letter.landscape.img_px + when /legal/; @tx.legal.landscape.img_px + when /b5/; @tx.b5.landscape.img_px + when /a5/; @tx.a5.landscape.img_px + else @tx.a4.landscape.img_px end - width=if width.to_i > dm.landscape.img_px - dm.landscape.img_px + width=if width.to_i > dm + dm else width end c=z[/``(.+?)''/m,1] @@ -1058,7 +527,54 @@ WOK end def http wm=@string.dup.scan(/\\\{.+?\\\}(?:(?:https?|file|ftp):\S+|image)|\w+\s*|./m) - @string=SiSU_TeX_Pdf::Format_text_object.new(@md,wm).http_word_mode #(orientation) + @string=SiSU_TeX_Pdf::Format_text_object.new(@md,wm,@ps).http_word_mode #GET PAPER SIZE AND USE IT + end + def title + @string=SiSU_TeX_Pdf::Special_characters.new(@md,@string).special_characters_safe + if @string1 + @string1=SiSU_TeX_Pdf::Special_characters.new(@md,@string1).special_characters_safe + @string1.gsub!(/\$/,"\\$") + "\n\\title{#@string#{@@tex_backslash*2} \\textbf{\\normalsize #@string1}\\normalsize}" + else "\n\\title{#@string}" + end + end + def title_landscape + title + end + def title_portrait + title + end + def para_num + paranumber_display=if @md.markup.inspect =~/no_ocn/ \ + or @md.mod.inspect =~/--no-ocn/ + '' + else "\\begin{tiny}~\\end{tiny}{\\marginpar{\\begin{tiny}#@string1\\end{tiny}}}" #ocn object citation numbering + end + if @string !~/^(?:#{Mx[:lv_o]}[1-6a-z-]:|#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}|<:.+?>|#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6})/ + @string.gsub!(/^\s*(.+)/m,"#{paranumber_display}\\1\n") #watch - in 1-6 is suspect + else + if (@string =~/^(?:#{Mx[:lv_o]}[1-6a-z-]:|#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})/) #watch - in 1-6 is suspect + @string.gsub!(/^(#{Mx[:lv_o]}[1-6a-z-]:\S*?#{Mx[:lv_c]})\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") #watch - in 1-6 is suspect + #@string.gsub!(/^(#{Mx[:lv_o]}[1-6a-z-]:\S*?#{Mx[:lv_c]})\s*(.+)/m,"\\1 #{paranumber_display} \\begin{bfseries}\\2 \\end{bfseries}\n") #watch - in 1-6 is suspect + #@string.gsub!(/^(#{Mx[:lv_o]}[1-6a-z-]:\S*?#{Mx[:lv_c]})\s*(.+)/m,"\\1 #{paranumber_display} \\emph{\\2}\n") #watch - in 1-6 is suspect + @string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") #WHAT? + #@string.gsub!(/^(<:.+?>)\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") #WHAT? + else + @string.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display} \\1\n") + #@string.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display} \\begin{bfseries}\\1 \\end{bfseries}\n") + #@string.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display}\\emph{\\1}\n") + end + end + @string + end + end + class Format_head + def initialize(md,ps,layout=nil,string1=nil) + @md,@ps,@layout,@string1=md,ps,layout,string1 + @tx=SiSU_Env::Get_init.instance.tex + @url_brace=SiSU_Viz::Skin.new.url_decoration + @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine + @ps=@string if @string=~/(?:a4|letter|legal|book|a5|b5)/i end def language @lang=if @md.dc_language[:code] @@ -1095,21 +611,6 @@ WOK else 'english' end end - def title - @string=Format_text_object.new(@md,@string).special_characters_safe - if @string1 - @string1=Format_text_object.new(@md,@string1).special_characters_safe - @string1.gsub!(/\$/,"\\$") - "\n\\title{#@string#{@@tex_backslash*2} \\textbf{\\normalsize #@string1}\\normalsize}" - else "\n\\title{#@string}" - end - end - def title_landscape - title - end - def title_portrait - title - end def tex_head_lang #babel 18n language #@md.dc_language[:name] @@ -1193,14 +694,14 @@ WOK end def tex_head_paper_dimensions d={} - case @string + case @layout when /portrait/ #textheight,textwidth=@tx.a4.portrait.h,@tx.a4.portrait.w d[:papertype],d[:fontsize]='a4paper','11pt' d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='0mm','0mm','-12pt' d[:headheight],d[:headsep],d[:columnsep]='12pt','35pt','' d[:marginparsep],d[:marginparwidth]='4mm','8mm' - case @md.papersize + case @ps #@md.papersize when /a4/i #European default, SiSU default d[:papertype],d[:fontsize]='a4paper','12pt' d[:textheight],d[:textwidth]=@tx.a4.portrait.h,@tx.a4.portrait.w @@ -1212,9 +713,14 @@ WOK d[:textheight],d[:textwidth]=@tx.legal.portrait.h,@tx.legal.portrait.w when /book|b5/i #book default - larger d[:papertype],d[:fontsize]='b5paper','11pt' + d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='-4mm','-4mm','-36pt' + d[:headheight],d[:headsep],d[:columnsep]='12pt','20pt','' d[:textheight],d[:textwidth]=@tx.b5.portrait.h,@tx.b5.portrait.w when /a5/i d[:papertype],d[:fontsize]='a5paper','11pt' + d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='-4mm','-4mm','-36pt' + d[:headheight],d[:headsep],d[:columnsep]='8pt','12pt','' + d[:marginparsep],d[:marginparwidth]='4mm','6mm' d[:textheight],d[:textwidth]=@tx.a5.portrait.h,@tx.a5.portrait.w else #default currently A4 d[:papertype],d[:fontsize]='a4paper','12pt' @@ -1226,7 +732,7 @@ WOK d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='-8mm','-8mm','-18mm' d[:headheight],d[:headsep],d[:columnsep]='12pt','20pt','40pt' d[:marginparsep],d[:marginparwidth]='4mm','8mm' - case @md.papersize + case @ps #@md.papersize when /a4/i #European default, SiSU default d[:papertype],d[:fontsize]='a4paper','12pt' d[:textheight],d[:textwidth]=@tx.a4.landscape.h,@tx.a4.landscape.w @@ -1240,7 +746,7 @@ WOK d[:papertype],d[:fontsize],d[:columnsep]='b5paper','11pt','35pt' d[:textheight],d[:textwidth]=@tx.b5.landscape.h,@tx.b5.landscape.w when /a5/i - d[:papertype],d[:fontsize],d[:columnsep]='a5paper','10pt','38pt' + d[:papertype],d[:fontsize],d[:columnsep]='a5paper','10pt','32pt' d[:textheight],d[:textwidth]=@tx.a5.landscape.h,@tx.a5.landscape.w else #default currently A4 d[:papertype],d[:fontsize]='a4paper','12pt' @@ -1250,8 +756,7 @@ WOK d end def tex_head_paper - d={} - case @string + case @layout when /portrait/ tex_head_paper_portrait(tex_head_paper_dimensions) when /landscape/ @@ -1259,7 +764,7 @@ WOK end end def tex_head_pdftex_dvi - color=case @string + color=case @layout when /portrait/ <<WOK colorlinks=true, @@ -1275,7 +780,7 @@ WOK linkcolor=myred, % \\href{...} and \\pageref{...} WOK end - if @string =~/portrait|landscape/ + if @layout =~/portrait|landscape/ <<WOK \\usepackage{url} \\usepackage{alltt} @@ -1383,69 +888,606 @@ WOK \\usepackage{fancyhdr} \\lhead{} \\renewcommand{\\part}{\\\@startsection -{part}% -{1}% -{-2mm}% -{-\\baselineskip}% -{0.5\\baselineskip}% -{\\bfseries\\large\\scshape}}% + {part}{1}{-2mm}% + {-\\baselineskip}{0.5\\baselineskip}% + {\\bfseries\\large\\upshape\\raggedright}} \\renewcommand{\\section}{\\\@startsection -{section}% -{2}% -{-2mm}% -{-\\baselineskip}% -{0.5\\baselineskip}% -{\\bfseries\\Large\\upshape}}% + {section}{2}{-2mm}% + {-\\baselineskip}{0.5\\baselineskip}% + {\\bfseries\\large\\upshape\\raggedright}} \\renewcommand{\\subsection}{\\\@startsection -{subsection}% -{3}% -{-2mm}% -{-\\baselineskip}% -{0.5\\baselineskip}% -{\\bfseries\\large\\upshape}}% + {subsection}{3}{-2mm}% + {-\\baselineskip}{0.5\\baselineskip}% + {\\bfseries\\large\\upshape\\raggedright}} \\renewcommand{\\subsubsection}{\\\@startsection -{subsubsection}% -{4}% -{-2mm}% -{-\\baselineskip}% -{0.5\\baselineskip}% -{\\bfseries\\normalsize\\upshape}}% + {subsubsection}{4}{-2mm}% + {-\\baselineskip}{0.5\\baselineskip}% + {\\normalfont\\normalsize\\bfseries\\raggedright}} \\renewcommand{\\paragraph}{\\\@startsection -{paragraph}% -{5}% -{-2mm}% -{-\\baselineskip}% -{0.5\\baselineskip}% -{\\normalfont\\normalsize\\itshape}}% + {paragraph}{5}{-2mm}% + {-\\baselineskip}{0.5\\baselineskip}% + {\\normalfont\\normalsize\\itshape\\raggedright}} \\renewcommand{\\subparagraph}{\\\@startsection -{subparagraph}% -{6}% -{-2mm}% -{-\\baselineskip}% -{0.5\\baselineskip}% -{\\normalfont\\normalsize\\itshape}}% + {subparagraph}%{6}%{-2mm}% + {-\\baselineskip}{0.5\\baselineskip}% + {\\normalfont\\normalsize\\itshape\\raggedright}} +% \\makeatother \\selectlanguage{#{language}} WOK end def a4generic end - def para_num - paranumber_display=if @md.markup.inspect =~/no_ocn/ \ - or @md.mod.inspect =~/--no-ocn/ - '' - else "\\begin{tiny}~\\end{tiny}{\\marginpar{\\begin{tiny}#@string1\\end{tiny}}}" #ocn object citation numbering + end + class Special_characters + @@flag_code=false + @@tex_backslash="\\\\" + def initialize(md,string) + @md,@string=md,string + @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern + #@tx=SiSU_Env::Get_init.instance.tex + @url_brace=SiSU_Viz::Skin.new.url_decoration + @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine + end + def pdftex_special_characters_1(string) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list + #p @@utf_8.list + #@string=Iconv.conv('ISO-8859-1', 'UTF-8', @string) + word=string.scan(/#{Mx[:mk_o]}\S+?#{Mx[:mk_c]}|\S+|\n/) #unless line =~/^(?:0~\S|%+\s)/ + para_array=[] + string=if word + word.each do |w| # _ - / # | : ! ^ ~ + unless string =~/^(?:#{Rx[:meta]}|%+ |#{Mx[:gr_o]}Th?#{Mx[:tc_p]} )/um + unless w=~/^#{Mx[:lv_o]}[1-6]:|~\{|\}~|~\[|\]~|^\^~\s|~\^|\*~\S+|~#|\{t~|#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/ + w.gsub!(/[\\]?~/,'<=tilde>') + #if w !~/^(\s*<:image|\}:image\s)|/ + # w.gsub!(/_/,'\_') + #end + end + w.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') #126 usual + #w.gsub!(/&#(?:126|152);/,'<=tilde>') unless w=~/https?:\/\/\S+/ #126 usual + w.gsub!(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'<=pipe>') #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX + end + para_array << w + end + string=para_array.join(' ') + string=string.strip + string + else '' end - if @string !~/^([1-6a-z-]#{@@tilde}\S*|<:.+?>|#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6})/ - @string.gsub!(/^\s*(.+)/m,"#{paranumber_display}\\1\n") #watch - in 1-6 is suspect - else - if (@string =~/^(?:[1-6a-z-]#{@@tilde}\S*|<:.+?>)/) #watch - in 1-6 is suspect - @string.gsub!(/^([1-6a-z-]#{@@tilde}\S*)\s*(.+)/m,"\\1 #{paranumber_display} \\2\n") #watch - in 1-6 is suspect - @string.gsub!(/^(<:.+?>)\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") - else - @string.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display}\\1\n") + string.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ') + string.gsub!(/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;[umdv]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') + string.gsub!(/.+?<-#>/,'') + string.gsub!(/#{Mx[:br_eof]}|#{Mx[:br_endnotes]}/,'') + #problem sequence -> + string.gsub!(/&(?:nbsp);/,'<=hardspace>') # < SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#nbsp#{Mx[:gl_c]}/,'<=hardspace>') # < SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<=lt>') # < SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'<=gt>') # > SiSU special character also LaTeX + #string.gsub!(/#{Mx[:gl_o]}(#[a-z]+|#[0-9]+)#{Mx[:gl_c]}/,'\1') #i don't think so + string.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'<=curlyopen>') # { SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'<=curlyclose>') # } SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') # ~ SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'\#') # # SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') # ! SiSU not really special sisu character but done, also LaTeX + string.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') # * should you wish to escape astrisk e.g. describing \*{bold}* + string.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') # - SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+') # + SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',') # + SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>') #unless @string=~/<:code>/ # / SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'<=slash>') # / SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'<=backslash>') # \ SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'<=underscore>') # _ SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|') # | SiSU not really special sisu character but done, also LaTeX + string.gsub!(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':') # : SiSU not really special sisu character but done, also LaTeX + string.gsub!(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'<=caret>') # ^ SiSU not really special sisu character but done, also LaTeX + string.gsub!(/\#/,'<=hash>') + ##watch placement, problem sequence ^ + string.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ') + string.gsub!(/#{Mx[:br_page]}/,'\newpage') + string.gsub!(/#{Mx[:br_page_new]}/,'\clearpage') + string.gsub!(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript + string + end + def pdftex_special_characters_2(string) + string.gsub!(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe ') + string.gsub!(/\$/,'\$') + string.gsub!(/\#/,'\#') + string.gsub!(/\%/,'\%') + string.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes + if string !~/^\s*<:image|\}:image\s/ + string.gsub!(/_/,'\_') + end + string.gsub!(/\{/,'\{') + #string.gsub!(/\}/,'\}') + string.gsub!(/ /,'~') # ~ character for hardspace + # sequence important must appear after removal of { and } + string.gsub!(/&\S+?;/,'') #hmmm + # sequence imortant place before removal of & + if string=~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/; @@flag_code=true + elsif string=~/#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/; @@flag_code=false + end + if @@flag_code; string.gsub!(/&/,'{\\\&}') + else string.gsub!(/(\s+&\s+)/,' and ') + end + string.gsub!(/§/u,'\S') #latex: space between next character not preserved? #string.gsub!(/§ /,'\S ') + string.gsub!(/£/u,'\pounds') + string.gsub!(/&\S+?;/,' ') + string.gsub!(/<a href=".+?">/,' ') + string.gsub!(/<\/a>/,' ') + string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case + string.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url + string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration + unless @@flag_code + string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start + else #code-block: angle brackets special characters, note _ already escaped + string.gsub!(/\\_</,'{\UseTextSymbol{OML}{<}}') + string.gsub!(/\\_>/,'{\UseTextSymbol{OML}{>}}') + end + string.gsub!(/<:ee>/,'') + string.gsub!(/<!>/,' ') + #proposed change, insert, but may be redundant + string.gsub!(/ \/>#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~|<br)/,' \begin{ParagraphIndent}{0.01\columnwidth}\1\end{ParagraphIndent} ') # footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder + string.gsub!(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") # Work Area + string.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}') + #string.gsub!(/<em>(.+?)<\/em>/,'\begin{bfseries}\1 \end{bfseries}') + #string.gsub!(/<(bold|strong)>(.+?)<\/(bold|strong)>/,'\begin{bfseries}\1 \end{bfseries}') + string.gsub!(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}') + string.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}') + #string.gsub!(/<italic>(.+?)<\/italic>/,'\emph{\1}') + string.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}') # ulem + string.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''") # quote #CHECK + string.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}') # ulem + string.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}') # ulem + string.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$") + string.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$") + unless @@flag_code + string.gsub!(/"(.+?)"/,'“\1”') # quote marks / quotations open & close " need condition exclude for code + string.gsub!(/\s+"/,' “') # open " + string.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*"/,'\1“') # open " + string.gsub!(/"(\s|\.|,|:|;)/,'”\1') # close " + string.gsub!(/"(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*$/,'”\1') # close " + string.gsub!(/"(\.|,)/,'”') # close " + string.gsub!(/\s+'/,' `') # open ' + string.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*'/,'\1`') # open ' + end + string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*#{Mx[:gl_bullet]}\s*/,'\1 \begin{math} \bullet \end{math}~~') #bullets - added 2004w17 watch \\_ + string.gsub!(/(<font.*?>|<\/font>)/,'') + string.gsub!(/\s*#{Mx[:fa_superscript_o]}(\S+?)#{Mx[:fa_superscript_c]}/,'^\1') + #string.gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_paragraph]}|\n)\*/,' \\\\ ') + #string.gsub!(/(<sup>|<\/sup>)/,'') + string + end + def pdftex_special_characters_3(string) + string.gsub!(/<br(\s*[^\/][^>])/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder + string.gsub!(/([^<][^b][^r]\s+)\/>/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder + #problem sequence (another kludge) -> + string.gsub!(/<=lt>/,'{\UseTextSymbol{OML}{<}}') + string.gsub!(/<=gt>/,'{\UseTextSymbol{OML}{>}}') + #string.gsub!(/<=lt>/,'\<') + #string.gsub!(/<=gt>/,'\>') + string.gsub!(/<=underscore>/,'\_') + string.gsub!(/(\href\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text + string.gsub!(/<=tilde>/,'{\~~}') + string.gsub!(/<=pipe>/,'{\textbar}') + string.gsub!(/<=caret>/,'{\^{~}}') + #string.gsub!(/<=caret>/,'\^{}') + string.gsub!(/<=exclaim>/,'\Verbatim{!}') + string.gsub!(/<=hash>/,'{\#}') + #string.gsub!(/<=hash>/,'{\UseTextSymbol{OT1}{#}}') + #string.gsub!(/<=slash>/,'{\slash}') + string.gsub!(/<=hardspace>/,'{~}') #changed ... 2005 + string.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005 + #string.gsub!(/<=amp>/,'{\UseTextSymbol{OT1}{&}}') + string.gsub!(/<=slash>/,'{/}') + string.gsub!(/<=backslash>/,'{\textbackslash}') + #string.gsub!(/<=asterisk>/,'*') + #string.gsub!(/<=exclaim>/,'!') + #string.gsub!(/<=asterisk>/,'{\ast}') + #string.gsub!(/<=copymark>/,"^{\\copyright} ") # watch has been problematic + #copymark='{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} ' + string.gsub!(/<=copymark>\s*(.+)?\s+(#{Mx[:id_o]}\\~\d+;\w(?:[0-6]:)?\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})/,"^\\copyright \\textnormal{\\1} \\2") # watch likely to be problematic + string + end + def xetex_special_characters_1(string) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list + #p @@utf_8.list + #string=Iconv.conv('ISO-8859-1', 'UTF-8', @string) + word=string.scan(/\S+|\n/) #unless line =~/^(?:0~\S|%+\s)/ + para_array=[] + string=if word + word.each do |w| # _ - / # | : ! ^ ~ + unless string =~/^(?:#{Rx[:meta]}|%+ |#{Mx[:gr_o]}Th?#{Mx[:tc_p]} )/um + unless w=~/^#{Mx[:lv_o]}[1-6]:|~\{|\}~|~\[|\]~|^\^~\s|~\^|\*~\S+|~#|\{t~|#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/ + w.gsub!(/[\\]?~/,'<=tilde>') + #if w !~/^(\s*<:image|\}:image\s)/ + # w.gsub!(/_/,'\_') + #end + end + w.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') #126 usual + #w.gsub!(/&#(?:126|152);/,'<=tilde>') unless w=~/https?:\/\/\S+/ #126 usual + w.gsub!(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'<=pipe>') #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX + end + para_array << w end + string=para_array.join(' ') + string=string.strip + string + else '' end - @string + string.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ') + string.gsub!(/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;[umdv]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') + string.gsub!(/.+?<-#>/,'') + string.gsub!(/#{Mx[:br_eof]}/,'') + string.gsub!(/#{Mx[:br_endnotes]}/,'') + #string.gsub!(/<ENDNOTES?>/,'') + #problem sequence -> + string.gsub!(/&(?:nbsp);/,'<=hardspace>') # < SiSU special character also LaTeX + string.gsub!(/&(?:lt|#060);/,'<=lt>') # < SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'<=gt>') # > SiSU special character also LaTeX + #string.gsub!(/#{Mx[:gl_o]}(&#(?:[a-z]+|[0-9]+);)#{Mx[:gl_c]}/,'\1') + string.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'<=curlyopen>') # { SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'<=curlyclose>') # } SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') # ~ SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'\#') # # SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') # ! SiSU not really special sisu character but done, also LaTeX + string.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') # * should you wish to escape astrisk e.g. describing \*{bold}* + string.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') # - SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+') # + SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',') # + SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>') #unless @string=~/<:code>/ # / SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'<=slash>') # / SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'<=backslash>') # \ SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'<=underscore>') # _ SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|') # | SiSU not really special sisu character but done, also LaTeX + string.gsub!(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':') # : SiSU not really special sisu character but done, also LaTeX + string.gsub!(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'<=caret>') # ^ SiSU not really special sisu character but done, also LaTeX + string.gsub!(/\#/,'<=hash>') + ##watch placement, problem sequence ^ + string.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ') + string.gsub!(/#{Mx[:br_page]}/,'\newpage') + string.gsub!(/#{Mx[:br_page_new]}/,'\clearpage') + string.gsub!(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript + string + end + def xetex_special_characters_2(string) + string.gsub!(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe ') + string.gsub!(/\$/,'\$') + string.gsub!(/\#/,'\#') + string.gsub!(/\%/,'\%') + string.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes + if string !~/^\s*<:image|\}:image\s/ + string.gsub!(/_/,'\_') + end + string.gsub!(/\{/,'\{') + string.gsub!(/\}/,'\}') + string.gsub!(/ /,'~') # ~ character for hardspace + # sequence important must appear after removal of { and } + string.gsub!(/&\S+?;/,'') #hmmm + # sequence imortant place before removal of & + if string=~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/; @@flag_code=true + elsif string=~/#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/; @@flag_code=false + end + if @@flag_code; string.gsub!(/&/,'{\\\&}') + else string.gsub!(/(\s+&\s+)/,' and ') + end + string.gsub!(/§/u,'\S') #latex: space between next character not preserved? #string.gsub!(/§ /,'\S ') + string.gsub!(/£/u,'\pounds') + string.gsub!(/&\S+?;/,' ') + string.gsub!(/<a href=".+?">/,' ') + string.gsub!(/<\/a>/,' ') + string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case + string.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url + string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration + unless @@flag_code + string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start + else #code-block: angle brackets special characters, note _ already escaped + string.gsub!(/\\_</,'{\UseTextSymbol{OML}{<}}') + string.gsub!(/\\_>/,'{\UseTextSymbol{OML}{>}}') + end + string.gsub!(/<:ee>/,'') + string.gsub!(/<!>/,' ') + #proposed change, insert, but may be redundant + string.gsub!(/ \/>#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~|<br)/,' \begin{ParagraphIndent}{0.01\columnwidth}\1\end{ParagraphIndent} ') # footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder + string.gsub!(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") # Work Area + string.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}') + #string.gsub!(/<em>(.+?)<\/em>/,'\begin{bfseries}\1 \end{bfseries}') + #string.gsub!(/<(bold|strong)>(.+?)<\/(bold|strong)>/,'\begin{bfseries}\1 \end{bfseries}') + string.gsub!(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}') + string.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}') + #string.gsub!(/<italic>(.+?)<\/italic>/,'\emph{\1}') + string.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}') # ulem + string.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''") # quote #CHECK + string.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}') # ulem + string.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}') # ulem + string.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$") + string.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$") + unless @@flag_code + string.gsub!(/"(.+?)"/,'“\1”') # quote marks / quotations open & close " need condition exclude for code + string.gsub!(/\s+"/,' “') # open " + string.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*"/,'\1“') # open " + string.gsub!(/"(\s|\.|,|:|;)/,'”\1') # close " + string.gsub!(/"(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*$/,'”\1') # close " + string.gsub!(/"(\.|,)/,'”') # close " + string.gsub!(/\s+'/,' `') # open ' + string.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*'/,'\1`') # open ' + end + string.gsub!(/^\s*#{Mx[:gl_bullet]}\s*/,'\begin{math} \bullet \end{math}~~') + string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*#{Mx[:gl_bullet]}\s*/,'\1 \begin{math} \bullet \end{math}~~') + #string.gsub!(/^\s*#{Mx[:gl_bullet]}\s*/,'● ~~') + #string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*#{Mx[:gl_bullet]}\s*/,'\1 ● ~~') + ##string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*\\_\*\s*/,'\1 ● ~~') + ##string.gsub!(/^\\_\*\s*/,'● ~~') + string.gsub!(/(<font.*?>|<\/font>)/,'') + string.gsub!(/\s*#{Mx[:fa_superscript_o]}(\S+?)#{Mx[:fa_superscript_c]}/,'^\1') + #string.gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_paragraph]}|\n)\*/,' \\\\ ') + #string.gsub!(/(<sup>|<\/sup>)/,'') + string + end + def xetex_special_characters_3(string) + string.gsub!(/<br(\s*[^\/][^>])/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder + string.gsub!(/([^<][^b][^r]\s+)\/>/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder + #problem sequence (another kludge) -> + string.gsub!(/<=lt>/,'{\UseTextSymbol{OML}{<}}') + string.gsub!(/<=gt>/,'{\UseTextSymbol{OML}{>}}') + #string.gsub!(/<=lt>/,'\<') + #string.gsub!(/<=gt>/,'\>') + string.gsub!(/<=underscore>/,'\_') + string.gsub!(/(\href\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text + string.gsub!(/<=tilde>/,'{\~~}') + string.gsub!(/<=pipe>/,'{\textbar}') + string.gsub!(/<=caret>/,'{\^{~}}') + #string.gsub!(/<=caret>/,'\^{}') + string.gsub!(/<=exclaim>/,'\Verbatim{!}') + string.gsub!(/<=hash>/,'{\#}') + #string.gsub!(/<=hash>/,'{\UseTextSymbol{OT1}{#}}') + #string.gsub!(/<=slash>/,'{\slash}') + string.gsub!(/<=hardspace>/,'{~}') #changed ... 2005 + string.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005 + #string.gsub!(/<=amp>/,'{\UseTextSymbol{OT1}{&}}') + string.gsub!(/<=slash>/,'{/}') + string.gsub!(/<=backslash>/,'{\textbackslash}') + #string.gsub!(/<=asterisk>/,'*') + #string.gsub!(/<=exclaim>/,'!') + #string.gsub!(/<=asterisk>/,'{\ast}') + #string.gsub!(/<=copymark>/,"^{\\copyright} ") # watch has been problematic + #copymark='{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} ' + string.gsub!(/<=copymark>\s*(.+)?\s+(#{Mx[:id_o]}\\~\d+;\w(?:[0-6]:)?\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})/,"^\\copyright \\textnormal{\\1} \\2") # watch likely to be problematic + string + end + def special_characters_curly(string) + string.gsub!(/<=curlyopen>/,'\{') + string.gsub!(/<=curlyclose>/,'\}') + string + end + def special_characters_unsafe_1(string) #depreciated, make obsolete + # some substitutions are sequence sensitive, rearrange with care. + string.gsub!(/\\backslash (copyright|clearpage|newpage)/,"\\\\\\1") #kludge bad solution, find out where tail is sent through specChar ! + string + end + def special_characters #special characters - some substitutions are sequence sensitive, rearrange with care. + string=@string + case @tex2pdf + when /pdf/ + string=pdftex_special_characters_1(string) unless string.nil? + string=special_characters_unsafe_1(string) unless string.nil? #pdftex_special_characters_unsafe_1(@string) + string=pdftex_special_characters_2(string) unless string.nil? + string=pdftex_special_characters_3(string) unless string.nil? + when /xe/ + string=xetex_special_characters_1(string) unless string.nil? + string=special_characters_unsafe_1(string) unless string.nil? #xetex_special_characters_unsafe_1(@string) + string=xetex_special_characters_2(string) unless string.nil? #issues with xetex + string=xetex_special_characters_3(string) unless string.nil? + end + @string=string + end + def special_characters_safe #special characters - some substitutions are sequence sensitive, rearrange with care. + string=@string + case @tex2pdf + when /pdf/ + string=pdftex_special_characters_1(@string) unless string.nil? + string=pdftex_special_characters_2(@string) unless string.nil? + #special_characters_3(@string) + when /xe/ + string=xetex_special_characters_1(@string) unless string.nil? + string=xetex_special_characters_2(@string) unless string.nil? # remove this to start with, causes issues + end + @string=string + end + end + class Use_TeX + attr_accessor :url,:txt,:date + def initialize(md) + @md=md + @vz=SiSU_Env::Get_init.instance.skin + @date=SiSU_Env::Info_date.new # #{@date.year} + @copymark='{\\begin{footnotesize}\\raisebox{1ex}{\\copyright}\\end{footnotesize}}' + @url_brace=SiSU_Viz::Skin.new.url_decoration + end + def skip + "\n\\vspace*{\\smallskipamount} \n" + end + def paraskip_normal + '\setlength{\parskip}{1ex plus0.5ex minus0.2ex}' + end + def paraskip_small + '\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}' + end + def skip_small + #"\\smallskip{}" + end + def skip_small_vspace + "\n\\vspace*{\\smallskipamount} \n" + end + def skip_small_footnote + #"\n\\smallskip{}\n" + end + def skip_medium + "\n\\medskip{}\n\n" + end + def skip_dummy + "\n" + end + def header + "\\lhead[ ]{ }\n" + + "\\chead[ \\fancyplain{} \\bfseries \\footnotesize \\leftmark ]{ \\fancyplain{} \\bfseries \\footnotesize \\rightmark }\n" + + "\\rhead[ ]{ }\n" + end + def footer + base_prog_txt=if @md.base_program + case @md.base_program + when /kdissert/i; " \\\\ \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert}" + else '' + end + else '' + end + "\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@vz.url_sisu}}{#{@vz.txt_signature}}#{base_prog_txt}}\n" + + "\\cfoot[\\href{#{@vz.url_home}}{#{@vz.url_txt}}]{\\href{#{@vz.url_home}}{#{@vz.url_txt}}}\n" + + "\\rfoot[\\tiny \\href{#{@vz.url_sisu}}{#{@vz.txt_signature}}]{\\textrm{\\thepage}}\n" + end + def site + "\\href{#{@vz.url_home}}{#{@vz.url_txt}}" + end + def sitename #owners site, eg freeculture, free.for.all, gutenberg etc. + "\\href{#{@vz.url_home}}{#{@vz.txt_home}}" + end + def owner_chapter + "Contact Details for Original Promulgating Authority" + end + #BOOK standard dimensions - 229x156 + def newpage(orientation) + case orientation + when /landscape/ # using longtable latex package +<<WOK +\\clearpage +WOK + when /portrait/ +<<WOK +\\newpage +WOK + end + end + def sisu_rights + v=SiSU_Env::Info_version.new.get_version + base_prog_txt=if @md.base_program + case @md.base_program + when /kdissert/i; "\n\\\\ This document prepared using \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert \\ http://freehackers.org/~tnagy/kdissert/ } \\\\ Kdissert is Document Mapping software by Thomas Nagy" + else '' + end + else '' + end +<<WOK +\\\\ ~ +{\\begin{footnotesize}#{base_prog_txt} +\\\\ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\begin{tiny}[ #{v[:project]} #{v[:version]} of #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} +\\\\ Copyright #@copymark 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved. +\\\\ SiSU is software for document structuring, publishing and search (with object citation numbering), \\href{http://www.sisudoc.org}{www.sisudoc.org} +\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later, #{@url_brace.tex_open}\\href{http://www.fsf.org/licenses/gpl.html}{http://www.fsf.org/licenses/gpl.html}#{@url_brace.tex_close}. +{\\end{footnotesize} +\\\\ +WOK + end + def doc_sc_info_footnote_full +<<WOK +\\footnote{%\nGenerated by \\href{http://www.jus.uio.no/sisu}{SiSU \\ www.jus.uio.no/sisu }\\ \\newline \\scriptsize{Document version information: \\emph{sourcefile} \\uline{#{@md.fnstex}}; \\emph{version} \\uline{#{@md.sc_number}}; \\emph{date} \\uline{#{@md.sc_date}}; \\emph{time} \\uline{#{@md.sc_time}}}} +WOK + end + def doc_sc_info_footnote_brief + " \\footnote{%\nGenerated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\ \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} \\newline \\href{http://www.sisudoc.org}{www.sisudoc.org} \\\n}" + end + def doc_sc_info + v=SiSU_Env::Info_version.new.get_version +<<WOK +\\\\ +{\\begin{footnotesize} +Document version information: \\\\ +\\emph{sourcefile} \\uline{#{@md.fnstex}}; \\emph{version} \\uline{#{@md.sc_number}}; \\emph{date} \\uline{#{@md.sc_date}}; \\emph{time} \\uline{#{@md.sc_time}} \\\\ +Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu }\\- version information: \\\\ +\\uline{ #{v[:project]} #{v[:version]} of #{v[:date_stamp]}} +\\end{footnotesize}}& +WOK + end + def doc_no_sc_info + v=SiSU_Env::Info_version.new.get_version +<<WOK +\\\\ +{\\begin{small} +Document information: \\\\ +\\emph{sourcefile} \\uline{#{@md.fnstex}} \\\\ +Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\ version information: \\ +\\uline{ #{v[:project]} #{v[:version]} of #{v[:date_stamp]}} + +\\end{small}}& +WOK + end + def manifest_info + url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') + fn=@md.fn[:manifest].gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') +<<WOK +{\\begin{footnotesize} +\\\\ For alternative output formats of this document check: +\\\\ #{@url_brace.tex_open}\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{fn}}{#{@vz.url_root_http}/#{url}/#{fn}}\\end{scriptsize}#{@url_brace.tex_close} +\\end{footnotesize}}& +WOK + end + def endnotes #not used should be inserted before MetaData section which preceeds doc_tail, but is "part of document" +<<WOK +\\subsection*{Endnotes} +\\addcontentsline{toc}{section}{Endnotes} +\\ +\\listofendnotes +WOK + end + def doc_tail + dir=SiSU_Env::Info_env.new(@md.fns) + base_html="#{dir.url.root}/#{@md.fnb}" + v=SiSU_Env::Info_version.new.get_version + 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 " + end + url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') +<<WOK +\\subsection*{Information on this document copy and an unofficial List of Some web related information and sources} +\\addcontentsline{toc}{section}{Information on this document copy and an unofficial List of Some web related information and sources} +\\\\ +\"Support Open Standards and Software Libre for the Information Technology Infrastructure\" RA\\subsubsection*{Information on this document copy #{site}} +\\addcontentsline{toc}{subsection}{Information on this document copy} +{\\begin{footnotesize} +\\\\ Generated by \\href{http://www.jus.uio.no/sisu/}{SiSU} found at \\href{http://www.jus.uio.no/sisu/}{www.jus.uio.no/sisu} \\begin{tiny}[ #{v[:project]} #{v[:version]} #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.sisudoc.org}{www.sisudoc.org}. SiSU is software for document structuring, publishing and search (using SiSU: object citation numbering, markup, meta-markup, and system) Copyright #@copymark 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved. +\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later (\\href{http://www.fsf.org/licenses/gpl.html}{www.fsf.org/licenses/gpl.html}). {\\end{footnotesize} +{\\begin{small} +\\\\ W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{#{sisu_ico}}SiSU 1997, current #{@date.year_static}. \\\\ #{sitename} presentations at \\begin{bfseries}#{site}\\end{bfseries} \\\\ \\\\ #{@md.title} \\textbf{pdf} versions can be found at: \\\\ +{\\end{small} +\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}\\end{scriptsize} \\\\ +\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}\\end{scriptsize} \\\\ +\\\\\n#{@md.title} \\textbf{html} versions may be found at: \\\\ +\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:toc]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:toc]}}\\end{scriptsize} or \\\\ +\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:doc]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:doc]}}\\end{scriptsize} +\\\\ +\\\\ +\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}{SiSU Manifest} of document output and metadata may be found at: \\\\ +\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}{#{@vz.url_root_http}/#{url}/#{@md.fnl[:pre]}sisu\\_manifest#{@md.fnl[:mid]}.html#{@md.fnl[:post]}}\\end{scriptsize} +\\\\ +\\\\ + #{sitename} found at: \\begin{bfseries}#{site}\\end{bfseries}\\subsubsection*{Links that may be of interest at #{@vz.txt_home} and elsewhere:} +\\addcontentsline{toc}{subsection}{Links that may be of interest} +WOK + end + def mail_tail #not retested, the old mail_tail is commented out and appended to this program + dir=SiSU_Env::Info_env.new(@md.fns) +<<WOK +\\subsection*{Mail sender details} +\\addcontentsline{toc}{subsection}{Mail sender details} +\\\\ +Mail from: ralph@amissah.com\\\\ +44 20 8789 3452\\\\ +44 77 9669 4448 +\\\\ + \"Support Open Standards and Open Sources for the Information Technology Infrastructure\" RA +\\subsubsection*{Information on this document copy #{site}\\copyright} +Presentations' look and feel generated by \\href{http://www.jus.uio.no/sisu/}{SiSU Scribe} \\href{http://www.jus.uio.no/sisu/}{http://www.jus.uio.no/sisu/} programmed in Ruby on Debian/Gnu/Linux by Copyright \\copyright Ralph Amissah, W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{\\includegraphics*[width=35pt]{#{dir.path.image_source_tex}/sisu.png}}for #{sitename}. SiSU Scribe (sisu information structuring unit) produces Electronic Documents, i.e. it generates structured output for use in a number of file formats, including the pdf file produced here. +WOK end end end diff --git a/lib/sisu/v0/urls.rb b/lib/sisu/v0/urls.rb index 794270f6..ad017bc5 100644 --- a/lib/sisu/v0/urls.rb +++ b/lib/sisu/v0/urls.rb @@ -273,6 +273,8 @@ module SiSU_urls SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@browser #@webserv_url/sitemap/#{y}") when /^I/ SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","cd #{@path.path.texinfo}; pinfo ./#@fnb.#{y}; cd -") + when /^i/ + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@manpage_gen #{@path.path.manpage}/#@fnb.1 |most") end tellx.result if tellx tell.result if tell diff --git a/lib/sisu/v0/wikispeak.rb b/lib/sisu/v0/wikispeak.rb index 8ac3b351..967387d9 100644 --- a/lib/sisu/v0/wikispeak.rb +++ b/lib/sisu/v0/wikispeak.rb @@ -110,25 +110,25 @@ module SiSU_Wikispeak end def lev_segname_para_ocn @text=nil - if @para =~/^(\d~|<:.+?>).+?<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - if /^(([1-6])~(\S+))\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) + if @para =~/^(\d~|<:.+?>).+?#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + if /^(([1-6])~(\S+))\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para) @format,@lev,segname,@text,@ocn=$1,$2,$3,$4,$5 - elsif /^(([1-6])~)\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) + elsif /^(([1-6])~)\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para) @format,@lev,@text,@ocn=$1,$2,$3,$4 - elsif /<:(.+?)>\s*(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) + elsif /<:(.+?)>\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para) @format,@text,@ocn=$1,$2,$3 - elsif /^(([1-6])~(\S+))\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;[um]\d+><#@dp:#@dp>$/m.match(@para) + elsif /^(([1-6])~(\S+))\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;[um]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para) @@alt_id_count+=1 @format,@lev,segname,@text,@ocn=$1,$2,$3,$4,"x#{@@alt_id_count}" - elsif /^(([1-6])~)\s+(\S.+?)<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/m.match(@para) + elsif /^(([1-6])~)\s+(\S.+?)#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para) @@alt_id_count+=1 @format,@lev,@text,@ocn=$1,$2,$3,"x#{@@alt_id_count}" end else - if /(.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para) + if /(.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para) @text,@ocn=$1,$2 end - if @para !~/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$|^$/ #added 2002w06 + if @para !~/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$|^$/ #added 2002w06 @text=/(.+?)/m.match(@para)[1] end if /^((\d)~(?:~\S+)?)\s+(.+)/m.match(@para) @@ -136,10 +136,10 @@ module SiSU_Wikispeak end end format=@format.dup - @lev_para_ocn=if @para =~/.+<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{#Mx[:id_c]}$/ Format::Format_text_object.new(format,@text,@ocn) else - Format::Format_text_object.new(format,@text,"<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>") + Format::Format_text_object.new(format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}") end self end @@ -154,7 +154,7 @@ module SiSU_Wikispeak @data,@md=data,md @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - @regx=/^(?:(?:<:p[bn]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ #m # 2004w18 pb pn removal added + @regx=/^(?:(?:#{Mx[:br_line]}\s*|#{Mx[:br_nl]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]}\s*)?(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #m # 2004w18 pb pn removal added @tab="\t" @@dostype='unix footnotes' @br="\n" @@ -168,7 +168,7 @@ module SiSU_Wikispeak end # Used for extraction of endnotes from paragraphs def extract_endnotes(para='') - notes=para.scan(/~[{\[]([\d*+]+\s+.+?)\s*<#@dp>[}\]]~/) + notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) @n=[] end def wiki_metadata(meta) @@ -220,9 +220,9 @@ WOK n3=lv + 2 lv=nil if lv == 0 extract_endnotes(para) - para.gsub!(/~[{\[](?:[\d*+]+)\s+(.+?)<#@dp>[}\]]~/,'<ref>\1</ref>') # endnote marker marked up - para.gsub!(/^\d~\S*\s+/,'') # endnote marker marked up - para.gsub!(/<\S+?><#@dp:#@dp>/,'') # endnote marker marked up + para.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(?:[\d*+]+)\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'<ref>\1</ref>') # endnote marker marked up + para.gsub!(/^#{Rx[:lv]}\S*\s+/,'') # endnote marker marked up + para.gsub!(/<\S+?>#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') # endnote marker marked up if lv @@wiki[:body] << case lv when 1; '='*2 << para.strip << @br*2 @@ -243,7 +243,7 @@ WOK table_message='[table omitted, see other document formats]' fix=[] data.each do |para| - para.gsub!(/<!Th?¡.+/um,"#@br#{table_message}") + para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#@br#{table_message}") para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down para.gsub!(/©/,'©') # bullet markup, marked down @@ -255,9 +255,9 @@ WOK para.gsub!(/<u>(.+?)<\/u>/,'_\1_') para.gsub!(/\{(.+?)\}(https?:\/\/\S+)/,'[\2 \1]') para.gsub!(/(https?:\/\/\S+)/,'[\1]') - para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,'') + para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,'') para.gsub!(/<:p[bn]>/,'') # remove page breaks - para.gsub!(/^\s*<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,'') # remove empty lines - check + para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') # remove empty lines - check para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1') para.gsub!(/<:name#\S+?>/,'') # remove name links para.gsub!(/ /,' ') # decide on @@ -270,14 +270,14 @@ WOK if d_meta; wiki_metadata(d_meta) end end - if para !~/(^0~|<ENDNOTES>|<EOF>)/ + if para !~/(^0~|#{Mx[:br_endnotes]}|#{Mx[:br_eof]})/ if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change paranum=para[@regx,3] @p_num=Format::Paragraph_number.new(paranum) end @sto=Split_text_object.new(para).lev_segname_para_ocn ### problem in scroll, it appears tables are getting paragraph numbers - m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m \ and para=~/\S+/ para=case @sto.format @@ -325,17 +325,17 @@ WOK elsif para =~/#{table_message}/ @@wiki[:body] << para << @br elsif para =~/(Note|Endnotes?)/ \ - and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ elsif para =~/(MetaData)/ \ - and para =~/<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info ####suspect visit + and para =~/#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info ####suspect visit #formatMono=MonoSiSU.new('<br /><a name="metadata">MetaData</a>') #para=formatMono.bold_para elsif para.include? 'Owner Details' \ - and para !~/<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #formatMono=MonoSiSU.new('<br /><a name="owner.details">Owner Details</a>') #@@wiki[:owner_details]=formatMono.bold_para #para='' - elsif para =~/(¡|<!Th?)/u #tables ! + elsif para =~/(#{Mx[:tc_p]}|#{Mx[:gr_o]}Th?)/u #tables ! elsif para =~/(.*)<!#!>(.*)/ one,two=$1,$2 format_text=Format_text_object.new(one,two) diff --git a/lib/sisu/v0/xhtml.rb b/lib/sisu/v0/xhtml.rb index 8503bddb..067ed8a8 100644 --- a/lib/sisu/v0/xhtml.rb +++ b/lib/sisu/v0/xhtml.rb @@ -111,16 +111,16 @@ module SiSU_XHTML end end class Scroll - @@xml={ :body=>[],:sisu=>[],:open=>[],:close=>[],:head=>[] } require "#{SiSU_lib}/shared_txt" require "#{SiSU_lib}/css" include SiSU_text_utils @@dp=nil + @@xml={ :body=>[],:sisu=>[],:open=>[],:close=>[],:head=>[] } def initialize(particulars) @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - @regx=/^(?:(?:<:p[nb]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + @regx=/^(?:(?:#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}\s*)?#{Mx[:lv_o]}\d:(\S*)#{Mx[:lv_c]}\s*)?(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @tab="\t" @trans=SiSU_XML_munge::Trans.new(@md) @sys=SiSU_Env::System_call.new @@ -132,16 +132,16 @@ module SiSU_XHTML publish end protected - def embedded_endntoes(para='') - para.gsub!(/~\{(\d+)\s+(.+?)\s*<#@dp>\}~/, + def embedded_endnotes(para='') + para.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/, '<endnote><number>\1</number><note>\2</note></endnote> ') - para.gsub!(/~\[([*+]\d+)\s+(.+?)\s*<#@dp>\]~/, + para.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/, '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') - para.gsub!(/~\{([*+]+)\s+(.+?)\s*<#@dp>\}~/, + para.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/, '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') end def extract_endnotes(para='') - notes=para.scan(/~[{\[]([\d*+]+\s+.+?)\s*<#@dp>[}\]]~/) + notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) notes.flatten.each do |e| s=e.to_s util=SiSU_text_utils::Wrap.new(s,70) @@ -176,7 +176,7 @@ WOK end def xml_head(meta) txt=meta.text - txt.gsub!(/<br(?: \/)?>/,'') + txt.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,' ') txt.gsub!(/ & /,' and ') el=meta.el.gsub(/\./,'_') el_txt=meta.el.gsub(/\./,' ') @@ -197,7 +197,8 @@ WOK n3=lv + 2 lv=nil if lv == 0 extract_endnotes(para) - para.gsub!(/~[{\[]([\d*+]+)\s+(?:.+?)\s*<#@dp>[}\]]~/,'<en>\1</en>') #footnote/endnote clean + para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean + para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean if para[@regx] paragraph="#{para[@regx,2]}" util=SiSU_text_utils::Wrap.new(paragraph,70) @@ -218,9 +219,11 @@ WOK @endnotes=[] end def group_structure(para='',ocn='') - para.gsub!(/<:group(?:-end)?>/,'') + para.gsub!(/#{Mx[:gr_o]}group(?:-end)?#{Mx[:gr_c]}/,'') para=@trans.markup_group(para) para.strip! + para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean + para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean @@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n" @@xml[:body] << %{#{@tab*1}<ocn>#{ocn}</ocn>} << "\n" @@xml[:body] << %{#{@tab*1}<text class="group">#{@tab*1}\n} @@ -229,7 +232,7 @@ WOK @@xml[:body] << "#{@tab*0}</object>" << "\n" end def poem_structure(para='',ocn='') - para.gsub!(/<:verse(?:-end)?>/,'') + para.gsub!(/#{Mx[:gr_o]}verse(?:-end)?#{Mx[:gr_c]}/,'') para=@trans.markup_group(para) para.strip! @@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n" @@ -240,7 +243,7 @@ WOK @@xml[:body] << "#{@tab*0}</object>" << "\n" end def code_structure(para='',ocn='') - para.gsub!(/<:code(?:-end)?>/,'') + para.gsub!(/#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}/,'') para=@trans.markup_group(para) para.gsub!(/\s\s/,'  ') para.strip! @@ -266,67 +269,67 @@ WOK data.each do |para| para=@trans.markup(para) @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 - if para =~/^0~(\S+)\s+(.+?)$/ # for headers + if para =~/^#{Rx[:meta]}\s*.+?$/ # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta if d_meta; xml_head(d_meta) end end if @rcdc==false \ and (para =~/~metadata/ \ - or para =~/1~meta\s+Document Information/) + or para =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_c]}\s*Document Information/) @rcdc=true end - if para !~/(^0~|<ENDNOTES>|<EOF>)/ - if para =~/.+?<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ + if para =~/.+?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ paranum=para[@regx,3] @p_num=SiSU_XML_format::Paragraph_number.new(@md,paranum) end - @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para_ocn + @sto=SiSU_text_parts::Split_text_object.new(@md,para).xml ### problem in scroll, it appears tables are getting paragraph numbers unless @rcdc - m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|null/ + format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ case @sto.format - when /^(1)~(?:(\S+))?/ + when /^(1):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) para=@sto.lev_para_ocn.heading_body1 - when /^(2)~(?:(\S+))?/ + when /^(2):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) para=@sto.lev_para_ocn.heading_body2 - when /^(3)~(?:(\S+))?/ + when /^(3):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) para=@sto.lev_para_ocn.heading_body3 - when /^(4)~(\S+)/ # work on see SiSU_text_parts::Split_text_object + when /^(4):(\S+)/ # work on see SiSU_text_parts::Split_text_object xml_structure(para,$1,@sto.ocn,$2) para=@sto.lev_para_ocn.heading_body4 - when /^(5)~(?:(\S+))?/ + when /^(5):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) para=@sto.lev_para_ocn.heading_body5 - when /^(6)~(?:(\S+))?/ + when /^(6):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) para=@sto.lev_para_ocn.heading_body6 else - matched=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/mi.match(para) + matched=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/mi.match(para) stamp,ocn=matched[0],matched[1] - if para =~ /<:verse>/ + if para =~ /#{Mx[:gr_o]}verse#{Mx[:gr_c]}/ para.gsub!(/#{stamp}/,'') poem_structure(para,ocn) - elsif para =~ /<:group>/ + elsif para =~ /#{Mx[:gr_o]}group#{Mx[:gr_c]}/ para.gsub!(/#{stamp}/,'') group_structure(para,ocn) - elsif para =~ /<:code>/ + elsif para =~ /#{Mx[:gr_o]}code#{Mx[:gr_c]}/ para.gsub!(/#{stamp}/,'') code_structure(para,ocn) - elsif para =~/<!Th?.+/ # tables come as single block #work area 2005w13 + elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13 table=SiSU_Tables::Table_xml.new(para,ocn) para=table.table_split table_structure(para,ocn) - elsif para =~ /^\s*(?:<:i([1-9])> )?_\*/ + elsif para =~ /^\s*(?:#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]})?#{Mx[:gl_bullet]}/ m=$1 - para.gsub!(/^(\s*(?:<:i[1-9]> )?)_\*/,'\1') + para.gsub!(/^(\s*(?:#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]})?)#{Mx[:gl_bullet]}/,'\1') xml_structure(para,nil,nil,nil,"indent_bullet#{m}") - elsif para =~ /<:i([1-9])>/ + elsif para =~ /^\s*#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/ xml_structure(para,nil,nil,nil,"indent#{$1}") else xml_structure(para,nil,nil,nil) end @@ -335,14 +338,14 @@ WOK #@@xml[:body] << "#{@tab*7}<text>#{para[@regx,2]}</text>\n" if para[@regx,2] # main text, contents, body KEEP #@@xml[:body] << "#{@tab*6}</object>" << "\n" if para[@regx] end - elsif para =~/(Note|Endnotes?)/ \ - and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/(#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ \ + and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ elsif para =~/(MetaData)/ \ - and para =~/<~(\d+);[m]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info + and para =~/#{Mx[:id_o]}~\d+;[m]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info format_scroll=Format_scroll.new(@md,'<br /><a name="metadata">MetaData</a>') para=format_scroll.bold_para elsif para =~/(Owner Details)/ \ - and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ format_scroll=Format_scroll.new(@md,'<br /><a name="owner.details">Owner Details</a>') @@xml[:owner_details]=format_scroll.bold_para para='' @@ -351,12 +354,12 @@ WOK format_text=Format_text_object.new(one,two) para=format_text.seg_no_paranum end - if (para =~/<a name="n\d+">/ \ - and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote + if para =~/<a name="n\d+">/ \ + and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote para='' end para=case para - when /<:i[1-9]>/ + when /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/ if para =~/.*<:#>.*$/ format_text=Format_text_object.new(para,'') format_text.scr_inden_ocn_e_no_paranum @@ -373,7 +376,7 @@ WOK end else # end - para.gsub!(/<:\S+?>|<!.+!>/,'') if para + para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if para end end 6.downto(4) do |x| @@ -428,7 +431,7 @@ WOK SiSU_Env::SiSU_file.new(@md).mkdir filename_xml=SiSU_Env::SiSU_file.new(@md,@md.fn[:xhtml]).mkfile @data.each do |para| - para.gsub!(/<:\S+?>|<!.+?!>/,'') + para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') #; para.gsub!(/<:\S+?>|<!.+?!>/,'') para.gsub!(/^\s*\n$/,'') filename_xml.puts para unless para.empty? end diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb index 23125e05..9f897266 100644 --- a/lib/sisu/v0/xml.rb +++ b/lib/sisu/v0/xml.rb @@ -118,7 +118,7 @@ module SiSU_XML_SAX @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - @regx=/^(?:(?:<:p[bn]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + @regx=/^(?:(?:#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]})?\s*(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @tab="\t" @trans=SiSU_XML_munge::Trans.new(@md) @sys=SiSU_Env::System_call.new @@ -130,16 +130,16 @@ module SiSU_XML_SAX publish end protected - def embedded_endntoes(para='') - para.gsub!(/~\{(\d+)\s+(.+?)\s*<#@dp>\}~/, + def embedded_endnotes(para='') + para.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/, '<endnote><number>\1</number><note>\2</note></endnote> ') - para.gsub!(/~\[([*+]\d+)\s+(.+?)\s*<#@dp>\]~/, + para.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/, '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') - para.gsub!(/~\{([*+]+)\s+(.+?)\s*<#@dp>\}~/, + para.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/, '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') end def extract_endnotes(para='') - notes=para.scan(/~[{\[]([\d*+]+\s+.+?)\s*<#@dp>[}\]]~/) + notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) notes.flatten.each do |e| s=e.to_s util=SiSU_text_utils::Wrap.new(s,70) @@ -176,7 +176,7 @@ WOK end def xml_head(meta) txt=meta.text - txt.gsub!(/<br(?: \/)?>/,'') + txt.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,' ') txt.gsub!(/ & /,' and ') el=meta.el.gsub(/\./,'_') el_txt=meta.el.gsub(/\./,' ') @@ -219,7 +219,8 @@ WOK n3=lv + 2 lv=nil if lv == 0 extract_endnotes(para) - para.gsub!(/~[{\[]([\d*+]+)\s+(?:.+?)\s*<#@dp>[}\]]~/,'<en>\1</en>') #footnote/endnote clean + para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean + para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean if para[@regx] paragraph="#{para[@regx,2]}" util=SiSU_text_utils::Wrap.new(paragraph,70) @@ -238,9 +239,10 @@ WOK @endnotes=[] end def group_structure(para='',ocn='') - para.gsub!(/<:group(?:-end)?>/,'') + para.gsub!(/#{Mx[:gr_o]}group(?:-end)?#{Mx[:gr_c]}/,'') extract_endnotes(para) - para.gsub!(/~[{\[]([\d*+]+)\s+(?:.+?)\s*<#@dp>[}\]]~/,'<en>\1</en>') #footnote/endnote clean + para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean + para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean para=@trans.markup_group(para) para.strip! @@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n" @@ -253,7 +255,7 @@ WOK @endnotes=[] end def poem_structure(para='',ocn='') - para.gsub!(/<:verse(?:-end)?>/,'') + para.gsub!(/#{Mx[:gr_o]}verse(?:-end)?#{Mx[:gr_c]}/,'') para=@trans.markup_group(para) #para.gsub!(/\s\s/,'  ') para.strip! @@ -265,7 +267,7 @@ WOK @@xml[:body] << "#{@tab*0}</object>" << "\n" end def code_structure(para='',ocn='') - para.gsub!(/<:code(?:-end)?>/,'') + para.gsub!(/#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}/,'') para=@trans.markup_group(para) para.gsub!(/\s\s/,'  ') para.strip! @@ -291,82 +293,79 @@ WOK data.each do |para| para=@trans.markup(para) @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 - if para =~/^0~(\S+)\s+(.+?)$/ # for headers + if para =~/^#{Rx[:meta]}\s*.+?$/ # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta if d_meta; xml_head(d_meta) end end if @rcdc==false \ - and (para =~/~metadata/ or para =~/1~meta\s+Document Information/) + and (para =~/~metadata/ \ + or para =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_c]}\s*Document Information/) @rcdc=true end - if para !~/(^0~|<ENDNOTES>|<EOF>)/ - if para =~/.+?<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|#{Mx[:br_endnotes]})/ + if para =~/.+?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ paranum=para[@regx,3] @p_num=SiSU_XML_format::Paragraph_number.new(@md,paranum) end - @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para_ocn - ### problem in scroll, it appears tables are getting paragraph numbers + @sto=SiSU_text_parts::Split_text_object.new(@md,para).xml + #@sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para_ocn unless @rcdc - m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|null/ + format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ case @sto.format - when /^(1)~(?:(\S+))?/ + when /^(1):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) para=@sto.lev_para_ocn.heading_body1 - when /^(2)~(?:(\S+))?/ + when /^(2):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) para=@sto.lev_para_ocn.heading_body2 - when /^(3)~(?:(\S+))?/ + when /^(3):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) para=@sto.lev_para_ocn.heading_body3 - when /^(4)~(\S+)/ # work on see Split_text_object + when /^(4):(\S+)/ # work on see Split_text_object xml_structure(para,$1,@sto.ocn,$2) para=@sto.lev_para_ocn.heading_body4 - when /^(5)~(?:(\S+))?/ + when /^(5):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) para=@sto.lev_para_ocn.heading_body5 - when /^(6)~(?:(\S+))?/ + when /^(6):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) para=@sto.lev_para_ocn.heading_body6 else - matched=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/mi.match(para) + matched=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/mi.match(para) stamp,ocn=matched[0],matched[1] - if para =~ /<:verse>/ + if para =~ /#{Mx[:gr_o]}verse#{Mx[:gr_c]}/ para.gsub!(/#{stamp}/,'') poem_structure(para,ocn) - elsif para =~ /<:group>/ + elsif para =~ /#{Mx[:gr_o]}group#{Mx[:gr_c]}/ para.gsub!(/#{stamp}/,'') group_structure(para,ocn) - elsif para =~ /<:code>/ + elsif para =~ /#{Mx[:gr_o]}code#{Mx[:gr_c]}/ para.gsub!(/#{stamp}/,'') code_structure(para,ocn) - elsif para =~/<!Th?.+/ # tables come as single block #work area 2005w13 + elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13 table=SiSU_Tables::Table_xml.new(para,ocn) para=table.table_split table_structure(para) - elsif para =~ /^\s*(?:<:i([1-9])> )?_\*/ #uncomment + elsif para =~ /^\s*(?:#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]})?#{Mx[:gl_bullet]}/ #uncomment m=$1 - para.gsub!(/^(\s*(?:<:i[1-9]> )?)_\*/,'\1') + para.gsub!(/^(\s*(?:#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?)#{Mx[:gl_bullet]}/,'\1') xml_structure(para,nil,nil,nil,"indent_bullet#{m}") - elsif para =~ /<:i([1-9])>/ + elsif para =~ /#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/ xml_structure(para,nil,nil,nil,"indent#{$1}") else xml_structure(para,nil,nil,nil) end - #@@xml[:body] << "#{@tab*6}<object>" << "\n" if para[@regx] - #@@xml[:body] << "#{@tab*7}<ocn>#{para[@regx,3]}</ocn>" << "\n" if para[@regx,3] - #@@xml[:body] << "#{@tab*7}<text>#{para[@regx,2]}</text>\n" if para[@regx,2] # main text, contents, body KEEP - #@@xml[:body] << "#{@tab*6}</object>" << "\n" if para[@regx] end - elsif para =~/(Note|Endnotes?)/ \ - and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/(#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ \ + and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ elsif para =~/(MetaData)/ \ - and para =~/<~(\d+);[m]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info + and para =~/#{Mx[:id_o]}~\d+;[m]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info format_scroll=Format_scroll.new(@md,'<br /><a name="metadata">MetaData</a>') para=format_scroll.bold_para elsif para =~/(Owner Details)/ \ - and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ format_scroll=Format_scroll.new(@md,'<br /><a name="owner.details">Owner Details</a>') @@xml[:owner_details]=format_scroll.bold_para para='' @@ -379,8 +378,8 @@ WOK and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote para='' end - if para =~/.*<:#>.*$/ - para=if para =~ /<:i[1-9]>/ + if para =~/.*<:#>.*$/ #investigate removal + para=if para =~ /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/ format_text=Format_text_object.new(para,'') format_text.scr_inden_ocn_e_no_paranum end @@ -395,7 +394,7 @@ WOK end else # end - para.gsub!(/<:\S+?>|<!.+!>/,'') if para + para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if para end end 6.downto(4) do |x| @@ -451,7 +450,7 @@ WOK SiSU_Env::SiSU_file.new(@md).mkdir filename_xml=SiSU_Env::SiSU_file.new(@md,@md.fn[:sax]).mkfile @data.each do |para| - para.gsub!(/<:\S+?>|<!.+?!>/,'') + para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') #; para.gsub!(/<:\S+?>|<!.+?!>/,'') para.gsub!(/^\s*\n$/,'') filename_xml.puts para unless para.empty? end diff --git a/lib/sisu/v0/xml_dom.rb b/lib/sisu/v0/xml_dom.rb index 008a8ed2..9bcb15ec 100644 --- a/lib/sisu/v0/xml_dom.rb +++ b/lib/sisu/v0/xml_dom.rb @@ -112,15 +112,15 @@ module SiSU_XML_DOM end end class Scroll - @@xml={ :body=>[],:open=>[],:close=>[],:head=>[],:sc=>[] } require "#{SiSU_lib}/shared_txt" include SiSU_text_utils @@dp=nil + @@xml={ :body=>[],:open=>[],:close=>[],:head=>[],:sc=>[] } def initialize(particulars) @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - @regx=/^(?:(?:<:p[bn]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ # + @regx=/^(?:(?:#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}\s*)?#{Mx[:lv_o]}\d:(\S*)#{Mx[:lv_c]}\s*)?(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @tab="\t" @trans=SiSU_XML_munge::Trans.new(@md) @sys=SiSU_Env::System_call.new @@ -133,16 +133,16 @@ module SiSU_XML_DOM end protected def xml_markup(para='') - para.gsub!(/~\{(\d+)\s+(.+?)\s*<#@dp>\}~/, + para.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/, '<endnote><number>\1</number><note>\2</note></endnote> ') - para.gsub!(/~\[([*+]\d+)\s+(.+?)\s*<#@dp>\]~/, + para.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/, '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') - para.gsub!(/~\{([*+]+)\s+(.+?)\s*<#@dp>\}~/, + para.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/, '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') end def xml_head(meta) txt=meta.text - txt.gsub!(/<br(?: \/)?>/,'') + txt.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,' ') txt.gsub!(/ & /,' and ') el=meta.el.gsub(/\./,'_') el_txt=meta.el.gsub(/\./,' ') @@ -301,9 +301,9 @@ WOK ((lv+1)..6).each { |x| @level[x]=false } end def group_structure(para='',ocn='') - para.gsub!(/<:group(?:-end)?>/,'') + para.gsub!(/#{Mx[:gr_o]}group(?:-end)?#{Mx[:gr_c]}/,'') para=@trans.markup_group(para) - para.gsub!(/~\{(\d+)\s+(.+?)\s*<#@dp>\}~/m, + para.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/m, '<endnote><number>\1</number><note>\2</note></endnote> ') para.strip! @@xml[:body] << %{#{@tab*6}<object id="#{ocn}">} << "\n" @@ -314,7 +314,7 @@ WOK @@xml[:body] << "#{@tab*6}</object>" << "\n" end def poem_structure(para='',ocn='') - para.gsub!(/<:verse(?:-end)?>/,'') + para.gsub!(/#{Mx[:gr_o]}verse(?:-end)?#{Mx[:gr_c]}/,'') para=@trans.markup_group(para) para.strip! @@xml[:body] << %{#{@tab*6}<object id="#{ocn}">} << "\n" @@ -325,7 +325,7 @@ WOK @@xml[:body] << "#{@tab*6}</object>" << "\n" end def code_structure(para='',ocn='') - para.gsub!(/<:code(?:-end)?>/,'') + para.gsub!(/#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}/,'') para=@trans.markup_group(para) para.gsub!(/\s\s/,'  ') para.strip! @@ -344,82 +344,82 @@ WOK end def markup(data) xml_sc(@md) - @rcdc=false @level,@cont,@copen,@xml_contents_close=[],[],[],[] + @rcdc=false (0..6).each { |x| @cont[x]=@level[x]=false } (4..6).each { |x| @xml_contents_close[x]='' } data.each do |para| para=@trans.markup(para) @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 - if para =~/^0~(\S+)\s+(.+?)$/ # for headers + if para =~/^#{Rx[:meta]}\s*(.+?)$/ # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta if d_meta; xml_head(d_meta) end end if @rcdc==false \ and (para =~/~metadata/ \ - or para =~/1~meta\s+Document Information/) + or para =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/) @rcdc=true end - if para !~/(^0~|<ENDNOTES>|<EOF>)/ - if para =~/.+?<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ + if para =~/.+?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ paranum=para[@regx,3] @p_num=SiSU_XML_format::Paragraph_number.new(@md,paranum) end - @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para_ocn + @sto=SiSU_text_parts::Split_text_object.new(@md,para).xml ### problem in scroll, it appears tables are getting paragraph numbers unless @rcdc - m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|null/ + format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ case @sto.format - when /^(1)~(?:(\S+))?/ + when /^(1):(\S*)/ xml_markup(para) xml_structure($1,@sto.ocn,para,$2) para=@sto.lev_para_ocn.heading_body1 #if para =~m - when /^(2)~(?:(\S+))?/ + when /^(2):(\S*)/ xml_markup(para) xml_structure($1,@sto.ocn,para,$2) para=@sto.lev_para_ocn.heading_body2 #if para =~m - when /^(3)~(?:(\S+))?/ + when /^(3):(\S*)/ xml_markup(para) xml_structure($1,@sto.ocn,para,$2) para=@sto.lev_para_ocn.heading_body3 #if para =~m - when /^(4)~(\S+)/ # work on see SiSU_text_parts::Split_text_object + when /^(4):(\S+)/ # work on see SiSU_text_parts::Split_text_object xml_markup(para) xml_structure($1,@sto.ocn,para,$2) para=@sto.lev_para_ocn.heading_body4 #if para =~m - when /^(5)~(?:(\S+))?/ + when /^(5):(\S*)/ xml_markup(para) xml_structure($1,@sto.ocn,para,$2) para=@sto.lev_para_ocn.heading_body5 #if para =~m - when /^(6)~(?:(\S+))?/ + when /^(6):(\S*)/ xml_markup(para) xml_structure($1,@sto.ocn,para,$2) para=@sto.lev_para_ocn.heading_body6 #if para =~m else - matched=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/mi.match(para) + matched=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/mi.match(para) stamp,ocn=matched[0],matched[1] - if para =~ /<:verse>/ + if para =~ /#{Mx[:gr_o]}verse#{Mx[:gr_c]}/ para.gsub!(/#{stamp}/,'') poem_structure(para,ocn) - elsif para =~ /<:group>/ + elsif para =~ /#{Mx[:gr_o]}group#{Mx[:gr_c]}/ para.gsub!(/#{stamp}/,'') group_structure(para,ocn) - elsif para =~ /<:code>/ + elsif para =~ /#{Mx[:gr_o]}code#{Mx[:gr_c]}/ para.gsub!(/#{stamp}/,'') code_structure(para,ocn) - elsif para =~/<!Th?.+/ # tables come as single block #work area 2005w13 + elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13 table=SiSU_Tables::Table_xml.new(para,ocn) para=table.table_split @@xml[:body] << table_structure(para,ocn) else #xml_structure(para, nil, nil, nil) type=case para - when /^\s*(?:<:i([1-9])> )?_\*/ + when /^\s*(?:#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}\s*)?#{Mx[:gl_bullet]}/ m=$1 - para.gsub!(/^(\s*(?:<:i[1-9]> )?)_\*/,'\1') + para.gsub!(/^(\s*(?:#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}\s*)?)#{Mx[:gl_bullet]}/,'\1') "indent_bullet#{m}" - when /^\s*<:i([1-9])>/; "indent#{$1}" + when /^\s*#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/; "indent#{$1}" else 'norm' end xml_markup(para) @@ -432,16 +432,16 @@ WOK @@xml[:body] << "#{@tab*6}</object>" << "\n" if para[@regx] end end - elsif para =~/(Note|Endnotes?)/ \ - and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/(#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ \ + and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #format_scroll=MonoSiSU.new('<br /><a name="notes">Note</a>') #para=format_scroll.boldPara elsif para =~/(MetaData)/ \ - and para =~/<~\d+;[m]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info + and para =~/#{Mx[:id_o]}~\d+;[m]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info format_scroll=Format_scroll.new(@md,'<br /><a name="metadata">MetaData</a>') para=format_scroll.bold_para elsif para =~/(Owner Details)/ \ - and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ format_scroll=Format_scroll.new(@md,'<br /><a name="owner.details">Owner Details</a>') @@xml[:owner_details]=format_scroll.bold_para para='' @@ -455,8 +455,7 @@ WOK para='' end if para =~/.*<:#>.*$/ - para=case para - when /<:i[1-9]>/ + para=if para =~ /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/ format_text=Format_text_object.new(para,'') format_text.scr_inden_ocn_e_no_paranum end @@ -471,8 +470,7 @@ WOK end else # end - para.gsub!(/<:\S+?>/,'') - para.gsub!(/<!.+!>/,' ') ## Clean Prepared Text + para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if para end end @content_flag=true @@ -535,8 +533,7 @@ WOK filename_xml=SiSU_Env::SiSU_file.new(@md,@md.fn[:dom]).mkfile @data.each do |para| #para.strip! - para.gsub!(/<:\S+?>/,'') - para.gsub!(/<!.+?!>/,'') + para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') #; para.gsub!(/<:\S+?>|<!.+?!>/,'') para="#{para}\n" unless para.empty? filename_xml.puts para end diff --git a/lib/sisu/v0/xml_fictionbook.rb b/lib/sisu/v0/xml_fictionbook.rb index 9e9a42f9..ce100f3b 100644 --- a/lib/sisu/v0/xml_fictionbook.rb +++ b/lib/sisu/v0/xml_fictionbook.rb @@ -177,8 +177,8 @@ WOK end def markup(para,type='') para.strip! - para=para.gsub(/^[1-9]~(?:\S+)?\s+/,'') - para=para.gsub(/<~(\d+);(?:\d:\d+|\S\d+);\S\d+><#@dp:#@dp>/,'[(\1)]') + para=para.gsub(/^#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}\s*/,'') + para=para.gsub(/#{Mx[:id_o]}~(\d+);(?:\d:\d+|\S\d+);\S\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'[(\1)]') para=@trans.markup_fictionbook(para) para=if type.empty?; "<p>#{para}</p>" else "<#{type}><p>#{para}</p></#{type}>" @@ -288,7 +288,7 @@ WOK @ds=[] c=0 data.each do |para| - rgx_headers=/<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)>/ + rgx_headers=/#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}/ if para =~rgx_headers x=(rgx_headers).match(para) if x[3] =~/^[hum]\d+/ diff --git a/lib/sisu/v0/xml_format.rb b/lib/sisu/v0/xml_format.rb index 5558bd80..20eb6736 100644 --- a/lib/sisu/v0/xml_format.rb +++ b/lib/sisu/v0/xml_format.rb @@ -292,7 +292,7 @@ WOK @paranum=/(\d+)/m.match(txt[2])[1] @headname='' #if txt[2]=~/\d+/ - m=/\d~(\S+)/m.match(format) + m=/#{Mx[:lv_o]}\d:(\S+?)#{Mx[:lv_c]}/m.match(format) headname=m[1] if m @headname=%{<a name="h#{headname}"></a>} unless headname.nil? @p_num=SiSU_XML_format::Paragraph_number.new(@md,@paranum) @@ -301,7 +301,7 @@ WOK rgx=/^[1-6-]~{1,2}/ #watch link=txt[0].gsub(rgx,'') if @one =~rgx @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - rgx=/~\{\d+\s+(.+?)<#@dp>\}~/ + rgx=/~\{\d+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}\}~/ link=txt[0].gsub(rgx,'\1') if txt[0] =~rgx @link,@linkname=link,txt[1] @vz=SiSU_Env::Get_init.instance.skin diff --git a/lib/sisu/v0/xml_scaffold.rb b/lib/sisu/v0/xml_scaffold.rb index 1404567c..9c3a7128 100644 --- a/lib/sisu/v0/xml_scaffold.rb +++ b/lib/sisu/v0/xml_scaffold.rb @@ -185,8 +185,8 @@ module SiSU_XML_scaffold @ds=[] c=0 data.each do |para| - if para =~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+>/ - x=(/<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)>/).match(para) + if para =~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/ + x=(/#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}/).match(para) if x[3] =~/^[hu]\d+/ @ds[c]={} @ds[c][:ocn]=x[1] diff --git a/lib/sisu/v0/xml_tables.rb b/lib/sisu/v0/xml_tables.rb index 1e08f3eb..98eab515 100644 --- a/lib/sisu/v0/xml_tables.rb +++ b/lib/sisu/v0/xml_tables.rb @@ -88,43 +88,43 @@ module SiSU_Tables m=@parablock[/<!f(.+?)!>/,1] @@tablefoot << m if m @parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if @parablock =~/<!Th¡/u - if @parablock =~/<!Th?¡/u - @parablock.gsub!(/<!Th?¡.+?!~(\d+);\w\d+;\w\d+>/u, + @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u + if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u, %{\n<ocn>#@ocn</ocn><table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">}) end - if @parablock =~/<!TZ!>/ + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] #bug table footers need rethink, removed for now @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - @parablock.gsub!(/<!TZ!>\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>/,"</table>\n") # + - @parablock.gsub!(/<!TZ!>\s*/,"</table>\n") + @parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,"</table>\n") # + + @parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}\s*/,"</table>\n") end if @@tablehead == 1 - if @parablock =~/¡¡/u - @parablock.gsub!(/<!¡¡(\d+?)¡/u, + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{<tr> <td width="\\1%" valign="top"> #{@vz.paragraph_table_xml}<b>}) - @parablock.gsub!(/¡¡(\d+?)¡/u, + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{</b></td><td width="\\1%" valign="top"> #{@vz.paragraph_table_xml}<b>}) - @parablock.gsub!(/!>/,"</b>\n</td>\n</tr>") + @parablock.gsub!(/#{Mx[:tc_c]}/,"</b>\n</td>\n</tr>") @@tablehead=0 end @parablock else - @parablock.gsub!(/<!¡¡(\d+?)¡/u, + @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{<tr> <td width="\\1%" valign="top"> #{@vz.paragraph_table_xml}}) - @parablock.gsub!(/¡¡(\d+?)¡/u, + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{ </td> <td width="\\1%" valign="top"> #{@vz.paragraph_table_xml}}) - @parablock.gsub!(/!>/,"\n</td>\n</tr>\n") + @parablock.gsub!(/#{Mx[:tc_c]}/,"\n</td>\n</tr>\n") end @parablock end @@ -171,39 +171,39 @@ module SiSU_Tables m=@parablock[/<!f(.+?)!>/,1] @@tablefoot << m if m @parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if @parablock =~/<!Th¡/u - if @parablock =~/<!Th?¡.+?!~(\d+);\w\d+;\w\d+>/u; @parablock=table_head($1) + @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u + if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head($1) end - if @parablock =~/<!TZ!>/ + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - if @parablock =~/<!TZ!>/; @parablock=table_end + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock=table_end end end if @@tablehead == 1 - if @parablock =~/¡¡/u - if @parablock =~/<!¡¡(\d+?)¡/u - @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1,true)) + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u + if @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true)) end - if @parablock =~/¡¡(\d+?)¡/u - @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1,true)) + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true)) end - if @parablock =~/!>/ - @parablock.gsub!(/!>/,table_row_close(true)) + if @parablock =~/#{Mx[:tc_c]}/ + @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close(true)) end @@tablehead=0 end @parablock else - if @parablock =~/<!¡¡(\d+?)¡/u - @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1)) + if @parablock =~/^#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/^#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1)) end - if @parablock =~/¡¡(\d+?)¡/u - @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1)) + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1)) end - if @parablock =~/!>/ - @parablock.gsub!(/!>/,table_row_close) + if @parablock =~/#{Mx[:tc_c]}/ + @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close) end @parablock end @@ -211,4 +211,5 @@ module SiSU_Tables end end end +__END__ diff --git a/man/man1/sisu.1 b/man/man1/sisu.1 index 59acec9f..fe745b87 100644 --- a/man/man1/sisu.1 +++ b/man/man1/sisu.1 @@ -1,4 +1,4 @@ -.TH "sisu" "1" "2008-05-22" "0.67.0" "SiSU" +.TH "sisu" "1" "2008-07-21" "0.68.0" "SiSU" .SH NAME sisu \- documents: markup, structuring, publishing in multiple standard formats, and search .SH SYNOPSIS @@ -179,14 +179,14 @@ content prepared in \- Structured information, Serialized Units \- a document publishing system .BR -sisu \ [ \ \-abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0\-9 \ ] \ [ \ filename/ \ -wildcard \ ] +sisu [ \ \-abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0\-9 \ ] [ \ filename/ \ wildcard +\ ] .BR -sisu \ [ \ \-Ddcv \ ] \ [ \ instruction \ ] +sisu [ \ \-Ddcv \ ] [ \ instruction \ ] .BR -sisu \ [ \ \-CcFLSVvW \ ] +sisu [ \ \-CcFLSVvW \ ] .BR Note: commands should be issued from within the directory that contains the @@ -208,20 +208,20 @@ structure information. For more see: <http://www.jus.uio.no/sisu> 2.3 DOCUMENT PROCESSING COMMAND FLAGS .TP -.B \ \-a \ \ [filename/wildcard] +.B \-a [filename/wildcard] produces plaintext with Unix linefeeds and without markup, (object numbers -are omitted), has footnotes at end of each paragraph that contains them \ [ \ -\-A \ for \ equivalent \ dos \ (linefeed) \ output \ file] \ [see \ \-e \ for \ +are omitted), has footnotes at end of each paragraph that contains them [ \ \-A +\ for \ equivalent \ dos \ (linefeed) \ output \ file] [see \ \-e \ for \ endnotes]. (Options include: \-\-endnotes for endnotes \-\-footnotes for footnotes at the end of each paragraph \-\-unix for unix linefeed (default) \-\-msdos for msdos linefeed) .TP -.B \ \-b \ \ [filename/wildcard] +.B \-b [filename/wildcard] produces xhtml/XML output for browser viewing (sax parsing). .TP -.B \ \-C \ \ [\-\-init\-site] +.B \-C [\-\-init\-site] configure/initialise shared output directory files initialize shared output directory (config files such as css and dtd files are not updated if they already exist unless modifier is used). \-C \-\-init\-site configure/initialise @@ -230,40 +230,37 @@ update, existing shared output config files such as css and dtd files are updated if this modifier is used. .TP -.B \ \-CC -\ configure/initialise \ shared \ output \ directory \ files \ initialize \ -shared \ output \ directory \ (config \ files \ such \ as \ css \ and \ dtd \ -files \ are \ not \ updated \ if \ they \ already \ exist \ unless \ modifier \ -is \ used). \ The \ equivalent \ of: \ \-C \ \-\-init\-site \ -configure/initialise \ site, \ more \ extensive \ than \ \-C \ on \ its \ own, -\ shared \ output \ directory \ files/force \ update, \ existing \ shared \ -output \ config \ files \ such \ as \ css \ and \ dtd \ files \ are \ updated \ -if \ \-CC \ is \ used. \ +.B \-CC +configure/initialise shared output directory files initialize shared output +directory (config files such as css and dtd files are not updated if they +already exist unless modifier is used). The equivalent of: \-C \-\-init\-site +configure/initialise site, more extensive than \-C on its own, shared output +directory files/force update, existing shared output config files such as css +and dtd files are updated if \-CC is used. .TP -.B \ \-c \ \ [filename/wildcard] +.B \-c [filename/wildcard] screen toggle ansi screen colour on or off depending on default set (unless \-c flag is used: if sisurc colour default is set to \'true\', output to screen will be with colour, if sisurc colour default is set to \'false\' or is undefined screen output will be without colour). .TP -.B \ \-D \ \ [instruction] \ [filename] +.B \-D [instruction] [filename] database postgresql ( \-\-pgsql may be used instead) possible instructions, -include: \-\-createdb; \-\-create; \-\-dropall; \-\-import \ [filename]; -\-\-update \ [filename]; \-\-remove \ [filename]; see database section below. +include: \-\-createdb; \-\-create; \-\-dropall; \-\-import [filename]; +\-\-update [filename]; \-\-remove [filename]; see database section below. .TP -.B \ \-d \ \ [\-\-db\-[database \ type \ (sqlite|pg)]] \-\-[instruction] \ -[filename] +.B \-d [\-\-db\-[database \ type \ (sqlite|pg)]] \-\-[instruction] [filename] database type default set to sqlite, (for which \-\-sqlite may be used instead) or to specify another database \-\-db\-[pgsql, \ sqlite] (however see \-D) possible instructions include: \-\-createdb; \-\-create; \-\-dropall; -\-\-import \ [filename]; \-\-update \ [filename]; \-\-remove \ [filename]; see +\-\-import [filename]; \-\-update [filename]; \-\-remove [filename]; see database section below. .TP -.B \ \-F \ \ [\-\-webserv=webrick] +.B \-F [\-\-webserv=webrick] generate examples of (naive) cgi search form for sqlite and pgsql depends on your already having used sisu to populate an sqlite and/or pgsql database, (the sqlite version scans the output directories for existing sisu_sqlite databases, @@ -277,71 +274,71 @@ that they be copied to the cgi\-bin directory). \-Fv (in addition to the above) provides some information on setting up hyperestraier for sisu .TP -.B \ \-H \ \ [filename/wildcard] +.B \-H [filename/wildcard] produces html without link suffixes (.html \.pdf etc.) (\"Hide\"). Requires -an appropriately configured web server. \ [behaviour \ switched \ after \ 0.35 -\ see \ \-h]. +an appropriately configured web server. [behaviour \ switched \ after \ 0.35 \ +see \ \-h]. .TP -.B \ \-h \ \ [filename/wildcard] +.B \-h [filename/wildcard] produces html (with hardlinks i.e. with name suffixes in links/local urls). html, with internal document links that include the document suffix, i.e. whether it is \.html or \.pdf (required for browsing directly off a file -system, and works with most web servers). \ [behaviour \ switched \ after \ -0.35 \ see \ \-H]. +system, and works with most web servers). [behaviour \ switched \ after \ 0.35 +\ see \ \-H]. .TP -.B \ \-I \ \ [filename/wildcard] +.B \-I [filename/wildcard] produces texinfo and info file, (view with pinfo). .TP -.B \ \-i \ \ [filename/wildcard] +.B \-i [filename/wildcard] produces man page of file, not suitable for all outputs. .TP -.B \ \-L -\ prints \ license \ information. \ +.B \-L +prints license information. .TP -.B \ \-M \ \ [filename/wildcard/url] +.B \-M [filename/wildcard/url] maintenance mode files created for processing preserved and their locations indicated. (also see \-V) .TP -.B \ \-m \ \ [filename/wildcard/url] +.B \-m [filename/wildcard/url] assumed for most other flags, creates new meta\-markup file, (the metaverse ) that is used in all subsequent processing of other output. This step is assumed for most processing flags. To skip it see \-n .TP -.B \ \-N \ \ [filename/wildcard/url] +.B \-N [filename/wildcard/url] document digest or document content certificate ( DCC ) as md5 digest tree of the document: the digest for the document, and digests for each object contained within the document (together with information on software versions that produced it) (digest.txt). \-NV for verbose digest output to screen. .TP -.B \ \-n \ \ [filename/wildcard/url] +.B \-n [filename/wildcard/url] skip meta\-markup (building of \"metaverse\"), this skips the equivalent of \-m which is otherwise assumed by most processing flags. .TP -.B \ \-o \ \ [filename/wildcard/url] +.B \-o [filename/wildcard/url] output basic document in opendocument file format (opendocument.odt). .TP -.B \ \-p \ \ [filename/wildcard] +.B \-p [filename/wildcard] produces LaTeX pdf (portrait.pdf & landscape.pdf). Default paper size is set in config file, or document header, or provided with additional command line parameter, e.g. \-\-papersize\-a4 preset sizes include: \'A4\', U.S. \'letter\' and \'legal\' and book sizes \'A5\' and \'B5\' (system defaults to A4). .TP -.B \ \-q \ \ [filename/wildcard] +.B \-q [filename/wildcard] quiet less output to screen. .TP -.B \ \-R \ \ [filename/wildcard] +.B \-R [filename/wildcard] copies sisu output files to remote host using rsync. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your \"keys\" and ssh agent in place. Note the behavior of rsync @@ -350,22 +347,21 @@ different if \-R is used with other flags from if used alone. Alone the rsync \-R is used together with other flags, it is not). Also see \-r .TP -.B \ \-r \ \ [filename/wildcard] +.B \-r [filename/wildcard] copies sisu output files to remote host using scp. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your \"keys\" and ssh agent in place. Also see \-R .TP -.B \ \-S -\ produces \ a \ sisupod \ a \ zipped \ sisu \ directory \ of \ markup \ -files \ including \ sisu \ markup \ source \ files \ and \ the \ directories \ -local \ configuration \ file, \ images \ and \ skins. \ Note: \ this \ only \ -includes \ the \ configuration \ files \ or \ skins \ contained \ in \ \./_sisu -\ not \ those \ in \ ~/.sisu \ \-S \ \ [filename/wildcard] option. Note: (this +.B \-S +produces a sisupod a zipped sisu directory of markup files including sisu +markup source files and the directories local configuration file, images and +skins. Note: this only includes the configuration files or skins contained in + \./_sisu not those in ~/.sisu \-S [filename/wildcard] option. Note: (this option is tested only with zsh). .TP -.B \ \-S \ \ [filename/wildcard] +.B \-S [filename/wildcard] produces a zipped file of the prepared document specified along with associated images, by default named sisupod.zip they may alternatively be named with the filename extension \.ssp This provides a quick way of gathering the @@ -382,19 +378,18 @@ that file that are not your own are treated as untrusted. The directory structure of the unzipped file is understood by sisu, and sisu commands can be run within it. Note: if you wish to send multiple files, it quickly becomes more space efficient to zip the sisu markup directory, rather than the -individual files for sending). See the \-S option without \ -[filename/wildcard]. +individual files for sending). See the \-S option without [filename/wildcard]. .TP -.B \ \-s \ \ [filename/wildcard] +.B \-s [filename/wildcard] copies sisu markup file to output directory. .TP -.B \ \-t \ \ [filename/wildcard \ (*.termsheet.rb)] +.B \-t [filename/wildcard \ (*.termsheet.rb)] standard form document builder, preprocessing feature .TP -.B \ \-U \ \ [filename/wildcard] +.B \-U [filename/wildcard] prints url output list/map for the available processing flags options and resulting files that could be requested, (can be used to get a list of processing options in relation to a file, together with information on the @@ -404,77 +399,76 @@ provides webrick url mappings where appropriate, but these can be switched to file system paths in sisurc.yml .TP -.B \ \-u \ \ [filename/wildcard] +.B \-u [filename/wildcard] provides url mapping of output files for the flags requested for processing, also see \-U .TP -.B \ \-V -\ on \ its \ own, \ provides -.B \ SiSU -\ version \ and \ environment \ information \ (sisu \ \-\-help \ env) \ +.B \-V +on its own, provides +.B SiSU +version and environment information (sisu \-\-help env) .TP -.B \ \-V \ \ [filename/wildcard] +.B \-V [filename/wildcard] even more verbose than the \-v flag. (also see \-M) .TP -.B \ \-v -\ on \ its \ own, \ provides -.B \ SiSU -\ version \ information \ +.B \-v +on its own, provides +.B SiSU +version information .TP -.B \ \-v \ \ [filename/wildcard] +.B \-v [filename/wildcard] provides verbose output of what is being built, where it is being built (and error messages if any), as with \-u flag provides a url mapping of files created for each of the processing flag requests. See also \-V .TP -.B \ \-W -\ starts \ ruby\'s \ webrick \ webserver \ points \ at \ sisu \ output \ -directories, \ the \ default \ port \ is \ set \ to \ 8081 \ and \ can \ be \ -changed \ in \ the \ resource \ configuration \ files. \ \ [tip: \ the \ -webrick \ server \ requires \ link \ suffixes, \ so \ html \ output \ should \ -be \ created \ using \ the \ \-h \ option \ rather \ than \ \-H; \ also, \ note -\ \-F \ webrick \ ]. +.B \-W +starts ruby\'s webrick webserver points at sisu output directories, the +default port is set to 8081 and can be changed in the resource configuration +files. [tip: \ the \ webrick \ server \ requires \ link \ suffixes, \ so \ html +\ output \ should \ be \ created \ using \ the \ \-h \ option \ rather \ than \ +\-H; \ also, \ note \ \-F \ webrick \ ]. .TP -.B \ \-w \ \ [filename/wildcard] +.B \-w [filename/wildcard] produces concordance (wordmap) a rudimentary index of all the words in a document. (Concordance files are not generated for documents of over 260,000 words unless this limit is increased in the file sisurc.yml) .TP -.B \ \-X \ \ [filename/wildcard] +.B \-X [filename/wildcard] produces XML output with deep document structure, in the nature of dom. .TP -.B \ \-x \ \ [filename/wildcard] +.B \-x [filename/wildcard] produces XML output shallow structure (sax parsing). .TP -.B \ \-Y \ \ [filename/wildcard] +.B \-Y [filename/wildcard] produces a short sitemap entry for the document, based on html output and the sisu_manifest. \-\-sitemaps generates/updates the sitemap index of existing -sitemaps. (Experimental, \ [g,y,m \ announcement \ this \ week]) +sitemaps. (Experimental, [g,y,m \ announcement \ this \ week]) .TP -.B \ \-y \ \ [filename/wildcard] +.B \-y [filename/wildcard] produces an html summary of output generated (hyperlinked to content) and document specific metadata (sisu_manifest.html). This step is assumed for most processing flags. .TP -.B \ \-Z \ \ [filename/wildcard] +.B \-Z [filename/wildcard] Zap, if used with other processing flags deletes output files of the type about to be processed, prior to processing. If \-Z is used as the lone processing related flag (or in conjunction with a combination of \-[mMvVq]), will remove the related document output directory. .TP -.B \ \-z \ \ [filename/wildcard] -produces php (zend) \ [this \ feature \ is \ disabled \ for \ the \ time \ +.B \-z [filename/wildcard] +produces php (zend) [this \ feature \ is \ disabled \ for \ the \ time \ being] .SH @@ -482,25 +476,22 @@ being] .BR .TP -.B \ \-\-no\-ocn -\ \ [with \ \-h \ \-H \ or \ \-p] switches off object citation numbering. -Produce output without identifying numbers in margins of html or LaTeX/pdf -output. +.B \-\-no\-ocn +[with \ \-h \ \-H \ or \ \-p] switches off object citation numbering. Produce +output without identifying numbers in margins of html or LaTeX/pdf output. .TP -.B \ \-\-no\-annotate -\ strips \ output \ text \ of \ editor \ endnotes[^*1] denoted by asterisk or -dagger/plus sign +.B \-\-no\-annotate +strips output text of editor endnotes[^*1] denoted by asterisk or dagger/plus +sign .TP -.B \ \-\-no\-asterisk -\ strips \ output \ text \ of \ editor \ endnotes[^*2] denoted by asterisk -sign +.B \-\-no\-asterisk +strips output text of editor endnotes[^*2] denoted by asterisk sign .TP -.B \ \-\-no\-dagger -\ strips \ output \ text \ of \ editor \ endnotes[^+1] denoted by dagger/plus -sign +.B \-\-no\-dagger +strips output text of editor endnotes[^+1] denoted by dagger/plus sign .SH 4. DATABASE COMMANDS @@ -514,36 +505,35 @@ dbi \- database interface \-d is modifiable with \-\-db=[database \ type \ (pgsql \ or \ sqlite)] .TP -.B \ \-Dv \ \-\-createall -\ initial \ step, \ creates \ required \ relations \ (tables, \ indexes) \ in -\ existing \ postgresql \ database \ (a \ database \ should \ be \ created \ -manually \ and \ given \ the \ same \ name \ as \ working \ directory, \ as \ -requested) \ (rb.dbi) \ \ [ \ \-dv \ \-\-createall \ sqlite \ equivalent] it -may be necessary to run sisu \-Dv \-\-createdb initially NOTE: at the present -time for postgresql it may be necessary to manually create the database. The -command would be \'createdb \ [database \ name]\' where database name would be -SiSU_[present \ working \ directory \ name \ (without \ path)]. Please use only -alphanumerics and underscores. +.B \-Dv \-\-createall +initial step, creates required relations (tables, indexes) in existing +postgresql database (a database should be created manually and given the same +name as working directory, as requested) (rb.dbi) [ \ \-dv \ \-\-createall \ +sqlite \ equivalent] it may be necessary to run sisu \-Dv \-\-createdb +initially NOTE: at the present time for postgresql it may be necessary to +manually create the database. The command would be \'createdb [database \ +name]\' where database name would be SiSU_[present \ working \ directory \ name +\ (without \ path)]. Please use only alphanumerics and underscores. .TP -.B \ \-Dv \ \-\-import -\ \ [filename/wildcard] imports data specified to postgresql db (rb.dbi) \ [ -\ \-dv \ \-\-import \ sqlite \ equivalent] +.B \-Dv \-\-import +[filename/wildcard] imports data specified to postgresql db (rb.dbi) [ \ \-dv +\ \-\-import \ sqlite \ equivalent] .TP -.B \ \-Dv \ \-\-update -\ \ [filename/wildcard] updates/imports specified data to postgresql db -(rb.dbi) \ [ \ \-dv \ \-\-update \ sqlite \ equivalent] +.B \-Dv \-\-update +[filename/wildcard] updates/imports specified data to postgresql db (rb.dbi) +[ \ \-dv \ \-\-update \ sqlite \ equivalent] .TP -.B \ \-D \ \-\-remove -\ \ [filename/wildcard] removes specified data to postgresql db (rb.dbi) \ [ -\ \-d \ \-\-remove \ sqlite \ equivalent] +.B \-D \-\-remove +[filename/wildcard] removes specified data to postgresql db (rb.dbi) [ \ \-d +\ \-\-remove \ sqlite \ equivalent] .TP -.B \ \-D \ \-\-dropall -\ kills \ data\" \ and \ drops \ (postgresql \ or \ sqlite) \ db, \ tables \ -& \ indexes \ \ [ \ \-d \ \-\-dropall \ sqlite \ equivalent] +.B \-D \-\-dropall +kills data\" and drops (postgresql or sqlite) db, tables & indexes [ \ \-d \ +\-\-dropall \ sqlite \ equivalent] .BR The v in e.g. \-Dv is for verbose output. @@ -553,7 +543,7 @@ The v in e.g. \-Dv is for verbose output. .BR .TP -.B \ \-\-update \ \ [filename/wildcard] +.B \-\-update [filename/wildcard] Checks existing file output and runs the flags required to update this output. This means that if only html and pdf output was requested on previous runs, only the \-hp files will be applied, and only these will be generated @@ -561,37 +551,37 @@ this time, together with the summary. This can be very convenient, if you offer different outputs of different files, and just want to do the same again. .TP -.B \ \-0 \ to \ \-5 \ \ [filename \ or \ wildcard] +.B \-0 to \-5 [filename \ or \ wildcard] Default shorthand mappings (note that the defaults can be changed/configured in the sisurc.yml file): .TP -.B \ \-0 -\ \-mNhwpAobxXyYv \ \ [this \ is \ the \ default \ action \ run \ when \ no \ -options \ are \ give, \ i.e. \ on \ \'sisu \ \ [filename]\'] +.B \-0 +\-mNhwpAobxXyYv [this \ is \ the \ default \ action \ run \ when \ no \ +options \ are \ give, \ i.e. \ on \ \'sisu \ [filename]\'] .TP -.B \ \-1 -\ \-mNHwpy \ +.B \-1 +\-mNHwpy .TP -.B \ \-2 -\ \-mNHwpaoy \ +.B \-2 +\-mNHwpaoy .TP -.B \ \-3 -\ \-mNhwpAobxXyY \ +.B \-3 +\-mNhwpAobxXyY .TP -.B \ \-4 -\ \-mNhwpAobxXDyY \ \-\-import \ +.B \-4 +\-mNhwpAobxXDyY \-\-import .TP -.B \ \-5 -\ \-mNhwpAobxXDyY \ \-\-update \ +.B \-5 +\-mNhwpAobxXDyY \-\-update .BR -add \-v for verbose mode and \-c for color, e.g. sisu \-2vc \ [filename \ or \ +add \-v for verbose mode and \-c for color, e.g. sisu \-2vc [filename \ or \ wildcard] .BR @@ -630,7 +620,7 @@ The manual can be generated from source, found respectively, either within the tarball or installed locally at: .BR - \./data/doc/sisu/sisu_markup_samples/sisu_manual/ + ./data/doc/sisu/sisu_markup_samples/sisu_manual/ .BR /usr/share/doc/sisu/sisu_markup_samples/sisu_manual/ @@ -667,7 +657,7 @@ the sisu manual, the sources files for which are located within the tarball at: .BR - \./data/doc/sisu/sisu_manual/ + ./data/doc/sisu/sisu_manual/ .BR Once installed, directory equivalent to: @@ -682,16 +672,16 @@ Available man pages are converted back to html using man2html: /usr/share/doc/sisu/html/ .BR - \./data/doc/sisu/html/ + ./data/doc/sisu/html/ .BR An online version of the sisu man page is available here: .BR -* various sisu man pages <http://www.jus.uio.no/sisu/man/> \ [^7] +* various sisu man pages <http://www.jus.uio.no/sisu/man/> [^7] .BR -* sisu.1 <http://www.jus.uio.no/sisu/man/sisu.1.html> \ [^8] +* sisu.1 <http://www.jus.uio.no/sisu/man/sisu.1.html> [^8] .SH 6.3 SISU BUILT\-IN INTERACTIVE HELP @@ -704,7 +694,7 @@ information: sisu \-\-help .BR - sisu \-\-help \ [subject] + sisu \-\-help [subject] .BR sisu \-\-help commands @@ -713,11 +703,11 @@ information: sisu \-\-help markup .BR - sisu \-\-help env \ [for \ feedback \ on \ the \ way \ your \ system \ is \ + sisu \-\-help env [for \ feedback \ on \ the \ way \ your \ system \ is \ setup \ with \ regard \ to \ sisu] .BR - sisu \-V \ [environment \ information, \ same \ as \ above \ command] + sisu \-V [environment \ information, \ same \ as \ above \ command] .BR sisu (on its own provides version and some help information) @@ -814,7 +804,7 @@ markup or sisu \-\-help markup To check the markup in a file: .BR - sisu \-\-identify \ [filename].sst + sisu \-\-identify [filename].sst .BR For brief descriptive summary of markup history @@ -945,12 +935,12 @@ This is a sample header .BR .B % SiSU 0.38 -\ [declared \ file\-type \ identifier \ with \ markup \ version] +[declared \ file\-type \ identifier \ with \ markup \ version] + .BR .B @title: -\ [title \ text] This is the title of the document and used as such, this -header is the only one that is + \ [title \ text] This is the title of the document and used as such, this header is the only one that is .I mandatory .BR @@ -959,7 +949,7 @@ The Subtitle if any .BR .B @creator: -\ [or \ @author:] Name of Author +[or \ @author:] Name of Author .BR .B @subject: @@ -988,8 +978,9 @@ The Subtitle if any .BR .B @date: 2000\-08\-27 -\ [ \ also \ @date.created: \ @date.issued: \ @date.available: \ @date.valid: -\ @date.modified: \ ] +[ \ also \ @date.created: \ @date.issued: \ @date.available: \ @date.valid: \ +@date.modified: \ ] + .BR .B @type: article @@ -1005,13 +996,13 @@ The Subtitle if any .BR .B @language: -\ [or \ @language.document:] \ [country \ code \ for \ language \ if \ -available, \ or \ language, \ English, \ en \ is \ the \ default \ setting] (en -\- English, fr \- French, de \- German, it \- Italian, es \- Spanish, pt \- +[or \ @language.document:] [country \ code \ for \ language \ if \ available, +\ or \ language, \ English, \ en \ is \ the \ default \ setting] (en \- +English, fr \- French, de \- German, it \- Italian, es \- Spanish, pt \- Portuguese, sv \- Swedish, da \- Danish, fi \- Finnish, no \- Norwegian, is \- Icelandic, nl \- Dutch, et \- Estonian, hu \- Hungarian, pl \- Polish, ro \- Romanian, ru \- Russian, el \- Greek, uk \- Ukranian, tr \- Turkish, sk \- -Slovak, sl \- Slovenian, hr \- Croatian, cs \- Czech, bg \- Bul garian ) \ +Slovak, sl \- Slovenian, hr \- Croatian, cs \- Czech, bg \- Bul garian ) [however, \ encodings \ are \ not \ available \ for \ all \ of \ the \ languages \ listed.] @@ -1040,16 +1031,16 @@ public domain, copyleft, creative commons variant, etc. .BR .B @keywords: text document generation processing management latex pdf structured xml -citation \ [your \ keywords \ here, \ used \ for \ example \ by \ rss \ feeds, -\ and \ in \ sql \ searches] +citation [your \ keywords \ here, \ used \ for \ example \ by \ rss \ feeds, \ +and \ in \ sql \ searches] .BR .B @abstract: -\ [paper \ abstract, \ placed \ after \ table \ of \ contents] +[paper \ abstract, \ placed \ after \ table \ of \ contents] .BR .B @comment: -\ [...] +[...] .BR .B @catalogue: @@ -1058,27 +1049,27 @@ classification]; isbn=[ISBN]; pg=[Project \ Gutenberg \ text \ number] .BR .B @classify_loc: -\ [Library \ of \ Congress \ classification] +[Library \ of \ Congress \ classification] .BR .B @classify_dewey: -\ [Dewey \ classification] +[Dewey \ classification] .BR .B @classify_isbn: -\ [ISBN] +[ISBN] .BR .B @classify_pg: -\ [Project \ Gutenberg \ text \ number] +[Project \ Gutenberg \ text \ number] .BR .B @prefix: -\ [prefix \ is \ placed \ just \ after \ table \ of \ contents] +[prefix \ is \ placed \ just \ after \ table \ of \ contents] .BR .B @prefix_a: -\ [prefix \ is \ placed \ just \ before \ table \ of \ contents \ \- \ not \ +[prefix \ is \ placed \ just \ before \ table \ of \ contents \ \- \ not \ implemented] .BR @@ -1086,8 +1077,8 @@ implemented] .BR .B @rcs: -$Id: sisu_markup.sst,v 1.2 2007/09/08 17:12:47 ralph Exp $ \ [used \ by \ rcs -\ or \ cvs \ to \ embed \ version \ (revision \ control) \ information \ into \ +$Id: sisu_markup.sst,v 1.2 2007/09/08 17:12:47 ralph Exp $ [used \ by \ rcs \ +or \ cvs \ to \ embed \ version \ (revision \ control) \ information \ into \ document, \ rcs \ or \ cvs \ can \ usefully \ provide \ a \ history \ of \ updates \ to \ a \ document \ ] @@ -1104,35 +1095,35 @@ for @toc:) .BR .B @level: newpage=3; breakpage=4 -\ [paragraph \ level, \ used \ by \ latex \ to \ breakpages, \ the \ page \ -is \ optional \ eg. \ in \ newpage] +[paragraph \ level, \ used \ by \ latex \ to \ breakpages, \ the \ page \ is +\ optional \ eg. \ in \ newpage] .BR .B @markup: -information on the markup used, e.g. new=1,2,3; break=4; num_top=4 \ [or \ +information on the markup used, e.g. new=1,2,3; break=4; num_top=4 [or \ newpage=1,2,3; \ breakpage=4; \ num_top=4] newpage and breakpage, heading level, used by LaTeX to breakpages. breakpage: starts on a new page in single column text and on a new column in double column text; newpage: starts on a new page for both single and double column texts. -num_top=4 \ [auto\-number \ document, \ starting \ at \ level \ 4. \ the \ +num_top=4 [auto\-number \ document, \ starting \ at \ level \ 4. \ the \ default \ is \ to \ provide \ 3 \ levels, \ as \ in \ 1 \ level \ 4, \ 1.1 \ level \ 5, \ 1.1.1 \ level \ 6, \ markup \ to \ be \ merged \ within \ level] -num_extract \ [take \ numbering \ of \ headings \ provided \ (manually \ in \ +num_extract [take \ numbering \ of \ headings \ provided \ (manually \ in \ marked \ up \ source \ document), \ and \ use \ for \ numbering \ of \ segments. \ Available \ where \ a \ clear \ numbering \ structure \ is \ provided \ within \ document, \ without \ the \ repetition \ of \ a \ number \ -in \ a \ header.] \ [In \ 0.38 \ notation, \ you \ would \ map \ to \ the \ +in \ a \ header.] [In \ 0.38 \ notation, \ you \ would \ map \ to \ the \ equivalent \ levels, \ the \ examples \ provided \ would \ map \ to \ the \ -following \ new=A,B,C; \ break=1; \ num_top=1 \ \ [or \ newpage=A,B,C; \ +following \ new=A,B,C; \ break=1; \ num_top=1 \ [or \ newpage=A,B,C; \ breakpage=1; \ num_top=1] see headings] .BR .B @bold: -\ [regular \ expression \ of \ words/phrases \ to \ be \ made \ bold] +[regular \ expression \ of \ words/phrases \ to \ be \ made \ bold] .BR .B @italics: -\ [regular \ expression \ of \ words/phrases \ to \ italicise] +[regular \ expression \ of \ words/phrases \ to \ italicise] .BR .B @vocabulary: @@ -1146,12 +1137,13 @@ generated, such as the urls of the home site, and the icon/logo for the document or site. .TP -.B \ @man: \ 8; -\ name=sisu \ \- \ documents: \ markup, \ structuring, \ publishing \ in \ -multiple \ standard \ formats, \ and \ search; \ synopsis=sisu \ \ -[\-abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0\-9] \ [filename/wildcard \ ] -sisu \ [\-Ddcv] \ [instruction] -sisu \ [\-CcFLSVvW] +.B @man: 8; +name=sisu \- documents: markup, structuring, publishing in multiple standard +formats, and search; +synopsis=sisu [\-abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0\-9] [filename/wildcard \ +] +sisu [\-Ddcv] [instruction] +sisu [\-CcFLSVvW] the man page category number (default 1) and special tags used in preparing man page headings @@ -1165,7 +1157,7 @@ man page headings .BR .B @promo: sisu, ruby, search_libre_docs, open_society -\ [places \ content \ in \ right \ pane \ in \ html, \ makes \ use \ of \ +[places \ content \ in \ right \ pane \ in \ html, \ makes \ use \ of \ list.yml \ and \ promo.yml, \ commented \ out \ sample \ in \ document \ sample: \ free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst] @@ -1185,21 +1177,21 @@ level 1 heading (used where a stand\-alone document may be imported into another) .BR -.B :A~ \ [heading \ text] -Top level heading \ [this \ usually \ has \ similar \ content \ to \ the \ +.B :A~ [heading \ text] +Top level heading [this \ usually \ has \ similar \ content \ to \ the \ title \ @title: \ ] NOTE: the heading levels described here are in 0.38 notation, see heading .BR -.B :B~ \ [heading \ text] -Second level heading \ [this \ is \ a \ heading \ level \ divider] +.B :B~ [heading \ text] +Second level heading [this \ is \ a \ heading \ level \ divider] .BR -.B :C~ \ [heading \ text] -Third level heading \ [this \ is \ a \ heading \ level \ divider] +.B :C~ [heading \ text] +Third level heading [this \ is \ a \ heading \ level \ divider] .BR -.B 1~ \ [heading \ text] +.B 1~ [heading \ text] Top level heading preceding substantive text of document or sub\-heading 2, the heading level that would normally be marked 1. or 2. or 3. etc. in a document, and the level on which sisu by default would break html output into @@ -1207,19 +1199,20 @@ named segments, names are provided automatically if none are given (a number), otherwise takes the form 1~my_filename_for_this_segment .BR -.B 2~ \ [heading \ text] +.B 2~ [heading \ text] Second level heading preceding substantive text of document or sub\-heading 3, the heading level that would normally be marked 1.1 or 1.2 or 1.3 or 2.1 etc. in a document. .BR -.B 3~ \ [heading \ text] +.B 3~ [heading \ text] Third level heading preceding substantive text of document, that would normally be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document .nf 1~filename level 1 heading, +.BR % the primary division such as Chapter that is followed by substantive text, and may be further subdivided (this is the level on which by default html segments are made) .fi @@ -1232,15 +1225,25 @@ normally be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document .nf normal text !{emphasis}! *{bold text}* _{underscore}_ /{italics}/ \"{citation}\" ^{superscript}^ ,{subscript}, +{inserted text}+ +.BR normal text +.BR !{emphasis}! +.BR *{bold text}* +.BR _{underscore}_ +.BR /{italics}/ +.BR \"{citation}\" +.BR ^{superscript}^ +.BR ,{subscript}, +.BR +{inserted text}+ +.BR \-{strikethrough}\- .fi @@ -1248,7 +1251,8 @@ normally be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document .B resulting output: .BR -normal text <em>emphasis</em> +normal text +.B emphasis .B bold text .I underscore .I italics @@ -1258,8 +1262,6 @@ normal text <em>emphasis</em> .BR normal text -.BR -<em>emphasis</em> .BR .B bold text @@ -1294,12 +1296,15 @@ normal text .nf ordinary paragraph +.BR _1 indent paragraph one step +.BR _2 indent paragraph two steps +.BR _9 indent paragraph nine steps .fi -.BR + .B resulting output: .BR @@ -1319,8 +1324,10 @@ ordinary paragraph .nf - * bullet text + _* bullet text +.BR _1* bullet text, first indent +.BR _2* bullet text, two step indent .fi @@ -1345,6 +1352,7 @@ Numbered List (not to be confused with headings/titles, (document structure)) .nf # numbered list numbered list 1., 2., 3, etc. +.BR _# numbered list numbered list indented a., b., c., d., etc. .fi @@ -1390,6 +1398,7 @@ normal text[^12] continues .nf normal text ~{* unnumbered asterisk footnote/endnote, insert multiple asterisks if required }~ continues +.BR normal text ~{** another unnumbered asterisk footnote/endnote }~ continues .fi @@ -1397,10 +1406,11 @@ normal text[^12] continues .B resulting output: .BR -normal text \ [^*] continues +normal text [^*] continues .BR -normal text \ [^**] continues +normal text [^**] continues + .BR .B markup example: @@ -1408,6 +1418,7 @@ normal text \ [^**] continues .nf normal text ~[* \ editors \ notes, \ numbered \ asterisk \ footnote/endnote \ series \ ]~ continues +.BR normal text ~[+ \ editors \ notes, \ numbered \ asterisk \ footnote/endnote \ series \ ]~ continues .fi @@ -1415,19 +1426,21 @@ normal text \ [^**] continues .B resulting output: .BR -normal text \ [^*3] continues +normal text [^*3] continues .BR -normal text \ [^+2] continues +normal text [^+2] continues + .BR .B Alternative endnote pair notation for footnotes/endnotes: .nf -.nf % note the endnote marker \"~^\" +.BR normal text~^ continues +.BR ^~ endnote text following the paragraph in which the marker occurs .fi @@ -1470,6 +1483,7 @@ An escaped url without decoration .nf normal text http://www.jus.uio.no/sisu continues +.BR deb http://www.jus.uio.no/sisu/archive unstable main non\-free .fi @@ -1492,6 +1506,7 @@ blocks are discussed later in this document .nf deb http://www.jus.uio.no/sisu/archive unstable main non\-free +.BR deb\-src http://www.jus.uio.no/sisu/archive unstable main non\-free .fi @@ -1531,7 +1546,7 @@ automatically as a footnote .B resulting output: .BR -about SiSU <http://www.jus.uio.no/sisu/> \ [^13] markup +about SiSU <http://www.jus.uio.no/sisu/> [^13] markup .SH 9.5.3 LINKING IMAGES @@ -1541,11 +1556,19 @@ about SiSU <http://www.jus.uio.no/sisu/> \ [^13] markup .nf - [ tux.png ] + \ [ tux.png ] +.BR % various url linked images - [ tux.png ] - [ GnuDebianLinuxRubyBetterWay.png ] +.BR + \ [ tux.png ] +.BR +.BR + \ [ GnuDebianLinuxRubyBetterWay.png ] +.BR +.BR {~^ ruby_logo.png \"Ruby\" }http://www.ruby\-lang.org/en/ +.BR +.BR .fi .BR @@ -1570,7 +1593,10 @@ and Ruby\" <http://www.jus.uio.no/sisu/> .nf {~^ \ [text \ to \ link] }http://url.org +.BR +.BR % maps to: { \ [text \ to \ link] }http://url.org ~{ http://url.org }~ +.BR % which produces hyper\-linked text within a document/paragraph, with an endnote providing the url for the text location used in the hyperlink .fi @@ -1599,12 +1625,19 @@ Tables may be prepared in two either of two forms .nf table{ c3; 40; 30; 30; +.BR This is a table +.BR this would become column two of row one +.BR column three of row one is here +.BR And here begins another row +.BR column two of row two +.BR column three of row two, and so on +.BR }table .fi @@ -1624,13 +1657,21 @@ information in each column .nf !_ Table 3.1: Contributors to Wikipedia, January 2001 \- June 2005 +.BR {table~h 24; 12; 12; 12; 12; 12; 12;} +.BR |Jan. 2001|Jan. 2002|Jan. 2003|Jan. 2004|July 2004|June 2006 +.BR Contributors* | 10| 472| 2,188| 9,653| 25,011| 48,721 +.BR Active contributors** | 9| 212| 846| 3,228| 8,442| 16,945 +.BR Very active contributors*** | 0| 31| 190| 692| 1,639| 3,016 +.BR No. of English language articles| 25| 16,000| 101,000| 190,000| 320,000| 630,000 +.BR No. of articles, all languages | 25| 19,000| 138,000| 490,000| 862,000|1,600,000 +.BR \\* Contributed at least ten times; \\** at least 5 times in last month; \\*\** more than 100 times in last month. .fi @@ -1655,8 +1696,11 @@ than 100 times in last month. .nf poem{ +.BR Your poem here +.BR }poem +.BR Each verse in a poem is given a separate object number. .fi @@ -1666,50 +1710,95 @@ than 100 times in last month. .nf poem{ +.BR \'Fury said to a +.BR mouse, That he +.BR met in the +.BR house, +.BR \"Let us +.BR both go to +.BR law: I will +.BR prosecute +.BR YOU. \-\-Come, +.BR I\'ll take no +.BR denial; We +.BR must have a +.BR trial: For +.BR really this +.BR morning I\'ve +.BR nothing +.BR to do.\" +.BR Said the +.BR mouse to the +.BR cur, \"Such +.BR a trial, +.BR dear Sir, +.BR With +.BR no jury +.BR or judge, +.BR would be +.BR wasting +.BR our +.BR breath.\" +.BR \"I\'ll be +.BR judge, I\'ll +.BR be jury,\" +.BR Said +.BR cunning +.BR old Fury: +.BR \"I\'ll +.BR try the +.BR whole +.BR cause, +.BR and +.BR condemn +.BR you +.BR to +.BR death.\"\' +.BR }poem .fi @@ -1718,93 +1807,93 @@ than 100 times in last month. \'Fury said to a -.P +.BR mouse, That he -.P +.BR met in the -.P +.BR house, -.P +.BR \"Let us -.P +.BR both go to -.P +.BR law: I will -.P +.BR prosecute -.P +.BR YOU. \-\-Come, -.P +.BR I\'ll take no -.P +.BR denial; We -.P +.BR must have a -.P +.BR trial: For -.P +.BR really this -.P +.BR morning I\'ve -.P +.BR nothing -.P +.BR to do.\" -.P +.BR Said the -.P +.BR mouse to the -.P +.BR cur, \"Such -.P +.BR a trial, -.P +.BR dear Sir, -.P +.BR With -.P +.BR no jury -.P +.BR or judge, -.P +.BR would be -.P +.BR wasting -.P +.BR our -.P +.BR breath.\" -.P +.BR \"I\'ll be -.P +.BR judge, I\'ll -.P +.BR be jury,\" -.P +.BR Said -.P +.BR cunning -.P +.BR old Fury: -.P +.BR \"I\'ll -.P +.BR try the -.P +.BR whole -.P +.BR cause, -.P +.BR and -.P +.BR condemn -.P +.BR you -.P +.BR to -.P +.BR death.\"\' -.P +.BR .SH 9.6.3 GROUP @@ -1815,8 +1904,11 @@ than 100 times in last month. .nf group{ +.BR Your grouped text here +.BR }group +.BR A group is treated as an object and given a single object number. .fi @@ -1826,50 +1918,95 @@ than 100 times in last month. .nf group{ +.BR \'Fury said to a +.BR mouse, That he +.BR met in the +.BR house, +.BR \"Let us +.BR both go to +.BR law: I will +.BR prosecute +.BR YOU. \-\-Come, +.BR I\'ll take no +.BR denial; We +.BR must have a +.BR trial: For +.BR really this +.BR morning I\'ve +.BR nothing +.BR to do.\" +.BR Said the +.BR mouse to the +.BR cur, \"Such +.BR a trial, +.BR dear Sir, +.BR With +.BR no jury +.BR or judge, +.BR would be +.BR wasting +.BR our +.BR breath.\" +.BR \"I\'ll be +.BR judge, I\'ll +.BR be jury,\" +.BR Said +.BR cunning +.BR old Fury: +.BR \"I\'ll +.BR try the +.BR whole +.BR cause, +.BR and +.BR condemn +.BR you +.BR to +.BR death.\"\' +.BR }group .fi @@ -1878,93 +2015,93 @@ than 100 times in last month. \'Fury said to a -.P +.BR mouse, That he -.P +.BR met in the -.P +.BR house, -.P +.BR \"Let us -.P +.BR both go to -.P +.BR law: I will -.P +.BR prosecute -.P +.BR YOU. \-\-Come, -.P +.BR I\'ll take no -.P +.BR denial; We -.P +.BR must have a -.P +.BR trial: For -.P +.BR really this -.P +.BR morning I\'ve -.P +.BR nothing -.P +.BR to do.\" -.P +.BR Said the -.P +.BR mouse to the -.P +.BR cur, \"Such -.P +.BR a trial, -.P +.BR dear Sir, -.P +.BR With -.P +.BR no jury -.P +.BR or judge, -.P +.BR would be -.P +.BR wasting -.P +.BR our -.P +.BR breath.\" -.P +.BR \"I\'ll be -.P +.BR judge, I\'ll -.P +.BR be jury,\" -.P +.BR Said -.P +.BR cunning -.P +.BR old Fury: -.P +.BR \"I\'ll -.P +.BR try the -.P +.BR whole -.P +.BR cause, -.P +.BR and -.P +.BR condemn -.P +.BR you -.P +.BR to -.P +.BR death.\"\' -.P +.BR .SH 9.6.4 CODE @@ -1977,7 +2114,7 @@ markup. You cannot however use code tags to escape code tags. They are however used in the same way as group or poem tags. .BR -A code\-block is treated as an object and given a single object number. \ [an \ +A code\-block is treated as an object and given a single object number. [an \ option \ to \ number \ each \ line \ of \ code \ may \ be \ considered \ at \ some \ later \ time] @@ -1987,48 +2124,91 @@ some \ later \ time] .nf \'Fury said to a +.BR mouse, That he +.BR met in the +.BR house, +.BR \"Let us +.BR both go to +.BR law: I will +.BR prosecute +.BR YOU. \-\-Come, +.BR I\'ll take no +.BR denial; We +.BR must have a +.BR trial: For +.BR really this +.BR morning I\'ve +.BR nothing +.BR to do.\" +.BR Said the +.BR mouse to the +.BR cur, \"Such +.BR a trial, +.BR dear Sir, +.BR With +.BR no jury +.BR or judge, +.BR would be +.BR wasting +.BR our +.BR breath.\" +.BR \"I\'ll be +.BR judge, I\'ll +.BR be jury,\" +.BR Said +.BR cunning +.BR old Fury: +.BR \"I\'ll +.BR try the +.BR whole +.BR cause, +.BR and +.BR condemn +.BR you +.BR to +.BR death.\"\' .fi @@ -2061,6 +2241,7 @@ basic markup for importing a document into a master document .nf << filename1.sst +.BR << filename2.ssi .fi @@ -2073,8 +2254,11 @@ documents under consideration, and occasionally supported have been. .nf << filename.ssi +.BR <<{filename.ssi} +.BR % using textlink alternatives +.BR << |filename.ssi|@|^| .fi @@ -2091,7 +2275,7 @@ MARKUP SYNTAX HISTORY were changed at 0.37 .BR -* sisu \-\-query=[sisu \ version \ \ [0.38] or \'history] +* sisu \-\-query=[sisu \ version \ [0.38] or \'history] .BR provides a short history of changes to @@ -2103,7 +2287,7 @@ markup (2007w34/4) .B SiSU 0.57 is the same as 0.42 with the introduction of some a shortcut to use the -headers @title and @creator in the first heading \ [expanded \ using \ the \ +headers @title and @creator in the first heading [expanded \ using \ the \ contents \ of \ the \ headers \ @title: \ and \ @author:] @@ -2130,7 +2314,7 @@ or, backward compatible using the comment marker: .BR variations include \' .B SiSU -(text|master|insert) \ [version]\' and \'sisu\-[version]\' +(text|master|insert) [version]\' and \'sisu\-[version]\' .BR .B 0.51 @@ -2237,7 +2421,9 @@ this is captured by the following file \'rename\' instruction: .nf rename \'s/\.s[123]$/\.sst/\' *.s{1,2,3} +.BR rename \'s/\.r[123]$/\.ssm/\' *.r{1,2,3} +.BR rename \'s/\.si$/\.ssi/\' *.si .fi @@ -2266,7 +2452,7 @@ relied upon .BR .B 0.16 (2005w25/2) substantial changes introduced to make markup cleaner, header -0~title type, and headings \ [1\-6]~ introduced, also percentage sign (%) at +0~title type, and headings [1\-6]~ introduced, also percentage sign (%) at start of a text line as comment marker .BR @@ -2318,7 +2504,7 @@ located locally or on a remote server for which a url is provided. source markup can be shared with the command: .BR - sisu \-s \ [filename] + sisu \-s [filename] .SH 12.1.1 SISU TEXT \- REGULAR FILES (.SST) @@ -2363,7 +2549,7 @@ contain other documents. .BR Note: a secondary file of the composite document is built prior to processing -with the same prefix and the suffix \._sst \ [^16] +with the same prefix and the suffix \._sst [^16] .BR <http://www.jus.uio.no/sisu/sisu_markup> @@ -2416,7 +2602,7 @@ documents. The command to create a sisupod is: .BR - sisu \-S \ [filename] + sisu \-S [filename] .BR Alternatively, make a pod of the contents of a whole directory: @@ -2452,28 +2638,26 @@ incomplete and should be handled with care. .B convert from sst to simple xml representations (sax, dom and node): .BR - sisu \-\-to\-sax \ [filename/wildcard] or sisu \-\-to\-sxs \ - [filename/wildcard] + sisu \-\-to\-sax [filename/wildcard] or sisu \-\-to\-sxs [filename/wildcard] .BR - sisu \-\-to\-dom \ [filename/wildcard] or sisu \-\-to\-sxd \ - [filename/wildcard] + sisu \-\-to\-dom [filename/wildcard] or sisu \-\-to\-sxd [filename/wildcard] .BR - sisu \-\-to\-node \ [filename/wildcard] or sisu \-\-to\-sxn \ - [filename/wildcard] + sisu \-\-to\-node [filename/wildcard] or sisu \-\-to\-sxn [filename/wildcard] + .BR .B convert to sst from any sisu xml representation (sax, dom and node): .BR - sisu \-\-from\-xml2sst \ [filename/wildcard \ \ [.sxs.xml,.sxd.xml,sxn.xml]] + sisu \-\-from\-xml2sst [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]] .BR or the same: .BR - sisu \-\-from\-sxml \ [filename/wildcard \ \ [.sxs.xml,.sxd.xml,sxn.xml]] + sisu \-\-from\-sxml [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]] .SH 13.1.1 XML SAX REPRESENTATION @@ -2482,20 +2666,19 @@ or the same: To convert from sst to simple xml (sax) representation: .BR - sisu \-\-to\-sax \ [filename/wildcard] or sisu \-\-to\-sxs \ - [filename/wildcard] + sisu \-\-to\-sax [filename/wildcard] or sisu \-\-to\-sxs [filename/wildcard] .BR To convert from any sisu xml representation back to sst .BR - sisu \-\-from\-xml2sst \ [filename/wildcard \ \ [.sxs.xml,.sxd.xml,sxn.xml]] + sisu \-\-from\-xml2sst [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]] .BR or the same: .BR - sisu \-\-from\-sxml \ [filename/wildcard \ \ [.sxs.xml,.sxd.xml,sxn.xml]] + sisu \-\-from\-sxml [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]] .SH 13.1.2 XML DOM REPRESENTATION @@ -2504,20 +2687,19 @@ or the same: To convert from sst to simple xml (dom) representation: .BR - sisu \-\-to\-dom \ [filename/wildcard] or sisu \-\-to\-sxd \ - [filename/wildcard] + sisu \-\-to\-dom [filename/wildcard] or sisu \-\-to\-sxd [filename/wildcard] .BR To convert from any sisu xml representation back to sst .BR - sisu \-\-from\-xml2sst \ [filename/wildcard \ \ [.sxs.xml,.sxd.xml,sxn.xml]] + sisu \-\-from\-xml2sst [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]] .BR or the same: .BR - sisu \-\-from\-sxml \ [filename/wildcard \ \ [.sxs.xml,.sxd.xml,sxn.xml]] + sisu \-\-from\-sxml [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]] .SH 13.1.3 XML NODE REPRESENTATION @@ -2526,20 +2708,19 @@ or the same: To convert from sst to simple xml (node) representation: .BR - sisu \-\-to\-node \ [filename/wildcard] or sisu \-\-to\-sxn \ - [filename/wildcard] + sisu \-\-to\-node [filename/wildcard] or sisu \-\-to\-sxn [filename/wildcard] .BR To convert from any sisu xml representation back to sst .BR - sisu \-\-from\-xml2sst \ [filename/wildcard \ \ [.sxs.xml,.sxd.xml,sxn.xml]] + sisu \-\-from\-xml2sst [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]] .BR or the same: .BR - sisu \-\-from\-sxml \ [filename/wildcard \ \ [.sxs.xml,.sxd.xml,sxn.xml]] + sisu \-\-from\-sxml [filename/wildcard \ [.sxs.xml,.sxd.xml,sxn.xml]] .SH 14. CONFIGURATION @@ -2587,7 +2768,7 @@ resource configuration is determined by looking at the following files if they exist: .BR - \./_sisu/sisurc.yml + ./_sisu/sisurc.yml .BR ~/.sisu/sisurc.yml @@ -2620,7 +2801,7 @@ Skins modify the default appearance of document output on a document, directory, or site wide basis. Skins are looked for in the following locations: .BR - \./_sisu/skin + ./_sisu/skin .BR ~/.sisu/skin @@ -2633,13 +2814,13 @@ directory, or site wide basis. Skins are looked for in the following locations: are the following the default sub\-directories for document skins: .BR - \./skin/doc + ./skin/doc .BR - \./skin/dir + ./skin/dir .BR - \./skin/site + ./skin/site .BR A skin is placed in the appropriate directory and the file named skin_[name].rb @@ -2838,16 +3019,27 @@ skin_poems.rb .nf class Home +.BR def homepage +.BR # place the html content of your homepage here, this will become index.html +.BR <<HOME <html> +.BR <head></head> +.BR <doc> +.BR <p>this is my new homepage.</p> +.BR </doc> +.BR </html> +.BR HOME +.BR end +.BR end .fi @@ -2991,10 +3183,10 @@ to populate a postgresql database, this being part of 22.3 SYNOPSIS .BR - sisu \-D \ [instruction] \ [filename/wildcard \ if \ required] + sisu \-D [instruction] [filename/wildcard \ if \ required] .BR - sisu \-D \-\-pg \-\-[instruction] \ [filename/wildcard \ if \ required] + sisu \-D \-\-pg \-\-[instruction] [filename/wildcard \ if \ required] .SH 22.4 COMMANDS @@ -3013,46 +3205,43 @@ may be used interchangeably. 22.4.1 CREATE AND DESTROY DATABASE .TP -.B \ \-\-pgsql \ \-\-createall -\ initial \ step, \ creates \ required \ relations \ (tables, \ indexes) \ in -\ existing \ (postgresql) \ database \ (a \ database \ should \ be \ created \ -manually \ and \ given \ the \ same \ name \ as \ working \ directory, \ as \ -requested) \ (rb.dbi) \ +.B \-\-pgsql \-\-createall +initial step, creates required relations (tables, indexes) in existing +(postgresql) database (a database should be created manually and given the same +name as working directory, as requested) (rb.dbi) .TP -.B \ sisu \ \-D \ \-\-createdb -\ creates \ database \ where \ no \ database \ existed \ before \ +.B sisu \-D \-\-createdb +creates database where no database existed before .TP -.B \ sisu \ \-D \ \-\-create -\ creates \ database \ tables \ where \ no \ database \ tables \ existed \ -before \ +.B sisu \-D \-\-create +creates database tables where no database tables existed before .TP -.B \ sisu \ \-D \ \-\-Dropall -\ destroys \ database \ (including \ all \ its \ content)! \ kills \ data \ -and \ drops \ tables, \ indexes \ and \ database \ associated \ with \ a \ -given \ directory \ (and \ directories \ of \ the \ same \ name). \ +.B sisu \-D \-\-Dropall +destroys database (including all its content)! kills data and drops tables, +indexes and database associated with a given directory (and directories of the +same name). .TP -.B \ sisu \ \-D \ \-\-recreate -\ destroys \ existing \ database \ and \ builds \ a \ new \ empty \ database -\ structure \ +.B sisu \-D \-\-recreate +destroys existing database and builds a new empty database structure .SH 22.4.2 IMPORT AND REMOVE DOCUMENTS .TP -.B \ sisu \ \-D \ \-\-import \ \-v \ \ [filename/wildcard] +.B sisu \-D \-\-import \-v [filename/wildcard] populates database with the contents of the file. Imports documents(s) specified to a postgresql database (at an object level). .TP -.B \ sisu \ \-D \ \-\-update \ \-v \ \ [filename/wildcard] +.B sisu \-D \-\-update \-v [filename/wildcard] updates file contents in database .TP -.B \ sisu \ \-D \ \-\-remove \ \-v \ \ [filename/wildcard] +.B sisu \-D \-\-remove \-v [filename/wildcard] removes specified document from postgresql database. .SH @@ -3081,10 +3270,10 @@ to populate an sqlite database, this being part of 23.3 SYNOPSIS .BR - sisu \-d \ [instruction] \ [filename/wildcard \ if \ required] + sisu \-d [instruction] [filename/wildcard \ if \ required] .BR - sisu \-d \-\-(sqlite|pg) \-\-[instruction] \ [filename/wildcard \ if \ + sisu \-d \-\-(sqlite|pg) \-\-[instruction] [filename/wildcard \ if \ required] .SH @@ -3104,46 +3293,43 @@ may be used interchangeably. 23.4.1 CREATE AND DESTROY DATABASE .TP -.B \ \-\-sqlite \ \-\-createall -\ initial \ step, \ creates \ required \ relations \ (tables, \ indexes) \ in -\ existing \ (sqlite) \ database \ (a \ database \ should \ be \ created \ -manually \ and \ given \ the \ same \ name \ as \ working \ directory, \ as \ -requested) \ (rb.dbi) \ +.B \-\-sqlite \-\-createall +initial step, creates required relations (tables, indexes) in existing +(sqlite) database (a database should be created manually and given the same +name as working directory, as requested) (rb.dbi) .TP -.B \ sisu \ \-d \ \-\-createdb -\ creates \ database \ where \ no \ database \ existed \ before \ +.B sisu \-d \-\-createdb +creates database where no database existed before .TP -.B \ sisu \ \-d \ \-\-create -\ creates \ database \ tables \ where \ no \ database \ tables \ existed \ -before \ +.B sisu \-d \-\-create +creates database tables where no database tables existed before .TP -.B \ sisu \ \-d \ \-\-dropall -\ destroys \ database \ (including \ all \ its \ content)! \ kills \ data \ -and \ drops \ tables, \ indexes \ and \ database \ associated \ with \ a \ -given \ directory \ (and \ directories \ of \ the \ same \ name). \ +.B sisu \-d \-\-dropall +destroys database (including all its content)! kills data and drops tables, +indexes and database associated with a given directory (and directories of the +same name). .TP -.B \ sisu \ \-d \ \-\-recreate -\ destroys \ existing \ database \ and \ builds \ a \ new \ empty \ database -\ structure \ +.B sisu \-d \-\-recreate +destroys existing database and builds a new empty database structure .SH 23.4.2 IMPORT AND REMOVE DOCUMENTS .TP -.B \ sisu \ \-d \ \-\-import \ \-v \ \ [filename/wildcard] +.B sisu \-d \-\-import \-v [filename/wildcard] populates database with the contents of the file. Imports documents(s) specified to an sqlite database (at an object level). .TP -.B \ sisu \ \-d \ \-\-update \ \-v \ \ [filename/wildcard] +.B sisu \-d \-\-update \-v [filename/wildcard] updates file contents in database .TP -.B \ sisu \ \-d \ \-\-remove \ \-v \ \ [filename/wildcard] +.B sisu \-d \-\-remove \-v [filename/wildcard] removes specified document from sqlite database. .SH @@ -3155,7 +3341,7 @@ removes specified document from sqlite database. INCLUDING OBJECT CITATION NUMBERING (BACKEND CURRENTLY POSTGRESQL) .BR -Sample search frontend <http://search.sisudoc.org> \ [^20] A small database and +Sample search frontend <http://search.sisudoc.org> [^20] A small database and sample query front\-end (search from) that makes use of the citation system, .I object citation numbering to demonstrates functionality.[^21] @@ -3176,9 +3362,8 @@ the names of the documents matched along with the objects (paragraphs) that meet the search criteria.[^22] .TP -.B \ sisu \ \-F \ \-\-webserv\-webrick -\ builds \ a \ cgi \ web \ search \ frontend \ for \ the \ database \ created -\ +.B sisu \-F \-\-webserv\-webrick +builds a cgi web search frontend for the database created .BR The following is feedback on the setup on a machine provided by the help @@ -3190,12 +3375,19 @@ command: .nf Postgresql +.BR user: ralph +.BR current db set: SiSU_sisu +.BR port: 5432 +.BR dbi connect: DBI:Pg:database=SiSU_sisu;port=5432 +.BR sqlite +.BR current db set: /home/ralph/sisu_www/sisu/sisu_sqlite.db +.BR dbi connect DBI:SQLite:/home/ralph/sisu_www/sisu/sisu_sqlite.db .fi @@ -3203,36 +3395,34 @@ command: Note on databases built .BR -By default, \ [unless \ otherwise \ specified] databases are built on a -directory basis, from collections of documents within that directory. The name -of the directory you choose to work from is used as the database name, i.e. if -you are working in a directory called /home/ralph/ebook the database SiSU_ebook -is used. \ [otherwise \ a \ manual \ mapping \ for \ the \ collection \ is \ +By default, [unless \ otherwise \ specified] databases are built on a directory +basis, from collections of documents within that directory. The name of the +directory you choose to work from is used as the database name, i.e. if you are +working in a directory called /home/ralph/ebook the database SiSU_ebook is +used. [otherwise \ a \ manual \ mapping \ for \ the \ collection \ is \ necessary] .SH 24.2 SEARCH FORM .TP -.B \ sisu \ \-F -\ generates \ a \ sample \ search \ form, \ which \ must \ be \ copied \ to \ -the \ web\-server \ cgi \ directory \ +.B sisu \-F +generates a sample search form, which must be copied to the web\-server cgi +directory .TP -.B \ sisu \ \-F \ \-\-webserv\-webrick -\ generates \ a \ sample \ search \ form \ for \ use \ with \ the \ webrick \ -server, \ which \ must \ be \ copied \ to \ the \ web\-server \ cgi \ directory -\ +.B sisu \-F \-\-webserv\-webrick +generates a sample search form for use with the webrick server, which must be +copied to the web\-server cgi directory .TP -.B \ sisu \ \-Fv -\ as \ above, \ and \ provides \ some \ information \ on \ setting \ up \ -hyperestraier \ +.B sisu \-Fv +as above, and provides some information on setting up hyperestraier .TP -.B \ sisu \ \-W -\ starts \ the \ webrick \ server \ which \ should \ be \ available \ -wherever \ sisu \ is \ properly \ installed \ +.B sisu \-W +starts the webrick server which should be available wherever sisu is properly +installed .BR The generated search form must be copied manually to the webserver directory as @@ -3271,7 +3461,7 @@ directory /home/ralph/sisu_www (A) to generate the index within the webserver directory to be indexed: .BR - estcmd gather \-sd \ [index \ name] \ [directory \ path \ to \ index] + estcmd gather \-sd [index \ name] [directory \ path \ to \ index] .BR the following are examples that will need to be tailored according to your @@ -3334,7 +3524,7 @@ rune along the following lines: sudo cp \-v /usr/share/hyperestraier/estseek.* /usr/lib/cgi\-bin .BR - \ [see \ estraier \ documentation \ for \ paths] + [see \ estraier \ documentation \ for \ paths] .BR (ii) edit estseek.conf, with attention to the lines starting \'indexname:\' and @@ -3373,13 +3563,13 @@ and try open the url: <http://localhost:8081/cgi\-bin/estseek.cgi> 26.2 SYNOPSIS .BR -sisu_webrick \ [port] +sisu_webrick [port] .BR or .BR -sisu \-W \ [port] +sisu \-W [port] .SH 26.3 DESCRIPTION @@ -3404,8 +3594,8 @@ yaml file: ~/.sisu/sisurc.yml a sample of which is provided as 26.4 SUMMARY OF MAN PAGE .BR -sisu_webrick, may be started on it\'s own with the command: sisu_webrick \ -[port] or using the sisu command with the \-W flag: sisu \-W \ [port] +sisu_webrick, may be started on it\'s own with the command: sisu_webrick [port] +or using the sisu command with the \-W flag: sisu \-W [port] .BR where no port is given and settings are unchanged the default port is 8081 @@ -3414,7 +3604,7 @@ where no port is given and settings are unchanged the default port is 8081 26.5 DOCUMENT PROCESSING COMMAND FLAGS .BR -sisu \-W \ [port] starts +sisu \-W [port] starts .B Ruby Webrick web\-server, serving .B SiSU @@ -3540,7 +3730,7 @@ may be used in conjunction with other processing flags, e.g. 28.1 COMMANDS .TP -.B \ \-R \ \ [filename/wildcard] +.B \-R [filename/wildcard] copies sisu output files to remote host using rsync. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your \"keys\" and ssh agent in place. Note the behavior of rsync @@ -3549,7 +3739,7 @@ different if \-R is used with other flags from if used alone. Alone the rsync \-R is used together with other flags, it is not). Also see \-r .TP -.B \ \-r \ \ [filename/wildcard] +.B \-r [filename/wildcard] copies sisu output files to remote host using scp. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your \"keys\" and ssh agent in place. Also see \-R @@ -3600,6 +3790,7 @@ Sid and testing archives (and possibly Ubuntu), assuming your .nf aptitude update +.BR aptitude install sisu\-complete .fi @@ -3610,8 +3801,11 @@ markup samples: .nf #/etc/apt/sources.list +.BR deb http://ftp.fi.debian.org/debian/ unstable main non\-free contrib +.BR deb\-src http://ftp.fi.debian.org/debian/ unstable main non\-free contrib +.BR d .fi @@ -3621,6 +3815,7 @@ The aptitude commands become: .nf aptitude update +.BR aptitude install sisu\-complete sisu\-markup\-samples .fi @@ -3635,7 +3830,9 @@ archives, they will be available by adding the following to your .nf #/etc/apt/sources.list +.BR deb http://www.jus.uio.no/sisu/archive unstable main non\-free +.BR deb\-src http://www.jus.uio.no/sisu/archive unstable main non\-free .fi @@ -3645,6 +3842,7 @@ repeat the aptitude commands .nf aptitude update +.BR aptitude install sisu\-complete sisu\-markup\-samples .fi @@ -3670,7 +3868,7 @@ They may be downloaded from: as root type: .BR - rpm \-i \ [rpm \ package \ name] + rpm \-i [rpm \ package \ name] .SH 30.1.3 INSTALLATION FROM SOURCE @@ -3719,8 +3917,11 @@ as root type: .nf ruby setup.rb config +.BR ruby setup.rb setup +.BR #[and \ as \ root:] +.BR ruby setup.rb install .fi @@ -3888,13 +4089,13 @@ The man pages are also available online, though not always kept as up to date as within the package itself: .BR -* sisu.1 <http://www.jus.uio.no/sisu/man/sisu.1> \ [^24] +* sisu.1 <http://www.jus.uio.no/sisu/man/sisu.1> [^24] .BR -* sisu.8 <http://www.jus.uio.no/sisu/man/sisu.8> \ [^25] +* sisu.8 <http://www.jus.uio.no/sisu/man/sisu.8> [^25] .BR -* man directory <http://www.jus.uio.no/sisu/man> \ [^26] +* man directory <http://www.jus.uio.no/sisu/man> [^26] .SH 30.3.2 BUILT IN HELP @@ -4055,12 +4256,10 @@ comments: assumes dark background; no display line\-wrap ~/.kde/share/apps/katepart/syntax .BR - \ [settings::configure \ kate::{highlighting,filetypes}] + [settings::configure \ kate::{highlighting,filetypes}] .BR - \ [tools::highlighting::{markup,scripts}:: -.B \ SiSU -] + [tools::highlighting::{markup,scripts}:: \ .B \ SiSU \ ] .BR * nedit <http://www.nedit.org> @@ -4072,7 +4271,7 @@ comments: assumes dark background; no display line\-wrap nedit \-import sisu_nedit.pats .BR - status: a very clumsy first attempt \ [not \ really \ done] + status: a very clumsy first attempt [not \ really \ done] .BR comments: this editor features display line wrap @@ -4093,7 +4292,7 @@ comments: assumes dark background; no display line\-wrap (require \'sisu\-mode.el) .BR - \ [not \ done \ / \ not \ yet \ included] + [not \ done \ / \ not \ yet \ included] .BR * vim & gvim <http://www.vim.org> @@ -4116,11 +4315,9 @@ comments: assumes dark background; no display line\-wrap NOTE: .BR -[ -.B \ SiSU -\ parses \ files \ with \ long \ lines \ or \ line \ breaks, \ but, \ display -\ linewrap \ (without \ line\-breaks) \ is \ a \ convenient \ editor \ feature -\ to \ have \ for \ sisu \ markup] +[ \ .B \ SiSU \ parses \ files \ with \ long \ lines \ or \ line \ breaks, \ +but, \ display \ linewrap \ (without \ line\-breaks) \ is \ a \ convenient \ +editor \ feature \ to \ have \ for \ sisu \ markup] .SH 32. HOW DOES SISU WORK? @@ -4159,9 +4356,8 @@ headers are optional. .BR * markup is easily readable/parsable by the human eye, (basic markup is simpler -and more sparse than the most basic HTML), \ [this \ may \ also \ be \ -converted \ to \ XML \ representations \ of \ the \ same \ input/source \ -document]. +and more sparse than the most basic HTML), [this \ may \ also \ be \ converted +\ to \ XML \ representations \ of \ the \ same \ input/source \ document]. .BR * markup defines document structure (this may be done once in a header @@ -4173,7 +4369,7 @@ may also contain processing instructions. .B SiSU markup is primarily an abstraction of document structure and document metadata to permit taking advantage of the basic strengths of existing -alternative practical standard ways of representing documents \ [be \ that \ +alternative practical standard ways of representing documents [be \ that \ browser \ viewing, \ paper \ publication, \ sql \ search \ etc.] (html, xml, odf, latex, pdf, sql) @@ -4232,8 +4428,8 @@ level (roughly headings, paragraphs, verse, tables) and become searchable with that degree of granularity, the output information provides the object/paragraph numbers which are relevant across all generated outputs; it is also possible to look at just the matching paragraphs of the documents in the -database; \ [output \ indexing \ also \ work \ well \ with \ search \ indexing -\ tools \ like \ hyperestraier]. +database; [output \ indexing \ also \ work \ well \ with \ search \ indexing \ +tools \ like \ hyperestraier]. .BR * long term maintainability of document collections in a world of changing @@ -4536,17 +4732,13 @@ Document Manifest @ <http://sisudoc.org/sisu_manual/sisu/sisu_manifest.html> .BR .I DC tags included with this document are provided here. -.BR DC Title: .I SiSU \- Manual -.BR DC Creator: .I Ralph Amissah -.BR DC Rights: -.I Copyright (C) Ralph Amissah 2008, part of SiSU documentation, License GPL 3 .BR @@ -4586,7 +4778,7 @@ Filetype: .BR Sourcefile Digest, MD5(sisu.ssm.sst)= -.I 7568e6bc171256672e0820a333b37459 +.I 7fbab3b7c0fd0ed2e128585c2982c5c8 .BR Skin_Digest: MD5(skin_sisu_manual.rb)= @@ -4597,17 +4789,17 @@ Skin_Digest: MD5(skin_sisu_manual.rb)= .BR Document (metaverse) last generated: -.I Thu May 22 21:53:23 \-0400 2008 +.I Mon Jul 21 02:54:34 \-0400 2008 .BR Generated by: .I SiSU -.I 0.67.0 -of 2008w20/4 (2008\-05\-22) +.I 0.68.0 +of 2008w29/1 (2008\-07\-21) .BR Ruby version: -.I ruby 1.8.6 (2008\-03\-03 patchlevel 114) \ [i486\-linux] +.I ruby 1.8.7 (2008\-06\-20 patchlevel 22) \ [i486\-linux] .TP .BI 1. @@ -4630,7 +4822,7 @@ code-blocks .BI 5. Specification submitted by Adobe to ISO to become a full open ISO specification - <http://www.linux-watch.com/news/NS7542722606.html> +<http://www.linux-watch.com/news/NS7542722606.html> .TP .BI 6. ISO/IEC 26300:2006 @@ -4683,7 +4875,7 @@ editors notes, numbered asterisk footnote/endnote series .TP .BI 15. Table from the Wealth of Networks by Yochai Benkler - <http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler> +<http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler> .TP .BI 16. \.ssc (for composite) is under consideration but \._sst makes clear that this @@ -4700,12 +4892,12 @@ and this behaviour could be reinstated. .TP .BI 18. <http://www.postgresql.org/> - <http://advocacy.postgresql.org/> - <http://en.wikipedia.org/wiki/Postgresql> +<http://advocacy.postgresql.org/> +<http://en.wikipedia.org/wiki/Postgresql> .TP .BI 19. <http://www.hwaci.com/sw/sqlite/> - <http://en.wikipedia.org/wiki/Sqlite> +<http://en.wikipedia.org/wiki/Sqlite> .TP .BI 20. <http://search.sisudoc.org> @@ -4736,9 +4928,11 @@ There is nothing to stop MySQL support being added in future. <http://www.jus.uio.no/sisu/man> .TP .BI 27. -the \.B Debian -Free Software guidelines require that everything distributed within \.B Debian -can be changed - and the documents are authors\' works that while freely +the +.B Debian +Free Software guidelines require that everything distributed within +.B Debian +can be changed - and the documents are authors' works that while freely distributable are not freely changeable. .TP .BI 28. @@ -4758,10 +4952,10 @@ pdf: <http://www.jus.uio.no/sisu/sisu/landscape.pdf> at: <http://www.jus.uio.no/sisu> .TP .TP -* Generated by: SiSU 0.67.0 of 2008w20/4 (2008-05-22) +* Generated by: SiSU 0.68.0 of 2008w29/1 (2008-07-21) .TP -* Ruby version: ruby 1.8.6 (2008-03-03 patchlevel 114) [i486-linux] +* Ruby version: ruby 1.8.7 (2008-06-20 patchlevel 22) [i486-linux] .TP -* Last Generated on: Thu May 22 21:53:23 -0400 2008 +* Last Generated on: Mon Jul 21 02:54:35 -0400 2008 .TP * SiSU http://www.jus.uio.no/sisu |