From d29a3e5469d8468084641c385ebf16948f7c2437 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 22 Jul 2008 20:00:59 -0400 Subject: sisu-0.68.0 proposed * middle layer document representation changed, (accounting for substantial patch) * texpdf multiple document sizes as specified in config * numerous small fixes [should on the whole be easier to maintain] --- CHANGELOG | 25 +- bin/sisu | 7 +- conf/sisu/sisurc.yml | 4 +- conf/sisu/version.yml | 6 +- data/doc/sisu/CHANGELOG | 28 +- data/doc/sisu/html/sisu.1.html | 3016 ++++++++++---------- .../sisu_manual/_sisu/sisurc.yml | 2 +- .../sisu_manual/sisu_download.ssi | 24 +- .../sisu_manual/sisu_manual.ssm | 4 +- .../sisu_manual/sisu_markup.sst | 2 - lib/sisu/v0/concordance.rb | 49 +- lib/sisu/v0/conf.rb | 1 + lib/sisu/v0/constants.rb | 109 +- lib/sisu/v0/css.rb | 8 +- lib/sisu/v0/dal.rb | 451 +-- lib/sisu/v0/dal_doc_str.rb | 83 +- lib/sisu/v0/dal_doc_str_code.rb | 40 +- lib/sisu/v0/dal_doc_str_tables.rb | 28 +- lib/sisu/v0/dal_syntax.rb | 261 +- lib/sisu/v0/db_import.rb | 145 +- lib/sisu/v0/defaults.rb | 187 ++ lib/sisu/v0/digests.rb | 55 +- lib/sisu/v0/help.rb | 2 +- lib/sisu/v0/html.rb | 145 +- lib/sisu/v0/html_format.rb | 19 +- lib/sisu/v0/html_format_css.rb | 6 +- lib/sisu/v0/html_scroll.rb | 59 +- lib/sisu/v0/html_segments.rb | 152 +- lib/sisu/v0/html_table.rb | 34 +- lib/sisu/v0/html_tune.rb | 56 +- lib/sisu/v0/hub.rb | 4 +- lib/sisu/v0/manifest.rb | 58 +- lib/sisu/v0/manpage.rb | 179 +- lib/sisu/v0/manpage_format.rb | 4 +- lib/sisu/v0/odf.rb | 190 +- lib/sisu/v0/odf_format.rb | 52 +- lib/sisu/v0/param.rb | 40 +- lib/sisu/v0/particulars.rb | 3 +- lib/sisu/v0/plaintext.rb | 162 +- lib/sisu/v0/plaintext_format.rb | 4 +- lib/sisu/v0/shared_html_lite.rb | 37 +- lib/sisu/v0/shared_structure.rb | 151 + lib/sisu/v0/shared_txt.rb | 180 +- lib/sisu/v0/shared_xml.rb | 110 +- lib/sisu/v0/sst_do_inline_footnotes.rb | 6 +- lib/sisu/v0/sst_to_s_xml_dom.rb | 50 +- lib/sisu/v0/sst_to_s_xml_node.rb | 153 +- lib/sisu/v0/sst_to_s_xml_sax.rb | 48 +- lib/sisu/v0/sysenv.rb | 30 +- lib/sisu/v0/texinfo.rb | 58 +- lib/sisu/v0/texinfo_format.rb | 70 +- lib/sisu/v0/texpdf.rb | 417 ++- lib/sisu/v0/texpdf_format.rb | 1449 +++++----- lib/sisu/v0/urls.rb | 2 + lib/sisu/v0/wikispeak.rb | 48 +- lib/sisu/v0/xhtml.rb | 87 +- lib/sisu/v0/xml.rb | 91 +- lib/sisu/v0/xml_dom.rb | 81 +- lib/sisu/v0/xml_fictionbook.rb | 6 +- lib/sisu/v0/xml_format.rb | 4 +- lib/sisu/v0/xml_scaffold.rb | 4 +- lib/sisu/v0/xml_tables.rb | 61 +- man/man1/sisu.1 | 1080 ++++--- 63 files changed, 5321 insertions(+), 4606 deletions(-) mode change 100755 => 100644 bin/sisu create mode 100644 lib/sisu/v0/shared_structure.rb diff --git a/CHANGELOG b/CHANGELOG index 5cc6ad17..03f069fc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,29 @@ 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 f07a6b01c52c178c4ed57d31eb3a9162e8d59aa643b7cfb8f4250c307c0fa019 1500535 sisu_0.67.5.orig.tar.gz @@ -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/bin/sisu b/bin/sisu old mode 100755 new mode 100644 index a749fc42..164655b4 --- a/bin/sisu +++ b/bin/sisu @@ -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..9a6f0d69 100644 --- a/data/doc/sisu/CHANGELOG +++ b/data/doc/sisu/CHANGELOG @@ -9,11 +9,31 @@ Reverse Chronological: %% STABLE MANIFEST +%% sisu_0.68.0.orig.tar.gz (2008-07-21:29/1) +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 + + 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 document in multiple paper 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 +52,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 @@

Name

sisu - documents: markup, structuring, publishing in multiple standard -formats, and search +formats, and search

Synopsis

sisu [-abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0-9] [filename/wildcard ] sisu [-Ddcv] [instruction] sisu [-CcFLSVvW] SISU - -MANUAL, RALPH AMISSAH -

WHAT IS SISU? -

1. INTRODUCTION - WHAT IS SISU? +MANUAL, RALPH AMISSAH +

WHAT IS SISU? +

1. INTRODUCTION - WHAT IS SISU?

SiSU 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.

SiSU 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.

SiSU both defines a markup syntax and provides an engine that produces open standards format outputs from documents prepared with SiSU markup. From a single lightly prepared document sisu custom builds @@ -42,7 +42,7 @@ of representation of the document. Significantly SiSU 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. SiSU 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.

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.

In preparing a SiSU 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.

SiSU 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 SiSU 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.

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).

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.

SiSU 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 SiSU offers great possibilities. +of SiSU offers great possibilities.

SiSU is primarily for published works, which can take advantage of the citation system to reliably reference its documents. SiSU 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 SiSU +the substance of content prepared in SiSU

<http://www.jus.uio.no/sisu -> +>

2. -COMMANDS SUMMARY -

2.1 SYNOPSIS +COMMANDS SUMMARY +

2.1 SYNOPSIS

SiSU - Structured information, Serialized -Units - a document publishing system -

sisu  [  -abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0-9 - ]  [  filename/ -

sisu  [  -Ddcv  ]  [  instruction  ] -

sisu  [  -CcFLSVvW  ] -

Note: -commands should be issued from within the directory that contains the marked -up files, cd to markup directory. -

2.2 DESCRIPTION -

SiSU SiSU 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: <http://www.jus.uio.no/sisu -> -

2.3 DOCUMENT - -

PROCESSING COMMAND FLAGS -

+Units - a document publishing system +

sisu [  -abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0-9 + ] [  filename/  wildcard  ] +

sisu [  -Ddcv  ] [  instruction  ] +

sisu [  -CcFLSVvW + ] +

Note: commands should be issued from within the directory that contains +the marked up files, cd to markup directory. +

2.2 DESCRIPTION +

SiSU SiSU +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: <http://www.jus.uio.no/sisu +> + +

2.3 DOCUMENT PROCESSING COMMAND FLAGS +

-
 -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 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) +
-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 (Options include: --endnotes for endnotes +--footnotes for footnotes at the end of each paragraph --unix for unix linefeed +(default) --msdos for msdos linefeed)

-
 -b   [filename/wildcard] -
-
produces xhtml/XML output for browser viewing (sax parsing). +
-b [filename/wildcard]
+
produces xhtml/XML +output for browser viewing (sax parsing).

-
 -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 -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. +
-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 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.

-
 -CC
-
 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 +
-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.

-
 -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). +
-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).

-
 -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. +
-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.

-
 -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 database section -below. +
-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 database section +below.

-
 -F   [--webserv=webrick]
+
-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 @@ -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 -

on setting up hyperestraier for sisu +

on setting up hyperestraier for sisu

-
 -H   [filename/wildcard]
+
-H [filename/wildcard]
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].

-
 -h   [filename/wildcard]
+
-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 +with most web servers). [behaviour  switched  after  0.35  see  -H].

-
 -I   [filename/wildcard] +
-I [filename/wildcard]
-
produces texinfo and info file, (view with pinfo). +
produces texinfo and info file, (view with pinfo).

-
 -i   [filename/wildcard] +
-i [filename/wildcard]
-
produces man page of file, not suitable for all outputs. +
produces man page of file, not suitable for all outputs.

-
 -L
-
 prints  license - information. +
-L
+
prints license +information.

-
 -M   [filename/wildcard/url]
+
-M [filename/wildcard/url]
maintenance mode files created for -processing preserved and their locations indicated. (also see -V) +processing preserved and their locations indicated. (also see -V)

-
 -m   [filename/wildcard/url] +
-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 +assumed for most processing flags. To skip it see -n

-
 -N   [filename/wildcard/url] +
-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. +that produced it) (digest.txt). -NV for verbose digest output to screen.

-
 -n -  [filename/wildcard/url]
+
-n +[filename/wildcard/url]
skip meta-markup (building of -m which is otherwise -assumed by most processing flags. +assumed by most processing flags.

-
 -o   [filename/wildcard/url]
+
-o [filename/wildcard/url]
output basic -document in opendocument file format (opendocument.odt). +document in opendocument file format (opendocument.odt).

-
 -p   [filename/wildcard] +
-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). +’legal’ and book sizes ’A5’ and ’B5’ (system defaults to A4).

-
 -q   [filename/wildcard] +
-q [filename/wildcard]
-
quiet less output to screen. +
quiet less output to screen.

-
 -R   [filename/wildcard]
+
-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 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

-
 -r   [filename/wildcard] +
-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 +

have your

-
 -S
-
 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). +
-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).

-
 -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 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. SiSU 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 +
-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 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. SiSU 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].

-
 -s   [filename/wildcard]
-
copies sisu markup file to output directory. +
-s [filename/wildcard]
+
copies sisu markup file to output directory.

-
 -t   [filename/wildcard +
-t [filename/wildcard  (*.termsheet.rb)]
-
standard form document builder, preprocessing feature +
standard form document builder, preprocessing feature

-
 -U   [filename/wildcard]
+
-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 @@ -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 -

can be switched to file system paths in sisurc.yml +

can be switched to file system paths in sisurc.yml

-
 -u   [filename/wildcard] +
-u [filename/wildcard]
provides url mapping of output files for the flags requested for processing, -

also see -U +

also see -U

-
 -V
-
 on  its  own,  provides  SiSU  version  and  environment  information - (sisu  --help  env) +
-V
+
on its own, provides SiSU version and environment information +(sisu --help env)

-
 -V   [filename/wildcard]
+
-V [filename/wildcard]
even more verbose than the -v flag. -(also see -M) +(also see -M)

-
 -v
-
 on  its  own,  provides  SiSU  version  information +
-v
+
on its own, provides SiSU version information

-
 -v   [filename/wildcard] +
-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 +created for each of the processing flag requests. See also -V

-
 -W
-
 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  ]. +
-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 and search -H;  also,  note  -F  webrick  ].

-
 -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) +
-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)

-
 -X   [filename/wildcard]
-
produces -XML output with deep document structure, in the nature of dom. +
-X [filename/wildcard]
+
produces XML output with deep document +structure, in the nature of dom.

-
 -x   [filename/wildcard] -
-
produces XML output shallow structure (sax parsing). +
-x [filename/wildcard]
+
produces XML output +shallow structure (sax parsing).

-
 -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]) +
-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])

-
 -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. +
-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. +

-
 -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. +
-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. +

-
 -z   [filename/wildcard]
-
produces php (zend)  [this  feature  is  disabled - for  the  time being] +
-z [filename/wildcard]
+
produces php (zend) [this  feature  is  disabled  for + the  time being]

-3. COMMAND LINE MODIFIERS -

+3. COMMAND LINE MODIFIERS +

-
 --no-ocn
-
  [with  -h  -H  or  -p] switches +
--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. +in margins of html or LaTeX/pdf output.

-
 --no-annotate
-
 strips  output  text  of - editor  endnotes[^*1] denoted by asterisk or dagger/plus sign +
--no-annotate
+
strips output text of +editor endnotes[^*1] denoted by asterisk or dagger/plus sign

-
 --no-asterisk +
--no-asterisk
-
 strips  output  text  of  editor  endnotes[^*2] denoted by asterisk sign +
strips output text of editor endnotes[^*2] denoted by asterisk sign

-
 --no-dagger +
--no-dagger
-
 strips  output  text  of  editor  endnotes[^+1] denoted by dagger/plus sign +
strips output text of editor endnotes[^+1] denoted by dagger/plus sign

-4. DATABASE COMMANDS -

dbi - database interface +4. DATABASE COMMANDS +

dbi - database interface

-D or --pgsql set for postgresql -d or --sqlite default set for sqlite -d is modifiable with --db=[database  type - (pgsql  or  sqlite)] -

+ (pgsql  or  sqlite)] +

-
 -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 --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. +[database name]’ where database name would be SiSU_[present  working  directory + name  (without  path)]. Please use only alphanumerics and underscores.

-
 -Dv - --import
-
  [filename/wildcard] imports data specified to postgresql db (rb.dbi) - [  -dv  --import  sqlite  equivalent] +
-Dv +--import
+
[filename/wildcard] imports data specified to postgresql db (rb.dbi) +[  -dv  --import  sqlite  equivalent]

-
 -Dv  --update
-
  [filename/wildcard] updates/imports -specified data to postgresql db (rb.dbi)  [  -dv  --update  sqlite  equivalent] +
-Dv --update
+
[filename/wildcard] updates/imports +specified data to postgresql db (rb.dbi) [  -dv  --update  sqlite  equivalent]

-
 -D  --remove
-
  [filename/wildcard] removes specified data to postgresql db (rb.dbi) - [  -d  --remove  sqlite  equivalent] +
-D --remove
+
[filename/wildcard] removes specified data to postgresql db (rb.dbi) +[  -d  --remove  sqlite  equivalent]

-
 -D  --dropall
-
 kills  data &  indexes   [  -d  --dropall - sqlite  equivalent] -

The v in e.g. -Dv is for verbose output. +

-D --dropall
+
kills data --dropall  sqlite  equivalent] + +

The v in e.g. -Dv is for verbose output.

-5. SHORTCUTS, -SHORTHAND FOR MULTIPLE FLAGS -

+5. SHORTCUTS, SHORTHAND FOR MULTIPLE +FLAGS +

-
 --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 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. +
--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 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.

-
 -0  to  -5   [filename - or  wildcard]
-
Default shorthand mappings (note that the defaults can be -changed/configured in the sisurc.yml file): +
-0 to -5 [filename  or  wildcard]
+
Default +shorthand mappings (note that the defaults can be changed/configured in +the sisurc.yml file):

-
 -0
-
 -mNhwpAobxXyYv   [this  is  the - default  action  run  when  no  i.e.  on  ’sisu   [filename]’] +
-0
+
-mNhwpAobxXyYv [this  is  the  default  action  run  when + no  i.e.  on  ’sisu  [filename]’]

-
 -1
-
 -mNHwpy  give,  i.e.  on - ’sisu   [filename]’] +
-1
+
-mNHwpy

-
 -2
-
 -mNHwpaoy give,  i.e.  on  ’sisu   [filename]’] +
-2
+
-mNHwpaoy

-
 -3
-
 -mNhwpAobxXyY - i.e.  on  ’sisu   [filename]’] +
-3
+
-mNhwpAobxXyY

-
 -4
-
 -mNhwpAobxXDyY  --import  ’sisu   [filename]’] +
-4
+
-mNhwpAobxXDyY + +

- +

- +

import

-
 -5
-
 -mNhwpAobxXDyY - --update  ’sisu   [filename]’] -

add -v for verbose mode and -c for color, e.g. sisu --2vc  [filename  or wildcard] -

consider -u for appended url info or -v for +

-5
+
-mNhwpAobxXDyY --update +

add -v for verbose mode and -c for color, +e.g. sisu -2vc [filename  or +

consider -u for appended url info or -v for verbose -

verbose output +

output

-5.1 COMMAND LINE WITH FLAGS - BATCH PROCESSING -

In the data -directory run sisu -mh filename or wildcard eg. cisg.sst documents. -

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. -

-6. HELP -

6.1 SISU MANUAL -

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 +

In the data directory +run sisu -mh filename or wildcard eg. cisg.sst documents. +

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. +

6. HELP + +

6.1 SISU MANUAL +

The most up to date information on sisu should be contained +in the sisu_manual, available at:

<http://sisudoc.org/sisu/sisu_manual/ >
- +

The manual can be generated from source, found respectively, either -within the SiSU tarball or installed locally at: +within the SiSU tarball or installed locally at:

./data/doc/sisu/sisu_markup_samples/sisu_manual/
- +

/usr/share/doc/sisu/sisu_markup_samples/sisu_manual/
- -

move to the respective directory and type e.g.: + +

move to the respective directory and type e.g.:

sisu sisu_manual.ssm
- -

6.2 SISU MAN PAGES + +

6.2 SISU MAN PAGES

If SiSU is installed on your system usual man commands -should be available, try: +should be available, try:

man sisu
- +

man sisu_markup
- +

man sisu_commands
- +

Most SiSU 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 SiSU tarball at: +within the SiSU tarball at:

./data/doc/sisu/sisu_manual/
- -

Once installed, directory equivalent to: + +

Once installed, directory equivalent to:

/usr/share/doc/sisu/sisu_manual/
- -

Available man pages are converted back to html using man2html: + +

Available man pages are converted back to html using man2html:

/usr/share/doc/sisu/html/
- +

./data/doc/sisu/html/
- -

An online version of the sisu man page is available here: + +

An online version of the sisu man page is available here:

* various sisu man pages <http://www.jus.uio.no/sisu/man/ ->  [^7] +> [^7]

* sisu.1 <http://www.jus.uio.no/sisu/man/sisu.1.html > - [^8] -

6.3 SISU BUILT-IN INTERACTIVE HELP +[^8] +

6.3 SISU BUILT-IN INTERACTIVE HELP

This is particularly useful for -getting the current sisu setup/environment information: +getting the current sisu setup/environment information:

sisu --help
- -

sisu --help  [subject]
- + +

sisu --help [subject]
+

sisu --help commands
- +

sisu --help markup
- -

sisu --help env  [for  feedback  on  the  way  your  system  is and search
+ +

sisu --help env [for  feedback  on  the  way  your  system  is
setup  with  regard  to  sisu]
- -

sisu -V  [environment  information,  same  as  above  command]
- + +

sisu -V [environment  information,  same  as  above  command]
+

sisu (on its own provides version and some help information)
- +

Apart from real-time information on your current configuration the SiSU 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).

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. -

6.4 HELP SOURCES +Enter to escape. +

6.4 HELP SOURCES

For lists of alternative help sources, -see: -

man page +see: +

man page

man sisu_help_sources
- -

man2html + +

man2html

/usr/share/doc/sisu/sisu_manual/sisu_help_sources/index.html
- -

sisu generated html + +

sisu generated html

/usr/share/doc/sisu/html/sisu_help_sources/index.html
- +

<http://sisudoc.org/sisu/sisu_help_sources/index.html >
- -

7. INTRODUCTION TO SISU MARKUP[^9] -

7.1 SUMMARY + +

7. INTRODUCTION TO SISU MARKUP[^9] +

7.1 SUMMARY

SiSU source documents -are plaintext (UTF-8)[^10] files +are plaintext (UTF-8)[^10] files

All paragraphs are separated by an empty -line. -

Markup is comprised of: +line. +

Markup is comprised of:

* 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)

* 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:

* heading levels defines document structure
- +

* text basic attributes, italics, bold etc.
- +

* grouped text (objects), which are to be treated differently, such as code
blocks or poems.
- +

* footnotes/endnotes
- +

* linked text and images
- +

* paragraph actions, such as indent, bulleted, numbered-lists, etc.
- +

Some interactive help on markup is available, by typing sisu and selecting -

markup or sisu --help markup -

To check the markup in a file: +

markup or sisu --help markup +

To check the markup in a file:

sisu --identify - [filename].sst
- -

For brief descriptive summary of markup history +[filename].sst
+ +

For brief descriptive summary of markup history

sisu --query-history
- -

or if for a particular version: + +

or if for a particular version:

sisu --query-0.38
- -

7.2 MARKUP EXAMPLES -

7.2.1 ONLINE + +

7.2 MARKUP EXAMPLES +

7.2.1 ONLINE

Online markup examples are available together with the respective outputs produced from <http://www.jus.uio.no/sisu/SiSU/examples.html > or from <http://www.jus.uio.no/sisu/sisu_examples/ -> +>

There is of course this document, which provides a cursory overview of sisu markup and the respective output produced: <http://www.jus.uio.no/sisu/sisu_markup/ -> +>

Some example marked up files are available as html with syntax highlighting for viewing: <http://www.jus.uio.no/sisu/sample/syntax > @@ -713,28 +716,28 @@ up files are available as html with syntax highlighting for viewing: < an alternative presentation of markup syntax: <http://www.jus.uio.no/sisu/sample/on_markup.txt > -

7.2.2 INSTALLED +

7.2.2 INSTALLED

With SiSU 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: -

/usr/share/doc/sisu/sisu_markup_samples/non-free -

8. MARKUP OF HEADERS +

/usr/share/doc/sisu/sisu_markup_samples/non-free +

8. MARKUP OF HEADERS

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.

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: -

+in a line of text) followed by a space and the comment: +


  % this would be a comment
 
-

8.1 SAMPLE HEADER +

8.1 SAMPLE HEADER

This current document has a header similar to this -one (without the comments): -

+one (without the comments): +


  % 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
 
-

8.2 AVAILABLE HEADERS +

8.2 AVAILABLE HEADERS

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 -

Dublin Core meta tags are available +

Dublin Core meta tags are available

@indentifier: information or instructions -

where the information +

where the information

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.

This -

is a sample header -

% SiSU 0.38  [declared  file-type  identifier  with  markup - version] -

@title:  [title  text] This is the title of the document and used -as such, this header is the only one that is mandatory -

@subtitle: The - -

Subtitle if any -

@creator:  [or  @author:] Name of Author -

@subject: (whatever -your subject) -

@description: -

@publisher: -

@contributor: -

@translator: - [or  @translated_by:] -

@illustrator:  [or  @illustrated_by:] -

@prepared_by: - [or  @digitized_by:] -

@date: 2000-08-27  [  also  @date.created:  @date.issued: - @date.available:  @date.valid:  @date.modified:  ] -

@type: article -

@format: +

is a sample header +

% SiSU 0.38 [declared  file-type  identifier  with  markup + version] +

+

@title:  [title  text] This is the title of the document and +used as such, this header is the only one that is
+ mandatory +

@subtitle: The Subtitle if any +

@creator: [or  @author:] Name + +

of Author +

@subject: (whatever your subject) +

@description: +

@publisher: + +

@contributor: +

@translator:  [or  @translated_by:] +

@illustrator:  [or + @illustrated_by:] +

@prepared_by:  [or  @digitized_by:] +

@date: 2000-08-27 +[  also  @date.created:  @date.issued:  @date.available:  @date.valid:  ] +

+

@type: -

@identifier: -

@source: -

@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 - 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.] -

[@language.original:  original  language - in  which  the  work  was published] +

article +

@format: +

@identifier: +

@source: +

@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 - 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.] +

[@language.original: + original  language  in  which  the  work  was published]

@papersize: (A4|US_letter|book_B5|book_A5|US_legal) -

@relation: -

@coverage: +

@relation: +

@coverage:

@rights: Copyright (c) Name of Right Holder, all rights reserved, or as granted: public domain, copyleft, creative commons -variant, etc. -

@owner: +variant, etc. +

@owner:

@keywords: text document generation processing -management latex pdf structured xml citation  [your  keywords  here,  used - for  example  by  rss  feeds,  and  in  sql  searches] -

@abstract:  [paper  abstract, - placed  after  table  of  contents] -

@comment:  [...] -

@catalogue: loc=[Library - of  Congress  classification]; dewey=[Dewey  rss  feeds, classification]; isbn=[ISBN]; -pg=[Project  Gutenberg  text  number] -

@classify_loc:  [Library  of  Congress - classification] -

@classify_dewey:  [Dewey  classification] -

@classify_isbn: - [ISBN] -

@classify_pg:  [Project  Gutenberg  text  number] -

@prefix:  [prefix - is  placed  just  after  table  of  contents] -

@prefix_a:  [prefix  is  placed - just  before  table  of  contents  -  not implemented] -

@prefix_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  rcs  or  cvs  can  usefully - provide  a  history  of -

@structure: 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, +

@abstract: [paper  abstract,  placed  after  table + of  contents] +

@comment: [...] +

@catalogue: loc=[Library  of  Congress  classification]; +dewey=[Dewey rss  feeds, isbn=[ISBN]; pg=[Project  Gutenberg  text  number] + +

@classify_loc: [Library  of  Congress  classification] +

@classify_dewey: +[Dewey  classification] +

@classify_isbn: [ISBN] +

@classify_pg: [Project + Gutenberg  text  number] +

@prefix: [prefix  is  placed  just  after  table  of + contents] +

@prefix_a: [prefix  is  placed  just  before  table  of  contents + -  not +

@prefix_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 document,  rcs  or  cvs  can  usefully  provide  a  history  of updates  to + a  document  ] +

@structure: 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:) -

@level: newpage=3; breakpage=4  [paragraph  level, - used  by  latex  to  breakpages,  the  page  in  newpage] -

@markup: 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] -

@bold:  [regular  expression  of  words/phrases - to  be  made  bold] -

@italics:  [regular  expression  of  words/phrases  to  italicise] +a synonym for @toc:) +

@level: newpage=3; breakpage=4 [paragraph  level, + used  by  latex  to  breakpages,  the  page  is  optional  eg.  in  newpage] +

@markup: +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] +

@bold: [regular  expression  of  words/phrases + to  be  made  bold] +

@italics: [regular  expression  of  words/phrases  to  italicise]

@vocabulary: name of taxonomy/vocabulary/wordlist to use against document

@skin: 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. -

+urls of the home site, and the icon/logo for the document or site. +

-
 @man: - 8;
-
 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 +
@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 +

page headings

@links: { SiSU }http://www.jus.uio.no/sisu/; { FSF }http://www.fsf.org -

@promo: 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] - +

@promo: 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

-9. MARKUP OF SUBSTANTIVE TEXT -

9.1 HEADING LEVELS -

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) -

:A~  [heading - text] Top level heading  [this  usually  has  similar  content  to  the  ] NOTE: -the heading levels described here are in 0.38 notation, see heading -

:B~ - [heading  text] Second level heading  [this  is  a  heading  level  divider] -

- :C~  [heading  text] Third level heading  [this  is  a  heading  level  divider] - -

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 named segments, names are provided automatically if none -are given (a number), otherwise takes the form 1~my_filename_for_this_segment - -

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. -

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 -

+9. MARKUP OF SUBSTANTIVE TEXT +

9.1 HEADING + +

LEVELS +

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) +

:A~ [heading  text] Top level heading [this  usually  has + similar  content  to  the  ] NOTE: the heading levels described here are in +0.38 notation, see heading +

:B~ [heading  text] Second level heading [this + is  a  heading  level  divider] +

:C~ [heading  text] Third level heading [this + is  a  heading  level  divider] +

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 named segments, names are +provided automatically if none are given (a number), otherwise takes the + +

form 1~my_filename_for_this_segment +

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. +

+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 + +


  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)
 
-

9.2 FONT ATTRIBUTES -

markup example: -

+

9.2 FONT ATTRIBUTES +

markup example: +


  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}-
 
-

resulting output: -

normal text <em>emphasis</em> bold text underscore italics +

resulting output: +

normal text emphasis bold text underscore italics <cite>citation</cite> ^superscript^  [subscript] <ins>inserted text</ins> <del>strikethrough</del> -

normal text -

<em>emphasis</em> -

bold text -

underscore -

italics +

normal text +

+

bold text +

underscore +

italics

<cite>citation</cite> - -

^superscript^ -

[subscript] -

<ins>inserted text</ins> +

+ ^superscript^ +

[subscript] +

<ins>inserted text</ins>

<del>strikethrough</del> -

9.3 INDENTATION AND BULLETS -

markup example: -

+

9.3 INDENTATION AND BULLETS +

markup example: +


  ordinary paragraph
   _1 indent paragraph one step
   _2 indent paragraph two steps
   _9 indent paragraph nine steps
 
-

resulting output: -

ordinary paragraph +

+

resulting output: +

ordinary paragraph

indent paragraph one step
- +

indent paragraph two steps
- +

indent paragraph nine steps
- -

markup example: -

+ +

markup example: +


-

  * bullet text
+
  _* bullet text
   _1* bullet text, first indent
   _2* bullet text, two step indent
 
-

resulting output: -

* bullet text +

resulting output: +

* bullet text

* bullet text, first indent
- +

* bullet text, two step indent
- +

Numbered List (not to be confused with headings/titles, (document structure)) -

markup example: -

+

markup example: +


  # numbered list                numbered list 1., 2., 3, etc.
   _# numbered list numbered list indented a., b., c., d., etc.
 
-

9.4 FOOTNOTES / ENDNOTES +

9.4 FOOTNOTES / ENDNOTES

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. -

markup example: -

+or endnotes. +

markup example: +


  ~{ a footnote or endnote }~
 
-

resulting output: -

[^11] -

markup example: -

+

resulting output: +

[^11] +

markup example: +


  normal text~{ self contained endnote marker & endnote in one }~ continues
 
-

resulting output: -

normal text[^12] continues -

markup example: -

+

resulting output: +

normal text[^12] continues +

markup example: +


  normal text ~{* unnumbered asterisk footnote/endnote, insert multiple
 asterisks if required }~ continues
   normal text ~{** another unnumbered asterisk footnote/endnote }~ continues
 
-

resulting output: -

normal text  [^*] continues -

normal text  [^**] continues +

resulting output: +

normal text [^*] continues +

normal text [^**] continues -

markup example: -

+

+

markup example: +


  normal text ~[*  editors  notes,  numbered  asterisk  footnote/endnote  series
  ]~ continues
   normal text ~[+  editors  notes,  numbered  asterisk  footnote/endnote  series
  ]~ continues
 
-

resulting output: -

normal text  [^*3] continues -

normal text  [^+2] continues +

resulting output: +

normal text [^*3] continues +

normal text [^+2] continues -

Alternative endnote pair notation for footnotes/endnotes: -

+

+

Alternative endnote pair notation for footnotes/endnotes: +


-

-  % note the endnote marker
+
  % note the endnote marker
   normal text~^ continues
   ^~ endnote text following the paragraph in which the marker occurs
 
-

the standard and pair notation cannot be mixed in the same document +

the standard and pair notation cannot be mixed in the same document

-

9.5 LINKS -

9.5.1 NAKED URLS WITHIN TEXT, DEALING WITH URLS +

9.5 LINKS +

9.5.1 NAKED URLS WITHIN TEXT, DEALING WITH URLS

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). -

markup example: -

+is omitted). +

markup example: +


  normal text http://www.jus.uio.no/sisu continues
 
-

resulting output: +

resulting output:

normal text <http://www.jus.uio.no/sisu -> continues +> continues

An -

escaped url without decoration -

markup example: -

+

escaped url without decoration +

markup example: +


  normal text http://www.jus.uio.no/sisu continues
   deb http://www.jus.uio.no/sisu/archive unstable main non-free
 
-

resulting output: +

resulting output:

normal text http://www.jus.uio.no/sisu - continues + continues

deb

http://www.jus.uio.no/sisu/archive - unstable main non-free + unstable main non-free

where a code block is used there is neither decoration nor hyperlinking, code blocks are discussed -

later in this document -

resulting output: -

+

later in this document +

resulting output: +


  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
 
-

To link text or an image to a url the markup is as follows +

To link text or an image to a url the markup is as follows

markup example: -

+


  about { SiSU }http://url.org markup
 
-

9.5.2 LINKING TEXT -

resulting output: +

9.5.2 LINKING TEXT +

resulting output:

about SiSU <http://www.jus.uio.no/sisu/ > -

markup +

markup

A shortcut notation is available so the url link may also be provided -

automatically as a footnote -

markup example: -

+

automatically as a footnote +

markup example: +


  about {~^ SiSU }http://url.org markup
 
-

resulting output: +

resulting output:

about SiSU <http://www.jus.uio.no/sisu/ ->  [^13] markup +> [^13] markup

-

9.5.3 LINKING IMAGES -

markup example: -

+

9.5.3 LINKING IMAGES +

markup example: +


-

     [ tux.png ]
+
      [ tux.png ]
   % various url linked images
-     [ tux.png ]
-     [ GnuDebianLinuxRubyBetterWay.png ]
+      [ tux.png ]
+      [ GnuDebianLinuxRubyBetterWay.png ]
   {~^ ruby_logo.png
 
-

resulting output: -

[ tux.png ] -

tux.png 64x80 +

resulting output: +

[ tux.png ] +

tux.png 64x80

[  ruby_logo  (png  missing) - ]  [^14] -

GnuDebianLinuxRubyBetterWay.png 100x101 and Ruby + ]  [^14] +

GnuDebianLinuxRubyBetterWay.png 100x101 and Ruby

linked url footnote -

shortcut -

+

shortcut +


  {~^  [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
 
-

+


  text marker *~name
 

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. -

9.6 GROUPED TEXT +auto-heading numbering, without further intervention. +

9.6 GROUPED TEXT

9.6.1 -

TABLES -

Tables may be prepared in two either of two forms +

TABLES +

Tables may be prepared in two either of two forms

markup example: -

+


  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
 
-

resulting output: +

resulting output:

 [table  omitted,  see  other  document  formats]
- +

a second form may be easier to work with in cases where there is not -

much information in each column -

markup example: [^15] -

+

much information in each column +

markup example: [^15] +


  !_ 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.
 
-

resulting output: +

resulting output:

Table 3.1: Contributors to Wikipedia, January 2001 -- June 2005 +- June 2005

 [table  omitted,  see  other  document  formats]
- +

* Contributed at least ten times; ** at least 5 times in last month; -*** more than 100 times in last month. -

9.6.2 POEM -

basic markup: -

+*** more than 100 times in last month. +

9.6.2 POEM +

basic markup: +


  poem{
     Your poem here
   }poem
   Each verse in a poem is given a separate object number.
 
-

markup example: -

+

markup example: +


  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
 
-

resulting output: -

+

resulting output: +

’Fury said to a
-

- mouse, That he
-

- met in the
-

- house,
-

-
-

- both go to
-

- law: I will
-

- prosecute
-

- YOU. --Come,
-

- I’ll take no
-

- denial; We
-

- must have a
-

- trial: For
-

- really this
-

- morning I’ve
-

- nothing
-

- to do.
-

- Said the
-

- mouse to the
-

- cur,
-

- a trial,
-

- dear Sir,
-

- With
-

- no jury
-

- or judge,
-

- would be
-

- wasting
-

- our
-

- breath.
-

-
-

- judge, I’ll
-

- be jury,
-

- Said
-

- cunning
-

- old Fury:
-

-
-

- try the
-

- whole
-

- cause,
-

- and
-

- condemn
-

- you
-

- to
-

- death.
-

- -

9.6.3 GROUP -

basic markup: -

+ mouse, That he
+ met in the
+ house,
+
+ both go to
+ law: I will
+ prosecute
+ YOU. --Come,
+ I’ll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I’ve
+ nothing
+ to do.
+ Said the
+ mouse to the
+ cur,
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath.
+
+ judge, I’ll
+ be jury,
+ Said
+ cunning
+ old Fury:
+
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death.
+ +

9.6.3 GROUP +

basic markup: +


  group{
     Your grouped text here
   }group
   A group is treated as an object and given a single object number.
 
-

markup example: -

+

markup example: +


  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
 
-

resulting output: -

+

resulting output: +

’Fury said to a
-

- mouse, That he
-

- met in the
-

- house,
-

-
-

- both go to
-

- law: I will
-

- prosecute
-

- YOU. --Come,
-

- I’ll take no
-

- denial; We
-

- must have a
-

- trial: For
-

- really this
-

- morning I’ve
-

- nothing
-

- to do.
-

- Said the
-

- mouse to the
-

- cur,
-

- a trial,
-

- dear Sir,
-

- With
-

- no jury
-

- or judge,
-

- would be
-

- wasting
-

- our
-

- breath.
-

-
-

- judge, I’ll
-

- be jury,
-

- Said
-

- cunning
-

- old Fury:
-

-
-

- try the
-

- whole
-

- cause,
-

- and
-

- condemn
-

- you
-

- to
-

- death.
-

- -

9.6.4 CODE + mouse, That he
+ met in the
+ house,
+
+ both go to
+ law: I will
+ prosecute
+ YOU. --Come,
+ I’ll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I’ve
+ nothing
+ to do.
+ Said the
+ mouse to the
+ cur,
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath.
+
+ judge, I’ll
+ be jury,
+ Said
+ cunning
+ old Fury:
+
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death.
+ +

9.6.4 CODE

Code tags are used to escape regular sisu markup, and have been used extensively within this document to provide examples of SiSU 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.

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]

use of code tags instead of -poem compared, resulting output: -

+poem compared, resulting output: +


                      ’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:
                 wasting
                our
                 breath.
- 
+
                    judge, I’ll
                      be jury,
                            Said
                       cunning
                         old Fury:
- 
+
                         try the
                            whole
                             cause,
@@ -1574,7 +1497,7 @@ poem compared, resulting output:
                         to
                          death.
 
-

10. COMPOSITE DOCUMENTS MARKUP +

10. COMPOSITE DOCUMENTS MARKUP

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 .sst regular markup file, or .ssi (insert

A secondary file of the composite document is built prior to processing -

with the same prefix and the suffix ._sst +

with the same prefix and the suffix ._sst

basic markup for importing a -

document into a master document -

+

document into a master document +


  << 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.
 
-

+


  << filename.ssi
   <<{filename.ssi}
   % using textlink alternatives
   << |filename.ssi|@|^|
 
-

MARKUP SYNTAX HISTORY +

MARKUP SYNTAX HISTORY

11. NOTES RELATED TO FILES-TYPES AND MARKUP SYNTAX - +

0.38 is substantially current, depreciated 0.16 supported, though file -

names were changed at 0.37 -

* sisu --query=[sisu  version   [0.38] or ’history] +

names were changed at 0.37 +

* sisu --query=[sisu  version  [0.38] or ’history] -

provides a short history of changes to SiSU markup +

provides a short history of changes to SiSU markup

0.57 (2007w34/4) 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 contents  of  the  headers  @title:  and  @author:] -

+use the headers @title and @creator in the first heading [expanded  using + the  and  @author:] +


  :A~ @title by @author
 

0.52 (2007w14/6) declared document type identifier at start of text/document:

.B SiSU
- 0.52 -

or, backward compatible using the comment marker: + 0.52 +

or, backward compatible using the comment marker:

%
- SiSU 0.38 -

variations include ’ SiSU (text|master|insert)  [version]’ and ’sisu-[version]’ + SiSU 0.38 +

variations include ’ SiSU (text|master|insert) [version]’ and ’sisu-[version]’ -

0.51 (2007w13/6) skins changed (simplified), markup unchanged +

0.51 (2007w13/6) skins changed (simplified), markup unchanged

0.42 (2006w27/4) -* (asterisk) type endnotes, used e.g. in relation to author +* (asterisk) type endnotes, used e.g. in relation to author

SiSU 0.42 is the same as 0.38 with the introduction of some additional endnote types,

Introduces some variations on endnotes, in particular the use of the -

asterisk -

+

asterisk +


  ~{* for example for describing an author }~ and ~{** for describing a
 second author }~
 
-

* for example for describing an author +

* for example for describing an author

** for describing a second author -

and -

+

and +


  ~[*  my  note  ]~ or ~[+  another  note  ]~
 
-

which numerically increments an asterisk and plus respectively +

which numerically increments an asterisk and plus respectively

*1 my -

note +1 another note +

note +1 another note

0.38 (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)

SiSU 0.38 introduced alternative experimental header and heading/structure markers, -

+


  @headername: and headers :A~ :B~ :C~ 1~ 2~ 3~
 
-

as the equivalent of: -

+

as the equivalent of: +


  0~headername and headers 1~ 2~ 3~ 4~ 5~ 6~
 

The internal document markup of SiSU 0.16 remains valid and standard Though -

note that SiSU 0.37 introduced a new file naming convention +

note that SiSU 0.37 introduced a new file naming convention

SiSU 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

0.37 (2006w09/7) introduced new file naming convention, .sst (text), .ssm -(master), .ssi (insert), markup syntax unchanged +(master), .ssi (insert), markup syntax unchanged

SiSU 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
- -

this is captured by the following file ’rename’ instruction: -

+ +

this is captured by the following file ’rename’ instruction: +


  rename ’s/.s[123]$/.sst/’ *.s{1,2,3}
   rename ’s/.r[123]$/.ssm/’ *.r{1,2,3}
   rename ’s/.si$/.ssi/’ *.si
 
-

The internal document markup remains unchanged, from SiSU 0.16 +

The internal document markup remains unchanged, from SiSU 0.16

0.35 (2005w52/3) -sisupod, zipped content file introduced +sisupod, zipped content file introduced

0.23 (2005w36/2) utf-8 for markup -

file +

file

0.22 (2005w35/3) image dimensions may be omitted if rmagick is available -

to be relied upon -

0.20.4 (2005w33/4) header 0~links +

to be relied upon +

0.20.4 (2005w33/4) header 0~links

0.16 (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 -

marker -

SiSU 0.16 (0.15 development branch) introduced the use of +

marker +

SiSU 0.16 (0.15 development branch) introduced the use of

the -header 0~ and headings/structure 1~ 2~ 3~ 4~ 5~ 6~ +header 0~ and headings/structure 1~ 2~ 3~ 4~ 5~ 6~

in place of the 0.1 -header, heading/structure notation +header, heading/structure notation

SiSU 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{

12. -SISU FILETYPES +SISU FILETYPES

SiSU has plaintext and binary filetypes, and can process -either type of document. -

12.1 .SST .SSM .SSI MARKED UP PLAIN TEXT +either type of document. +

12.1 .SST .SSM .SSI MARKED UP PLAIN TEXT

SiSU documents are prepared as plain-text (utf-8) files with SiSU 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.
- +

SiSU 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. -

SiSU source markup can be shared with the command: -

sisu -s  [filename]
- -

12.1.1 SISU TEXT - REGULAR FILES (.SST) +

SiSU source markup can be shared with the command: +

sisu -s [filename]
+ +

12.1.1 SISU TEXT - REGULAR FILES (.SST)

The most common form of document -in SiSU , see the section on SiSU markup. +in SiSU , see the section on SiSU markup.

<http://www.jus.uio.no/sisu/sisu_markup >

<http://www.jus.uio.no/sisu/sisu_manual -> -

12.1.2 SISU MASTER FILES (.SSM) +> +

12.1.2 SISU MASTER FILES (.SSM)

Composite documents which incorporate other SiSU documents which may be either regular SiSU text .sst which may be generated independently, or inserts prepared solely for the purpose of being incorporated into one or more master documents.

The mechanism by which master files incorporate other documents is described -as one of the headings under under SiSU markup in the SiSU manual. +as one of the headings under under SiSU markup in the SiSU manual.

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.

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]

<http://www.jus.uio.no/sisu/sisu_markup -> +>

<http://www.jus.uio.no/sisu/sisu_manual > -

12.1.3 SISU INSERT FILES (.SSI) +

12.1.3 SISU INSERT FILES (.SSI)

Inserts are documents prepared solely for the purpose of being incorporated into one or more master documents. They resemble regular SiSU text files except they are ignored by the SiSU 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.

12.2 SISUPOD, -ZIPPED BINARY CONTAINER (SISUPOD.ZIP, .SSP) +ZIPPED BINARY CONTAINER (SISUPOD.ZIP, .SSP)

A sisupod is a zipped SiSU text file or set of SiSU text files and any associated images that they -contain (this will be extended to include sound and multimedia-files) -

+contain (this will be extended to include sound and multimedia-files) +

SiSU 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.

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 SiSU documents. +of a whole directory of prepared SiSU documents.

The command to create -a sisupod is: -

sisu -S  [filename]
- -

Alternatively, make a pod of the contents of a whole directory: -

+a sisupod is: +

sisu -S [filename]
+ +

Alternatively, make a pod of the contents of a whole directory: +

sisu -S
- +

SiSU 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.

<http://www.jus.uio.no/sisu/sisu_commands >

<http://www.jus.uio.no/sisu/sisu_manual -> +>

13. EXPERIMENTAL ALTERNATIVE INPUT -REPRESENTATIONS -

13.1 ALTERNATIVE XML +REPRESENTATIONS +

13.1 ALTERNATIVE XML

SiSU 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.

convert from sst to simple xml representations (sax, -dom and node): -

sisu --to-sax  [filename/wildcard] or sisu --to-sxs node):
- [filename/wildcard]
- -

sisu --to-dom  [filename/wildcard] or sisu --to-sxd node):
- [filename/wildcard]
- -

sisu --to-node  [filename/wildcard] or sisu --to-sxn
- [filename/wildcard]
- +dom and node): +

sisu --to-sax [filename/wildcard] or sisu --to-sxs [filename/wildcard]
+ +

sisu --to-dom [filename/wildcard] or sisu --to-sxd [filename/wildcard]
+ +

sisu --to-node [filename/wildcard] or sisu --to-sxn [filename/wildcard]
+ +

convert to sst from any sisu xml representation (sax, dom and node): -

sisu --from-xml2sst  [filename/wildcard   [.sxs.xml,.sxd.xml,sxn.xml]]
- -

or the same: -

sisu --from-sxml  [filename/wildcard   [.sxs.xml,.sxd.xml,sxn.xml]]
- -

13.1.1 XML SAX REPRESENTATION +

sisu --from-xml2sst [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

or the same: +

sisu --from-sxml [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

13.1.1 XML SAX REPRESENTATION

To convert from sst to simple xml (sax) -representation: -

sisu --to-sax  [filename/wildcard] or sisu --to-sxs
- [filename/wildcard]
- -

To convert from any sisu xml representation back to sst +representation: +

sisu --to-sax [filename/wildcard] or sisu --to-sxs [filename/wildcard]
+ +

To convert from any sisu xml representation back to sst

sisu --from-xml2sst - [filename/wildcard   [.sxs.xml,.sxd.xml,sxn.xml]]
- -

or the same: -

sisu --from-sxml  [filename/wildcard   [.sxs.xml,.sxd.xml,sxn.xml]]
- -

13.1.2 XML DOM REPRESENTATION +[filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

or the same: +

sisu --from-sxml [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

13.1.2 XML DOM REPRESENTATION

To convert from sst to simple xml (dom) -representation: -

sisu --to-dom  [filename/wildcard] or sisu --to-sxd
- [filename/wildcard]
- -

To convert from any sisu xml representation back to sst +representation: +

sisu --to-dom [filename/wildcard] or sisu --to-sxd [filename/wildcard]
+ +

To convert from any sisu xml representation back to sst

sisu --from-xml2sst - [filename/wildcard   [.sxs.xml,.sxd.xml,sxn.xml]]
- -

or the same: -

sisu --from-sxml  [filename/wildcard   [.sxs.xml,.sxd.xml,sxn.xml]]
- -

13.1.3 XML NODE REPRESENTATION +[filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

or the same: +

sisu --from-sxml [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

13.1.3 XML NODE REPRESENTATION

To convert from sst to simple xml (node) -representation: -

sisu --to-node  [filename/wildcard] or sisu --to-sxn
- [filename/wildcard]
- -

To convert from any sisu xml representation back to sst +representation: +

sisu --to-node [filename/wildcard] or sisu --to-sxn [filename/wildcard]
+ +

To convert from any sisu xml representation back to sst

sisu --from-xml2sst - [filename/wildcard   [.sxs.xml,.sxd.xml,sxn.xml]]
- -

or the same: -

sisu --from-sxml  [filename/wildcard   [.sxs.xml,.sxd.xml,sxn.xml]]
- -

14. CONFIGURATION -

14.1 DETERMINING THE CURRENT CONFIGURATION +[filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

or the same: +

sisu --from-sxml [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
+ +

14. CONFIGURATION +

14.1 DETERMINING THE CURRENT CONFIGURATION

Information on the current configuration of SiSU should be available with the help -command: +command:

sisu -v
- -

which is an alias for: + +

which is an alias for:

sisu --help env
- +

Either of these should be executed from within a directory that contains -sisu markup source documents. -

14.2 CONFIGURATION FILES (CONFIG.YML) +sisu markup source documents. +

14.2 CONFIGURATION FILES (CONFIG.YML)

SiSU 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.

The SiSU configuration file is a yaml file, which -means indentation is significant. +means indentation is significant.

SiSU resource configuration is determined -by looking at the following files if they exist: +by looking at the following files if they exist:

./_sisu/sisurc.yml
- +

~/.sisu/sisurc.yml
- +

/etc/sisu/sisurc.yml
- -

The search is in the order listed, and the first one found is used. + +

The search is in the order listed, and the first one found is used.

In the absence of instructions in any of these it falls back to the internal -program defaults. +program defaults.

Configuration determines the output and processing directories -and the database access details. +and the database access details.

If SiSU is installed a sample sisurc.yml -

may be found in /etc/sisu/sisurc.yml -

15. SKINS +

may be found in /etc/sisu/sisurc.yml +

15. SKINS

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:

./_sisu/skin
- +

~/.sisu/skin
- +

/etc/sisu/skin
- +

Within the skin directory are the following the default sub-directories -for document skins: +for document skins:

./skin/doc
- +

./skin/dir
- +

./skin/site
- +

A skin is placed in the appropriate directory and the file named skin_[name].rb

The skin itself is a ruby file which modifies the default appearances -set in the program. -

15.1 DOCUMENT SKIN +set in the program. +

15.1 DOCUMENT SKIN

Documents take on a document skin, -if the header of the document specifies a skin to be used. -

+if the header of the document specifies a skin to be used. +


  @skin: skin_united_nations
 
-

15.2 DIRECTORY SKIN +

15.2 DIRECTORY SKIN

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).

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. -

15.3 SITE SKIN -

A site skin, modifies the program default skin. +

15.3 SITE SKIN +

A site skin, modifies the program default skin.

15.4 SAMPLE -

SKINS -

With SiSU installed sample skins may be found in: +

SKINS +

With SiSU installed sample skins may be found in:

/etc/sisu/skin/doc and
/usr/share/doc/sisu/sisu_markup_samples/dfsg/_sisu/skin/doc
- +

(or equivalent directory) and if sisu-markup-samples is installed also -under: +under:

/usr/share/doc/sisu/sisu_markup_samples/non-free/_sisu/skin/doc
- +

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:

/usr/share/doc/sisu/sisu_markup_samples/dfsg/_sisu/skin/yml (or equivalent
directory)
- -

16. CSS - CASCADING STYLE SHEETS (FOR HTML, XHTML AND XML) + +

16. CSS - CASCADING STYLE SHEETS (FOR HTML, XHTML AND XML)

CSS files to modify the appearance of SiSU 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
- output directories with the command sisu -CC. + output directories with the command sisu -CC.

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. -

HTML: html.css -

XML DOM: dom.css -

XML SAX: sax.css -

XHTML: xhtml.css +

HTML: html.css +

XML DOM: dom.css +

XML SAX: sax.css +

XHTML: xhtml.css

- The default homepage may use homepage.css or html.css + The default homepage may use homepage.css or html.css

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] -

17. ORGANISING CONTENT +is looked for in a skin.[^17] +

17. ORGANISING CONTENT

17.1 DIRECTORY STRUCTURE -

AND MAPPING +

AND MAPPING

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)

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. -

17.2 ORGANISING CONTENT -

18. HOMEPAGES +

17.2 ORGANISING CONTENT +

18. HOMEPAGES

SiSU is about the ability to auto-generate documents. Home pages are regarded as custom built items, and are not created by SiSU SiSU 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:

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) -

2. through providing what you want as the home page in a skin, +

2. through providing what you want as the home page in a skin,

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.

18.1 HOME PAGE AND OTHER CUSTOM BUILT -

PAGES IN A SUB-DIRECTORY +

PAGES IN A SUB-DIRECTORY

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:

sisu -CC
- -

18.2 HOME PAGE WITHIN A SKIN + +

18.2 HOME PAGE WITHIN A SKIN

Skins are described in a separate section, but basically are a file written in the programming language Ruby 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.

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 -

poems in skin_poems.rb -

+

poems in skin_poems.rb +


    class Home
       def homepage
@@ -2076,20 +1994,20 @@ index.html
       end
     end
 
-

19. MARKUP AND OUTPUT EXAMPLES -

19.1 MARKUP EXAMPLES +

19. MARKUP AND OUTPUT EXAMPLES +

19.1 MARKUP EXAMPLES

Current markup examples and document output samples are provided at <http://www.jus.uio.no/sisu/SiSU/examples.html >

Some markup with syntax highlighting may be found under <http://www.jus.uio.no/sisu/sample/syntax > -but is not as up to date. +but is not as up to date.

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.

20. -SISU SEARCH - INTRODUCTION +SISU SEARCH - INTRODUCTION

SiSU 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.

In addition to this SiSU 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. -

21. SQL +or in various output formats. +

21. SQL

21.1 POPULATING SQL TYPE DATABASES

SiSU feeds sisu markupd documents into sql type databases PostgreSQL[^18] and/or SQLite[^19] database together with information related to document -structure. +structure.

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:

* one containing semantic (and other) headers, including, title, author,
subject, (the Dublin Core...);
- +

* another the substantive texts by individual
along with structural information, each paragraph being identifiable by its
@@ -2126,25 +2044,25 @@ by its
substantive text of each paragraph quite naturally being searchable (both in
formatted and clean text versions for searching); and
- +

* a third containing endnotes cross-referenced back to the paragraph from
which they are referenced (both in formatted and clean text versions for
searching).
- +

* a fourth table with a one to one relation with the headers table contains
full text versions of output, eg. pdf, html, xml, and ascii.
- -

There is of course the possibility to add further structures. + +

There is of course the possibility to add further structures.

At this level SiSU 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.

Being able to search a relational database at an object level with the SiSU citation system is an effective way of locating content generated by SiSU 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).

22. -POSTGRESQL -

22.1 NAME +POSTGRESQL +

22.1 NAME

SiSU - Structured information, Serialized Units -- a document publishing system, postgresql dependency package +- a document publishing system, postgresql dependency package

22.2 DESCRIPTION

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 SiSU to populate a postgresql database, this being -part of SiSU - man sisu). -

22.3 SYNOPSIS -

sisu -D  [instruction]  [filename/wildcard +part of SiSU - man sisu). +

22.3 SYNOPSIS +

sisu -D [instruction] [filename/wildcard  if  required]
- -

sisu -D --pg --[instruction]  [filename/wildcard  if  required]
- -

22.4 COMMANDS + +

sisu -D --pg --[instruction] [filename/wildcard  if  required]
+ +

22.4 COMMANDS

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

-D or --pgsql may -be used interchangeably. -

22.4.1 CREATE AND DESTROY DATABASE -

+be used interchangeably. +

22.4.1 CREATE AND DESTROY DATABASE +

-
 --pgsql  --createall +
--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) the  same  name - as  working  directory,  as +
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)

-
 sisu  -D  --createdb
-
 creates  database  where  no  database - existed  before  as +
sisu -D --createdb +
+
+

creates database where no database existed before

-
 sisu  -D  --create
-
 creates  database  tables  where  no  database - tables  existed before  database  tables  where  no  database  tables  existed +
sisu -D --create
+
creates +

database tables where no database tables existed before

-
 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).  a +
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).

-
 sisu  -D  --recreate
-
 destroys  existing +
sisu -D --recreate
+
destroys existing database and builds -

 database  and  builds  a  new  empty  database  structure +

a new empty database structure

-22.4.2 IMPORT AND REMOVE - -

DOCUMENTS -

+22.4.2 IMPORT AND REMOVE DOCUMENTS +

-
 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). +
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).

-
 sisu  -D  --update  -v   [filename/wildcard]
-
updates +
sisu -D --update -v [filename/wildcard]
+
updates file contents -

file contents in database +

in database

-
 sisu  -D  --remove  -v   [filename/wildcard]
-
removes -specified document from postgresql database. +
sisu -D --remove -v [filename/wildcard]
+
removes specified document +from postgresql database.

-23. SQLITE -

23.1 NAME -

SiSU -- Structured information, Serialized Units - a document publishing system. - -

23.2 DESCRIPTION -

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 SiSU to populate an sqlite database, this being -part of SiSU - man sisu). -

23.3 SYNOPSIS -

sisu -d  [instruction]  [filename/wildcard - if  required]
- -

sisu -d --(sqlite|pg) --[instruction]  [filename/wildcard  if
+23. SQLITE +

23.1 NAME +

SiSU - Structured information, +Serialized Units - a document publishing system. +

23.2 DESCRIPTION +

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 SiSU +to populate an sqlite database, this being part of SiSU - man sisu). +

23.3 + +

SYNOPSIS +

sisu -d [instruction] [filename/wildcard  if  required]
+ +

sisu -d --(sqlite|pg) --[instruction] [filename/wildcard  if
required]
- -

23.4 COMMANDS + +

23.4 COMMANDS

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

-d or --sqlite may -be used interchangeably. -

23.4.1 CREATE AND DESTROY DATABASE -

+be used interchangeably. +

23.4.1 CREATE AND DESTROY DATABASE +

-
 --sqlite  --createall +
--sqlite --createall
-
 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 +
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)

-
 sisu  -d  --createdb
-
 creates  database  where - no  database  existed  before  as +
sisu -d --createdb +
+
+

creates database where no database existed before

-
 sisu  -d  --create
-
 creates  database  tables  where - no  database  tables  existed before  database  tables  where  no  database  tables - existed +
sisu -d --create
+
creates + +

database tables where no database tables existed before

-
 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).  a +
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).

-
 sisu  -d  --recreate
-
 destroys +
sisu -d --recreate
+
destroys existing database and builds -

 existing  database  and  builds  a  new  empty  database  structure +

a new empty database structure

-23.4.2 IMPORT - -

AND REMOVE DOCUMENTS -

+23.4.2 IMPORT AND REMOVE DOCUMENTS +

-
 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). +
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).

-
 sisu  -d  --update  -v   [filename/wildcard]
-
updates +
sisu -d --update -v [filename/wildcard]
+
updates file contents in database -

file contents in database

-
 sisu  -d  --remove  -v   [filename/wildcard]
-
removes -specified document from sqlite database. +
sisu -d --remove -v [filename/wildcard]
+
removes specified document from sqlite +database.

-24. INTRODUCTION -

24.1 SEARCH - -DATABASE FRONTEND SAMPLE, UTILISING DATABASE AND SISU FEATURES, INCLUDING -OBJECT CITATION NUMBERING (BACKEND CURRENTLY POSTGRESQL) -

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, object citation -numbering to demonstrates functionality.[^21] -

SiSU 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. -

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] -

+24. INTRODUCTION +

24.1 SEARCH - DATABASE FRONTEND SAMPLE, UTILISING +DATABASE AND SISU FEATURES, INCLUDING OBJECT CITATION NUMBERING (BACKEND +CURRENTLY POSTGRESQL) +

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, object citation numbering to demonstrates functionality.[^21] + +

SiSU 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. +

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] +

-
 sisu  -F  --webserv-webrick -
-
-

 builds  a  cgi  web  search  frontend  for  the  database  created -

The following -is feedback on the setup on a machine provided by the help command: -

- sisu --help sql
- -

+

sisu -F --webserv-webrick
+
builds a cgi web search + +

frontend for the database created +

The following is feedback on the setup +on a machine provided by the help command: +

sisu --help sql
+ +


  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
 
-

Note on databases built -

By default,  [unless  otherwise  specified] databases +

Note on databases built +

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

-24.2 SEARCH FORM -

+24.2 SEARCH FORM +

-
 sisu  -F
-
 generates  a  sample  search  form,  which  must - be  copied  to  which  must  be  copied  to +
sisu -F
+
generates a sample search form, which must + +

be copied to the web-server cgi directory

-
 sisu  -F  --webserv-webrick
-
 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 +
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

-
 sisu  -Fv
-
 as  above,  and  provides  some  information  on  setting  up +
sisu -Fv
+
as above, and provides some information + +

on setting up hyperestraier

-
 sisu  -W -
-
-

 starts  the  webrick  server  which  should  be  available +

sisu -W
+
starts the webrick server which should + +

be available wherever sisu is properly installed

The generated search -

form must be copied manually to the webserver directory as instructed +

form must be copied manually to the webserver directory as instructed

-25. HYPERESTRAIER -

See the documentation for hyperestraier: +25. HYPERESTRAIER +

See the documentation for hyperestraier:

<http://hyperestraier.sourceforge.net/ >
- +

/usr/share/doc/hyperestraier/index.html
- +

man estcmd
- -

on sisu_hyperestraier: + +

on sisu_hyperestraier:

man sisu_hyperestraier
- +

/usr/share/doc/sisu/sisu_markup/sisu_hyperestraier/index.html
- +

NOTE: the examples that follow assume that sisu output is placed in -

the directory /home/ralph/sisu_www +

the directory /home/ralph/sisu_www

(A) to generate the index within the -webserver directory to be indexed: -

estcmd gather -sd  [index  name]  [directory +webserver directory to be indexed: +

estcmd gather -sd [index  name] [directory  path  to  index]
- +

the following are examples that will need to be tailored according to -your needs: +your needs:

cd /home/ralph/sisu_www
- +

estcmd gather -sd casket /home/ralph/sisu_www
- +

you may use the ’find’ command together with ’egrep’ to limit indexing to particular document collection directories within the web server directory:

find /home/ralph/sisu_www -type f | egrep
’/home/ralph/sisu_www/sisu/.+?.html$’ |estcmd gather -sd casket -
- +

Check which directories in the webserver/output directory (~/sisu_www or elsewhere depending on configuration) you wish to include in the search -index. +index.

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.

find /home/ralph/sisu_www -type f | egrep
’/sisu_www/(sisu|bookmarks)/.+?.html$’ | egrep -v
’(doc|concordance).html$’ |estcmd gather -sd casket -
- +

from your current document preparation/markup directory, you would construct -a rune along the following lines: +a rune along the following lines:

find /home/ralph/sisu_www -type f | egrep ’/home/ralph/sisu_www/([specify
first  directory  for  inclusion]|[specify  second  directory  for
inclusion]|[another  directory  for  inclusion?  ...])/.+?.html$’ |
egrep -v ’(doc|concordance).html$’ |estcmd gather -sd
/home/ralph/sisu_www/casket -
- -

(B) to set up the search form + +

(B) to set up the search form

(i) copy estseek.cgi to your cgi directory -and set file permissions to 755: +and set file permissions to 755:

sudo cp -vi /usr/lib/estraier/estseek.cgi /usr/lib/cgi-bin
- +

sudo chmod -v 755 /usr/lib/cgi-bin/estseek.cgi
- +

sudo cp -v /usr/share/hyperestraier/estseek.* /usr/lib/cgi-bin
- -

 [see  estraier  documentation  for  paths]
- + +

[see  estraier  documentation  for  paths]
+

(ii) edit estseek.conf, with attention to the lines starting ’indexname:’ -and ’replace:’: +and ’replace:’:

indexname: /home/ralph/sisu_www/casket
- +

replace: ^file:///home/ralph/sisu_www{{!}}http://localhost
- +

replace: /index.html?${{!}}/
- -

(C) to test using webrick, start webrick: + +

(C) to test using webrick, start webrick:

sisu -W
- +

and try open the url: <http://localhost:8081/cgi-bin/estseek.cgi -> +>

26. SISU_WEBRICK - -

26.1 NAME + +

26.1 NAME

SiSU - Structured information, Serialized Units - a document -

publishing system -

26.2 SYNOPSIS -

sisu_webrick  [port] -

or -

sisu -W  [port] +

publishing system +

26.2 SYNOPSIS +

sisu_webrick [port] +

or +

sisu -W [port] -

26.3 DESCRIPTION +

26.3 DESCRIPTION

sisu_webrick is part of SiSU (man sisu) sisu_webrick starts Ruby ’s Webrick web-server and points it to the directories to which SiSU output is written, providing a list of these directories (assuming -SiSU is in use and they exist). +SiSU is in use and they exist).

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). -

26.4 SUMMARY OF MAN PAGE +on your system). +

26.4 SUMMARY OF MAN PAGE

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] -

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] +

where no port is given and settings are -

the default port is 8081 -

26.5 DOCUMENT PROCESSING COMMAND FLAGS -

sisu --W  [port] starts Ruby Webrick web-server, serving SiSU output directories, +

unchanged the default port is 8081 +

26.5 DOCUMENT PROCESSING COMMAND FLAGS + +

sisu -W [port] starts Ruby Webrick web-server, serving SiSU output directories, on the port provided, or if no port is provided and the defaults have not -

been changed in ~/.sisu/sisurc.yaml then on port 8081 +

been changed in ~/.sisu/sisurc.yaml then on port 8081

26.6 FURTHER INFORMATION

For more information on SiSU see: <http://www.jus.uio.no/sisu -> +>

or man sisu -

26.7 AUTHOR -

Ralph Amissah ralph@amissah.com or ralph.amissah@gmail.com +

26.7 AUTHOR +

Ralph Amissah ralph@amissah.com or ralph.amissah@gmail.com

-

26.8 SEE ALSO +

26.8 SEE ALSO

sisu(1)
- +

sisu_vim(7)
- +

sisu(8)
- -

27. REMOTE SOURCE DOCUMENTS + +

27. REMOTE SOURCE DOCUMENTS

SiSU 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 SiSU 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

.sst / .ssm - sisu text files

SiSU 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. -

+parts (such as images) will be downloaded and generated locally. +


  sisu -3 http://[provide  url  to  valid  .sst  or  .ssm  file]
 

Any of the source documents in the sisu examples page can be used in this way, see <http://www.jus.uio.no/sisu/SiSU/examples.html > and use the url -for the desired document. +for the desired document.

NOTE: to set up a remote machine to serve SiSU documents in this way, images should be in the directory relative to the -

document source ../_sisu/image -

sisupod - zipped sisu files +

document source ../_sisu/image +

sisupod - zipped sisu files

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.

SiSU 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. -

+locally. +


  sisu -3 http://[provide  url  to  valid  sisupod.zip  or  .ssp  file]
 

Any of the source documents in the sisu examples page can be used in this way, see <http://www.jus.uio.no/sisu/SiSU/examples.html > and use the url -for the desired document. -

REMOTE DOCUMENT OUTPUT -

28. REMOTE OUTPUT -

+for the desired document. +

REMOTE DOCUMENT OUTPUT +

28. REMOTE OUTPUT +

Once properly configured SiSU 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.

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. -

+may be used in conjunction with other processing flags, e.g. +


  sisu -3R sisu_remote.sst
 
-

28.1 COMMANDS -

+

28.1 COMMANDS +

-
 -R   [filename/wildcard]
+
-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 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

-
 -r   [filename/wildcard]
+
-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 +

your

-28.2 CONFIGURATION +28.2 CONFIGURATION

[expand  on  the  setting  up  of  an  ssh-agent  /  keychain] -

29. REMOTE SERVERS +

29. REMOTE SERVERS

As SiSU is generally operated using the command line, and works within a Unix type environment, SiSU 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.

30. QUICKSTART - GETTING STARTED HOWTO - -

30.1 INSTALLATION + +

30.1 INSTALLATION

Installation is currently most straightforward and tested on the Debian 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.

30.1.1 DEBIAN INSTALLATION

SiSU is available directly from the Debian Sid and testing archives (and possibly Ubuntu), assuming your /etc/apt/sources.list is set accordingly: -

+


    aptitude update
     aptitude install sisu-complete
 

The following /etc/apt/sources.list setting permits the download of additional -markup samples: -

+markup samples: +


  #/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
 
-

The aptitude commands become: -

+

The aptitude commands become: +


    aptitude update
     aptitude install sisu-complete sisu-markup-samples
@@ -2652,308 +2572,308 @@ markup samples:
 
 

they will be available by adding the following to your /etc/apt/sources.list -

+


  #/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
 
-

repeat the aptitude commands -

+

repeat the aptitude commands +


    aptitude update
     aptitude install sisu-complete sisu-markup-samples
 

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. -

30.1.2 RPM INSTALLATION +will provide basic functionality. +

30.1.2 RPM INSTALLATION

RPMs are provided though untested, they are prepared by running alien against the source -package, and against the debs. -

They may be downloaded from: +package, and against the debs. +

They may be downloaded from:

<http://www.jus.uio.no/sisu/SiSU/download.html#rpm >
- -

as root type: -

rpm -i  [rpm  package  name]
- -

30.1.3 INSTALLATION FROM SOURCE + +

as root type: +

rpm -i [rpm  package  name]
+ +

30.1.3 INSTALLATION FROM SOURCE

To install SiSU from source check information -at: +at:

<http://www.jus.uio.no/sisu/SiSU/download.html#current >
- -

* download the source package -

* Unpack the source + +

* download the source package +

* Unpack the source

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:

For basic use SiSU is only dependent on the programming language in which it is written Ruby , and SiSU 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. -

setup.rb +(postgresql or sqlite)[^23] or converting LaTeX to pdf. +

setup.rb

This is a standard ruby installer, using setup.rb is a three step process. In -the root directory of the unpacked SiSU as root type: -

+the root directory of the unpacked SiSU as root type: +


      ruby setup.rb config
       ruby setup.rb setup
       #[and  as  root:]
       ruby setup.rb install
 
-

further information on setup.rb is available from: +

further information on setup.rb is available from:

<http://i.loveruby.net/en/projects/setup/ >
- +

<http://i.loveruby.net/en/projects/setup/doc/usage.html >
- -

-

The root directory of the unpacked SiSU as root type: + +

+

The root directory of the unpacked SiSU as root type:

ruby install base
- -

or for a more complete installation: + +

or for a more complete installation:

ruby install
- -

or + +

or

ruby install base
- +

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.

Further -

information on +

information on

<http://make.rubyforge.org/ >
- +

<http://rubyforge.org/frs/?group_id=615 >
- -

For a list of alternative actions you may type: + +

For a list of alternative actions you may type:

ruby install help
- +

ruby install -T
- -

30.2 TESTING SISU, GENERATING OUTPUT + +

30.2 TESTING SISU, GENERATING OUTPUT

To check which version of sisu -is installed: -

sisu -v +is installed: +

sisu -v

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:

- -

or -

-

change directory to the appropriate one: + +

or +

+

change directory to the appropriate one:

cd /usr/share/doc/sisu/sisu_markup_samples/dfsg -

30.2.1 BASIC TEXT, PLAINTEXT, HTML, XML, ODF +

30.2.1 BASIC TEXT, PLAINTEXT, HTML, XML, ODF

Having moved to the directory that contains the markup samples (see instructions above if necessary), -

choose a file and run sisu against it +

choose a file and run sisu against it

sisu -NhwoabxXyv free_as_in_freedom.rms_and_free_software.sam_williams.sst

this will generate html including a concordance file, opendocument text format, plaintext, XHTML and various forms of XML, and OpenDocument text -

30.2.2 LATEX / PDF +

30.2.2 LATEX / PDF

Assuming a LaTeX engine such as tetex or texlive is installed with the required modules (done automatically on selection of -sisu-pdf in Debian ) +sisu-pdf in Debian )

Having moved to the directory that contains the markup samples (see instructions above if necessary), choose a file and run sisu -

against it +

against it

sisu -pv free_as_in_freedom.rms_and_free_software.sam_williams.sst -

sisu -3 free_as_in_freedom.rms_and_free_software.sam_williams.sst +

sisu -3 free_as_in_freedom.rms_and_free_software.sam_williams.sst

should generate most available output formats: html including a concordance file, opendocument text format, plaintext, XHTML and various forms of XML, and -

OpenDocument text and pdf +

OpenDocument text and pdf

30.2.3 RELATIONAL DATABASE - POSTGRESQL, SQLITE

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.

Assuming you have -

the database installed and the requisite permissions +

the database installed and the requisite permissions

sisu --sqlite --recreate

sisu --sqlite -v --import free_as_in_freedom.rms_and_free_software.sam_williams.sst -

sisu --pgsql --recreate +

sisu --pgsql --recreate

sisu --pgsql -v --import free_as_in_freedom.rms_and_free_software.sam_williams.sst -

30.3 GETTING HELP -

30.3.1 THE MAN PAGES -

Type: +

30.3 GETTING HELP +

30.3.1 THE MAN PAGES +

Type:

man sisu
- +

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:

* sisu.1 <http://www.jus.uio.no/sisu/man/sisu.1 > - [^24] +[^24]

* sisu.8 <http://www.jus.uio.no/sisu/man/sisu.8 ->  [^25] +> [^25]

* man directory <http://www.jus.uio.no/sisu/man ->  [^26] -

30.3.2 BUILT IN HELP -

sisu --help +> [^26] +

30.3.2 BUILT IN HELP +

sisu --help

sisu

-

- -

help --env -

sisu --help --commands -

sisu --help --markup -

30.3.3 THE HOME PAGE -

+

help --env +

sisu --help --commands +

sisu --help --markup +

30.3.3 THE HOME PAGE +

<http://www.jus.uio.no/sisu -> +>

<http://www.jus.uio.no/sisu/SiSU -> +>

30.4 MARKUP SAMPLES -

A number of markup samples (along with output) are available off: +

A number of markup samples (along with output) are available off:

<http://www.jus.uio.no/sisu/SiSU/examples.html > -

Additional markup samples are packaged separately in the file: -

* -

+

Additional markup samples are packaged separately in the file: +

* +

On Debian 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. -

31. EDITOR FILES, SYNTAX HIGHLIGHTING +sisu home site. +

31. EDITOR FILES, SYNTAX HIGHLIGHTING

The directory:

./data/sisu/conf/editor-syntax-etc/
- +

/usr/share/sisu/conf/editor-syntax-etc
- -

contains rudimentary sisu syntax highlighting files for: + +

contains rudimentary sisu syntax highlighting files for:

* (g)vim <http://www.vim.org -> +>

package: sisu-vim
- -

status: largely done + +

status: largely done

there is a vim syntax highlighting and folds component
- +

* gedit <http://www.gnome.org/projects/gedit -> +>

* gobby <http://gobby.0x539.de/ >

file: sisu.lang
- -

place in: + +

place in:

/usr/share/gtksourceview-1.0/language-specs
- -

or + +

or

~/.gnome2/gtksourceview-1.0/language-specs
- +

status: very basic syntax highlighting
- +

comments: this editor features display line wrap and is used by Goby!
- +

* nano <http://www.nano-editor.org -> +>

file: nanorc
- -

save as: + +

save as:

~/.nanorc
- +

status: basic syntax highlighting
- +

comments: assumes dark background; no display line-wrap; does line breaks
- +

* diakonos (an editor written in ruby) <http://purepistos.net/diakonos > -

file: diakonos.conf -

save as: +

file: diakonos.conf +

save as:

~/.diakonos/diakonos.conf
- -

includes: + +

includes:

status: basic syntax highlighting
- -

comments: assumes dark background; no display line-wrap + +

comments: assumes dark background; no display line-wrap

* kate & kwrite <http://kate.kde.org -> +>

file: sisu.xml
- +

place in:
- +

/usr/share/apps/katepart/syntax
- +

or
- +

~/.kde/share/apps/katepart/syntax
- -

 [settings::configure  kate::{highlighting,filetypes}]
- -

 [tools::highlighting::{markup,scripts}::
-  SiSU ] + +

[settings::configure  kate::{highlighting,filetypes}]
+ +

[tools::highlighting::{markup,scripts}::  .B  SiSU  ]
+

* nedit <http://www.nedit.org -> +>

file: sisu_nedit.pats
- +

nedit -import sisu_nedit.pats
- -

status: a very clumsy first attempt  [not  really  done]
- + +

status: a very clumsy first attempt [not  really  done]
+

comments: this editor features display line wrap
- +

* emacs <http://www.gnu.org/software/emacs/emacs.html -> +>

files: sisu-mode.el
- +

to file ~/.emacs add the following 2 lines:
- +

(add-to-list ’load-path
- +

(require ’sisu-mode.el)
- -

 [not  done  /  not  yet  included]
- + +

[not  done  /  not  yet  included]
+

* vim & gvim <http://www.vim.org -> +>

files:
- +

package is the most comprehensive sisu syntax highlighting and editor
environment provided to date (is for vim/ gvim, and is separate from the
contents of this directory)
- +

status: this includes: syntax highlighting; vim folds; some error checking
- +

comments: this editor features display line wrap
- -

NOTE: -

[  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] -

32. HOW DOES SISU WORK? + +

NOTE: +

[  .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] +

32. HOW DOES SISU WORK?

SiSU 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). -

33. SUMMARY OF FEATURES +create new ones). +

33. SUMMARY OF FEATURES

* 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.

* 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].

* 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. 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 browser  viewing,  paper  publication, - sql  search  etc.] (html, xml, odf, latex, pdf, sql) -

* 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: -

* html - both as a single scrollable -text and a segmented document
- +of representing documents [be  that  paper  publication,  sql  search  etc.] (html, +xml, odf, latex, pdf, sql) +

* 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: +

* html - both as a single scrollable text and a segmented document
+

* xhtml
- +

* XML - both in sax and dom style xml structures for further development as
required
- +

* ODF - open document format, the iso standard for document storage
- +

* LaTeX - used to generate pdf
- +

* pdf (via LaTeX)
- +

* sql - population of an sql database, (at the same object level that is
used to cite text within a document)
- +

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))

* 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.

* 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].

* 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 -

existing prepared texts +

existing prepared texts

* SQL search aside, documents are generated as -required and static once generated. +required and static once generated.

* 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)

* document source (plaintext utf-8) if shared on the net may be used as -

input and processed locally to produce the different document outputs +

input and processed locally to produce the different document outputs

* 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

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

* as a developers -

tool it is flexible and extensible +

tool it is flexible and extensible

Syntax highlighting for SiSU markup -is available for a number of text editors. +is available for a number of text editors.

SiSU 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 -

search of content +

search of content

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)...

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.

34. HELP SOURCES - +

For a summary of alternative ways to get help on SiSU try one of the -following: -

man page +following: +

man page

man sisu_help
- -

man2html + +

man2html

<http://www.jus.uio.no/sisu/man/sisu_help.1.html >
- -

sisu generated output - links to html + +

sisu generated output - links to html

<http://sisudoc.org/sisu/sisu_help/index.html >
- -

help sources lists + +

help sources lists

Alternative sources for this help sources page -listed here: +listed here:

man sisu_help_sources
- +

<http://sisudoc.org/sisu/sisu_help_sources/index.html >
- -

34.1 MAN PAGES -

34.1.1 MAN + +

34.1 MAN PAGES +

34.1.1 MAN

man sisu
- +

man 7 sisu_complete
- +

man 7 sisu_pdf
- +

man 7 sisu_postgresql
- +

man 7 sisu_sqlite
- +

man sisu_termsheet
- +

man sisu_webrick
- -

34.2 SISU GENERATED OUTPUT - LINKS TO HTML + +

34.2 SISU GENERATED OUTPUT - LINKS TO HTML

Note SiSU documentation is prepared in SiSU 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] -

34.2.1 WWW.SISUDOC.ORG +html pages[^28] +

34.2.1 WWW.SISUDOC.ORG

<http://sisudoc.org/sisu/sisu_manual/index.html >

<http://sisudoc.org/sisu/sisu_manual/index.html >
- +

<http://sisudoc.org/sisu/sisu_commands/index.html >
- +

<http://sisudoc.org/sisu/sisu_complete/index.html >
- +

<http://sisudoc.org/sisu/sisu_configuration/index.html >
- +

<http://sisudoc.org/sisu/sisu_description/index.html >
- +

<http://sisudoc.org/sisu/sisu_examples/index.html >
- +

<http://sisudoc.org/sisu/sisu_faq/index.html >
- +

<http://sisudoc.org/sisu/sisu_filetypes/index.html >
- +

<http://sisudoc.org/sisu/sisu_help/index.html >
- +

<http://sisudoc.org/sisu/sisu_help_sources/index.html >
- +

<http://sisudoc.org/sisu/sisu_howto/index.html >
- +

<http://sisudoc.org/sisu/sisu_introduction/index.html >
- +

<http://sisudoc.org/sisu/sisu_manual/index.html >
- +

<http://sisudoc.org/sisu/sisu_markup/index.html >
- +

<http://sisudoc.org/sisu/sisu_output_overview/index.html >
- +

<http://sisudoc.org/sisu/sisu_pdf/index.html >
- +

<http://sisudoc.org/sisu/sisu_postgresql/index.html >
- +

<http://sisudoc.org/sisu/sisu_quickstart/index.html >
- +

<http://sisudoc.org/sisu/sisu_remote/index.html >
- +

<http://sisudoc.org/sisu/sisu_search/index.html >
- +

<http://sisudoc.org/sisu/sisu_skin/index.html >
- +

<http://sisudoc.org/sisu/sisu_sqlite/index.html >
- +

<http://sisudoc.org/sisu/sisu_syntax_highlighting/index.html >
- +

<http://sisudoc.org/sisu/sisu_vim/index.html >
- +

<http://sisudoc.org/sisu/sisu_webrick/index.html >
- -

34.3 MAN2HTML -

34.3.1 LOCALLY INSTALLED + +

34.3 MAN2HTML +

34.3.1 LOCALLY INSTALLED

<file:///usr/share/doc/sisu/html/sisu.1.html> -

<file:///usr/share/doc/sisu/html/sisu_help.1.html> +

<file:///usr/share/doc/sisu/html/sisu_help.1.html>

<file:///usr/share/doc/sisu/html/sisu_help_sources.1.html>

/usr/share/doc/sisu/html/sisu.1.html
- +

/usr/share/doc/sisu/html/sisu_pdf.7.html
- +

/usr/share/doc/sisu/html/sisu_postgresql.7.html
- +

/usr/share/doc/sisu/html/sisu_sqlite.7.html
- +

/usr/share/doc/sisu/html/sisu_webrick.1.html
- -

34.3.2 WWW.JUS.UIO.NO/SISU + +

34.3.2 WWW.JUS.UIO.NO/SISU

<http://www.jus.uio.no/sisu/man/sisu.1.html -> +>

<http://www.jus.uio.no/sisu/man/sisu.1.html >
- +

<http://www.jus.uio.no/sisu/man/sisu_complete.7.html >
- +

<http://www.jus.uio.no/sisu/man/sisu_pdf.7.html >
- +

<http://www.jus.uio.no/sisu/man/sisu_postgresql.7.html >
- +

<http://www.jus.uio.no/sisu/man/sisu_sqlite.7.html >
- +

<http://www.jus.uio.no/sisu/man/sisu_webrick.1.html >
- -

DOCUMENT INFORMATION (METADATA) -

METADATA + +

DOCUMENT INFORMATION (METADATA) +

METADATA

Document Manifest @ <http://sisudoc.org/sisu_manual/sisu/sisu_manifest.html > -

Dublin Core (DC) +

Dublin Core (DC)

DC tags included with this document are provided here. -

DC Title: SiSU - Manual -

DC Creator: Ralph Amissah -

DC Rights: Copyright -(C) Ralph Amissah 2008, part of SiSU documentation, License GPL 3 -

DC -Type: information -

DC Date created: 2002-08-28 -

DC Date issued: 2002-08-28 +

DC Title: SiSU - Manual +

DC Creator: Ralph Amissah +

DC Rights: 3 +

DC Type: -

DC Date available: 2002-08-28 -

DC Date modified: 2008-05-22 +

information +

DC Date created: 2002-08-28 +

DC Date issued: 2002-08-28 +

DC +Date available: 2002-08-28 +

DC Date modified: 2008-05-22

DC Date: 2008-05-22 -

Version Information -

Sourcefile: sisu.ssm.sst +

Version Information +

Sourcefile: sisu.ssm.sst

Filetype: SiSU text insert -

0.67 -

Sourcefile Digest, MD5(sisu.ssm.sst)= 7568e6bc171256672e0820a333b37459 +

0.67 +

Sourcefile Digest, MD5(sisu.ssm.sst)= 7fbab3b7c0fd0ed2e128585c2982c5c8

Skin_Digest: MD5(skin_sisu_manual.rb)= 072b2584bedea82ea8a416587b9fa244 -

Generated -

Document (metaverse) last generated: Thu May 22 20:03:01 +

Generated +

Document (metaverse) last generated: Mon Jul 21 02:54:34

- -

0400 2008 -

Generated by: SiSU 0.66.3 of 2008w18/0 (2008-05-11) +

0400 2008 +

Generated by: SiSU 0.68.0 of 2008w29/1 (2008-07-21)

Ruby version: -ruby 1.8.6 (2008-03-03 patchlevel 114)  [i486-linux] -

+ruby 1.8.7 (2008-06-20 patchlevel 22)  [i486-linux] +

    .
  1. 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.
  2. .
  3. the different heading levels
  4. .
  5. units of text, primarily paragraphs and headings, also any tables, poems, code-blocks
  6. .
  7. Specification submitted by Adobe to -ISO to become a full open ISO specification <http://www.linux-watch.com/news/NS7542722606.html ->
    -
  8. .
  9. ISO/IEC 26300:2006 +ISO to become a full open ISO specification <http://www.linux-watch.com/news/NS7542722606.html +> +
  10. .
  11. ISO/IEC 26300:2006
    *1.
    square brackets
    @@ -3340,44 +3259,43 @@ notes, numbered asterisk footnote/endnote series
  12. .
  13. <http://www.ruby-lang.org/en/ >
  14. .
  15. Table from the Wealth of Networks by Yochai Benkler - <http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler ->
    -
  16. .
  17. .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.
  18. .
  19. .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.
  20. .
  21. <http://www.postgresql.org/ -> <http://advocacy.postgresql.org/ ->
    - <http://en.wikipedia.org/wiki/Postgresql ->
    -
  22. .
  23. <http://www.hwaci.com/sw/sqlite/ -> <http://en.wikipedia.org/wiki/Sqlite ->
    -
  24. .
  25. <http://search.sisudoc.org ->
  26. .
  27. (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.
  28. .
  29. 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. -
  30. .
  31. There is nothing to stop MySQL support being added in future.
  32. .
  33. <http://www.jus.uio.no/sisu/man/sisu.1 +<http://www.jus.uio.no/sisu/the_wealth_of_networks.yochai_benkler +>
  34. .
  35. .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.
  36. .
  37. .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.
  38. .
  39. <http://www.postgresql.org/ > -
  40. .
  41. <http://www.jus.uio.no/sisu/man/sisu.8 ->
  42. .
  43. <http://www.jus.uio.no/sisu/man ->
  44. .
  45. 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.
  46. .
  47. named index.html or more extensively - -

    through sisu_manifest.html +<http://advocacy.postgresql.org/ +> <http://en.wikipedia.org/wiki/Postgresql +>

  48. .
  49. <http://www.hwaci.com/sw/sqlite/ +> +<http://en.wikipedia.org/wiki/Sqlite +>
  50. .
  51. <http://search.sisudoc.org +>
  52. .
  53. (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. +
  54. .
  55. 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.
  56. .
  57. There is nothing to stop MySQL support +being added in future.
  58. .
  59. <http://www.jus.uio.no/sisu/man/sisu.1 +>
  60. .
  61. <http://www.jus.uio.no/sisu/man/sisu.8 +> +
  62. .
  63. <http://www.jus.uio.no/sisu/man +>
  64. .
  65. the Debian Free Software guidelines require +that everything distributed within Debian can be changed - and the documents +are authors’ works that while freely distributable are not freely changeable. +
  66. .
  67. +

    named index.html or more extensively through sisu_manifest.html

    -

    Other versions of this document:
    +
    Other versions +of this document:
    manifest: <http://www.jus.uio.no/sisu/sisu/sisu_manifest.html @@ -3408,15 +3326,15 @@ distributable are not freely changeable.
  68. .
  69. named index.html or mo
    -
    * Generated by: SiSU 0.66.3 of 2008w18/0 (2008-05-11)
    +
    * Generated by: SiSU 0.68.0 of 2008w29/1 (2008-07-21)
    * Ruby version: ruby -1.8.6 (2008-03-03 patchlevel 114) [i486-linux]
    +1.8.7 (2008-06-20 patchlevel 22) [i486-linux]
    -
    * Last Generated on: Thu May -22 20:03:01 -0400 2008
    +
    * Last Generated on: Mon Jul 21 +02:54:35 -0400 2008
    * SiSU http://www.jus.uio.no/sisu 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
    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 ~{
    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
    Depends: ruby (>=1.8.2), libwebrick-ruby
    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 ~{
    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
    Depends: ruby (>=1.8.2), libwebrick-ruby
    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 ~{
    a package that pulls in other packages to build the whole of sisu (excluding sisu-examples)
    Depends: ruby (>=1.8.2), sisu, sisu-pdf, sisu-postgresql, sisu-remote, sisu-sqlite, vim-sisu
    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 ~{
    a package that pulls in other packages to build the whole of sisu (excluding sisu-examples)
    Depends: ruby (>=1.8.2), sisu, sisu-pdf, sisu-postgresql, sisu-remote, sisu-sqlite, vim-sisu
    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 ~{
    dependencies used by sisu to produce pdf from LaTeX generated
    Depends: sisu, tetex-bin, tetex-extra, latex-ucs
    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 ~{
    dependencies used by sisu to produce pdf from LaTeX generated
    Depends: sisu, tetex-bin, tetex-extra, latex-ucs
    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 ~{
    dependencies used by sisu to populate postgresql database (further configuration is necessary)
    Depends: sisu, postgresql-8.1, libdbi-ruby, libdbm-ruby, libdbd-pg-ruby
    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 ~{
    dependencies used by sisu to populate postgresql database (further configuration is necessary)
    Depends: sisu, postgresql-8.1, libdbi-ruby, libdbm-ruby, libdbd-pg-ruby
    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 ~{
    dependencies used by sisu to populate sqlite database
    Depends: sisu, sqlite, libdbi-ruby, libdbm-ruby, libdbd-sqlite-ruby
    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 ~{
    dependencies used by sisu to populate sqlite database
    Depends: sisu, sqlite, libdbi-ruby, libdbm-ruby, libdbd-sqlite-ruby
    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 ~{
    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 \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{(?:(?:[a-zA-Z0-9"\s]){2,7}|(?:[a-zA-Z0-9"\s]){2,7}|(?: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 1fa40fb1..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,6 +60,110 @@ ** Description: system environment, resource control and configuration details =end - +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!(/ \/\//,'
    ') #added 2004w29 - para.gsub!(/
    /,'
    ') #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!(/
    /,"#{Mx[:br_line]}") #needed by xml, xhtml etc. #para.gsub!(/

    /,'

    ') #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!(//,'\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!(//,'\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" + @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$|||||<\/tr>|


    |\[endnotes\]|<:zz>|<:isbn-|<:journal-|<:conference-|/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$|||||<\/tr>|
    |\[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 --> 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 --> - 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 /^(|[-~]\{{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}: #{@md.dc_title} <~0;m#{ocnm};d#{ocnd}>" - when /^0~(?:creator|author)/ - "\n#{@tr.creator}: #{@md.dc_creator} <~0;m#{ocnm};d#{ocnd}>" - when /0~(?:translator|translated_by)/ - "\n#{@tr.translator}: #{@md.translator} <~0;m#{ocnm};d#{ocnd}>" - when /^0~(?:illustrator|illustrated_by)/ - "\n#{@tr.illustrator}: #{@md.illustrator} <~0;m#{ocnm};d#{ocnd}>" - when /^0~prepared_by/ - "\n#{@tr.prepared_by}: #{@md.prepared_by} <~0;m#{ocnm};d#{ocnd}>" - when /^0~digitized_by/ - "\n#{@tr.digitized_by}: #{@md.digitized_by} <~0;m#{ocnm};d#{ocnd}>" - when /^0~description/ - "\n#{@tr.description}: #{@md.dc_description} <~0;m#{ocnm};d#{ocnd}>" - when /^0~subject/ - "\n#{@tr.subject}: #{@md.dc_subject} <~0;m#{ocnm};d#{ocnd}>" - when /^0~abstract/ - "\n#{@tr.abstract}: #{@md.dc_abstract} <~0;m#{ocnm};d#{ocnd}>" - when /^0~publisher/ - "\n#{@tr.publisher}: #{@md.dc_publisher} <~0;m#{ocnm};d#{ocnd}>" - when /^0~contributor/ - "\n#{@tr.contributor}: #{@md.dc_contributor} <~0;m#{ocnm};d#{ocnd}>" - when /^0~date.created/ - "\n#{@tr.date_created}: #{@md.dc_date_created} <~0;m#{ocnm};d#{ocnd}>" - when /^0~date.issued/ - "\n#{@tr.date_issued}: #{@md.dc_date_issued} <~0;m#{ocnm};d#{ocnd}>" - when /^0~date.available/ - "\n#{@tr.date_available}: #{@md.dc_date_available} <~0;m#{ocnm};d#{ocnd}>" - when /^0~date.modified/ - "\n#{@tr.date_modified}: #{@md.dc_date_modified} <~0;m#{ocnm};d#{ocnd}>" - when /^0~date.valid/ - "\n#{@tr.date_valid}: #{@md.dc_date_valid} <~0;m#{ocnm};d#{ocnd}>" - when /^0~date/ - "\n#{@tr.date}: #{@md.dc_date} <~0;m#{ocnm};d#{ocnd}>" - when /^0~type/ - "\n#{@tr.type}: #{@md.dc_type} <~0;m#{ocnm};d#{ocnd}>" - when /^0~format/ - "\n#{@tr.format}: #{@md.dc_format} <~0;m#{ocnm};d#{ocnd}>" - when /^0~rights/ - "\n#{@tr.rights}: #{@md.dc_rights} <~0;m#{ocnm};d#{ocnd}>" - when /^0~identifier/ - "\n#{@tr.identifier}: #{@md.dc_identifier} <~0;m#{ocnm};d#{ocnd}>" - when /^0~source/ - "\n#{@tr.source}: #{@md.dc_source} <~0;m#{ocnm};d#{ocnd}>" - when /^0~language/ - "\n#{@tr.language}: #{@md.dc_language} <~0;m#{ocnm};d#{ocnd}>" - when /^0~language.original/ - "\n#{@tr.language_original}: #{@md.language_original} <~0;m#{ocnm};d#{ocnd}>" - when /^0~relation/ - "\n#{@tr.relation}: #{@md.dc_relation} <~0;m#{ocnm};d#{ocnd}>" - when /^0~coverage/ - "\n#{@tr.coverage}: #{@md.dc_coverage} <~0;m#{ocnm};d#{ocnd}>" - when /^0~keywords/ - "\n#{@tr.keywords}: #{@md.keywords} <~0;m#{ocnm};d#{ocnd}>" - when /^0~comments/ - "\n#{@tr.comments}: #{@md.comments} <~0;m#{ocnm};d#{ocnd}>" - when /^0~cls_loc/ - "\n#{@cls_dewey}: #{@md.cls_dewey} <~0;m#{ocnm};d#{ocnd}>" - when /^0~cls_dewey/ - "\n#{@tr.cls_dewey}: #{@md.cls_dewey} <~0;m#{ocnm};d#{ocnd}>" - when /^0~cls_gutenberg|0~cls_pg/ - "\n#{@tr.cls_gutenberg}: #{@md.cls_gutenberg} <~0;m#{ocnm};d#{ocnd}>" - #"\n#{@tr.cls_gutenberg}: #{@md.cls_pg} <~0;m#{ocnm};d#{ocnd}>" - when /^0~cls_isbn/ - "\n#{@tr.cls_isbn}: #{@md.cls_isbn} <~0;m#{ocnm};d#{ocnd}>" - when /^0~prefix(?:_a)?/ - "\n#{@tr.prefix_a}: #{@md.prefix_a} <~0;m#{ocnm};d#{ocnd}>" - when /^0~prefix_b/ - "\n#{@tr.prefix_b}: #{@md.prefix_b} <~0;m#{ocnm};d#{ocnd}>" - else para.gsub(/^0~(#{m})\s+(.+)/m,"\n#{m.capitalize}: \\2 <~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}: #{@md.cls_pg} #{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}: #{@md.sc_number} <~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}: #{@md.sc_date} <~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: #{@md.sc_time} <~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}: #{@md.sc_filename} <~0;m#{ocnm};v#{ocnv}>" - else @rc << "#{@tr.sourcefile}: #{@md.fns} <~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: #{@md.file_encoding} <~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]} #{@md.dgst[1]} <~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]} #{@md.dgst_skin[1]} <~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 << "Generated #{head_no_rc}" if @rc.length > 0 - @rc << "#{@tr.last_generated}: #{Time.now} <~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}: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} 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}: #{@md.ruby_version} <~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 << "Dublin Core (DC) #{head_no_dc}" if @dc.length > 0 - meta << "DC tags included with this document are provided here. #{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 << "Version Information #{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 << "Note the version information provided here, is specific to the host site. #{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" + 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> 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>/,'DELETED(\1)') # deletions s=s.gsub(/(\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|||||<\/tr>|
    |\[endnotes\]|<:zz>|<:isbn-|<:journal-|<:conference-|/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|||||<\/tr>|
    |\[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=~//; 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 =~//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; ]*\}/ - "" + "#{Mx[:gr_o]}Th#{Mx[:tc_p]} c#{@row[2].length}; #{widths}#{Mx[:gr_c]}" elsif para =~/\{(?:t|table)(?:\sc\d+;)?[\d; ]*\}/ - "" + "#{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 << '' + table << Mx[:tc_o] #'' n= -1 l.each do |c| n +=1 #'' + c + '' 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 << '!>' #'' + table << Mx[:tc_c] tuned_file << table.join end end - tuned_file << '' #'' + tuned_file << "#{Mx[:gr_o]}TZ#{Mx[:gr_c]}" #'' 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+?;.+?)$/,"") - para.gsub!(/^table\{\s+(c\d+?;.+?)$/,"") + 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*$/,"\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,'') unless para =~// + 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)>|)/ + 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 =~/|<: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.+?(?:
    |\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],'\1') + 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,'\1') + 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+(.+?)(
    )/,'\1\2') - given.gsub!(/(?:^!_|^[7-9]~)\s+(.+?)\s+((?:[*]~\S+\s*)+)/,'\1 \2') - given.gsub!(/(?:^!_|^[7-9]~)\s+(.+?)\s*([~-]#)$/,'\1 \2') - given.gsub!(/(?:^!_\s+|^[7-9]~\s+)(.*)?\s*$/,'\1') + given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)(
    )/,"#{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],'\1') + 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,'\1') + 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},
    \\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},
    \\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!(//,'<:\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!(/\\\|/,'|') #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]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{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 - line.gsub!(/^([56]~)(\S+)(.+)/,'\1\2 \3 <:name#\2>') #html name marker , 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>/,'
    ') #xml requires - # depreciated --> - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)e\{(.+?)\}e/,'\1\2') #emphasis - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)b\{(.+?)\}b/,'\1\2') #bold - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)u\{(.+?)\}u/,'\1\2') #underscore - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)c\{(.+?)\}c/,'\1\2') #cite /blockquote? - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)i\{(.+?)\}i/,'\1\2') #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 + line.gsub!(/^(#{Mx[:lv_o]}[56]:(\S+?)#{Mx[:lv_c]})\s*(.+)/,"\\1 \\3 #{Mx[:mk_o]}:name#\\2#{Mx[:mk_c]}") #html name marker , 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>|
    )/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
    |
    )\s*_([12])\s+/,'
    <: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!(/(?:
    |
    )\s*_([12])\s+/,'
    <: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\2') #emphasis - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)\*\{(.+?)\}\*/,'\1\2') #bold - line.gsub!(/(^|\s+|['"]| |[\(\[\{]|\>)_\{(.+?)\}_/,'\1\2') #underscore - line.gsub!(/(^|\s+|['"]| |[\(\[]|\(|\>)\/\{(.+?)\}\//,'\1\2') #italics - line.gsub!(/(^|\s+|['"]| |\(|\>)\"\{(.+?)\}\"/,'\1\2') #cite /blockquote? - line.gsub!(/(^|[^\\])\^\{(.+?)\}\^/,'\1\2') #superscript - line.gsub!(/(^|\s+|['"]| |\(|\>|\S)9\{(.+?)\}9/,'\1\2') #superscript - line.gsub!(/(^|[^\\]),\{(.+?)\},/,'\1\2') #subscript - line.gsub!(/(^|\s+|['"]| |\(|\>)6\{(.+?)\}6/,'\1\2') #subscript - line.gsub!(/(^|\s+|['"]| |\(|\>)\+\{(.+?)\}\+/,'\1\2') #inserted text - line.gsub!(/(^|\s+|['"]| |\(|\>)v\{(.+?)\}v/,'\1\2') #inserted text - line.gsub!(/(^|\s+|['"]| |\(|\>)-\{(.+?)\}-/,'\1\2') #strikethrough - deleted text - line.gsub!(/(^|\s+|['"]| |\(|\>)x\{(.+?)\}x/,'\1\2') #deleted text - line.gsub!(/(^|\s+|['"]| |\(|\>)\*(\S+?)\*/,'\1\2') #bold single word, watch - line.gsub!(/(^|\s+|['"]| |\(|\>)\!(\S+?)\!/,'\1\2') #bold single word, watch - line.gsub!(/(^|\s+|['"]| |\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([^a-zA-Z0-9]|[ ,.;:'"~$]|$)/,'\1\2\3') #italics single word, watch - line.gsub!(/(^|\s+|['"]| |\(|\>)_(\S+?)_([.,!'")]?(?:\s|$))/,'\1\2\3') #underscore single word, watch (made more complicated by url decoration escape tag (_url)) - line.gsub!(/(^|\s+)-([^{]\S+?)-( |$)/,'\1\2\3') #underscore single word, watch - line.gsub!(/(^|\s+|['"]| |\(|\>|\d+)\^(\S+?)\^/,'\1\2') #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!(/(?:
    |
    )\s*_[12]\s+/,'
    ') #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
    |
    )\s*_([12])\s+/,'
    <:i\1> ') - line.gsub!(/<:?br>/,'
    ') #adjustment 2004w41, from # line.gsub!(/
    /,'
    ') + 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>|
    )/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
    |
    )\s*_([12])\s+/,'
    <:i\1> ') ##added #line.gsub!(/(?:^!_\s+|^[7-9]~\s+|<:b>)(.*)?([~-]#)$/i,'\1 \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,'\1') #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,'\1 ') #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,'\1') #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,'\1 ') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! #line.gsub!(/^_" (.*)\n/i,'
    \1
    ') #blockquotes #introduce KEEP - line.gsub!(/<:hi>/,'') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) - line.gsub!(/<:\/hi>/,'') - line.gsub!(/(<:verse>.+)/m,"\\1\n") + line.gsub!(/<:hi>/,"#{Mx[:fa_hilite_o]}") #'') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) + line.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'') + #line.gsub!(/<:hi>/, + #line.gsub!(/<:\/hi>/,'') + 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!(/(
    )/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!(/
    /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

    back, clumsy - line.gsub!(/(^|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert

    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

    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 puts 'tech' @data.each do |line| - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)e\{(.+?)\}e/,'\1\2') #emphasis - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)b\{(.+?)\}b/,'\1\2') #bold - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)u\{(.+?)\}u/,'\1\2') #underscore - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)c\{(.+?)\}c/,'\1\2') #cite - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)i\{(.+?)\}i/,'\1\2') #italics - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)!\{(.+?)\}!/,'\1\2') #emphasis - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)\*\{(.+?)\}\*/,'\1\2') #bold - line.gsub!(/(^|\s+|['"]|[\(\[]|\>)_\{(.+?)\}_/,'\1\2') #underscore - line.gsub!(/(^|\s+|['"]|[\(\[]|\(|\>)\/\{(.+?)\}\//,'\1\2') #italics - line.gsub!(/(^|\s+|['"]|\(|\>)\"\{(.+?)\}\"/,'\1\2') - line.gsub!(/(^|\s+|['"]|\(|\>|\S)\^\{(.+?)\}\^/,'\1\2') - line.gsub!(/(^|\s+|['"]|\(|\>|\S)9\{(.+?)\}9/,'\1\2') - line.gsub!(/(^|\s+|['"]|\(|\>),\{(.+?)\},/,'\1\2') - line.gsub!(/(^|\s+|['"]|\(|\>)6\{(.+?)\}6/,'\1\2') - line.gsub!(/(^|\s+|['"]|\(|\>)\+\{(.+?)\}\+/,'\1\2') - line.gsub!(/(^|\s+|['"]|\(|\>)v\{(.+?)\}v/,'\1\2') - line.gsub!(/(^|\s+|['"]|\(|\>)-\{(.+?)\}-/,'\1\2') - line.gsub!(/(^|\s+|['"]|\(|\>)x\{(.+?)\}x/,'\1\2') - line.gsub!(/(^|\s+|['"]|\(|\>)\*(\S+?)\*/,'\1\2') #bold single word, watch - line.gsub!(/(^|\s+|['"]|\(|\>)\!(\S+?)\!/,'\1\2') #bold single word, watch - line.gsub!(/(^|\s+|['"]|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/,'\1\2\3') #italics single word, watch - line.gsub!(/(^|\s+|['"]|\(|\>)_(\S+?)_/,'\1\2') #underscore single word, watch - line.gsub!(/(^|\s+|['"]|\(|\>|\d+)\^(\S+?)\^/,'\1\2') #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>/,'
    ') + 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>|
    )\s*_[12]\s+/,"#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
    |
    )\s*_([12])\s+/,'
    <: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>/,"
    \n") - string.gsub!(/<:(?:code|alt|group|verse)(?:-end)?>/,'') - string.gsub!(/<:name#\S+?>/,'') + string.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"
    \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!(/(\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!(//u,"[TABLE]\n") #tables - string.gsub!(//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>/,'\1') # remove bold, italics, underscore - data.gsub!(/(.+?)<\/i>/,'\1') # remove bold, italics, underscore - data.gsub!(/(.+?)<\/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=~// #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+).+?\}~/,%{\\1}) - @txt.gsub!(/~\[([*]\d+).+?\]~/,%{\\1}) - @txt.gsub!(/~\[([+]\d+).+?\]~/,%{\\1}) + @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,%{\\1}) + @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,%{\\1}) + @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,%{\\1}) else - @txt.gsub!(/~\{(\d+).+?\}~/,'\1') - @txt.gsub!(/~\[([*]\d+).+?\]~/,'\1') - @txt.gsub!(/~\[([+]\d+).+?\]~/,'\1') + @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,'\1') + @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,'\1') + @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,'\1') 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 5ea3de65..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 %{ } 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]}/,'\1') + para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') + para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + 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*([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}.+?/ #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 / - if pg =~/~[{\[][\d*+]+ / - 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*+]+ <#@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>/ @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!(/  [\d*+]+<\/sup> <\/a>\s+~[{\[].+?[}\]]~/m,'') #remove endnotes from toc + para_toc.gsub!(/  [\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/ %{#{linkname}} else linkname end else @@toc[:scr] << '
    ' - 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 %{#{linkname}} 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>(.*)/,'\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*(.+?)$/, %{ \\2 }) - @@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+)(.*)/, %{<#@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='

    ' - 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 %{

    -


    } #revisit +
    +

    } #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]/; %{} #consider: h_#{headname} else %{} @@ -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+)\)/,'(\1)') - @one.gsub!(/^(<:i[1-9]>)\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1(\2)') - 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(\2)') + when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\(?(\d|[a-z])+\)/ @one.gsub!(/^\((\d+|[a-z])+\)/,'(\1)') - @one.gsub!(/^(<:i[1-9]>)\s*\((\d+|[a-z])+\)/,'\1(\2)') + @one.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1(\2)') when /^\s*\d{1,3}\.\s/ @one.gsub!(/^\s*(\d+\.)/,'\1') when /^\s*[A-Z]\.\s/ @@ -1069,7 +1070,7 @@ WOK def bold_header @one.gsub!(/[1-9]~(\S+)/,'') @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 %{

    #@one

    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!(/ \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') end - if para =~/^\d~metadata\s+Metadata/ + if para =~/^#{Mx[:lv_o]}\d:metadata#{Mx[:lv_c]}\s*Metadata/ para.gsub!(/(Metadata)/,'\1') 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~||)/ - 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 =~/<#@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,'
    Note') 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,'
    Owner Details') @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 =~/^|^/ + or para =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ if newfile == 1 \ - or para =~/^|^/ + or para =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ newfile=0 - if para =~/^4~\S+/ \ - or para =~/^|^/ # @@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[/.+?.*/]; @@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 =~//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 !~/^/ + 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 =~/^/ + 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 =~/¡|/,%{" 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 #?? workpoint if para =~/ / #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>/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*+]+ / # endnote- + if para =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ /) 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('
    ') #% 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[//,1] @@tablefoot << m if m @parablock.gsub!(//,'') - @@tablehead=1 if @parablock =~//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 =~// + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - if @parablock =~//; @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 =~// - @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 =~// - @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
    #\2. ') + para.gsub!(/#{Mx[:lv_o]}\d:(\S?)#{Mx[:lv_c]}/,'\0#\1. ') @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]}/,'
    ') + para.gsub!(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'


    ') # else clean '' + 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_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1') + para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_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') + para.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') + 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+?)>/,'') + #para.gsub!(/#{Mx[:mk_o]}name#(\S+?)#{Mx[:mk_c]}/,'') para.gsub!(/<-#>/,'') - para.gsub!(/<:p[bn]>/,'') - para.gsub!(/<(p|br)>/,'<\1 />') - para.gsub!(/<: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+!>/, %{\\1}) @@ -308,11 +314,11 @@ module SiSU_Tune %{}) 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,%{©}) 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}?)>/,'to { \1 } ') if para =~/\b\S+\@\S+?\.\S+/ \ and para !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/ - para.gsub!(/\b(\S+\@\S+?\.\S+)(\s)/,'<\1>\2') + para.gsub!(/([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,'<\1>') end para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2') #http ftp matches escaped, no decoration para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2\3') #special case \{ e.g. \}http://url - para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}\\2#{@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}\\2#{@url_brace.xml_close}\\3}) #http ftp matches with decoration if para =~/..\/\S+/ \ and para !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ para.gsub!(/(\.\.\/\S+)/,'\1') @@ -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]})/, '  \2  ' + #note- endnote- '\1\2  \2. \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]})/, '  \2  ' + #note- endnote- '\1\2  \2. \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]})/, '  \2  ' + #note- endnote- '\1\2  \2 \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='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='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='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='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='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='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='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='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='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='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='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='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 ).+?<~(\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 \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
    appropriately within manpage, consider n=n.dup.to_s - if n =~// - fix = n.split(//) #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, </ + 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!(//,'') # remove dummy headings (used by html) #check - para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down - para.gsub!(/(.+?)<\/sup>/,'^\1^') - para.gsub!(/(.+?)<\/sub>/,'[\1]') - para.gsub!(/(.+?)<\/i>/,'<:br>.I \1<:br>') - para.gsub!(/\A(.+?)<\/b>
    /m,'<:br>.BI \1<:br>') - para.gsub!(/(.+?)<\/b>/,'<:br>.B \1<:br>') - para.gsub!(/(.+?)<\/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!(//,"\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!(//,"\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>|)/,'\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>/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~||)/ + 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('
    MetaData') #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('
    Owner Details') #@@manpage[:owner_details]=formatMono.bold_para #para='' - 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 ).+?<~(\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 \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
    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|$))/, - %{\\1\\2}) #http ftp matches escaped, no decoration + '\1\2') #http ftp matches escaped, no decoration para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, '\1\2\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}\\2#{@url_brace.xml_close}\\3}) #http ftp matches with decoration #para.gsub!(/\b((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, also works #%{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}\\2}) #http ftp matches with decoration para.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, %{#{@url_brace.xml_open}\\1#{@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,'') %{#{para}} else %{#{para}} 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!(/
    <:i[1-9]>/,'
    ') - if para =~/~\{\d+\s+/ - para=para.gsub(/~\{(\d+)\s+(.+?)\}~/,'\1 \2') + if para =~/#{Mx[:en_a_o]}\d+\s+/ + para=para.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,'\1 \2') 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+(.+?)\]~/,%{\\1 \\2}) + para=para.gsub(/#{Mx[:en_b_o]}(#{a})\s+(.+?)#{Mx[:en_b_c]}/,%{\\1 \\2}) @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+(.+?)\}~/,%{\\1 \\2}) + para=para.gsub(/#{Mx[:en_a_o]}(#{a})\s+(.+?)#{Mx[:en_a_c]}/,%{\\1 \\2}) @astx+=1 end end @@ -358,15 +310,16 @@ module SiSU_ODF para.gsub!(/&nbsp;| /,' ') para.gsub!(//,'>') para.gsub!(/<(text:span text:style-name="T[1-5]"|\/text:span)>/,'<\1>') #works, not ideal + para.gsub!(/#{Mx[:br_line]}/,'
    ') para.gsub!(/<br(?:\s+\/)?>/,'
    ') #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 << %{#{parablock}} 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,'') 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*$/,'
    ') parablock.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, - %{\\1\\2}) #http ftp matches escaped, no decoration + '\1\2') #http ftp matches escaped, no decoration parray << %{#{parablock}} if parablock =~/\S+/ end para=parray.join + '' para end def table(para) # - if para =~// + 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 =~ /<\-_&!@%~#\]\[*=$| \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>') end - para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1 ') # bullet_09.png + para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_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[: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 ') # bullet_09.png #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1 ') #bullet #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1● ') # bullet utf8, make smaller if used #para.gsub!(/^_\*\s+/,' ') #bullet - para.gsub!(/^(<:i[1-9]>)\s+_\*\s+/,'\1 · ') #bullet - para.gsub!(/<:?br>/,'
    ') - para.gsub!(/<:p[bn]>/,' ') + para.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})\s*#{Mx[:gl_bullet]}/,'\1 · ') #bullet + para.gsub!(/^#{Mx[:gl_bullet]}/,'· ') #bullet + para.gsub!(/#{Mx[:br_line]}/,'
    ') + para.gsub!(/#{Mx[:br_page]}|#{Mx[:br_page_new]}/,' ') para.gsub!(/©/,'©') #too arbitrary para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check - para.gsub!(/(.+?)<\/b>/,'\1') - para.gsub!(/(.+?)<\/i>/,'\1') - para.gsub!(/(.+?)<\/u>/,'\1') - para.gsub!(/(.+?)<\/sup>/,'\1') - para.gsub!(/(.+?)<\/sub>/,'\1') + 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_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1') + para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1') 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>/,'\1') - para.gsub!(/<:name#\S+?>/,'') # remove name links + para.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links # para.gsub!(/(.+?)<\/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~||)/ + 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 #yyyy-mm-ddT00:00:00#{ocn} #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 %{#@br} + %{#@br} + %{#@br} + # P1 - %{#@br} + %{#@br} + %{#@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 =~/^<#@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[//,1] @@tablefoot << m if m @parablock.gsub!(//,'') - @@tablehead=1 if @parablock =~//u; @parablock=table_head(@@table_counter,$1,true) - elsif @parablock =~//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 =~// + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - if @parablock =~//; @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 =~// - @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 =~// - @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*[] } @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 ).+?<~(\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 \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
    appropriately within plaintext, consider n=n.dup.to_s - if n =~// - fix = n.split(//) #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!(//,'') # remove dummy headings (used by html) #check - para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down - para.gsub!(/(.+?)<\/sup>/,'^\1^') - para.gsub!(/(.+?)<\/sub>/,'[\1]') - para.gsub!(/(.+?)<\/i>/,'/\1/') - para.gsub!(/(.+?)<\/b>/,'*\1*') - para.gsub!(/(.+?)<\/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!(//,"\n") # watch - para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,'') - else para.gsub!(//,"\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>/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~||)/ + 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('
    MetaData') #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('
    Owner Details') #@plaintext[:owner_details]=formatMono.bold_para #para='' - elsif para =~/(¡|(.*)/ one,two=$1,$2 format_text=Format_text_object.new(one,two) @@ -446,7 +405,7 @@ WOK para='' if (para =~// \ and para =~/^(-\{{2}~\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/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|$))/,'\1\2') #http ftp matches escaped, no decoration para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2\3') #special case \{ e.g. \}http://url - para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}\\2#{@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}\\2#{@url_brace.xml_close}\\3}) #http ftp matches with decoration else para.gsub!(/(^|[^}])_/m,'\1>') #code-block: angle brackets special characters para.gsub!(/(^|[^}])_/m,'\1>') @@ -175,13 +176,9 @@ GSUB @content=markup(@content) %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} end - def indent1 + def indent(t) @content=markup(@content) - %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} - end - def indent2 - @content=markup(@content) - %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} + %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} end def para_table %{

    } @@ -195,40 +192,40 @@ GSUB m=parablock[//,1] @@tablefoot</,'') - @@tablehead=1 if parablock =~//, + @@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]}/, #%{

    \n} + %{}) - if parablock =~// + if parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << %{

    #{x}

    \n}} @@tablefoot=[] - parablock.gsub!(//, + parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/, %{#{@vz.table_close}\n}) # + #%{#{tablefoot}}) end if @@tablehead == 1 - if parablock =~/¡¡/u - parablock.gsub!(/} + %{\n') - @@tablehead=0 #if parablock =~/!>/ + parablock.gsub!(/#{Mx[:tc_c]}/, '') + @@tablehead=0 end parablock else - parablock.gsub!(/} + %{\n') + parablock.gsub!(/#{Mx[:tc_c]}/, '') 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: 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]}/,'
    ') + 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]}/,'\1') #reinstate + 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_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1') + para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_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') + 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]}/,'\1') + para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') + para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') + para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
    ') + 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+)/, %{[\\1] \\4}) para.gsub!(/(?:^|[^_\\])\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/, %{\\1}) - para.gsub!(/(^|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, + para.gsub!(/(^|#{Mx[:gl_c]}|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, '\1\2\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}\\2#{@url_brace.xml_close}\\3}) para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, '\1\2') #escaped urls not linked, deal with later @@ -429,7 +404,7 @@ module SiSU_XML_munge para.gsub!(//,'
    ') 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)/, "#{@dir.url.images_local}\/\\1") @@ -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)/, "#{@dir.url.images_local}\/\\1") @@ -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" @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>/,'DELETED(\1)') # deletions s=s.gsub(/(\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+(.+?)\]~/, '\1\2 ') end - def xml_markup(para='') + def xml_clean(para='') para.gsub!(/~\[([*+])\s+(.+?)\]~/, '\1\2 ') para.gsub!(/~\{([*+]+)\s+(.+?)\}~/, '\1\2 ') para.gsub!(/~\{(.+?)\}~/, '\1 ') + 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!(//,'>') - code_structure(para) + para=code_structure(para) elsif para =~/} << "\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,'
    MetaData') 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,'
    Owner Details') @@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!(/_\{(.+?)\}_/,'\1') para.gsub!(/-\{(.+?)\}-/,'\1') # 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 697a7a77..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!(/~\{(.+?)\}~/,'\1 ') - para.gsub!(/~\[([*+])\s+(.+?)\]~/,'\2 ') + para.gsub!(/#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/,'\1 ') + para.gsub!(/#{Mx[:en_b_o]}([*+])\s+(.+?)#{Mx[:en_b_c]}/,'\2 ') end def xml_head(meta) txt=meta.text - txt.gsub!(/\/{(.+?)}\//,'\1') - txt.gsub!(/[*!]{(.+?)}[*!]/,'\1') - txt.gsub!(/_{(.+?)}_/,'\1') - txt.gsub!(/-{(.+?)}-/,'\1') - txt.gsub!(//,'
    ') + txt.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') + txt.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') + txt.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + txt.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') + txt.gsub!(/#{Mx[:br_line]}|#{Mx[:br_paragraph]}/,'
    ') txt.gsub!(/ & /,' and ') @@xml[:head] <<< @@ -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}" << "\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]}/,'\1') + # para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') + # para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + # para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') + # para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_paragraph]}/,'
    ') + # if @rcdc==false \ + # and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) + # if para !~/(^0~|^@\S+?:|^\s*$||)/ + # @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 =~/|)/ - @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 =~/\1') + para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') + para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') + para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') + para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_paragraph]}/,'
    ') 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 =~//,'') 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}\n#{@tab*2}#{wrapped}\n#{@tab*1}\n} << "\n" elsif wrapped =~/\A%%?\s+/; %{\n} # comments - else %{#{@tab*1}\n#{@tab*2}#{wrapped}\n#{@tab*1}\n} # main text, contents, body KEEP + else %{#{@tab*1}\n#{@tab*2}#{wrapped}\n#{@tab*1}\n} # main text, contents, body KEEP end #@@xml[:body] << "#{@tab*1}\n#{@tab*2}#{wrapped}\n#{@tab*1}\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*$||)/ @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!(//,'>') - code_structure(para) + para=code_structure(para) + #elsif para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block #work area 2005w13 elsif para =~//,'') 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 =~ //,'') - 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 =~ /@\}\\~/m,' @footnote{ \1} ') - elsif para =~ /\\~@\{\*+\s+/ #if para =~ /@\}\\~/m,' @footnote{ \1} ') + if para =~ /#{Mx[:en_a_o]}\d+\s+/ #if para =~ // + 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 =~ /¡|\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*/ \ and para !~ /<:\d-endnotes>/ header=para[//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 !~ // - 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!(//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!(/&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[//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 =~ //u,"#{@@start_table}") + @para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") end - if @para =~// - @para.gsub!(//," #@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!(//,1] @para.gsub!(/\/,'') - @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[//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!(//u,"#{@@start_table}") + @para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") end - if @para =~// - @para.gsub!(//,"#@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 =~//] @para.gsub!(/\/,'') 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 =~/\\\}\\~/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 =~/¡|/ \ + 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 <<< 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!(/(
    |
    |

    |

    )/,'') + 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\}|/ #catch - 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 + 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 - 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 ab4c7fe2..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 -< 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[//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 =~/ 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!(//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 =~// - @string.gsub!(//," #@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!(//,1] @string.gsub!(/\/,'') - @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[//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 =~/\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!(//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 =~// - @string.gsub!(//," #@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!(//,1] @string.gsub!(/\/,'') - @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[//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!(//u,"#@start_table}") + @string.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#@start_table}") end - if @string =~// - @string.gsub!(//,"#@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 =~//,1] @string.gsub!(/\/,'') 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~|%+ |') 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 '' + 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!(/#{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 - string.gsub!(/<~\d+;(?:\w|[0-6]:)\d+;[umdv]\d+><#@dp:#@dp>/,'') - string.gsub!(/.+?<-#>/,'') - string.gsub!(//,'') - string.gsub!(//,'') - #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!(/&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!(//,' ') - 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 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}{>}}') - end - string.gsub!(/<:ee>/,'') - string.gsub!(//,' ') - #proposed change, insert, but may be redundant - string.gsub!(/ \/><:i[12]>(.+?)(?:\}~||<\/\s*(br|p)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") # Work Area - string.gsub!(/(.+?)<\/b>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/(.+?)<\/em>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/<(bold|strong)>(.+?)<\/(bold|strong)>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/(.+?)<\/i>/,'\emph{\1}') - string.gsub!(/(.+?)<\/italic>/,'\emph{\1}') - string.gsub!(/(.+?)<\/u>/,'\uline{\1}') # ulem - string.gsub!(/(.+?)<\/cite>/,"``\\1''") # quote - string.gsub!(/(.+?)<\/ins>/,'\uline{\1}') # ulem - string.gsub!(/(.+?)<\/del>/,'\sout{\1}') # ulem - string.gsub!(/(.+?)<\/sub>/,"\$_{\\textrm{\\1}}\$") - string.gsub!(/(.+?)<\/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>)/,'') - string.gsub!(/\s*(\S+?)<\/sup>/,'^\1') - string.gsub!(/(|<\/sup>)/,'') - string - end - def pdftex_special_characters_3(string) - string.gsub!(/])/,'\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~|%+ |') 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!(//,'') - string.gsub!(//,'') - #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!(/&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!(//,' ') - 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 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}{>}}') - end - string.gsub!(/<:ee>/,'') - string.gsub!(//,' ') - #proposed change, insert, but may be redundant - string.gsub!(/ \/><:i[12]>(.+?)(?:\}~||<\/\s*(br|p)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") # Work Area - string.gsub!(/(.+?)<\/b>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/(.+?)<\/em>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/<(bold|strong)>(.+?)<\/(bold|strong)>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}') - string.gsub!(/(.+?)<\/i>/,'\emph{\1}') - string.gsub!(/(.+?)<\/italic>/,'\emph{\1}') - string.gsub!(/(.+?)<\/u>/,'\uline{\1}') # ulem - string.gsub!(/(.+?)<\/cite>/,"``\\1''") # quote - string.gsub!(/(.+?)<\/ins>/,'\uline{\1}') # ulem - string.gsub!(/(.+?)<\/del>/,'\sout{\1}') # ulem - string.gsub!(/(.+?)<\/sub>/,"\$_{\\textrm{\\1}}\$") - string.gsub!(/(.+?)<\/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>)/,'') - string.gsub!(/\s*(\S+?)<\/sup>/,'^\1') - string.gsub!(/(|<\/sup>)/,'') - string - end - def xetex_special_characters_3(string) - string.gsub!(/])/,'\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) - 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+/,'') - 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} -\\addcontentsline{toc}{section}{#{cont_ln}} -\\markboth{#{title}}\n") if (para !~/#{lev}#{@@tilde}/) - para.gsub!(/^#{lev}#{@@tilde}\s*(.*)\n?$/m, - "\\part*{\\1} -\\addcontentsline{toc}{section}{#{cont_ln}} -\\markboth{#{title}}\n") + 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 !~/#{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 @@ -1231,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 @@ -1245,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' @@ -1255,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/ @@ -1264,7 +764,7 @@ WOK end end def tex_head_pdftex_dvi - color=case @string + color=case @layout when /portrait/ <') + #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!(/&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!(//,' ') + 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 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}{>}}') + end + string.gsub!(/<:ee>/,'') + string.gsub!(//,' ') + #proposed change, insert, but may be redundant + string.gsub!(/ \/>#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~||<\/\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>/,'\begin{bfseries}\1 \end{bfseries}') + #string.gsub!(/<(bold|strong)>(.+?)<\/(bold|strong)>/,'\begin{bfseries}\1 \end{bfseries}') + string.gsub!(/(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}') + string.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}') + #string.gsub!(/(.+?)<\/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>)/,'') + 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>)/,'') + string + end + def pdftex_special_characters_3(string) + string.gsub!(/])/,'\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!(//,'') + #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!(/&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!(//,' ') + 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 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}{>}}') + end + string.gsub!(/<:ee>/,'') + string.gsub!(//,' ') + #proposed change, insert, but may be redundant + string.gsub!(/ \/>#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~||<\/\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>/,'\begin{bfseries}\1 \end{bfseries}') + #string.gsub!(/<(bold|strong)>(.+?)<\/(bold|strong)>/,'\begin{bfseries}\1 \end{bfseries}') + string.gsub!(/(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}') + string.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}') + #string.gsub!(/(.+?)<\/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>)/,'') + 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>)/,'') + string + end + def xetex_special_characters_3(string) + string.gsub!(/])/,'\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 +<).+?<~(\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>[}\]]~/,'\1') # 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]})/,'\1') # 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!(//,'') # 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>/,'_\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>/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~||)/ + 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('
    MetaData') #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('
    Owner Details') #@@wiki[:owner_details]=formatMono.bold_para #para='' - 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]}/, '\1\2 ') - 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]}/, '\1\2 ') - para.gsub!(/~\{([*+]+)\s+(.+?)\s*<#@dp>\}~/, + para.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/, '\1\2 ') 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!(//,'') + 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>[}\]]~/,'\1') #footnote/endnote clean + para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,'\1') #footnote/endnote clean + para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,'\1') #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]}/,'\1') #footnote/endnote clean + para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,'\1') #footnote/endnote clean @@xml[:body] << %{#{@tab*0}} << "\n" @@xml[:body] << %{#{@tab*1}#{ocn}} << "\n" @@xml[:body] << %{#{@tab*1}#{@tab*1}\n} @@ -229,7 +232,7 @@ WOK @@xml[:body] << "#{@tab*0}" << "\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}} << "\n" @@ -240,7 +243,7 @@ WOK @@xml[:body] << "#{@tab*0}" << "\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~||)/ - 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 =~/ )?_\*/ + 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}#{para[@regx,2]}\n" if para[@regx,2] # main text, contents, body KEEP #@@xml[:body] << "#{@tab*6}" << "\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,'
    MetaData') 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,'
    Owner Details') @@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 =~// \ - and para =~/^(-\{{2}~\d+|)/) # -endnote + if para =~// \ + and para =~/^(-\{{2}~\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]}/, '\1\2 ') - 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]}/, '\1\2 ') - para.gsub!(/~\{([*+]+)\s+(.+?)\s*<#@dp>\}~/, + para.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/, '\1\2 ') 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!(//,'') + 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>[}\]]~/,'\1') #footnote/endnote clean + para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,'\1') #footnote/endnote clean + para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,'\1') #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>[}\]]~/,'\1') #footnote/endnote clean + para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/,'\1') #footnote/endnote clean + para.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_b_c]}/,'\1') #footnote/endnote clean para=@trans.markup_group(para) para.strip! @@xml[:body] << %{#{@tab*0}} << "\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}" << "\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~||)/ - 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 =~/ )?_\*/ #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}" << "\n" if para[@regx] - #@@xml[:body] << "#{@tab*7}#{para[@regx,3]}" << "\n" if para[@regx,3] - #@@xml[:body] << "#{@tab*7}#{para[@regx,2]}\n" if para[@regx,2] # main text, contents, body KEEP - #@@xml[:body] << "#{@tab*6}" << "\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,'
    MetaData') 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,'
    Owner Details') @@xml[:owner_details]=format_scroll.bold_para para='' @@ -379,8 +378,8 @@ WOK and para =~/^(-\{{2}~\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]}/, '\1\2 ') - 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]}/, '\1\2 ') - para.gsub!(/~\{([*+]+)\s+(.+?)\s*<#@dp>\}~/, + para.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/, '\1\2 ') end def xml_head(meta) txt=meta.text - txt.gsub!(//,'') + 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, '\1\2 ') para.strip! @@xml[:body] << %{#{@tab*6}} << "\n" @@ -314,7 +314,7 @@ WOK @@xml[:body] << "#{@tab*6}" << "\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}} << "\n" @@ -325,7 +325,7 @@ WOK @@xml[:body] << "#{@tab*6}" << "\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~||)/ - 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 =~/ )?_\*/ + 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}" << "\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('
    Note') #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,'
    MetaData') 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,'
    Owner Details') @@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?; "

    #{para}

    " else "<#{type}>

    #{para}

    " @@ -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=%{} 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[//,1] @@tablefoot << m if m @parablock.gsub!(//,'') - @@tablehead=1 if @parablock =~//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
    } + %{#{para_table}}) - parablock.gsub!(/¡¡(\d+?)¡/u, + parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{} + %{#{para_table}}) - parablock.gsub!(/!>/, '
    } + %{#{para_table}}) - parablock.gsub!(/¡¡(\d+?)¡/u, + parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{} + %{#{para_table}}) - parablock.gsub!(/!>/, '
    }) end - if @parablock =~// + 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!(/\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>/,"
    \n") # + - @parablock.gsub!(/\s*/,"
    \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]}/,"\n") # + + @parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}\s*/,"\n") end if @@tablehead == 1 - if @parablock =~/¡¡/u - @parablock.gsub!(/ #{@vz.paragraph_table_xml}}) - @parablock.gsub!(/¡¡(\d+?)¡/u, + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{ #{@vz.paragraph_table_xml}}) - @parablock.gsub!(/!>/,"\n\n") + @parablock.gsub!(/#{Mx[:tc_c]}/,"
    \n\n") @@tablehead=0 end @parablock else - @parablock.gsub!(/ #{@vz.paragraph_table_xml}}) - @parablock.gsub!(/¡¡(\d+?)¡/u, + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{ #{@vz.paragraph_table_xml}}) - @parablock.gsub!(/!>/,"\n\n\n") + @parablock.gsub!(/#{Mx[:tc_c]}/,"\n\n\n") end @parablock end @@ -171,39 +171,39 @@ module SiSU_Tables m=@parablock[//,1] @@tablefoot << m if m @parablock.gsub!(//,'') - @@tablehead=1 if @parablock =~//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 =~// + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - if @parablock =~//; @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 =~// - @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 =~// - @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: 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 \ [^7] +* various sisu man pages [^7] .BR -* sisu.1 \ [^8] +* sisu.1 [^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 emphasis +normal text +.B emphasis .B bold text .I underscore .I italics @@ -1258,8 +1262,6 @@ normal text emphasis .BR normal text -.BR -emphasis .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 \ [^13] markup +about SiSU [^13] markup .SH 9.5.3 LINKING IMAGES @@ -1541,11 +1556,19 @@ about 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\" .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 @@ -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 < +.BR +.BR +.BR

    this is my new homepage.

    +.BR +.BR +.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 \ [^20] A small database and +Sample search frontend [^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: 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 \ [^24] +* sisu.1 [^24] .BR -* sisu.8 \ [^25] +* sisu.8 [^25] .BR -* man directory \ [^26] +* man directory [^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 @@ -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 @@ -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 @ .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 - + .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 - + .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. - - + + .TP .BI 19. - + .TP .BI 20. @@ -4736,9 +4928,11 @@ There is nothing to stop MySQL support being added in future. .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: at: .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 -- cgit v1.2.3