diff --git a/lib/sisu/v0/character_encoding.rb b/lib/sisu/v0/character_encoding.rb
index 23bad376..2bac8edc 100644
--- a/lib/sisu/v0/character_encoding.rb
+++ b/lib/sisu/v0/character_encoding.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/composite.rb b/lib/sisu/v0/composite.rb
index 4994f568..9dc35eec 100644
--- a/lib/sisu/v0/composite.rb
+++ b/lib/sisu/v0/composite.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/conf.rb b/lib/sisu/v0/conf.rb
index 03af859b..9e2b7efd 100644
--- a/lib/sisu/v0/conf.rb
+++ b/lib/sisu/v0/conf.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/css.rb b/lib/sisu/v0/css.rb
index 8023c737..3f2733b1 100644
--- a/lib/sisu/v0/css.rb
+++ b/lib/sisu/v0/css.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/dal_expand_insertions.rb b/lib/sisu/v0/dal_expand_insertions.rb
index 2f04803f..90102c7d 100644
--- a/lib/sisu/v0/dal_expand_insertions.rb
+++ b/lib/sisu/v0/dal_expand_insertions.rb
@@ -22,7 +22,7 @@
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
+ 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
@@ -194,4 +194,3 @@ module SiSU_insertions
end
end
__END__
-
diff --git a/lib/sisu/v0/db_columns.rb b/lib/sisu/v0/db_columns.rb
index 7ed5cdf9..2dc88a9d 100644
--- a/lib/sisu/v0/db_columns.rb
+++ b/lib/sisu/v0/db_columns.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/db_dbi.rb b/lib/sisu/v0/db_dbi.rb
index d95b7be5..1c09f334 100644
--- a/lib/sisu/v0/db_dbi.rb
+++ b/lib/sisu/v0/db_dbi.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/db_drop.rb b/lib/sisu/v0/db_drop.rb
index 02a38880..bed179b7 100644
--- a/lib/sisu/v0/db_drop.rb
+++ b/lib/sisu/v0/db_drop.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/db_select.rb b/lib/sisu/v0/db_select.rb
index 4ba722d4..1d5e1f20 100644
--- a/lib/sisu/v0/db_select.rb
+++ b/lib/sisu/v0/db_select.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/db_tests.rb b/lib/sisu/v0/db_tests.rb
index c002bdda..c5370b52 100644
--- a/lib/sisu/v0/db_tests.rb
+++ b/lib/sisu/v0/db_tests.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/dbi.rb b/lib/sisu/v0/dbi.rb
index a30820f7..644b150d 100644
--- a/lib/sisu/v0/dbi.rb
+++ b/lib/sisu/v0/dbi.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb
index 61eb74b1..2f82c31e 100644
--- a/lib/sisu/v0/defaults.rb
+++ b/lib/sisu/v0/defaults.rb
@@ -70,6 +70,7 @@ module SiSU_Viz
@fonts='verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' # 'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman'
@dir=SiSU_Env::Info_env.new
@date=SiSU_Env::Info_date.new #{@date.year}
+ @v=SiSU_Env::Info_version.new.get_version
end
#% glyph
def glyph_bullet # •
@@ -342,13 +343,11 @@ module SiSU_Viz
end
#% text #changed from txt to avoid naming conflicts #FOLLOW
def txt_generator
- v=SiSU_Env::Info_version.new.get_version
- %{
+ %{
}
end
def txt_generator_comment
- v=SiSU_Env::Info_version.new.get_version
- %{ }
+ %{ }
end
def txt_hp
' SiSU'
@@ -1500,7 +1499,6 @@ WOK
WOK
end
def widget_sisu
- v=SiSU_Env::Info_version.new.get_version
<
- #{v[:project]} using:
+ #{@v[:project]} using:
Standard SiSU markup syntax,
Standard SiSU meta-markup syntax, and the
Standard SiSU object citation numbering and system, (object/text positioning system)
@@ -1557,7 +1555,6 @@ WOK
WOK
end
def widget_way_better
- v=SiSU_Env::Info_version.new.get_version
<
- #{v[:project]}, developed using
+ #{@v[:project]}, developed using
Ruby
diff --git a/lib/sisu/v0/digests.rb b/lib/sisu/v0/digests.rb
index b39fb2aa..d4e5befc 100644
--- a/lib/sisu/v0/digests.rb
+++ b/lib/sisu/v0/digests.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/embedded.rb b/lib/sisu/v0/embedded.rb
index 20700674..7f351a18 100644
--- a/lib/sisu/v0/embedded.rb
+++ b/lib/sisu/v0/embedded.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/errors.rb b/lib/sisu/v0/errors.rb
index 65d23685..93aab7cb 100644
--- a/lib/sisu/v0/errors.rb
+++ b/lib/sisu/v0/errors.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/harvest_authors.rb b/lib/sisu/v0/harvest_authors.rb
index 4d9b9dce..c3369210 100644
--- a/lib/sisu/v0/harvest_authors.rb
+++ b/lib/sisu/v0/harvest_authors.rb
@@ -23,7 +23,7 @@
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
+ 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
@@ -216,7 +216,7 @@ module HARVEST_authors
SiSU Metadata Harvest - Authors
-
+
diff --git a/lib/sisu/v0/harvest_topics.rb b/lib/sisu/v0/harvest_topics.rb
index 85067e55..06246fe6 100644
--- a/lib/sisu/v0/harvest_topics.rb
+++ b/lib/sisu/v0/harvest_topics.rb
@@ -24,7 +24,7 @@
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
+ 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
@@ -293,7 +293,7 @@ module HARVEST_topics
SiSU Metadata Harvest - Topics
-
+
diff --git a/lib/sisu/v0/help.rb b/lib/sisu/v0/help.rb
index e9d1c365..18726ce4 100644
--- a/lib/sisu/v0/help.rb
+++ b/lib/sisu/v0/help.rb
@@ -22,7 +22,7 @@
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
+ 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
@@ -158,7 +158,7 @@ module SiSU_Help
end
def summary
print <
+
-
+
+
+
+
* SiSU uses:
* Standard SiSU markup syntax,
@@ -115,6 +116,8 @@ module SiSU_relaxng
+ ** Description: html generation, processing
+
=end
RELAXNG
end
diff --git a/lib/sisu/v0/remote.rb b/lib/sisu/v0/remote.rb
index af3a389a..cc217018 100644
--- a/lib/sisu/v0/remote.rb
+++ b/lib/sisu/v0/remote.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/response.rb b/lib/sisu/v0/response.rb
index c01f4d47..b69f2677 100644
--- a/lib/sisu/v0/response.rb
+++ b/lib/sisu/v0/response.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/rexml.rb b/lib/sisu/v0/rexml.rb
index be81b6d6..6b6ff906 100644
--- a/lib/sisu/v0/rexml.rb
+++ b/lib/sisu/v0/rexml.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/screen_text_color.rb b/lib/sisu/v0/screen_text_color.rb
index 6bb0c8e2..915cf58b 100644
--- a/lib/sisu/v0/screen_text_color.rb
+++ b/lib/sisu/v0/screen_text_color.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/share_src.rb b/lib/sisu/v0/share_src.rb
index 993027a9..d151daff 100644
--- a/lib/sisu/v0/share_src.rb
+++ b/lib/sisu/v0/share_src.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/share_src_kdissert.rb b/lib/sisu/v0/share_src_kdissert.rb
index 85fcfe8e..8dbe83f2 100644
--- a/lib/sisu/v0/share_src_kdissert.rb
+++ b/lib/sisu/v0/share_src_kdissert.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/shared_html.rb b/lib/sisu/v0/shared_html.rb
index 0f84ae0c..baefa2fd 100644
--- a/lib/sisu/v0/shared_html.rb
+++ b/lib/sisu/v0/shared_html.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/shared_sem.rb b/lib/sisu/v0/shared_sem.rb
index f63fbf4a..e7a0724b 100644
--- a/lib/sisu/v0/shared_sem.rb
+++ b/lib/sisu/v0/shared_sem.rb
@@ -23,7 +23,7 @@
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
+ 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
diff --git a/lib/sisu/v0/shared_structure.rb b/lib/sisu/v0/shared_structure.rb
index 573f9c8e..60e6a451 100644
--- a/lib/sisu/v0/shared_structure.rb
+++ b/lib/sisu/v0/shared_structure.rb
@@ -80,7 +80,7 @@ module SiSU_Structure
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
+ @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]
diff --git a/lib/sisu/v0/sisupod_make.rb b/lib/sisu/v0/sisupod_make.rb
index c55bb1c7..f9d5d1c9 100644
--- a/lib/sisu/v0/sisupod_make.rb
+++ b/lib/sisu/v0/sisupod_make.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/sitemaps.rb b/lib/sisu/v0/sitemaps.rb
index 85589c5b..f838373b 100644
--- a/lib/sisu/v0/sitemaps.rb
+++ b/lib/sisu/v0/sitemaps.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/spell.rb b/lib/sisu/v0/spell.rb
index 8d61387a..6ceb44cf 100644
--- a/lib/sisu/v0/spell.rb
+++ b/lib/sisu/v0/spell.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/sst_convert_markup.rb b/lib/sisu/v0/sst_convert_markup.rb
index d5b0aeef..1d678b11 100644
--- a/lib/sisu/v0/sst_convert_markup.rb
+++ b/lib/sisu/v0/sst_convert_markup.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/sst_do_inline_footnotes.rb b/lib/sisu/v0/sst_do_inline_footnotes.rb
index a40ad27e..ebe038fb 100644
--- a/lib/sisu/v0/sst_do_inline_footnotes.rb
+++ b/lib/sisu/v0/sst_do_inline_footnotes.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/sst_from_kdissert.rb b/lib/sisu/v0/sst_from_kdissert.rb
index bd86e088..171c599f 100644
--- a/lib/sisu/v0/sst_from_kdissert.rb
+++ b/lib/sisu/v0/sst_from_kdissert.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/sst_from_xml.rb b/lib/sisu/v0/sst_from_xml.rb
index de40c16d..87b6c0b1 100644
--- a/lib/sisu/v0/sst_from_xml.rb
+++ b/lib/sisu/v0/sst_from_xml.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/sst_identify_markup.rb b/lib/sisu/v0/sst_identify_markup.rb
index e652fe62..7d8e0eda 100644
--- a/lib/sisu/v0/sst_identify_markup.rb
+++ b/lib/sisu/v0/sst_identify_markup.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb
index ee5e3f38..fe1d1b62 100644
--- a/lib/sisu/v0/sysenv.rb
+++ b/lib/sisu/v0/sysenv.rb
@@ -87,7 +87,7 @@ module SiSU_Env
@t.month
end
def year_static
- '2008'
+ '2009'
end
end
class Info_system
diff --git a/lib/sisu/v0/termsheet.rb b/lib/sisu/v0/termsheet.rb
index 056a5d34..ce4d63f3 100644
--- a/lib/sisu/v0/termsheet.rb
+++ b/lib/sisu/v0/termsheet.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/texinfo.rb b/lib/sisu/v0/texinfo.rb
index 03fd3adc..08b0cbe9 100644
--- a/lib/sisu/v0/texinfo.rb
+++ b/lib/sisu/v0/texinfo.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/texinfo_format.rb b/lib/sisu/v0/texinfo_format.rb
index 076d3ccd..c89cd4c3 100644
--- a/lib/sisu/v0/texinfo_format.rb
+++ b/lib/sisu/v0/texinfo_format.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb
index 9450aed5..facd3008 100644
--- a/lib/sisu/v0/texpdf.rb
+++ b/lib/sisu/v0/texpdf.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb
index 690321b7..3bc972ad 100644
--- a/lib/sisu/v0/texpdf_format.rb
+++ b/lib/sisu/v0/texpdf_format.rb
@@ -22,7 +22,7 @@
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
+ 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
@@ -93,7 +93,6 @@ module SiSU_TeX_Pdf
p t_o.class
p caller
end
-
if defined? @md.image \
and @md.image =~/center/
@center_begin,@center_end='\begin{center}','\end{center}'
@@ -580,12 +579,12 @@ para
class Format_head
def initialize(md,t_o)
@md,@t_o=md,t_o
- if t_o.class == Hash
+ if t_o.class==Hash
@txt =t_o[:txt] || nil
#@title =t_o[:title] || nil
- @subtitle =t_o[:subtitle] || nil
- @ps =t_o[:paper_size] || nil
- @ocn =t_o[:ocn] || nil
+ @subtitle=t_o[:subtitle] || nil
+ @ps=t_o[:paper_size] || nil
+ @ocn=t_o[:ocn] || nil
@layout=t_o[:orientation] || nil
#elsif t_o.class == Array
# @txt =txt[0]
@@ -595,7 +594,6 @@ para
p t_o.class
p caller
end
-
@tx=SiSU_Env::Get_init.instance.tex
@url_brace=SiSU_Viz::Skin.new.url_decoration
@tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine
diff --git a/lib/sisu/v0/update.rb b/lib/sisu/v0/update.rb
index 781b6a5d..a54a6e1b 100644
--- a/lib/sisu/v0/update.rb
+++ b/lib/sisu/v0/update.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/urls.rb b/lib/sisu/v0/urls.rb
index 1c358910..ea090253 100644
--- a/lib/sisu/v0/urls.rb
+++ b/lib/sisu/v0/urls.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/webrick.rb b/lib/sisu/v0/webrick.rb
index e579da4e..0e8ed910 100644
--- a/lib/sisu/v0/webrick.rb
+++ b/lib/sisu/v0/webrick.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/wikispeak.rb b/lib/sisu/v0/wikispeak.rb
index d29487e0..170ff39e 100644
--- a/lib/sisu/v0/wikispeak.rb
+++ b/lib/sisu/v0/wikispeak.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/xml_fictionbook.rb b/lib/sisu/v0/xml_fictionbook.rb
index 98609c45..208c3d55 100644
--- a/lib/sisu/v0/xml_fictionbook.rb
+++ b/lib/sisu/v0/xml_fictionbook.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/xml_md_oai_pmh_dc.rb b/lib/sisu/v0/xml_md_oai_pmh_dc.rb
index 341596bb..afe46d88 100644
--- a/lib/sisu/v0/xml_md_oai_pmh_dc.rb
+++ b/lib/sisu/v0/xml_md_oai_pmh_dc.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/xml_tables.rb b/lib/sisu/v0/xml_tables.rb
index 11748331..72a4d9d1 100644
--- a/lib/sisu/v0/xml_tables.rb
+++ b/lib/sisu/v0/xml_tables.rb
@@ -22,7 +22,7 @@
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
+ 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
diff --git a/lib/sisu/v0/zap.rb b/lib/sisu/v0/zap.rb
index 7dcc09e4..54b60bed 100644
--- a/lib/sisu/v0/zap.rb
+++ b/lib/sisu/v0/zap.rb
@@ -22,7 +22,7 @@
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
+ 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
--
cgit v1.2.3
From 53a4ec45a504cc19536530e37da4f79bfbd895fd Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Sat, 4 Jul 2009 08:40:03 -0400
Subject: make sisu and ruby version info ruby instance methods
---
lib/sisu/v0/cgi_sql_common.rb | 2 +-
lib/sisu/v0/defaults.rb | 4 ++--
lib/sisu/v0/harvest_authors.rb | 4 ++--
lib/sisu/v0/harvest_topics.rb | 4 ++--
lib/sisu/v0/help.rb | 4 ++--
lib/sisu/v0/manpage.rb | 2 +-
lib/sisu/v0/param.rb | 2 +-
lib/sisu/v0/sisupod_make.rb | 2 +-
lib/sisu/v0/sst_from_kdissert.rb | 2 +-
lib/sisu/v0/sst_from_xml.rb | 2 +-
lib/sisu/v0/sysenv.rb | 11 +++++++----
lib/sisu/v0/texinfo_format.rb | 2 +-
lib/sisu/v0/texpdf_format.rb | 8 ++++----
lib/sisu/v0/xml_fictionbook.rb | 4 ++--
14 files changed, 28 insertions(+), 25 deletions(-)
(limited to 'lib')
diff --git a/lib/sisu/v0/cgi_sql_common.rb b/lib/sisu/v0/cgi_sql_common.rb
index 2bfde9eb..fea17a7a 100644
--- a/lib/sisu/v0/cgi_sql_common.rb
+++ b/lib/sisu/v0/cgi_sql_common.rb
@@ -516,7 +516,7 @@ module SiSU_CGI_sql
WOK_SQL
end
def tail
- v=SiSU_Env::Info_version.new.get_version
+ v=SiSU_Env::Info_version.instance.get_version
<<-WOK_SQL
def tail
<<-'WOK'
diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb
index 2f82c31e..fe2a61e8 100644
--- a/lib/sisu/v0/defaults.rb
+++ b/lib/sisu/v0/defaults.rb
@@ -70,7 +70,7 @@ module SiSU_Viz
@fonts='verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' # 'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman'
@dir=SiSU_Env::Info_env.new
@date=SiSU_Env::Info_date.new #{@date.year}
- @v=SiSU_Env::Info_version.new.get_version
+ @v=SiSU_Env::Info_version.instance.get_version
end
#% glyph
def glyph_bullet # •
@@ -1657,7 +1657,7 @@ WOK
end
class Home < Skin
def initialize
- @v=SiSU_Env::Info_version.new.get_version
+ @v=SiSU_Env::Info_version.instance.get_version
@dir=SiSU_Env::Info_env.new
@date=SiSU_Env::Info_date.new #{@date.year}
end
diff --git a/lib/sisu/v0/harvest_authors.rb b/lib/sisu/v0/harvest_authors.rb
index c3369210..c7ca80fb 100644
--- a/lib/sisu/v0/harvest_authors.rb
+++ b/lib/sisu/v0/harvest_authors.rb
@@ -208,7 +208,7 @@ module HARVEST_authors
'../_sisu/css/harvest.css'
else 'harvest.css'
end
- sv=SiSU_Env::Info_version.new.get_version
+ sv=SiSU_Env::Info_version.instance.get_version
<
@@ -216,7 +216,7 @@ module HARVEST_authors
SiSU Metadata Harvest - Authors
-
+
diff --git a/lib/sisu/v0/harvest_topics.rb b/lib/sisu/v0/harvest_topics.rb
index 06246fe6..1ab62a95 100644
--- a/lib/sisu/v0/harvest_topics.rb
+++ b/lib/sisu/v0/harvest_topics.rb
@@ -285,7 +285,7 @@ module HARVEST_topics
'../_sisu/css/harvest.css'
else 'harvest.css'
end
- sv=SiSU_Env::Info_version.new.get_version
+ sv=SiSU_Env::Info_version.instance.get_version
<
@@ -293,7 +293,7 @@ module HARVEST_topics
SiSU Metadata Harvest - Topics
-
+
diff --git a/lib/sisu/v0/help.rb b/lib/sisu/v0/help.rb
index 18726ce4..cd5eaf25 100644
--- a/lib/sisu/v0/help.rb
+++ b/lib/sisu/v0/help.rb
@@ -1014,8 +1014,8 @@ WOK
end
end
def sisu_version
- version=SiSU_Env::Info_version.new.get_version
- rb_ver=SiSU_Env::Info_version.new.rbversion
+ version=SiSU_Env::Info_version.instance.get_version
+ rb_ver=SiSU_Env::Info_version.instance.rbversion
if version[:version]
tell=SiSU_Screen::Ansi.new('-v',version[:project],version[:version],version[:date_stamp],version[:date],rb_ver)
tell.version
diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb
index 81684fb6..7129e45a 100644
--- a/lib/sisu/v0/manpage.rb
+++ b/lib/sisu/v0/manpage.rb
@@ -420,7 +420,7 @@ WOK
date=if @md.date; @md.date
else '2007' #date missing decide on action
end
- proj=SiSU_Env::Info_version.new.get_version
+ proj=SiSU_Env::Info_version.instance.get_version
manpage[:open] = %{.TH "#{@md.fnb}" "1" "#{date}" "#{proj[:version]}" "#{@md.title}"#{@md.man_name}#{@md.man_synopsis}}
content << manpage[:open]
content << manpage[:head]
diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb
index 7153c40d..4efdebb5 100644
--- a/lib/sisu/v0/param.rb
+++ b/lib/sisu/v0/param.rb
@@ -244,7 +244,7 @@ module SiSU_Param
@flag_separate_endnotes=false
@flag_separate_endnotes_make=true
regx_date=/^\d{4}(?:-(?:[0][0-9]|1[0-2])(-(?:[0-2][0-9]|3[01]))?)?$/
- ver=SiSU_Env::Info_version.new
+ ver=SiSU_Env::Info_version.instance
@sisu_version=ver.get_version
@ruby_version=ver.rbversion
@generated=Time.now
diff --git a/lib/sisu/v0/sisupod_make.rb b/lib/sisu/v0/sisupod_make.rb
index f9d5d1c9..470cbb01 100644
--- a/lib/sisu/v0/sisupod_make.rb
+++ b/lib/sisu/v0/sisupod_make.rb
@@ -68,7 +68,7 @@ module SiSU_Doc
m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
@date=SiSU_Env::Info_date.new.dt
@env=SiSU_Env::Info_env.new(@opt.fns)
- @ver=SiSU_Env::Info_version.new.get_version
+ @ver=SiSU_Env::Info_version.instance.get_version
@ans=SiSU_Response::Response.new
pod_path="#{@env.path.processing}/sisupod"
@v=if @opt.cmd =~/[VM]/; 'v'
diff --git a/lib/sisu/v0/sst_from_kdissert.rb b/lib/sisu/v0/sst_from_kdissert.rb
index 171c599f..53840fcd 100644
--- a/lib/sisu/v0/sst_from_kdissert.rb
+++ b/lib/sisu/v0/sst_from_kdissert.rb
@@ -65,7 +65,7 @@ module SiSU_Kdissert
def initialize(opt)
@opt=opt
@sisu,@sisu_base=[],[]
- @ver=SiSU_Env::Info_version.new.get_version
+ @ver=SiSU_Env::Info_version.instance.get_version
end
def read
kdissert_to_sisu
diff --git a/lib/sisu/v0/sst_from_xml.rb b/lib/sisu/v0/sst_from_xml.rb
index 87b6c0b1..cab88cbb 100644
--- a/lib/sisu/v0/sst_from_xml.rb
+++ b/lib/sisu/v0/sst_from_xml.rb
@@ -65,7 +65,7 @@ module SiSU_sst_from_xml
def initialize(opt)
@opt=opt
@sisu,@sisu_base=[],[]
- @ver=SiSU_Env::Info_version.new.get_version
+ @ver=SiSU_Env::Info_version.instance.get_version
end
def tell(filename,type)
SiSU_Screen::Ansi.new(@opt.cmd,"XML #{type} to SiSU sst","#{filename} --> #{filename}.sst").green_hi_blue
diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb
index fe1d1b62..a37905bd 100644
--- a/lib/sisu/v0/sysenv.rb
+++ b/lib/sisu/v0/sysenv.rb
@@ -517,7 +517,7 @@ module SiSU_Env
:sxd => filename(code,@fnb,'.sxd.xml'),
:sxn => filename(code,@fnb,'.sxn.xml'),
:sisupod => filename(nil,@fnz,''),
- :book_idx => filename(code,'book_index','.html'),
+ :book_idx_html => filename(code,'book_index','.html'),
}
@fn
end
@@ -546,7 +546,7 @@ module SiSU_Env
program='file'
fnsp=Info_env.new(filename).source_file_with_path
if program_found?(program)
- encoding=%x{file #{fnsp}}.strip
+ encoding=%x{file -L #{fnsp}}.strip
encoding.gsub!(/#{fnsp}:(\s+|$)/,'')
encoding=if encoding \
and not encoding.empty?
@@ -1481,7 +1481,9 @@ WOK
pth
end
def odf
- "#{processing}/odf"
+ pth="#{processing}/odf"
+ mkdir_p(pth) unless FileTest.directory?(pth)
+ pth
end
def tex
pth=if defined? @rc['processing']['latex'] \
@@ -2635,6 +2637,7 @@ WOK
end
end
class Info_version #{@md.date_available} Initial version
"
else ''
end
--
cgit v1.2.3
From a7774c04305fa787a21cc2695d5565ea52485a1f Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Sat, 4 Jul 2009 08:42:04 -0400
Subject: dal_idx, book_idx_html, match sysenv
---
lib/sisu/v0/dal_idx.rb | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
(limited to 'lib')
diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb
index 7201e2ac..fec0e1ed 100644
--- a/lib/sisu/v0/dal_idx.rb
+++ b/lib/sisu/v0/dal_idx.rb
@@ -292,8 +292,7 @@ module SiSU_book_index
if @md.book_idx
path="#{@env.path.output}/#{@md.fnb}"
Dir.mkdir(path) unless FileTest.directory?(path)
- html_index_file=File.new("#{path}/#{@md.fn[:book_idx]}",'w')
- #puts "#{path}/#{@md.fn[:book_idx]}"
+ html_index_file=File.new("#{path}/#{@md.fn[:book_idx_html]}",'w')
html_idx.each {|x| html_index_file << x }
html_index_file.close
end
--
cgit v1.2.3
From 9cbb974b492c390ed03091a55a945dcf90eec0eb Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Sat, 4 Jul 2009 08:43:25 -0400
Subject: dal_numbering, minor regex reduction
---
lib/sisu/v0/dal_numbering.rb | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
(limited to 'lib')
diff --git a/lib/sisu/v0/dal_numbering.rb b/lib/sisu/v0/dal_numbering.rb
index bbbd3f46..05123bbc 100644
--- a/lib/sisu/v0/dal_numbering.rb
+++ b/lib/sisu/v0/dal_numbering.rb
@@ -133,10 +133,7 @@ module SiSU_numbering
if (para =~/^(?:#{no1}|^#{no2}|^#{no3}#{no4})~#/ \
and para !~/^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}/)
t_not+=1 #; t_no2=0; t_no3=0
- 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")
+ para.gsub!(/^(#{Mx[:lv_o]}(?:#{no1}|#{no2}|#{no3}|#{no4})):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2")
end
if para =~/#{Mx[:lv_o]}#{no1}:/
@subnumber=1
--
cgit v1.2.3
From 4e4ce5d362db3e88d41d371645bf998cdead1fbf Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Sat, 4 Jul 2009 08:46:20 -0400
Subject: html various minor: use suffix provided in constants; module
SiSU_HTML_Tune; html promo
html promo, possibility of use of adsense, or other
---
lib/sisu/v0/html.rb | 33 +++++++++------------------------
lib/sisu/v0/html_format.rb | 31 +++++++++++++++----------------
lib/sisu/v0/html_minitoc.rb | 12 ++++++------
lib/sisu/v0/html_promo.rb | 21 +++++++++++++++++++++
lib/sisu/v0/html_segments.rb | 20 ++++++++------------
lib/sisu/v0/html_tune.rb | 4 ++--
6 files changed, 61 insertions(+), 60 deletions(-)
(limited to 'lib')
diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb
index 5cf8e8d4..39775832 100644
--- a/lib/sisu/v0/html.rb
+++ b/lib/sisu/v0/html.rb
@@ -71,7 +71,7 @@ module SiSU_HTML
require "#{SiSU_lib}/html_promo"
include SiSU_HTML_promo
require "#{SiSU_lib}/html_tune"
- include SiSU_Tune
+ include SiSU_HTML_Tune
require "#{SiSU_lib}/shared_xml"
require "#{SiSU_lib}/shared_structure"
class Source
@@ -152,27 +152,12 @@ module SiSU_HTML
end
def tuned_file_instructions
@tell=SiSU_Screen::Ansi.new(@md.cmd)
- if @md
- #@md.sfx=''
- @md.sfx='' if @md.cmd =~/z/
- if @md.cmd =~/h/ \
- or @md.fns =~/\~[a-z]{2,3}\.s?/ #multilingual document protection is a bit arbitrary, (needed by existing server configuration), add configuration overide...
- if @md.cmd =~/H/ \
- and @md.fns =~/\~[a-z]{2,3}\.s?/
- SiSU_Screen::Ansi.new(@md.cmd,
- 'multilingual document, creating internal url links with filetype suffix',
- "\n\t\t(overriding -H request, using -h mode instead)"
- ).warn unless @md.cmd =~/q/
- end
- @md.sfx='.html'
- end
- end
@md.cmd=@md.cmd.gsub(/H/,'h')
@md.file_type='html' if @md.cmd =~/[hon]/
directories
newfilename=%{#{@env.path.output}/#{@md.fnb}/#{@md.fn[:index]}} if @md.file_type =~/html/
dal_array=@particulars.dal_array # dal file drawn here
- @tuned_file_array=SiSU_Tune::Tune.new(dal_array,@md).songsheet
+ @tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet
@tuned_file_array
end
end
@@ -353,7 +338,7 @@ WOK
title=unless para =~/Document Information/; linkname
else
link='metadata'
- %{#{linkname}}
+ %{#{linkname}}
end
toc={}
txt_obj={:txt =>title}
@@ -456,7 +441,7 @@ WOK
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
})
if seg_link =~/(#{Mx[:id_o]}\~\d+;(?:\w|[0-6]:\d+);\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/m
@@ -466,7 +451,7 @@ WOK
@@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+)(.*)/,
- %{\\1 \\2 \\3 })
end
p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn
@@ -504,7 +489,7 @@ WOK
para.gsub!(m,'')
title=linkname
else
- lnk_n_txt=%{
+ lnk_n_txt=%{
#{linkname}
}
txt_obj={:txt =>lnk_n_txt}
@@ -535,7 +520,7 @@ WOK
para.gsub!(m,'')
title=linkname
else
- lnk_n_txt=%{
+ lnk_n_txt=%{
#{linkname}
}
txt_obj={:txt =>lnk_n_txt}
@@ -593,11 +578,11 @@ WOK
toc_shared << format_head_toc.scroll_head_navigation_band
if @md.rights
rights=format_head_toc.rights
- rights=SiSU_Tune::Clean_html.new(rights).clean
+ rights=SiSU_HTML_Tune::Clean_html.new(rights).clean
end
if @md.prefix_b
prefix_b=format_head_toc.prefix_b
- prefix_b=SiSU_Tune::Clean_html.new(prefix_b).clean
+ prefix_b=SiSU_HTML_Tune::Clean_html.new(prefix_b).clean
end
@seg_toc_band=format_head_toc.seg_head_navigation_band('pdf') #bug, vary depending on type of doc !! examine
@seg_toc_band_bottom=format_head_toc.seg_head_navigation_band_bottom('pdf') #bug, vary depending on type of doc !! examine
diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb
index 7f2fab67..eb29f9f9 100644
--- a/lib/sisu/v0/html_format.rb
+++ b/lib/sisu/v0/html_format.rb
@@ -97,10 +97,9 @@ module SiSU_HTML_Format
end
class Head_information
include SiSU_Viz
- attr_reader :md,:sfx,:pdf,:rdf,:vz
+ attr_reader :md,:pdf,:rdf,:vz
def initialize(md)
@md=md
- @sfx,@pdf=@md.sfx,@md.pdf
@rdf=SiSU_XML_tags::RDF.new(md)
# DublinCore 1 - title
@vz=SiSU_Env::Get_init.instance.skin
@@ -276,7 +275,7 @@ WOK
if type=~/pdf/
@tocband_segtoc=make_scroll_seg_pdf
end
- firstseg=%{
+ firstseg=%{
#{@vz.png_nav_nxt}
} if @md.firstseg =~/\S+/
%{
@@ -295,7 +294,7 @@ WOK
if type=~/pdf/
@tocband_segtoc=make_scroll_seg_pdf
end
- firstseg=%{
+ firstseg=%{
#{@vz.png_nav_nxt}
} if @md.firstseg =~/\S+/
%{
- #{v[:project]}, developed using
-
- Ruby
-
- on
-
- Debian/Gnu/Linux
-
- software infrastructure,
- with the usual GPL (or OSS) suspects.
-
- Better - "performance, reliability, scalability, security & total cost of ownership"
- [not to mention flexibility & choice] use of and adherence to open standards (where practical and fair) and it is software libré.
-
- Get With the Future
-
- Way Better!
-
-
-
-
-
-
- WOK
- end
- WOK_SQL
- end
- def main1
- <<-'WOK_SQL'
- @tail=tail
- @counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0
- @counters_txt,@counters_endn,@sql_select_body,@sql_select_endnotes='','','',''
- FCGI.each_cgi do |cgi|
- begin # all code goes in begin section
- @search={ :text => [],:endnotes => [] }
- q=CGI.new
- @db=if cgi['db'] =~/\S+/;
- @stub=/SiSU_(\S+)/.match(cgi['db'])[1]
- cgi['db']
- else
- @stub='sisu'
- 'SiSU_sisu'
- end
- checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','',''
- if cgi['view']=~/text/; checked_index,checked_text='','checked'
- else checked_index,checked_text='checked',''
- end
- checked_echo='checked' if cgi['echo'] =~/\S/
- checked_stats='checked' if cgi['stats'] =~/\S/
- checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1
- checked_searched='checked' if cgi['searched'] =~/\S/
- checked_tip='checked' if cgi['tip'] =~/\S/
- checked_case='checked' if cgi['casesense'] =~/\S/
- checked_sql='checked' if cgi['sql'] =~/\S/
- if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1
- checked_all='checked'
- checked_echo=checked_stats=checked_url=checked_searched=checked_tip=checked_sql='checked'
- checked_none=''
- elsif cgi['checks'] =~/check_none/
- checked_none='checked'
- checked_all=checked_url=checked_stats=checked_searched=checked_tip=checked_echo=checked_sql=''
- elsif cgi['checks'] =~/check_selected/
- checked_selected='checked'
- elsif cgi['checks'] =~/check_default/
- checked_default='checked'
- checked_echo=checked_stats=checked_url='checked'
- checked_searched=checked_tip=checked_case=checked_sql=''
- else
- checked_selected='checked'
- checked_echo=checked_stats=checked_url='checked'
- checked_searched=checked_tip=checked_case=checked_sql=''
- end
- WOK_SQL
- end
- def main2
- <<-'WOK_SQL'
- search_field=cgi['find'] if cgi['find'] # =~/\S+/
- @search_for=Search_request.new(search_field,q) #.analyze #% search_for
- #% searches
- #Canned_search.new(@base,@search_for.text1,cgi)
- if @search_for.text1=~/\S+/ or @search_for.author=~/\S+/ #and search_field =~/\S/
- s1='s1=' + CGI.escape(@search_for.text1) if @search_for.text1=~/\S/
- key='key=' + CGI.escape(@search_for.keywords) if @search_for.keywords=~/\S/
- ti='&ti=' + CGI.escape(@search_for.title) if @search_for.title=~/\S/
- au='&au=' + CGI.escape(@search_for.author) if @search_for.author=~/\S/
- sj='&sj=' + CGI.escape(@search_for.subject) if @search_for.subject=~/\S/
- dsc='&dsc=' + CGI.escape(@search_for.description) if @search_for.description=~/\S/
- pb='&pb=' + CGI.escape(@search_for.publisher) if @search_for.publisher=~/\S/
- cntr='&cntr=' + CGI.escape(@search_for.contributor) if @search_for.contributor=~/\S/
- dt='&dt=' + CGI.escape(@search_for.date) if @search_for.date=~/\S/
- ty='&ty=' + CGI.escape(@search_for.type) if @search_for.type=~/\S/
- id='&id=' + CGI.escape(@search_for.identifier) if @search_for.identifier=~/\S/
- src='&src=' + CGI.escape(@search_for.source) if @search_for.source=~/\S/
- lang='&lang=' + CGI.escape(@search_for.language) if @search_for.language=~/\S/
- rel='&rel=' + CGI.escape(@search_for.relation) if @search_for.relation=~/\S/
- cov='&cov=' + CGI.escape(@search_for.coverage) if @search_for.coverage=~/\S/
- cr='&cr=' + CGI.escape(@search_for.rights) if @search_for.rights=~/\S/
- co='&co=' + CGI.escape(@search_for.comment) if @search_for.comment=~/\S/
- ab='&ab=' + CGI.escape(@search_for.abstract) if @search_for.abstract=~/\S/
- dtc='&dtc=' + CGI.escape(@search_for.date_created) if @search_for.date_created=~/\S/
- dti='&dti=' + CGI.escape(@search_for.date_issued) if @search_for.date_issued=~/\S/
- dtm='&dtm=' + CGI.escape(@search_for.date_modified) if @search_for.date_modified=~/\S/
- dta='&dta=' + CGI.escape(@search_for.date_available) if @search_for.date_available=~/\S/
- dtv='&dtv=' + CGI.escape(@search_for.date_valid) if @search_for.date_valid=~/\S/
- fns='&fns=' + CGI.escape(@search_for.filename) if @search_for.filename=~/\S/
- @@canned_search_url=if checked_all =~/checked/
- "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1"
- else "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}"
- end
- @canned_base_url="#@base?#{s1}&db=#{cgi['db']}"
- if checked_case=~/\S/
- @search[:text][1]=%{documents.clean~'#{@search_for.text1}'} #s1
- @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1
- else
- @search[:text][1]=%{documents.clean~*'#{@search_for.text1}'} #s1
- @search[:endnotes][1]=%{endnotes.clean~*'#{@search_for.text1}'} #s1
- end
- canned_note='search url:'
- else
- @@canned_search_url="#@base?db=#{@db}&view=index"
- canned_note='search url example:'
- end
- if search_field =~/\S+/
- analyze_format=search_field.gsub(/\s*\n/,'; ')
- elsif checked_all =~/checked/ or checked_url =~/checked/
- canned_search=@@canned_search_url.scan(/(?:s1|au|ti|fns)=[^&]+/)
- af=canned_search.join('; ')
- af.gsub!(/s1=/,'text: ')
- af.gsub!(/au=/,'author: ')
- af.gsub!(/ti=/,'title: ')
- af.gsub!(/fns=/,'filename: ')
- af.gsub!(/%2B/,' ')
- analyze_format=af
- st=af.split(/\s*;\s*/)
- search_field=st.join("\n")
- end
- green=%{}
- canned_search_url_txt=CGI.escapeHTML(@@canned_search_url)
- the_can=%{#{canned_note} #{canned_search_url_txt} }
- p_text=p_keywords=p_title=p_author=p_subject=p_description=p_publisher=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_subject=p_filename=''
- p_text=%{text: #{green}#{@search_for.text1} } if @search_for.text1 =~/\S+/
- p_keywords=%{keywords: #{green}#{@search_for.keywords} } if @search_for.keywords =~/\S+/
- p_title=%{title: #{green}#{@search_for.title} } if @search_for.title =~/\S+/
- p_author=%{author: #{green}#{@search_for.author} } if @search_for.author =~/\S+/
- p_subject=%{subject: #{green}#{@search_for.subject} } if @search_for.subject =~/\S+/
- p_description=%{description: #{green}#{@search_for.description} } if @search_for.description =~/\S+/
- p_publisher=%{publisher: #{green}#{@search_for.publisher} } if @search_for.publisher =~/\S+/
- p_contributor=%{contributor: #{green}#{@search_for.contributor} } if @search_for.contributor =~/\S+/
- p_date=%{date: #{green}#{@search_for.date} } if @search_for.date =~/\S+/
- p_type=%{type: #{green}#{@search_for.type} } if @search_for.type =~/\S+/
- p_format=%{format: #{green}#{@search_for.format} } if @search_for.format =~/\S+/
- p_identifier=%{identifier: #{green}#{@search_for.identifier} } if @search_for.identifier =~/\S+/
- p_source=%{source: #{green}#{@search_for.source} } if @search_for.source =~/\S+/
- p_language=%{language: #{green}#{@search_for.language} } if @search_for.language =~/\S+/
- p_relation=%{relation: #{green}#{@search_for.relation} } if @search_for.relation =~/\S+/
- p_coverage=%{coverage: #{green}#{@search_for.coverage} } if @search_for.coverage =~/\S+/
- p_rights=%{rights: #{green}#{@search_for.rights} } if @search_for.rights =~/\S+/
- p_comment=%{comment: #{green}#{@search_for.comment} } if @search_for.comment =~/\S+/
- p_abstract=%{abstract: #{green}#{@search_for.abstract} } if @search_for.abstract =~/\S+/
- p_filename=%{filename: #{green}#{@search_for.filename} } if @search_for.filename =~/\S+/
- search_note=<<-WOK
-
- database: #{green}#@db; selected view: #{green}#{cgi['view']}
- search string: "#{green}#{analyze_format}"
- #{p_text} #{p_keywords} #{p_title} #{p_author} #{p_subject} #{p_description} #{p_publisher} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename}
-
- WOK
- #eg = %{canned search e.g.: #{url} find: #{analyze} database: #{database}}
- #dbi_canning
- @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can).submission_form #% form
- unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/
- print "Content-type: text/html\n\n"
- puts (@header+@tail)
- else #% searches
- s1=if @search_for.text1 =~/\S/
- @search_for.text1
- else 'Unavailable'
- end
- if checked_case=~/\S/
- @search[:text]<<%{documents.clean~'#{CGI.unescape(s1)}'}
- @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'}
- else
- @search[:text]<<%{documents.clean~*'#{CGI.unescape(s1)}'}
- @search[:endnotes]<<%{endnotes.clean~*'#{CGI.unescape(s1)}'}
- end
- #dbi_request
- dbi_statement=Dbi_search_statement.new(@conn,@search_for,q,checked_case)
- @text_search_flag=false
- @text_search_flag=dbi_statement.text_search_flag
- s_contents=dbi_statement.contents
- s_endnotes=dbi_statement.endnotes
- @body_main,@endnotes=[],[]
- @search_regx=nil
- oldtid=0
- if @text_search_flag
- if checked_sql =~/\S/
- sql_select_body=dbi_statement.sql_select_body_format
- sql_select_endnotes=dbi_statement.sql_select_endnotes_format
- else sql_select_body,sql_select_endnotes='',''
- end
- @body_main << ' Main Text: ' << sql_select_body
- @endnotes << ' Endnotes: ' << sql_select_endnotes
- else
- end
- #text_objects_body
- s_contents.each do |c| #% text body
- location=c['filename'][/(.+?)\.(?:ssm\.sst|sst)$/,1]
- file_suffix=c['filename'][/.+?\.(_?sst|ssm)$/,1]
- lang=if location =~ /\S+?~(\S\S\S?)$/
- l=location[/\S+?~(\S\S\S?)$/,1]
- location.gsub!(/(\S+?)~\S\S\S?/,'\1')
- l=".#{l}"
- else ''
- end
- #metadata_found_body
- if c['tid'].to_i != oldtid.to_i
- ti=if c['subtitle'] =~/\S+/; "#{c['title']} - #{c['subtitle']}"
- else c['title']
- end
- can_txt_srch=if cgi['view']=~/index/; %{ }
- else %{ }
- end
- title=%{ #{ti} by #{c['creator']} #{can_txt_srch} } if file_suffix=~/s/ #hmm watch file_suffix
- if @text_search_flag; title=' '+title
- else title=' '+title
- end
- @counter_txt_doc+=1
- oldtid=c['tid'].to_i
- else title=''
- end
- if @text_search_flag
- if cgi['view']=~/text/ #% txt body
- text=if c['suffix'] !~/1/ #seg
- if @search_for.text1 =~/\S+/ \
- or q['s1'] =~/\S+/ #% only this branch is working !!
- unescaped_search=if @search_for.text1 =~/\S+/
- CGI.unescape(@search_for.text1)
- elsif q['s1'] =~/\S+/
- CGI.unescape(q['s1'])
- else nil
- end
- @search_regx=if unescaped_search #check
- search_regex=[]
- build=unescaped_search.scan(/\S+/).each do |g|
- if g.to_s =~/(AND|OR)/
- search_regex << '|'
- else search_regex << %{#{g.to_s}}
- end
- end
- search_regex=search_regex.join(' ')
- search_regex=search_regex.gsub(/\s*\|\s*/,'|')
- Regexp.new(search_regex, Regexp::IGNORECASE)
- else nil
- end
- else nil
- end
- matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/)
- matched=c['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{\\1})
- else c['body']
- end
- %{
Word index links are to html versions of the text the segmented version followed by the scroll (single document) version. [For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]
-
(The word listing/index is Case sensitive: Capitalized words appear before lower case)
-
- word (number of occurences) linked references to word within document
- [if number of occurences exceed number of references - word occurs more than once in at least one reference. Footnote/endnotes are either assigned to the paragraph from which they are referenced or ignored, so it is relevant to check the footnotes referenced from within a paragraph as well.]
-
-
- (After the page is fully loaded) you can jump directly to a word by appending a hash (#) and the word to the url for this text, (do not forget that words are case sensitive, and may be listed twice (starting with and without an upper case letter)), #your_word # [ http://[web host]/#{@fnb}/concordance.html#your_word ]
-
-WOK
- end
- end
- class Word
- @@word_previous=''
- def initialize(word,freq)
- @word,@freq=word,freq
- end
- def html
- w=if @word.capitalize==@@word_previous
- %{\n
#@word
(#@freq)
\n\t
}
- else n=@word.strip.gsub(/\s+/,'_') #also need to convert extended character set to html
- %{\n
}
- end
- @@word_previous=@word.capitalize
- w
- end
- end
- class Words
- require "#{SiSU_lib}/defaults"
- include SiSU_Viz
- require "#{SiSU_lib}/html_format"
- include SiSU_HTML_Format
- require "#{SiSU_lib}/sysenv"
- include SiSU_Screen
- @@dp=nil
- def initialize(particulars)
- @particulars=particulars
- begin
- @vz=SiSU_Env::Get_init.instance.skin
- @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
- @path="#{@env.path.output}/#{@md.fnb}"
- @freq=Hash.new(0)
- @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @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+/
- @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_splitlist=%r{[—.,;:-]|#{Mx[:id_o]}\S+?#{Mx[:id_c]}}mi
- @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+?>|\w+|[a-zA-Z]+}mi
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- end
- end
- def songsheet
- begin
- mkdir_p(@path) unless FileTest.directory?(@path)
- @file_concordance=File.open("#@path/#{@md.fn[:concordance]}",'w')
- map_para
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error
- ensure
- @file_concordance.close
- end
- end
- protected
- def location_scroll(wordlocation,show)
- @wordlocation=wordlocation
- %{#@wordlocation; }
- end
- def location_seg(wordlocation,show)
- @wordlocation,@show=wordlocation,show
- @sfx='.html' #used for hardlinks, previous setting @sfx='', web server takes care of suffix
- @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#@sfx#{@md.fnl[:post]}#\\2") unless wordlocation.nil?
- case @wordlocation
- when @rxp_t1
- %{[H]#@show, }
- when @rxp_t2
- %{[H]#@show, }
- when @rxp_t3
- %{[H]#@show, }
- else %{#@show, }
- end
- end
- def map_para
- @seg,toy=nil,nil
- @word_map={}
- @dal_array.each do |line|
- 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]
- end
- if toy =~/\d+/ \
- and toy !~/^0$/
- line=line.split(@rgx_splitlist).join(' ') #%take in word or other match
- for word in line.scan(@rgx_scanlist) #%take in word or other match
- #word.gsub!(@rxp_clean,'')
- word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}(?:http)?/,'')
- 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!(/#{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*[\(]/,'')
- word.gsub!(/[\(]\s*$/,'')
- 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!(/:name#\S+/,'')
- word.gsub!(/^\S$/,'')
- word=nil if word =~/^\S$/
- word=nil if word =~/^\s*$/ #watch
- if word
- unless word =~/[A-Z][A-Z]/ \
- or word =~/\w+\s\w+/
- word.capitalize!
- end
- #word.downcase! if word =~lesser
- #word.capitalize! if word =~greater
- @freq[word] +=1
- @word_map[word] ||= []
- if line !~@rxp_lv1 \
- and line !~@rxp_lv2 \
- and line !~@rxp_lv3
- @word_map[word] << location_seg("#@seg\##{toy}",toy)
- else
- @word_map[word] << case line
- when @rxp_lv1; location_seg('T1',toy)
- when @rxp_lv2; location_seg('T2',toy)
- when @rxp_lv3; location_seg('T3',toy)
- end
- end
- end
- end
- end
- end
- end
- end
- scr=' scroll: doc# '
- seg=''
- @file_concordance << SiSU_Concordance::Source::Doc_title.new(@particulars).create
- alph=%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]
- @file_concordance << '
}
- for word in @freq.keys.sort! {|a,b| a.downcase<=>b.downcase}
- f=/^(\S)/.match(word)[1]
- if letter < f.upcase
- while letter < f.upcase
- if alph.length > 0
- letter=alph.shift
- @file_concordance << %{\n
|<\/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=~/^#{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=~/^#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/ \
- or para =~@md.lv1 \
- or para =~@md.lv2 \
- or para =~@md.lv3 \
- or para =~@md.lv4 \
- or para =~@md.lv5 \
- or para =~@md.lv6
- ocnh+=1
- 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=~/^#{Mx[:lv_o]}2:(\S*?)#{Mx[:lv_c]}/ \
- or para =~@md.lv2; ocnh2+=1
- ocn_dv,ocn_sp="2:#{ocnh2}","h#{ocnh}"
- 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=~/^#{Mx[:lv_o]}4:(\S*?)#{Mx[:lv_c]}/ \
- or para =~@md.lv4; ocnh4+=1
- ocn_dv,ocn_sp="4:#{ocnh4}","h#{ocnh}"
- 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=~/^#{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=~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; ocnt+=1 #table
- ocn_dv,ocn_sp="o#{ocno}","t#{ocnt}"
- elsif para=~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/; ocnc+=1 #code block
- ocn_dv,ocn_sp="o#{ocno}","c#{ocnc}"
- 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=~/#{Mx[:lnk_o]}\S+?\.(?:png|jpg|gif)\s+/m; ocni+=1 #image
- ocn_dv,ocn_sp="o#{ocno}","i#{ocni}"
- else ocnp+=1 #paragraph
- ocn_dv,ocn_sp="o#{ocno}","p#{ocnp}"
- end
- end
- o[:txt],o[:node],o[:ocn],o[:lv],o[:type]=para,node,ocn,ocn_dv,ocn_sp
- else ocnu+=1
- #if para=~/-#/ #if implemented would remove need to keep <-#>
- # ocnk+=1
- # ocn_dv,ocn_sp="k#{ocnk}","u#{ocnu}"
- #else
- # ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}"
- #end
- #para.gsub!(/<~#>|<-#>/,'') if para #get rid of need
- 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
- else o[:txt],o[:node],o[:ocn],o[:lv],o[:type]=para,node,nil,nil,nil
- end
- else
- para=if para !~/^%{1,4}\s/
- o[:txt],o[:node],o[:ocn],o[:lv],o[:type]=para,node,nil,nil,nil
- else ''
- end
- end
- end
- 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
- @o_array
- end
- end
- class Code < SiSU_document_structure_code::Code
- end
- class Tables < SiSU_document_structure_tables::Tables
- end
-end
-__END__
diff --git a/lib/sisu/v0/dal_doc_str_code.rb b/lib/sisu/v0/dal_doc_str_code.rb
deleted file mode 100644
index 02643fa3..00000000
--- a/lib/sisu/v0/dal_doc_str_code.rb
+++ /dev/null
@@ -1,187 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: document abstraction
-
-=end
-module SiSU_document_structure_code
- class Instantiate < SiSU_Param::Parameters::Instructions
- @@flag={} #Beware!!
- def initialize
- @@flag['table_to']=false
- @@counter=@@column=@@columns=0
- @@line_mode=''
- end
- end
- class Code
- @@flag={} #Beware!!
- def initialize(md,data)
- @md,@data=md,data
- Instantiate.new
- end
- def code
- data=@data
- tuned_file=[]
- @tuned_group=[]
- @@counter=0
- @verse_count=0
- data.each do |para|
- 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\{/ and not @@flag['code']
- @@flag['code']=true
- @@counter=1
- para.gsub!(/^code\{.*/,"#{Mx[:gr_o]}code#{Mx[:gr_c]}")
- elsif para =~/^(?:poem)\{/ \
- and not @@flag['code']
- @@flag['poem']=true
- 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)\{.*/,"#{Mx[:gr_o]}\\1#{Mx[:gr_c]}")
- end
- if @@flag['code']
- if @@flag['code'] \
- and para =~/^\}code/
- para.gsub!(/^\}code.*/,"#{Mx[:gr_o]}code-end#{Mx[:gr_c]}")
- @@flag['code']=false
- end
- if @@flag['code'] \
- 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(/.+/)
- #@line_mode=[]
- #sub_array.scan(/.+/) {|w| @line_mode << w + '<:br>' if w =~/[\Ss]+/}
- SiSU_document_structure_code::Code.new(@md,@line_mode).code_lines('code')
- para=@line_mode.join
- end
- elsif ( @@flag['poem'] \
- or @@flag['group'] ) \
- and not @@flag['code']
- if @@flag['poem'] \
- and para =~/^\}(?:poem)/
- 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).*/,"#{Mx[:gr_o]}\\1-end#{Mx[:gr_c]}")
- @@flag['group']=false
- end
- if @@flag['poem'] \
- or @@flag['group'] \
- and para =~/\S/ \
- 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(/.+/)
- type=if @@flag['poem']; 'poem'
- else 'group'
- end
- SiSU_document_structure_code::Code.new(@md,@line_mode).code_lines(type)
- div=if @@flag['poem'] \
- and @verse_count > 0
- "\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']
- para = div + @line_mode.join
- else para
- end
- end
- if @@flag['code'] \
- or @@flag['poem'] \
- or @@flag['group']
- @tuned_group << para if para =~/\S+/
- elsif para =~/#{Mx[:gr_o]}(?:code|alt|group|verse)-end#{Mx[:gr_c]}/
- @verse_count=0
- @tuned_group << para
- 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!(/#{Mx[:br_nl]}#{Mx[:br_nl]}(#{Mx[:gr_o]}code-end#{Mx[:gr_c]})/,'\1')
- @tuned_group
- end
- @tuned_group=[]
- else tuned_file << para
- end
- end
- tuned_file
- end
- def code_lines(type='')
- data=@data
- data.each do |line|
- if line =~/\S/ \
- and line !~/^code\{|^\}code|#{Mx[:gr_o]}code.+/
- line.gsub!(/\s\s/,"#{Mx[:nbsp]}#{Mx[:nbsp]}")
- 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!(/$/," #{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!(/$/,"#{Mx[:br_nl]}")
- end
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v0/dal_doc_str_tables.rb b/lib/sisu/v0/dal_doc_str_tables.rb
deleted file mode 100644
index ff29706b..00000000
--- a/lib/sisu/v0/dal_doc_str_tables.rb
+++ /dev/null
@@ -1,198 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: document abstraction tables
-
-=end
-module SiSU_document_structure_tables
- class Instantiate < SiSU_Param::Parameters::Instructions
- @@flag={}
- def initialize
- @@flag['table_to']=false
- @@counter=@@column=@@columns=0
- @@line_mode=''
- end
- end
- class Tables
- @@flag={}
- def initialize(md,data)
- @md,@data=md,data
- Instantiate.new
- end
- def table_visual(para)
- count=0
- @row=[]
- table=[]
- @rows=para.split(/;;/)
- @rows.compact! #(c\d+?;.+?)
- @rows.each do |row|
- count +=1
- @row[count]=row.split(/\|/)
- end
- @row.compact!
- widths=if @row[0].join =~/^\{(?:t|table)(?:~h)?\s+\d+;/
- col_width=@row[0].join.scan(/\d+/)
- rem=(100 - col_width[0].to_i)
- col_w=rem/(@row[1].length - 1)
- "#{col_width[0].to_s};" + ("#{col_w};" * (@row[1].length-1))
- else
- col_w=100/@row[1].length
- "#{col_w};" * @row[1].length
- end
- @row.delete_if {|r| r[0] =~/\{(?:table|t)(?:~h)?(?:\s+c\d+;)?[\d; ]*\}/}
- 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 << Mx[:tc_o] #'
'
- n= -1
- l.each do |c|
- n +=1 #'
' + c + '
'
- table << if c =~/\A(?:\n)?\s*\Z/
- "#{Mx[:tc_p]}#{Mx[:tc_p]}#{w[n]}#{Mx[:tc_p]}" + ' '
- else
- "#{Mx[:tc_p]}#{Mx[:tc_p]}#{w[n]}#{Mx[:tc_p]}" + c.strip
- end
- end
- table << Mx[:tc_c]
- tuned_file << table.join
- end
- end
- tuned_file << "#{Mx[:gr_o]}TZ#{Mx[:gr_c]}" #'
'
- tuned_file=tuned_file.compact.join("\n")
- end
- def tables
- data=@data
- count=0
- @row,@tuned_file,@tuned_table=[],[],[]
- data.each do |para|
- para.gsub!(/\n\s+\n/,"\n")
- para.gsub!(/\s+\n/,"\n")
- para.gsub!(/<:hi>/,'') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200)
- para.gsub!(/<:\/hi>/,%{})
- table=[]
- if para =~/^\{(?:t|table)(?:~h)?(?:\sc\d+;)?[\d; ]*\}/
- @tuned_file << table_visual(para)
- @tuned_file=@tuned_file.flatten
- elsif @@flag['table_to'] \
- or para[/^table\{(?:~h)?/]
- if para[/table\{(?:~h)?\s+c(\d+;.+)/]
- instructions=$1
- @@column=instructions.split(/;\s*/)
- @@columns=@@column[0]
- 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*$/,"#{Mx[:gr_o]}TZ#{Mx[:gr_c]}\n")
- para.gsub!(/\n/,' ') #newlines taken out
- para.strip!
- @tuned_table << para
- @tuned_table.delete('')
- @tuned_file << @tuned_table.compact.join("\n") #@tuned_table.compact.join =~/\S+/ #would be preferable
- para=''
- @tuned_table=[]
- @@flag['table_to']=false
- end
- if @@flag['table_to'] \
- and para =~/\S/
- @@counter=1
- sub_array=para.dup
- @@line_mode=sub_array.scan(/.+/u)
- Tables.new(@md,@@line_mode).tr_td
- para=@@line_mode.join
- para.gsub!(/(.*\S+.*)\Z/m,"#{Mx[:tc_o]}\\1#{Mx[:tc_c]}") unless para =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u
- end
- para.gsub!(/\n/,' ')
- para.strip!
- @tuned_table << para
- else
- para.gsub!(/\n/,' ') unless para =~/#{Mx[:gr_o]}(?:code|verse|alt|group)#{Mx[:gr_c]}/
- para.strip!
- @tuned_file << para
- end
- @tuned_file
- end
- @tuned_file
- end
- def tr_td
- data=@data
- data.each do |line|
- if @@counter <= @@columns.to_i \
- 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!(/(.+)/,"#{Mx[:tc_p]}#{Mx[:tc_p]}#{@@column[@@counter]}#{Mx[:tc_p]}\\1") unless line =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u
- @@counter+=1
- end
- end
- data
- end
- end
-end
-__END__
-#p line.encoding
-@data.each {|x| p x.encoding }
-p para if para.encoding.inspect =~/Encoding:ASCII-8BIT/
diff --git a/lib/sisu/v0/dal_endnotes.rb b/lib/sisu/v0/dal_endnotes.rb
deleted file mode 100644
index 77909443..00000000
--- a/lib/sisu/v0/dal_endnotes.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_endnotes
- class Endnotes
- def initialize(md,data,endnote_array=nil)
- @md,@data,@endnote_array=md,data,endnote_array
- @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1
- end
- def endnotes
- data=@data
- @tuned_file=[]
- endnote_no,endnote_ref=1,1
- #% endnote work zone
- data.each do |para|
- # manually numbered endnotes -->
- if @md.mod.inspect =~/--no-asterisk|--no-annotate/
- para.gsub!(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'')
- end
- if @md.mod.inspect =~/--no-dagger|--no-annotate/
- para.gsub!(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'')
- end
- unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- case para
- # auto-numbered endnotes -->
- when /#{Mx[:en_a_o]}.+?#{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(/#{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
- end
- end
- @tuned_file << para
- end
- @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1
- @tuned_file=@tuned_file.flatten
- end
- def endnote_call_number(data)
- data.each do |word|
- unless data =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
- case word
- 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 /#{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!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@endnote_counter_asterisk} ")
- @endnote_counter_asterisk+=1
- end
- when /~\^|<:e>/
- if @endnote_array
- word.gsub!(/~\^|<:e>/,"#{@endnote_array[@endnote_counter-1]}")
- @endnote_counter+=1
- end
- end
- end
- end
- end
- end
-end
-__END__
-
diff --git a/lib/sisu/v0/dal_expand_insertions.rb b/lib/sisu/v0/dal_expand_insertions.rb
deleted file mode 100644
index 90102c7d..00000000
--- a/lib/sisu/v0/dal_expand_insertions.rb
+++ /dev/null
@@ -1,196 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_insertions
- class Insertions
- def initialize(data)
- @data=data
- end
- def output_filetypes_in_cmd(cmd_shortcut,source=nil)
- #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used
- cf_defaults=SiSU_Env::Info_processing_flag.new
- cmd_list=case cmd_shortcut.inspect
- when /0/; cf_defaults.cf_0
- when /1/; cf_defaults.cf_1
- when /2/; cf_defaults.cf_2
- when /3/; cf_defaults.cf_3
- when /4/; cf_defaults.cf_4
- when /5/; cf_defaults.cf_5
- end
- file_type_names={}
- file_type_names[:gen],file_type_names[:src]=[],[]
- file_type_names[:gen] <<= if cmd_list =~ /y/; 'sisu_manifest.html'
- end
- file_type_names[:gen] <<= if cmd_list =~ /h/; ['toc.html', 'doc.html']
- end
- file_type_names[:gen] <<= if cmd_list =~ /p/; ['landscape.pdf', 'portrait.pdf']
- end
- #file_type_names[:gen] <<= if cmd_list =~ /i/; 'manpage.1'
- #end
- file_type_names[:gen] <<= if cmd_list =~ /o/; 'opendocument.odt'
- end
- file_type_names[:gen] <<= if cmd_list =~ /b/; 'scroll.xhtml'
- end
- file_type_names[:gen] <<= if cmd_list =~ /x/; 'sax.xml'
- end
- file_type_names[:gen] <<= if cmd_list =~ /X/; 'dom.xml'
- end
- file_type_names[:gen] <<= if cmd_list =~ /a/; 'plain.txt'
- end
- file_type_names[:gen] <<= if cmd_list =~ /g/; 'wiki.txt'
- end
- file_type_names[:gen] <<= if cmd_list =~ /w/; 'concordance.html'
- end
- file_type_names[:gen] <<= if cmd_list =~ /N/; 'digest.txt'
- end
- file_type_names[:src] <<= if source and cmd_shortcut =~ /s/; source
- end
- file_type_names[:src] <<= if cmd_shortcut =~ /S/; "#{source}.zip"
- end
- file_type_names[:gen]=file_type_names[:gen].flatten
- file_type_names[:src]=file_type_names[:src].flatten
- file_type_names
- end
- def expand_insertions?
- data=@data
- tuned_file,tuned_file_tmp=[],[]
- data.each do |para|
- if para !~/^%+\s/ \
- and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/
- txt,cmd,source,url_dir,note,manifest=nil,nil,nil,nil,nil,nil
- @u=SiSU_Env::Info_env.new.url
- if defined? @u.remote
- if para =~/(.+?)\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/m
- pre,txt,cmd,source,url_dir,note="#{$1.strip} ",$2,$3,$4,$5,$6
- elsif para =~/\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/
- pre,txt,cmd,source,url_dir,note='',$1,$2,$3,$4,$5
- end
- 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+#{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
- end
- tuned_file_tmp << manifest
- output_filetypes=output_filetypes_in_cmd(cmd,source)
- output_filetypes[:gen].each do |o_f|
- describe = case o_f
- when /sisu_manifest.html/; '~^ document manifest'
- when /toc.html/; ' html, segmented text'
- when /doc.html/; ' html, scroll, document in one'
- when /landscape.pdf/; ' pdf, landscape'
- when /portrait.pdf/; ' pdf, portrait'
- when /opendocument.odt/; ' odf:odt, open document text'
- when /scroll.xhtml/; ' xhtml scroll'
- when /sax.xml/; ' xml, sax'
- when /dom.xml/; ' xml, dom'
- when /plain.txt/; ' plain text utf-8'
- #when /manpage.1/; ' man, 1'
- when /wiki.txt/; ' wiki text'
- when /concordance.html/; ' concordance'
- when /digest.txt/; ' dcc, document content certificate (digests)'
- else nil
- end
- if describe
- tuned_file_tmp << if @u.remote #to double space <:br> at beginning of entry
- if describe =~/^~\^ /
- "#{Mx[:nbsp]*4} {#{describe} }#{@u.remote}/#{url_dir}/#{o_f} "
- else
- "#{Mx[:nbsp]*4} { #{describe} }#{@u.remote}/#{url_dir}/#{o_f} "
- end
- else
- if describe =~/^~\^ /
- "#{Mx[:nbsp]*4} {#{describe} }../#{url_dir}/#{o_f} "
- else "#{Mx[:nbsp]*4} { #{describe} }../#{url_dir}/#{o_f} "
- end
- end
- end
- end
- output_filetypes[:src].each do |o_f|
- describe=case o_f
- when /#{source}\.zip/; ' markup source (zipped) pod'
- when /#{source}/; ' markup source text'
- else nil
- end
- if describe
- tuned_file_tmp << if @u.remote
- x=if describe =~/zip/
- "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_pod}/#{o_f} "
- else "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_txt}/#{o_f} "
- end
- else
- x=if describe =~/zip/
- "#{Mx[:nbsp]*4} { #{describe} }../pod/#{o_f} "
- else "#{Mx[:nbsp]*4} { #{describe} }../zip/#{o_f} "
- end
- end
- end
- end
- tuned_file << 'group{' << tuned_file_tmp.join("\n") << '}group'
- #tuned_file << 'group{' << tuned_file_tmp.join("\n").strip << '}group'
- tuned_file_tmp=[]
- else tuned_file << para
- end
- end
- tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v0/dal_hash_digest.rb b/lib/sisu/v0/dal_hash_digest.rb
deleted file mode 100644
index 2b7370ca..00000000
--- a/lib/sisu/v0/dal_hash_digest.rb
+++ /dev/null
@@ -1,173 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: system environment, resource control and configuration details
-
-=end
-
-module SiSU_hash
- class Object_digest
- def initialize(md,data,env=nil)
- @md,@data,@env=md,data,env
- @env ||=SiSU_Env::Info_env.new(@md.fns)
- end
- def object_digest
- # 1. clean/stripped text without any markup, paragraph, headings etc. without endnotes
- # 2. endnotes clean/stripped text digest only (there may be several endnotes within a paragraph)
- # 3. whole object, text with markup and any endnotes, (question: with or without the endnote digests??? presumption better without, [however may be easier to check with?])
- # [digests should not include other digests]
- # vim==/<[0-9a-f]\{#{@@dl}\}\(:[0-9a-f]\{#{@@dl}\}\)\?>/
- require 'digest/md5'
- require 'digest/sha2'
- data=@data
- @tuned_file=[]
- data.compact!
- data.each do |para|
- para.strip!
- 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)
- end
- else
- for hash_class in [ Digest::MD5 ]
- @tuned_file << stamped(para,hash_class)
- end
- end
- else @tuned_file << para unless para.nil?
- end
- end
- @tuned_file=@tuned_file.flatten
- #use md5 or to create hash of each dal object including ocn, & add into to each dal object
- end
- def endnote_digest(data)
- para_bit=[]
- data.each do |en_plus|
- para_bit <<= case en_plus
- 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 + 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
- end
- end
- para_bit.join
- end
- def stamped(para,hash_class)
- @tuned=[]
- para=strip_clean_extra_spaces(para)
- 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 =~/#{Mx[:fa_o]}code#{Mx[:fa_c]}/
- case para
- 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*(#{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]
- #/(?:.*?#{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 + 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 + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil?
- end
- @tuned.join
- end
- def strip_clean_extra_spaces(s) # dal output tuned
- s=s.dup
- s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
- s=s.gsub(/ [ ]+/,' ')
- s=s.gsub(/^ [ ]+/,'')
- s=s.gsub(/ [ ]+$/,'')
- 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]>|#{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]')
- s=s.gsub(/(?:#{Mx[:nbsp]})+/,' ')
- #s=s.gsub(//,"[TABLE]\n") # tables
- #s=s.gsub(//,'\1') # tables
- #s=s.gsub(/¡¡\d+¡/,' ') # tables
- #s=s.gsub(/¡/,' ') # tables tidy later
- #s=s.gsub(/<.+?>/,'')
- s=s.gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search
- s=s.gsub(/\s\s+/,' ')
- s=s.strip
- end
- end
-end
-__END__
-
diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb
deleted file mode 100644
index fec0e1ed..00000000
--- a/lib/sisu/v0/dal_idx.rb
+++ /dev/null
@@ -1,323 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_book_index
- class Book_index
- def initialize(md,data,env=nil)
- @md,@data,@env=md,data,env
- @rgx_idx=/#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/
- #@rgx_idx=/\s*#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/
- @rgx_idx_ocn_init=/#{Mx[:idx_o]}(.+?)#{Mx[:idx_c]}\s*#{Mx[:id_o]}~(\d+)\S+?#{Mx[:id_c]}/
- @rgx_idx_ocn_seg=/(.+?)~(\d+)~(\S+)/
- @rgx_idx_ocn=/(.+?)~(\d+)/
- @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_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]}$")
- @env ||=SiSU_Env::Info_env.new(@md.fns)
- end
- def indexing_song
- data=@data
- data,sisu_markup_idx,html_idx=extract_book_index(data)
- data=clean_and_insert_index(data,sisu_markup_idx)
- [data,sisu_markup_idx,html_idx]
- end
- def extract_book_index(data)
- tuned_file=[]
- idx_array=[]
- data.each do |para|
- if para =~@rxp_seg; @seg=para[@rxp_seg,1]
- end
- idx_array << @rgx_idx_ocn_init.match(para)[0].gsub(@rgx_idx_ocn_init,"\\1~\\2~#{@seg}") if para =~ @rgx_idx_ocn_init
- tuned_file << para if para
- end
- idx_array=construct_idx_array(idx_array) if idx_array.length > 0
- if idx_array.length > 0
- the_idx=construct_book_index(idx_array)
- #screen_print(the_idx) if @md.cmd.inspect =~/V/
- sisu_markup_idx,html_idx=nil,nil
- if @md.book_idx
- idx=index(the_idx)
- output_html_idx(idx[:html])
- html_idx=idx[:html]
- sisu_markup_idx=idx[:sst]
- end
- end
- [tuned_file,sisu_markup_idx,html_idx]
- end
- def construct_idx_array(idx_array)
- idx_lst=[]
- idx_array.each do |idx|
- idx_list,ocn,seg=@rgx_idx_ocn_seg.match(idx)[1..3]
- idx_lst <<=if idx_list =~/;/
- g=idx_list.scan(/[^;]+/)
- idxl=[]
- g.each do |i|
- i.strip!
- idxl << { :rough_idx => i, :ocn => ocn, :seg => seg }
- end
- idxl
- else { :rough_idx => idx_list, :ocn => ocn, :seg => seg }
- end
- end
- idx_lst.flatten!
- idx_lst
- end
- def construct_book_index(idx_array)
- @the_idx={}
- idx_array.each do |idx|
- idx_lst=idx[:rough_idx].scan(/[^|:]+/)
- idx_lst[0].strip!
- if idx_lst[0] =~/.+?\+\d+/
- use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2]
- else use=idx_lst[0]
- end
- use=use[0].chr.capitalize + use[1,use.length]
- @the_idx[use]={} unless @the_idx[use] and defined? @the_idx[use]
- idx_lst.each do |i|
- i.strip!
- i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/
- x=if idx_lst.length == 1 or idx_lst[0].gsub(/\+\d+/,'') == i
- @the_idx[use]['term_node_lev1']=[] unless @the_idx[use]['term_node_lev1'] and defined? @the_idx[use]['term_node_lev1']
- x=if r
- @the_idx[use]['term_node_lev1'] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", :seg => idx[:seg] }
- "#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
- else
- @the_idx[use]['term_node_lev1'] << { :ocn => idx[:ocn], :seg => idx[:seg] }
- "#{i} #{idx[:ocn]}"
- end
- else
- @the_idx[use]['term_node_lev2']={} unless @the_idx[use]['term_node_lev2'] and defined? @the_idx[use]['term_node_lev2']
- @the_idx[use]['term_node_lev2'][i]=[] unless @the_idx[use]['term_node_lev2'][i] and defined? @the_idx[use]['term_node_lev2'][i]
- x=if r
- @the_idx[use]['term_node_lev2'][i] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", :seg => idx[:seg] }
- "#{idx_lst[0]}:#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
- else
- @the_idx[use]['term_node_lev2'][i] << { :ocn => idx[:ocn], :seg => idx[:seg] }
- "#{idx_lst[0]}:#{i} #{idx[:ocn]}"
- end
- end
- end
- end
- the_idx=@the_idx.sort
- #p the_idx; p '-----'
- the_idx
- end
- def index(the_idx)
- @x=1
- @idx={}
- @idx[:sst],@idx[:html]=[],[]
- @idx[:sst] << "\n\n#{Mx[:br_page_new]}"
- @idx[:sst] << "\n\n#{Mx[:lv_o]}2:#{Mx[:lv_c]}Index #{Mx[:id_o]}~0;0:0;x0#{Mx[:id_c]}"
- @idx[:sst] << "\n\n#{Mx[:lv_o]}4:idx#{Mx[:lv_c]} [Index] #{Mx[:pa_non_object_dummy_heading]} #{Mx[:id_o]}~0;0:0;x0#{Mx[:id_c]}"
- alph=%W[9 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]
- @idx[:html] << '
'
- alph.each do |x|
- @idx[:html] << if x =~/[0-9]/; ''
- else
- %{#{x}, }
- end
- end
- @idx[:html] << '
'
- letter=alph.shift
- @idx[:html] << %{\n
}
- the_idx.each do |i|
- i.each do |x|
- if x.class == String
- f=/^(\S)/.match(x)[1]
- if letter < f
- while letter < f
- if alph.length > 0
- letter=alph.shift
- @idx[:html] << %{\n
}
- else break
- end
- end
- end
- @idx[:sst] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} }
- aname=x.gsub(/\s+/,'_')
- @idx[:html] << %{\n
#{x}, }
- @o=@idx[:sst].index(@idx[:sst].last) #@o=@idx[:sst].length - 1
- @q=@idx[:html].index(@idx[:html].last) #@o=@idx[:html].length - 1
- print "\n" + x + ', ' if @md.cmd =~/V/
- elsif x.class == Array
- p 'array error? -->'
- print x
- elsif x.class == Hash
- if x['term_node_lev1'].class == Array
- x['term_node_lev1'].each do |a|
- if a[:range]
- @idx[:sst][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{a[:seg]}.html##{a[:ocn]}, }
- @idx[:html][@q]=@idx[:html][@q] + %{#{a[:range]}, }
- print a[:range] + ', ' if @md.cmd =~/V/
- elsif a[:ocn]
- @idx[:sst][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{a[:seg]}.html##{a[:ocn]}, }
- @idx[:html][@q]=@idx[:html][@q] + %{#{a[:ocn]}, }
- print a[:ocn] + ', ' if @md.cmd =~/V/
- else p 'error'
- end
- end
- @idx[:html][@q]=@idx[:html][@q] + '
'
- end
- if x['term_node_lev2']
- m=x['term_node_lev2']
- m=m.sort
- m.each do |k,y|
- if k !~/term_node_lev1/
- @idx[:sst][@o]=@idx[:sst][@o] + %{#{k}, }
- @idx[:html][@q]=@idx[:html][@q] + %{\n
#{k}, }
- print "\n\t" + k + ', ' if @md.cmd =~/V/
- y.each do |z|
- if z[:range]
- @idx[:sst][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{z[:seg]}.html##{z[:ocn]}, }
- @idx[:html][@q]=@idx[:html][@q] + %{#{z[:range]}, }
- print z[:range] + ', ' if @md.cmd =~/V/
- elsif z[:ocn]
- @idx[:sst][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{z[:seg]}.html##{z[:ocn]}, }
- @idx[:html][@q]=@idx[:html][@q] + %{#{z[:ocn]}, }
- print z[:ocn] + ', ' if @md.cmd =~/V/
- else p 'error'
- end
- end
- @idx[:html][@q]=@idx[:html][@q] + '
'
- end
- end
- end
- @idx[:sst][@o]=@idx[:sst][@o] + " #{Mx[:id_o]}~0;0:0;x#{@x}#{Mx[:id_c]}"
- @x +=1
- end
- end
- end
- print "\n" if @md.cmd =~/V/
- @idx
- end
- def screen_print(the_idx)
- the_idx.each do |i|
- i.each do |x|
- if x.class == String
- print "\n" + x + ', '
- elsif x.class == Array
- p 'array error? -->'
- print x
- elsif x.class == Hash
- if x['term_node_lev1'].class == Array
- x['term_node_lev1'].each do |a|
- if a[:range]
- print a[:range] + ', '
- elsif a[:ocn]
- print a[:ocn] + ', '
- else p 'error'
- end
- end
- end
- if x['term_node_lev2']
- m=x['term_node_lev2']
- m=m.sort
- m.each do |k,y|
- if k !~/term_node_lev1/
- print "\n\t" + k + ', '
- #p y
- y.each do |z|
- if z[:range]
- print z[:range] + ', '
- elsif z[:ocn]
- print z[:ocn] + ', '
- else p 'error'
- end
- end
- end
- end
- end
- end
- end
- end
- end
- def output_html_idx(html_idx)
- if @md.book_idx
- path="#{@env.path.output}/#{@md.fnb}"
- Dir.mkdir(path) unless FileTest.directory?(path)
- html_index_file=File.new("#{path}/#{@md.fn[:book_idx_html]}",'w')
- html_idx.each {|x| html_index_file << x }
- html_index_file.close
- end
- end
- def clean_and_insert_index(data,sisu_markup_idx)
- tuned_file=[]
- data.each do |para|
- para.gsub!(/\n*#{@rgx_idx}/m,'')
- tuned_file << para
- if para =~/#{Mx[:br_endnotes]}/ and sisu_markup_idx
- sisu_markup_idx.each do |idx|
- tuned_file << idx
- end
- end
- end
- tuned_file
- end
- def clean_index(data)
- tuned_file=[]
- data.each do |para|
- para.gsub!(/\n*#{@rgx_idx}/m,'')
- tuned_file << para
- end
- tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v0/dal_images.rb b/lib/sisu/v0/dal_images.rb
deleted file mode 100644
index 621ac986..00000000
--- a/lib/sisu/v0/dal_images.rb
+++ /dev/null
@@ -1,123 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_images
- class Images
- def initialize(md,data)
- @md,@data=md,data
- end
- def images
- data=@data
- tuned_file=[]
- @rmgk=false
- if SiSU_Env::Info_settings.new.program?('rmagick'); @rmgk=SiSU_Env::Load.new('RMagick').prog
- else tell=SiSU_Screen::Ansi.new(@md.cmd,'use of RMagick is not enabled in sisurc.yml')
- tell.warn if @md.cmd =~/[vVM]/
- end
- data.each do |para|
- para.strip!
- if para =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/
- if para !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+\s+/
- m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/
- if @rmgk
- imgs=para.scan(m).flatten
- images=imgs.each do |image|
- dir=SiSU_Env::Info_env.new(@md.fns)
- path_image=[dir.path.image_source_local_tex,dir.path.image_source_remote_tex,dir.path.image_source_tex]
- image_path=nil
- path_image.each do |image_path|
- break if FileTest.exist?("#{image_path}/#{image}")
- end
- if FileTest.exist?("#{image_path}/#{image}")
- img=Magick::ImageList.new("#{image_path}/#{image}")
- img_col,img_row=img.columns,img.rows
- if img_col > img_row #landscape
- if img_col> 640 #480
- img_col=640 #480
- img_row=((1.00*img_col/img.columns)*img.rows).round
- end
- else #portrait
- if img_col> 640 #480
- img_col=640 #480
- img_row=((1.00*img_col/img.columns)*img.rows).round
- end
- if img_row > 640
- img_row=640
- img_col=((1.00*img_row/img.rows)*img.columns).round
- end
- end
- para.gsub!(/(#{image})/,"#{image} #{img_col}x#{img_row}")
- else para.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}((?:https?|file|ftp):\S+|image)/,'[ \1 (\2 missing) ]')
- end
- end
- else
- images=para.scan(m) do |image|
- tell=SiSU_Screen::Ansi.new(@md.cmd,'where image dimensions have not been provided RMagick is required',image)
- tell.warn #unless @opt.cmd =~/q/
- end
- end
- end
- end
- para.gsub!(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ') if para =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/
- tuned_file << para unless para.nil?
- end
- tuned_file
- end
- end
-end
-__END__
diff --git a/lib/sisu/v0/dal_metadata.rb b/lib/sisu/v0/dal_metadata.rb
deleted file mode 100644
index bdf0dace..00000000
--- a/lib/sisu/v0/dal_metadata.rb
+++ /dev/null
@@ -1,225 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_metadata
- class Metadata
- def initialize(md,data)
- @md,@data=md,data
- l=SiSU_Env::Standardise_language.new.file_to_language(md.fns)
- language=l[:l]
- @tr=SiSU_Translate::Source.new(md,language)
- end
- def metadata
- data=@data
- meta,@dc,@rc,@cvs,dctitle,add=Array.new(6){[]}
- dir=SiSU_Env::Info_env.new(@md.fns)
- base_html="#{dir.url.root}/#{@md.fnb}"
- ocnm=ocnd=ocnv=0
- ocnm+=1
- 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="\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="#{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- ocnm+=1; ocnd+=1
- head_no_dc_tag="#{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
- data.each do |para|
- case para
- 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 /^#{Mx[:meta_o]}title#{Mx[:meta_c]}/
- "\n#{@tr.full_title}: #{Mx[:fa_underscore_o]}#{@md.full_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.author}: #{Mx[:fa_underscore_o]}#{@md.author}#{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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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_loc#{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="#{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- ocnm+=1; ocnv+=1
- 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}: #{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}: #{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: #{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
- end
- end
- if true #default version information
- ocnm+=1; ocnv+=1
- if @md.sc_filename \
- and @md.sc_filename.length > 3
- @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: #{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]} #{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]} #{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 << "#{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}: #{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}: #{Mx[:fa_underscore_o]} #{@md.ruby_version}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
- end
- 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 << "#{Mx[:fa_bold_o]}Version Information#{Mx[:fa_bold_c]} #{head_no_rc}" if @rc.length > 0
- if @cvs.length > 0
- 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#{Mx[:br_eof]}"
- meta=SiSU_hash::Object_digest.new(@md,meta,@env).object_digest
- end
- end
-end
-__END__
diff --git a/lib/sisu/v0/dal_numbering.rb b/lib/sisu/v0/dal_numbering.rb
deleted file mode 100644
index 05123bbc..00000000
--- a/lib/sisu/v0/dal_numbering.rb
+++ /dev/null
@@ -1,368 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_numbering
- class Numbering
- def initialize(md,data)
- @md,@data=md,data
- end
- def numbering_song
- data=@data
- data=number_plaintext_para(data)
- data=name_endnote_seg(data) #tr issue
- data=auto_number_heading_ie_title(data) #tr issue
- data=ocn(data) #watch
- data=minor_numbering(data)
- data=name_para_seg_filename(data)
- data=set_heading_seg(data) unless @md.set_heading_seg
- data=set_heading_top(data) unless @md.set_heading_top
- data=set_header_title(data) unless @md.set_header_title
- data
- end
- def number_plaintext_para(data)
- @tuned_file=[]
- data.each do |para|
- 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
- @tuned_file=@tuned_file.flatten
- end
- def name_endnote_seg(data)
- tuned_file=data
- if @md.flag_auto_endnotes \
- and @md.flag_separate_endnotes_make
- 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#{Mx[:br_endnotes]}" #DECIDE ON
- tuned_file=tuned_file.flatten
- end
- def owner_details_seg
- data << "#{Mx[:lv_o]}4:owner.details#{Mx[:lv_c]}Owner Details"
- end
- def number_sub_heading(para,num,title_no)
- case para
- 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!(/^#{Mx[:lv_o]}[5-9]:\S*?#{Mx[:lv_c]}/,'!_ ') #bold line, watch
- end
- para
- end
- def auto_number_heading_ie_title(data) #also does some segment naming
- @tuned_file=[]
- if @md.markup =~/num_top/ \
- or @md.num_top # watch, 2003w23
- input="#{@md.markup}"[/num_top\=([1-6])/,1] if @md.markup
- input||=@md.num_top if @md.num_top !~/^$/
- end
- num_top=input.to_i
- t_no1=t_no2=t_no3=t_no4=0
- no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3)
- t_not=0
- data.each do |para| #@md.seg_names << [additions to segment names]
- if (@md.markup =~/num_top/ \
- or (@md.num_top \
- and @md.num_top !~/^$/)) \
- and para !~/^#{Rx[:meta]}/
- if (para =~/^(?:#{no1}|^#{no2}|^#{no3}#{no4})~#/ \
- and para !~/^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}/)
- t_not+=1 #; t_no2=0; t_no3=0
- para.gsub!(/^(#{Mx[:lv_o]}(?:#{no1}|#{no2}|#{no3}|#{no4})):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2")
- end
- if para =~/#{Mx[:lv_o]}#{no1}:/
- @subnumber=1
- @subnumber=0 if para =~/#{Mx[:lv_o]}#{no1}:/
- end
- 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!(/^#{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 =~/^#{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 =~/^#{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 =~/^#{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 =~/^#{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 =~/^#{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
- 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
- end
- @tuned_file << para
- end
- @tuned_file=@tuned_file.flatten
- end
- def ocn(data) #and auto segment numbering increment
- @tuned_file=[]
- object_array=SiSU_document_structure::OCN.new(@md,data).ocn
- object_array.each do |o|
- @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
- @tuned_file=@tuned_file.flatten
- end
- def minor_numbering(data) #and auto segment numbering increment
- @tuned_file=[]
- number_small,letter_small=0,0
- 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 !~/^%% |#{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
- number_small=0 if para =~ /^#1/
- number_small+=1
- para.gsub!(/^#[ 1]/,"#{number_small}. ") #change 2004
- end
- if para =~/^_# /
- para.gsub!(/^_# /,"#{Mx[:fa_o]}:i1#{Mx[:fa_c]} #{letter[letter_small]}. ") #change 2004
- letter_small+=1
- end
- end
- end
- @tuned_file << para
- end
- @tuned_file=@tuned_file.flatten
- end
- def name_para_seg_filename(data)
- # paragraph name/numbering rules
- # manual naming overrides, manual naming may be
- # alpha-numeric characters mixed,
- # numeric only (a number), if
- # all segments have been named,
- # the numbers used are over 1000 or
- # it is not minded that auto-numbering uses a funny scheme for naming segments (not yet implemented)
- # [for now a warning is printed for such documents on use of maintenance or very-verbose flag]
- # auto-naming takes the form of giving numbers to segments
- # the rules for which are as follows
- # if the title/heading text starts with a numeric, then that is used (1 3.1 3rd etc.)
- # otherwise the level 4 segment number from the embedded document structure info is used
- # if there is none a sequential number is designated, preceded by an underscore
- @tuned_file=[]
- art_filename_auto=1
- @counter=1
- @unique_auto_name=[]
- if not @md.seg_autoname_safe and @md.cmd =~/[MV]/
- puts 'manual segment names, numbers used as names, risk warning (segmented html)'
- end
- data.each do |para|
- para=SiSU_document_structure::Structure.new(@md,para).structure_markup
- 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 =~/^#{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!(/^#{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 =~/^#{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!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1#{pattern}#{Mx[:lv_c]}")
- @md.seg_names << pattern
- else
- 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 =~/^#{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!(/^#{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 =~/^#{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 << "#{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
- end
- else para
- end
- end
- if @md.seg_names.length > 0
- @md.set_heading_seg=true
- end
- @tuned_file=@tuned_file.flatten
- end
- def set_heading_top(data) #% make sure no false positives
- unless @md.set_heading_top
- puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.cmd =~/[MV]/
- @tuned_file=[]
- data.each do |para|
- unless @md.set_heading_top
- if para !~/^(?:#{Rx[:meta]}|@\S+:|0~\S+)\s/m \
- and para !~/\A\s*\Z/m
- @md.set_heading_top=true
- 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
- end
- @tuned_file << para
- end
- @tuned_file=@tuned_file.flatten
- end
- end
- def set_heading_seg(data) #% make sure no false positives
- unless @md.set_heading_seg
- puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.cmd =~/[MV]/
- @tuned_file=[]
- data.each do |para|
- unless @md.set_heading_seg
- if para !~/^(?:#{Rx[:meta]}|#{Mx[:lv_o]}[123]:\S*?#{Mx[:lv_c]})/m \
- and para !~/\A\s*\Z/m \
- and para !~/#{Mx[:br_page]}|#{Mx[:br_page_new]}/
- @md.set_heading_seg=true
- 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
- end
- @tuned_file << para
- end
- @tuned_file=@tuned_file.flatten
- end
- end
- def set_header_title(data) #% make sure no false positives
- unless @md.set_header_title
- puts "\t no document title provided, (will have to manufacture one)" if @md.cmd =~/[MV]/
- @tuned_file=[]
- data.each do |para|
- unless @md.set_header_title
- if para !~/^%{1,2}\s/m \
- and para !~/\A\s*\Z/m
- @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
- end
- @tuned_file << para
- end
- @tuned_file=@tuned_file.flatten
- end
- end
- end
-end
-__END__
diff --git a/lib/sisu/v0/dal_substitutions_and_insertions.rb b/lib/sisu/v0/dal_substitutions_and_insertions.rb
deleted file mode 100644
index cadae8a7..00000000
--- a/lib/sisu/v0/dal_substitutions_and_insertions.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: system environment, resource control and configuration details
-
-=end
-module SiSU_substitute_and_insert
- class SI
- def initialize(md,data)
- @md,@data=md,data
- @skin=SiSU_Env::Info_skin.new(@md)
- end
- def substitutions_and_insertions?
- data=@data
- 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 precedes it)
- data[0].gsub!(/^#!\s*\/usr\/bin\/sisu/,'')
- data[0].gsub!(/^#!\s*\/usr\/bin\/env sisu/,'')
- end
- if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier
- data[0].gsub!(/^(SiSU\s*[\d.]*)$/,'% \1')
- data[0].gsub!(/^(sisu-[\d.]+)$/,'% \1')
- end
- data.each do |para|
- if para =~/<:insert\d+!?>/ \
- and para !~/^%\s+/
- @skin.select
- ins=SiSU_Viz::Inserts.new
- case para
- when /^\s*<:insert1>\s*$/
- para=[]
- ins.insert1.split(/\n\n/).each{|x| para << x }
- when /^\s*<:insert2>\s*$/
- para=[]
- ins.insert2.split(/\n\n/).each{|x| para << x }
- when /^\s*<:insert3>\s*$/
- para=[]
- ins.insert3.split(/\n\n/).each{|x| para << x << "\n"}
- para=ins.insert3
- when /^\s*<:insert4>\s*$/
- para=[]
- ins.insert4.split(/\n\n/).each{|x| para << x << "\n"}
- para=ins.insert4
- when /^\s*<:insert5>\s*$/
- para=[]
- ins.insert5.split(/\n\n/).each{|x| para << x << "\n"}
- when /^\s*<:insert6>\s*$/
- para=[]
- ins.insert6.split(/\n\n/).each{|x| para << x << "\n"}
- when /^\s*<:insert7>\s*$/
- para=[]
- ins.insert7.split(/\n\n/).each{|x| para << x << "\n"}
- end
- 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
- end
- end
- end
-end
-__END__
-
diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb
deleted file mode 100644
index e917621a..00000000
--- a/lib/sisu/v0/dal_syntax.rb
+++ /dev/null
@@ -1,427 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: Syntax for markup, input markup syntaxes, determined here
-
-=end
-module SiSU_Syntax
- class Words
- def initialize(line,md,mkp)
- @line,@md,@mkp=line,md,mkp
- end
- end
- class Markup
- def initialize(md='',data='')
- @data,@md=data,md
- @vz=SiSU_Env::Get_init.instance.skin
- @data_new=[]
- url_and_stub=SiSU_Env::Info_env.new.url
- @output_url="#{url_and_stub.remote}"
- @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=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?}
- bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)}
- ital_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/
- elsif defined? @md.make_italic[:str]
- /#@http_m|#{bold_line}|#@manmkp_ital#{tail_m_ital}|#{@md.make_italic[:str]}#{tail_m_ital}|\S+|\n/
- elsif defined? @vz.markup_make_italic[:str]
- /#@http_m|#{bold_line}|#@manmkp_ital#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/
- end
- @manmkp_bold='^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]'
- @line_scan_bold=if (defined? @md.make_bold[:str] \
- and @md.make_bold[:str]) \
- and (defined? @vz.markup_make_bold[:str] \
- and @vz.markup_make_bold[:str])
- /#@http_m|#{bold_line}|(?:#@manmkp_bold|#{@md.make_bold[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/
- elsif defined? @md.make_bold[:str] \
- and @md.make_bold[:str]
- /#@http_m|#{bold_line}|(?:#@manmkp_bold|#{@md.make_bold[:str]})#{tail_m_bold}|\S+|\n/
- elsif defined? @vz.markup_make_bold[:str] \
- and @vz.markup_make_bold[:str]
- /#@http_m|#{bold_line}|(?:#@manmkp_bold|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/
- end
- end
- def songsheet
- @data.each do |line|
- line=if @md.sem_tag then sem(line) else line end
- line=pre(line)
- line=wordlist_italics(line)
- line=wordlist_bold(line)
- line=bodymarkup(line)
- @data_new << line
- end
- @data_new
- end
- def sem(line)
- line=SiSU_sem::Tags.new(line,@md).rm.all
- 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
- end
- def wordlist_italics(line)
- line=line.dup
- if (defined? @md.make_italic[:str] \
- and @md.make_italic[:str]) \
- or (defined? @vz.markup_make_italic[:str] \
- and @vz.markup_make_italic[:str])
- line= if line !~/^(?:#{Rx[:meta]}|#{Mx[:gr_o]}code)/ #!~/^(?:[0-6]~|!_|%+\s)/
- word=line.scan(@line_scan_ital)
- word.flatten!
- word.compact! #reinstated
- line_array=[]
- word.each do |w|
- unless /#@manmkp_ital|#@http_m/.match(w)
- if defined? @md.make_italic[:regx] \
- and @md.make_italic[:regx]
- 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,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
- end
- end
- line_array << w
- end
- line_array.join(' ')
- else line
- end
- end
- line
- end
- def embolden(given)
- given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})http:\/\/\S+.*?)( )/,"#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2")
- given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})http:\/\/\S+.*)/,"#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}")
- 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 italicise(given)
- given.gsub!(/^\/_\s*(.+?)( )/,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2")
- given.gsub!(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2")
- given.gsub!(/^\/_\s*(.+?)\s*([~-]#)$/,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2")
- given.gsub!(/^\/_\s+(.*)?\s*$/,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
- end
- def wordlist_bold(line)
- line=line.dup
- if (defined? @md.make_bold[:str] \
- and @md.make_bold[:str]) \
- or (defined? @vz.markup_make_bold[:str] \
- and @vz.markup_make_bold[:str])
- 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!
- word.compact!
- word.each do |w|
- 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],"#{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,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
- end
- else
- 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!
- elsif w =~/^\/_\s+/; italicise(w)
- end
- end
- line_array << w
- end
- line_array.join(' ')
- else line
- end
- else
- 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
- if line =~ /\/_\s+/
- italicise(line)
- end
- end
- line
- end
- def bodymarkup(line)
- # << http://www.jus.uio.no/sisu/sisu_markup_table/markup >>
- # See: data/sisu/sample/document_samples_sisu_markup/
- # !{emphasis}! e{emphasis}e emphasis
- # *{bold text}* b{bold}b bold text
- # _{underline}_ u{underline}u underline
- # /{italics}/ i{italics}i italics
- # "{citation}" c{citation}c citation #blockquote?
- # ^{superscript}^ superscript
- # ,{subscript}, subscript
- # +{inserted text}+ inserted text
- # -{deleted text}- deleted text
- # {url address}:url
- # {image.png}imageurl
- # {image.png}png
- # ~{endnote}~
- # !_ #bold/emphasise paragraph
- # _" #blockquote paragraph
- # _1 <:i1> #indent paragraph 1 step
- # _2 <:i2> #indent paragraph 2 steps
- # _3 <:i3> #indent paragraph 3 steps
- # _4 <:i4> #indent paragraph 4 steps
- # _* #bullet (list) ●
- # _1* #bullet (list) indented
- # _1* #bullet (list) indented
- # # #numbered (list) level 1
- # _# #numbered (list) level 2
- line=line.dup
- 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 =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit
- if word
- word.each do |w| # _ - / # | : ! ^ ~
- unless w =~/^#{Mx[:lv_o]}[0-9]:\S*?#{Mx[:lv_c]}|~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|http:\/\/\S+/
- w.gsub!(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
- #w.gsub!(/~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}")
- end
- 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!(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c])
- line.gsub!(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]) #default if markup does not specify
- line.gsub!(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c])
- if @md.subtitle and not @md.subtitle.empty?
- if line =~/(?:by\s+)?(?:@creator|@author)/
- line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.title} - #{@md.subtitle}, \\2#{@md.author}")
- else
- line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}")
- end
- else
- if line =~/(?:by\s+)?(?:@creator|@author)/
- line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.title}, \\2#{@md.author}")
- else
- line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s*$/,"\\1 #{@md.title}")
- end
- end
- line.gsub!(/^(1~\??) @title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}") #
- line.gsub!(/^(#{Mx[:lv_o]}[23]:\??#{Mx[:lv_c]}) (?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 \\2#{@md.author}") #
- 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!(/ /,"#{Mx[:nbsp]}") #escaped special character
- line.gsub!(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\<,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\>>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}") #escaped special character
- line.gsub!(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}") #& #escaped special character
- line.gsub!(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- line.gsub!(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- line.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- line.gsub!(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- line.gsub!(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
- #ADD -->
- line.gsub!(/\\\\/,"#{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#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\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#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\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[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)e\{(.+?)\}e/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)b\{(.+?)\}b/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)u\{(.+?)\}u/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)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[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)i\{(.+?)\}i/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
- # depreciated ^
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)!\{(.+?)\}!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)\*\{(.+?)\}\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)_\{(.+?)\}_/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote?
- line.gsub!(/(^|[^\\])\^\{(.+?)\}\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript
- line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|\(|\>|\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[:nbsp]}|#{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[:nbsp]}|#{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[:nbsp]}|#{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[:nbsp]}|#{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[:nbsp]}|#{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[:nbsp]}|#{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[:nbsp]}|#{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[:nbsp]}|#{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[:nbsp]}|#{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[:nbsp]}|#{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!(/=\{(.+?)\}/,"#{Mx[:idx_o]}\\1#{Mx[:idx_c]}") #
- 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!(/^_" (.*)\n/i,'
\1
') #blockquotes #introduce KEEP
- 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')
- line.gsub!(/\{\s*(.+?)\s*\}(https?:\S+)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked (text or image)
- line.gsub!(/\{\s*(.+?)\s*\}(image)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image
- #line.gsub!(/(#{Mx[:lnk_c]})\s*((?:https?|file|ftp):\S+?)/m,'\1\2')
- ##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 =~/^#{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!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n#{Mx[:nbsp]}#{Mx[:nbsp]}") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n")
- line
- else # 0~
- end
- line
- end
- def tech #script markup planned to be more strict for technical documents
- # !{emphasis}! e{emphasis}e emphasis
- # *{bold text}* b{bold}b bold text
- # _{underline}_ u{underline}u underline
- # /{italics}/ i{italics}i italics
- # "{citation}" c{citation}c citation
- # ^{superscript}^ superscript
- # ,{subscript}, subscript
- # +{inserted text}+ inserted text
- # -{deleted text}- deleted text
- # {url address}:url
- # {image.png}imageurl
- # {image.png}png
- # ~{endnote}~
- # +1
- # +2
- puts 'tech'
- @data.each do |line|
- line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis
- 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
- end
-end
-__END__
-NOTE:
-downstream code blocks are not currently/yet honoured, e.g. stuff within angle brackets are removed
diff --git a/lib/sisu/v0/db_columns.rb b/lib/sisu/v0/db_columns.rb
deleted file mode 100644
index 2dc88a9d..00000000
--- a/lib/sisu/v0/db_columns.rb
+++ /dev/null
@@ -1,229 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_columns
- class Column_size
- def lt_title
- 600
- end
- def lt_subtitle
- 600
- end
- def lt_author
- 600
- end
- def lt_author_title
- 100
- end
- def lt_author_nationality
- 100
- end
- def lt_illustrator
- 600
- end
- def lt_translator
- 600
- end
- def lt_prepared_by
- 600
- end
- def lt_digitized_by
- 600
- end
- def lt_subject
- 600
- end
- def lt_date
- 10
- end
- def lt_type
- 600
- end
- def lt_description
- 2000
- end
- def lt_publisher
- 600
- end
- def lt_contributor
- 600
- end
- def lt_format
- 600
- end
- def lt_identifier
- 256
- end
- def lt_source
- 200
- end
- def lt_language
- 30
- end
- def lt_language_char
- 3
- end
- def lt_language_original
- 30
- end
- def lt_language_original_char
- 3
- end
- def lt_relation
- 100
- end
- def lt_coverage
- 100
- end
- def lt_rights
- 2000
- end
- def lt_copyright
- 2000
- end
- def lt_owner
- 600
- end
- def lt_keywords
- 600
- end
- def lt_comment
- 600
- end
- def lt_loc
- 30
- end
- def lt_dewey
- 30
- end
- def lt_isbn
- 16
- end
- def lt_pg
- 10
- end
- def lt_abstract
- 600
- end
- def lt_skin
- 100
- end
- def lt_markup
- 100
- end
- def lt_links
- 100
- end
- def lt_information
- 100
- end
- def lt_contact
- 100
- end
- def lt_suffix
- 600
- end
- def lt_filename
- 256
- end
- def lt_types
- 1
- end
- def lt_subj
- 64
- end
- def lt_orig_pub
- 400
- end
- def lt_orig_pub_date
- 400
- end
- def lt_orig_pub_institution
- 200
- end
- def lt_orig_pub_nationality
- 200
- end
- def lt_writing_focus_nationality
- 100
- end
- def lt_topic_register
- 2000
- end
- def document_clean # restriction not necessary #12000 #2712
- 60000
- end
- def document_body
- 16000
- end
- def document_seg
- 120
- end
- def document_seg_full
- 120
- end
- def endnote_clean # restriction not necessary #12000 #2712
- 60000
- end
- def endnote_body
- 16000
- end
- end
-end
-__END__
diff --git a/lib/sisu/v0/db_create.rb b/lib/sisu/v0/db_create.rb
deleted file mode 100644
index 2cdb2c06..00000000
--- a/lib/sisu/v0/db_create.rb
+++ /dev/null
@@ -1,597 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_create
- require "#{SiSU_lib}/db_columns"
- class Create < SiSU_DB_columns::Column_size
- require "#{SiSU_lib}/sysenv"
- @@dl=nil
- def initialize(opt,conn,file,sql_type='pg')
- @opt,@conn,@file,@sql_type=opt,conn,file,sql_type
- @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
- @comment=Comment.new(@conn,@sql_type)
- @@dl ||=SiSU_Env::Info_env.new.digest.length
- end
- def available
- DBI.available_drivers.each do |driver|
- puts "Driver: #{driver}"
- DBI.data_sources(driver).each do |dsn|
- puts "\tDatasource: #{dsn}"
- end
- end
- end
- def create_db
- @env=SiSU_Env::Info_env.new(@opt.fns)
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create PG db:',%{"SiSU_#{@env.path.stub_pwd}"})
- tell.colorize unless @opt.cmd =~/q/
- SiSU_Env::System_call.new.create_pg_db(@env.path.stub_pwd) #watch use of path.stub_pwd instead of stub
- end
- def output_dir?
- dir=SiSU_Env::Info_env.new('')
- if @opt.cmd =~/d/
- #p dir.path.webserv_stub_ensure.inspect
- dir.path.webserv_stub_ensure
- end
- end
- def create_table
- def metadata
- print %{
- currently using sisu dbi module
- to be populated from documents files
- create tables metadata
- data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
- CREATE TABLE metadata (
- tid BIGINT PRIMARY KEY,
- title VARCHAR(#{lt_title}) NULL,
- subtitle VARCHAR(#{lt_subtitle}) NULL,
- author VARCHAR(#{lt_author}) NULL,
-/* plan to replace creator field, currently used, with author field */
- creator VARCHAR(#{lt_author}) NULL,
- author_title VARCHAR(#{lt_author_title}) NULL,
- author_nationality VARCHAR(#{lt_author_nationality}) NULL,
- illustrator VARCHAR(#{lt_illustrator}) NULL,
- translator VARCHAR(#{lt_translator}) NULL,
- subject VARCHAR(#{lt_subject}) NULL,
- date VARCHAR(#{lt_date}) NULL,
- date_added_to_site VARCHAR(#{lt_date}) NULL,
- date_created VARCHAR(#{lt_date}) NULL,
- date_issued VARCHAR(#{lt_date}) NULL,
- date_available VARCHAR(#{lt_date}) NULL,
- date_valid VARCHAR(#{lt_date}) NULL,
- date_modified VARCHAR(#{lt_date}) NULL,
- date_translated VARCHAR(#{lt_date}) NULL,
-/* date DATE, */
-/* date_added_to_site DATE, */
-/* date_created DATE, */
-/* date_issued DATE, */
-/* date_available DATE, */
-/* date_valid DATE, */
-/* date_modified DATE, */
-/* date_translated DATE, */
- type VARCHAR(#{lt_type}) NULL,
- description VARCHAR(#{lt_description}) NULL,
- publisher VARCHAR(#{lt_publisher}) NULL,
- contributor VARCHAR(#{lt_contributor}) NULL,
- prepared_by VARCHAR(#{lt_prepared_by}) NULL,
- digitized_by VARCHAR(#{lt_digitized_by}) NULL,
- format VARCHAR(#{lt_format}) NULL,
- identifier VARCHAR(#{lt_identifier}) NULL,
- source VARCHAR(#{lt_source}) NULL,
- language VARCHAR(#{lt_language}) NULL,
- language_original VARCHAR(#{lt_language_original}) NULL,
- relation VARCHAR(#{lt_relation}) NULL,
- coverage VARCHAR(#{lt_coverage}) NULL,
- rights VARCHAR(#{lt_rights}) NULL,
- copyright VARCHAR(#{lt_copyright}) NULL,
- owner VARCHAR(#{lt_owner}) NULL,
- keywords VARCHAR(#{lt_keywords}) NULL,
- comment VARCHAR(#{lt_comment}) NULL,
- loc VARCHAR(#{lt_loc}) NULL,
- dewey VARCHAR(#{lt_dewey}) NULL,
- isbn VARCHAR(#{lt_isbn}) NULL,
- pg VARCHAR(#{lt_pg}) NULL,
- abstract VARCHAR(#{lt_abstract}) NULL,
- prefix_a TEXT NULL,
- prefix_b TEXT NULL,
- skin VARCHAR(#{lt_skin}) NULL,
- markup VARCHAR(#{lt_markup}) NULL,
- links VARCHAR(#{lt_links}) NULL,
- information VARCHAR(#{lt_information}) NULL,
- contact VARCHAR(#{lt_contact}) NULL,
- suffix VARCHAR(#{lt_suffix}) NULL,
- filename VARCHAR(#{lt_filename}) NULL UNIQUE,
- types CHAR(#{lt_types}) NULL,
- subj VARCHAR(#{lt_subj}) NULL,
- original_publication VARCHAR(#{lt_orig_pub}) NULL,
- original_publication_date VARCHAR(#{lt_orig_pub_date}) NULL,
- original_publication_institution VARCHAR(#{lt_orig_pub_institution}) NULL,
- original_publication_nationality VARCHAR(#{lt_orig_pub_nationality}) NULL,
- writing_focus_nationality VARCHAR(#{lt_writing_focus_nationality}) NULL,
- topic_register VARCHAR(#{lt_topic_register}) NULL
- );
- })
- @comment.metadata
- end
- def documents # create documents base
- print %{
- to be populated from documents files
- create tables documents document_trade document_env
- data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
- CREATE TABLE documents (
- lid BIGINT PRIMARY KEY,
- metadata_tid BIGINT REFERENCES metadata,
- ocn SMALLINT,
- ocnd VARCHAR(6),
- ocns VARCHAR(6),
- clean TEXT NULL,
- body TEXT NULL,
- seg VARCHAR(#{document_seg}) NULL,
- lev SMALLINT NULL,
- lev1 SMALLINT,
- lev2 SMALLINT,
- lev3 SMALLINT,
- lev4 SMALLINT,
- lev5 SMALLINT,
- lev6 SMALLINT,
- en_a SMALLINT NULL,
- en_z SMALLINT NULL,
- en_a_asterisk SMALLINT NULL,
- en_z_asterisk SMALLINT NULL,
- en_a_plus SMALLINT NULL,
- en_z_plus SMALLINT NULL,
- digest_clean CHAR(#{@@dl}),
- digest_all CHAR(#{@@dl}),
- types CHAR(1) NULL
- );
- })
- @comment.documents
- end
- def endnotes
- print %{
- to be populated from document files
- create tables endnotes
- data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
- CREATE TABLE endnotes (
- nid BIGINT PRIMARY KEY,
- document_lid BIGINT REFERENCES documents,
- nr SMALLINT,
- clean TEXT NULL,
- body TEXT NULL,
- ocn SMALLINT,
- ocnd VARCHAR(6),
- ocns VARCHAR(6),
- digest_clean CHAR(#{@@dl}),
- metadata_tid BIGINT REFERENCES metadata
- );
- })
- @comment.endnotes
- end
- def endnotes_asterisk
- print %{
- to be populated from document files
- create tables endnotes_asterisk
- data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
- CREATE TABLE endnotes_asterisk (
- nid BIGINT PRIMARY KEY,
- document_lid BIGINT REFERENCES documents,
- nr SMALLINT,
- clean TEXT NULL,
- body TEXT NULL,
- ocn SMALLINT,
- ocnd VARCHAR(6),
- ocns VARCHAR(6),
- digest_clean CHAR(#{@@dl}),
- metadata_tid BIGINT REFERENCES metadata
- );
- })
- @comment.endnotes_asterisk
- end
- def endnotes_plus
- print %{
- to be populated from document files
- create tables endnotes_plus
- data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
- CREATE TABLE endnotes_plus (
- nid BIGINT PRIMARY KEY,
- document_lid BIGINT REFERENCES documents,
- nr SMALLINT,
- clean TEXT NULL,
- body TEXT NULL,
- ocn SMALLINT,
- ocnd VARCHAR(6),
- ocns VARCHAR(6),
- digest_clean CHAR(#{@@dl}),
- metadata_tid BIGINT REFERENCES metadata
- );
- })
- @comment.endnotes_plus
- end
- def urls # create documents file links mapping
- print %{
- currently using sisu dbi module
- to be populated from documents files
- create tables urls
- data import through ruby transfer
- } unless @opt.cmd =~/q/
- @conn.execute(%{
- CREATE TABLE urls (
- metadata_tid BIGINT REFERENCES metadata,
- plaintext varchar(512),
- html_toc varchar(512),
- html_doc varchar(512),
- xhtml varchar(512),
- xml_sax varchar(512),
- xml_dom varchar(512),
- odf varchar(512),
- pdf_p varchar(512),
- pdf_l varchar(512),
- concordance varchar(512),
- latex_p varchar(512),
- latex_l varchar(512),
- digest varchar(512),
- manifest varchar(512),
- markup varchar(512),
- sisupod varchar(512)
- );
- })
- @comment.urls
- end
- self
- end
- end
- class Comment
- def initialize(conn,sql_type='pg')
- @conn=conn
- if sql_type =~ /pg/; psql
- else none
- end
- end
- def psql
- def conn_execute_array(sql_arr)
- @conn.transaction do |conn|
- sql_arr.each do |sql|
- conn.execute(sql)
- end
- end
- end
- #def conn_execute_array(sql_arr)
- # sql_arr.each do |sql|
- # @conn.execute(sql)
- # end
- #end
- def metadata
- sql_arr=[
- %{COMMENT ON Table metadata
- IS 'contains SiSU documents metadata with metadata';},
- %{COMMENT ON COLUMN metadata.tid
- IS 'unique';},
- %{COMMENT ON COLUMN metadata.filename
- IS 'document filename';},
- %{COMMENT ON COLUMN metadata.title
- IS 'metadata title (dublin core element 1)';},
- %{COMMENT ON COLUMN metadata.subtitle
- IS 'document subtitle';},
- %{COMMENT ON COLUMN metadata.creator
- IS 'metadata creator (dublin core element 2)';},
- %{COMMENT ON COLUMN metadata.author
- IS 'metadata author (dublin core element 2)';},
- %{COMMENT ON COLUMN metadata.illustrator
- IS 'metadata illustrator';},
- %{COMMENT ON COLUMN metadata.translator
- IS 'metadata translator';},
- %{COMMENT ON COLUMN metadata.subject
- IS 'metadata subject (dublin core element 3)';},
- %{COMMENT ON COLUMN metadata.date
- IS 'metadata date (dublin core element 7)';},
- %{COMMENT ON COLUMN metadata.date_created
- IS 'metadata date created (dublin core)';},
- %{COMMENT ON COLUMN metadata.date_issued
- IS 'metadata date of issue (dublin core)';},
- %{COMMENT ON COLUMN metadata.date_available
- IS 'metadata date available (dublin core)';},
- %{COMMENT ON COLUMN metadata.date_valid
- IS 'metadata date valid (dublin core)';},
- %{COMMENT ON COLUMN metadata.date_modified
- IS 'metadata date modified (dublin core)';},
- %{COMMENT ON COLUMN metadata.type
- IS 'metadata type (dublin core element 8)';},
- %{COMMENT ON COLUMN metadata.description
- IS 'metadata description (dublin core element 4)';},
- %{COMMENT ON COLUMN metadata.publisher
- IS 'metadata publisher (dublin core element 5)';},
- %{COMMENT ON COLUMN metadata.contributor
- IS 'metadata contributor (dublin core element 6)';},
- %{COMMENT ON COLUMN metadata.prepared_by
- IS 'metadata markup prepared by';},
- %{COMMENT ON COLUMN metadata.digitized_by
- IS 'metadata digitized by';},
- %{COMMENT ON COLUMN metadata.format
- IS 'metadata format (dublin core element 9)';},
- %{COMMENT ON COLUMN metadata.identifier
- IS 'metadata identifier (dublin core element 10)';},
- %{COMMENT ON COLUMN metadata.source
- IS 'metadata source (dublin core element 11)';},
- %{COMMENT ON COLUMN metadata.language
- IS 'metadata language (dublin core element 12)';},
- %{COMMENT ON COLUMN metadata.language_original
- IS 'metadata original language';},
- %{COMMENT ON COLUMN metadata.relation
- IS 'metadata (dublin core element 13)';},
- %{COMMENT ON COLUMN metadata.coverage
- IS 'metadata coverage (dublin core element 14)';},
- %{COMMENT ON COLUMN metadata.rights
- IS 'metadata rights / copyright / license (dublin core element 15)';},
- %{COMMENT ON COLUMN metadata.owner
- IS 'metadata owner';},
- %{COMMENT ON COLUMN metadata.keywords
- IS 'metadata keywords';},
- %{COMMENT ON COLUMN metadata.comment
- IS 'metadata comment';},
- %{COMMENT ON COLUMN metadata.abstract
- IS 'metadata abstract';},
- %{COMMENT ON COLUMN metadata.loc
- IS 'metadata library of congress';},
- %{COMMENT ON COLUMN metadata.dewey
- IS 'metadata dewey';},
- %{COMMENT ON COLUMN metadata.isbn
- IS 'metadata isbn';},
- %{COMMENT ON COLUMN metadata.pg
- IS 'metadata project gutenberg number';},
- %{COMMENT ON COLUMN metadata.prefix_a
- IS 'metadata prefix';},
- %{COMMENT ON COLUMN metadata.prefix_b
- IS 'metadata prefix';},
- %{COMMENT ON COLUMN metadata.skin
- IS 'metadata sisu skin';},
- %{COMMENT ON COLUMN metadata.markup
- IS 'metadata markup source';},
- %{COMMENT ON COLUMN metadata.links
- IS 'metadata links';},
- %{COMMENT ON COLUMN metadata.information
- IS 'metadata information';},
- %{COMMENT ON COLUMN metadata.contact
- IS 'metadata contact';},
- %{COMMENT ON COLUMN metadata.suffix
- IS 'metadata sisu suffix (output related)';},
- %{COMMENT ON COLUMN metadata.filename
- IS 'metadata source filename';},
- %{COMMENT ON COLUMN metadata.types
- IS 'document types scroll 1, seg 2, both 3';},
- %{COMMENT ON COLUMN metadata.subj
- IS 'subject areas - no way to populate at present as not mapped';},
- ]
- conn_execute_array(sql_arr)
- end
- def documents
- sql_arr=[
- %{COMMENT ON Table documents
- IS 'contains searchable text of SiSU documents';},
- %{COMMENT ON COLUMN documents.lid
- IS 'unique';},
- %{COMMENT ON COLUMN documents.metadata_tid
- IS 'tie to title in metadata';},
- %{COMMENT ON COLUMN documents.lev
- IS 'doc level 1-6 \d\~';},
- %{COMMENT ON COLUMN documents.seg
- IS 'segment name from level 4';},
- %{COMMENT ON COLUMN documents.ocn
- IS 'object citation number';},
- %{COMMENT ON COLUMN documents.en_a
- IS 'first endnote number in text object (eg. NULL or 34) (used with en_z to create range)';},
- %{COMMENT ON COLUMN documents.en_z
- IS 'last endnote number within text object (eg. NULL, 34 or say 47) (used with en_a to create range)';},
- %{COMMENT ON COLUMN documents.en_a_asterisk
- IS 'first endnote number in text object (eg. NULL or 34) (used with en_z_asterisk to create range)';},
- %{COMMENT ON COLUMN documents.en_z_asterisk
- IS 'last endnote number within text object (eg. NULL, 34 or say 47) (used with en_a_asterisk to create range)';},
- %{COMMENT ON COLUMN documents.en_a_plus
- IS 'first endnote number in text object (eg. NULL or 34) (used with en_z_plus to create range)';},
- %{COMMENT ON COLUMN documents.en_z_plus
- IS 'last endnote number within text object (eg. NULL, 34 or say 47) (used with en_a_plus to create range)';},
- %{COMMENT ON COLUMN documents.types
- IS 'document types seg scroll';},
- %{COMMENT ON COLUMN documents.clean
- IS 'text object - substantive text: clean, stripped of markup';},
- %{COMMENT ON COLUMN documents.body
- IS 'text object - substantive text: light html markup';},
- %{COMMENT ON COLUMN documents.lev1
- IS 'document structure, level 1';},
- %{COMMENT ON COLUMN documents.lev2
- IS 'document structure, level 2';},
- %{COMMENT ON COLUMN documents.lev3
- IS 'document structure, level 3';},
- %{COMMENT ON COLUMN documents.lev4
- IS 'document structure, level 4';},
- %{COMMENT ON COLUMN documents.lev5
- IS 'document structure, level 5';},
- %{COMMENT ON COLUMN documents.lev6
- IS 'document structure, level 6';}
- ]
- conn_execute_array(sql_arr)
- end
- def endnotes
- sql_arr=[
- %{COMMENT ON Table endnotes
- IS 'contains searchable text of SiSU documents endnotes';},
- %{COMMENT ON COLUMN endnotes.nid
- IS 'unique';},
- %{COMMENT ON COLUMN endnotes.document_lid
- IS 'ties to text block from which referenced';},
- %{COMMENT ON COLUMN endnotes.nr
- IS 'endnote number ';},
- %{COMMENT ON COLUMN endnotes.clean
- IS 'endnote substantive content, stripped of markup';},
- %{COMMENT ON COLUMN endnotes.body
- IS 'endnote substantive content';},
- %{COMMENT ON COLUMN endnotes.ocn
- IS 'object citation no# <\~(\d+)> from which endnote is referenced';},
- %{COMMENT ON COLUMN documents.metadata_tid
- IS 'tie to title in metadata - unique for each document';}
- ]
- conn_execute_array(sql_arr)
- end
- def endnotes_asterisk
- sql_arr=[
- %{COMMENT ON Table endnotes_asterisk
- IS 'contains searchable text of SiSU documents endnotes asterisk';},
- %{COMMENT ON COLUMN endnotes_asterisk.nid
- IS 'unique';},
- %{COMMENT ON COLUMN endnotes_asterisk.document_lid
- IS 'ties to text block from which referenced';},
- %{COMMENT ON COLUMN endnotes_asterisk.nr
- IS 'endnote number ';},
- %{COMMENT ON COLUMN endnotes_asterisk.clean
- IS 'endnote substantive content, stripped of markup';},
- %{COMMENT ON COLUMN endnotes_asterisk.body
- IS 'endnote substantive content';},
- %{COMMENT ON COLUMN endnotes_asterisk.ocn
- IS 'object citation no# <\~(\d+)> from which endnote is referenced';},
- %{COMMENT ON COLUMN documents.metadata_tid
- IS 'tie to title in metadata - unique for each document';}
- ]
- conn_execute_array(sql_arr)
- end
- def endnotes_plus
- sql_arr=[
- %{COMMENT ON Table endnotes_plus
- IS 'contains searchable text of SiSU documents endnotes';},
- %{COMMENT ON COLUMN endnotes_plus.nid
- IS 'unique';},
- %{COMMENT ON COLUMN endnotes_plus.document_lid
- IS 'ties to text block from which referenced';},
- %{COMMENT ON COLUMN endnotes_plus.nr
- IS 'endnote number ';},
- %{COMMENT ON COLUMN endnotes_plus.clean
- IS 'endnote substantive content, stripped of markup';},
- %{COMMENT ON COLUMN endnotes_plus.body
- IS 'endnote substantive content';},
- %{COMMENT ON COLUMN endnotes_plus.ocn
- IS 'object citation no# <\~(\d+)> from which endnote is referenced';},
- %{COMMENT ON COLUMN documents.metadata_tid
- IS 'tie to title in metadata - unique for each document';},
- ]
- conn_execute_array(sql_arr)
- end
- def urls
- sql_arr=[
- %{COMMENT ON Table urls
- IS 'contains base url links to different SiSU output';},
- %{COMMENT ON COLUMN documents.metadata_tid
- IS 'tie to title in metadata - unique for each document, the mapping of rows is one to one';},
- %{COMMENT ON COLUMN urls.plaintext
- IS 'plaintext utf-8';},
- %{COMMENT ON COLUMN urls.html_toc
- IS 'table of contents for segmented html document';},
- %{COMMENT ON COLUMN urls.html_doc
- IS 'html document (scroll)';},
- %{COMMENT ON COLUMN urls.xhtml
- IS 'xhtml document (scroll)';},
- %{COMMENT ON COLUMN urls.xml_sax
- IS 'xml sax oriented document (scroll)';},
- %{COMMENT ON COLUMN urls.xml_dom
- IS 'xml dom oriented document (scroll)';},
- %{COMMENT ON COLUMN urls.odf
- IS 'opendocument format text';},
- %{COMMENT ON COLUMN urls.pdf_p
- IS 'pdf portrait';},
- %{COMMENT ON COLUMN urls.pdf_l
- IS 'pdf landscape';},
- %{COMMENT ON COLUMN urls.concordance
- IS 'rudimentary document index linked to html';},
- %{COMMENT ON COLUMN urls.latex_p
- IS 'latex portrait';},
- %{COMMENT ON COLUMN urls.latex_l
- IS 'latex_landscape';},
- %{COMMENT ON COLUMN urls.markup
- IS 'markup';},
- %{COMMENT ON COLUMN urls.sisupod
- IS 'SiSU document format .tgz (all SiSU information on document)';},
- ]
- conn_execute_array(sql_arr)
- end
- self
- end
- def none
- def metadata
- end
- def documents
- end
- def endnotes
- end
- def endnotes_asterisk
- end
- def endnotes_plus
- end
- def urls
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/v0/db_dbi.rb b/lib/sisu/v0/db_dbi.rb
deleted file mode 100644
index 1c09f334..00000000
--- a/lib/sisu/v0/db_dbi.rb
+++ /dev/null
@@ -1,93 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_DBI
- require "#{SiSU_lib}/db_columns"
- require "#{SiSU_lib}/db_tests"
- require "#{SiSU_lib}/db_create"
- require "#{SiSU_lib}/db_select"
- require "#{SiSU_lib}/db_indexes"
- require "#{SiSU_lib}/db_drop"
- require "#{SiSU_lib}/db_remove"
- require "#{SiSU_lib}/db_load_tuple"
- require "#{SiSU_lib}/db_import"
- class Column_size < SiSU_DB_columns::Column_size
- end
- class Test < SiSU_DB_tests::Test #% db_tests.rb
- end
- class Create .
-
- 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: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_drop
- class Drop
- require "#{SiSU_lib}/response"
- def initialize(opt,conn,db_info,sql_type='')
- @opt,@conn,@db_info,@sql_type=opt,conn,db_info,sql_type
- @ans=SiSU_Response::Response.new
- case @sql_type
- when /sqlite/
- cascade=''
- else
- cascade='CASCADE'
- end
- @drop_table=[
- "DROP TABLE metadata #{cascade};",
- "DROP TABLE documents #{cascade};",
- "DROP TABLE urls #{cascade};",
- "DROP TABLE endnotes #{cascade};",
- "DROP TABLE endnotes_asterisk #{cascade};",
- "DROP TABLE endnotes_plus #{cascade};",
- ]
- end
- def drop
- def tables #% drop all tables
- begin
- msg_sqlite="as not all disk space is recovered after dropping the database << #{@db_info.sqlite.db} >>, you may be better off deleting the file, and recreating it as necessary"
- case @sql_type
- when /sqlite/
- @conn.transaction
- @drop_table.each do |d|
- @conn.execute(d)
- end
- @conn.commit
- puts msg_sqlite
- ans=@ans.response?('remove sql database?')
- if ans and File.exist?(@db_info.sqlite.db)
- File.unlink(@db_info.sqlite.db)
- end
- else
- @conn.do(@drop_table.join(''))
- end
- rescue
- case @sql_type
- when /sqlite/
- #system("rm -vi #{@db_info.sqlite.db}")
- ans=@ans.response?('remove sql database?')
- if ans and File.exist?(@db_info.sqlite.db); File.unlink(@db_info.sqlite.db)
- end
- else
- @conn.do(@drop_table.join(''))
- end
- ensure
- #commit
- end
- end
- def indexes #% drop all indexes
- #@conn.do(%{
- # DROP INDEX object_nr ON documents(ocn);
- # DROP INDEX body ON documents(body);
- # DROP INDEX clean ON documents(clean);
- # DROP INDEX lev1 ON documents(lev1);
- # DROP INDEX lev2 ON documents(lev2);
- # DROP INDEX lev3 ON documents(lev3);
- # DROP INDEX lev4 ON documents(lev4);
- # DROP INDEX lev5 ON documents(lev5);
- # DROP INDEX lev6 ON documents(lev6);
- # DROP INDEX endnote_nr ON endnotes(nr);
- # DROP INDEX endnote ON endnotes(body);
- # DROP INDEX title ON metadata(title);
- # DROP INDEX filename ON metadata(filename)
- # /*
- # DROP INDEX object_nr ON documents(ocn) CASCADE;
- # DROP INDEX body ON documents(body) CASCADE;
- # DROP INDEX clean ON documents(clean) CASCADE;
- # DROP INDEX lev1 ON documents(lev1) CASCADE;
- # DROP INDEX lev2 ON documents(lev2) CASCADE;
- # DROP INDEX lev3 ON documents(lev3) CASCADE;
- # DROP INDEX lev4 ON documents(lev4) CASCADE;
- # DROP INDEX lev5 ON documents(lev5) CASCADE;
- # DROP INDEX lev6 ON documents(lev6) CASCADE;
- # DROP INDEX endnote_nr ON endnotes(nr) CASCADE;
- # DROP INDEX endnote ON endnotes(body) CASCADE;
- # DROP INDEX title ON metadata(title) CASCADE;
- # DROP INDEX filename ON metadata(filename) CASCADE
- # */
- #})
- end
- self
- end
- end
-end
-__END__
diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb
deleted file mode 100644
index da564639..00000000
--- a/lib/sisu/v0/db_import.rb
+++ /dev/null
@@ -1,886 +0,0 @@
-#j coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_import
- require "#{SiSU_lib}/db_columns"
- require "#{SiSU_lib}/db_load_tuple"
- require "#{SiSU_lib}/shared_html_lite"
- require 'sqlite3'
- class Import < SiSU_DB_columns::Column_size
- include SiSU_Param
- include SiSU_Screen
- @@dl=nil
- @@hname=nil
- attr_accessor :tp
- def initialize(opt,conn,file,sql_type='pg')
- @opt,@conn,@file,@sql_type=opt,conn,file,sql_type
- @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
- @env=SiSU_Env::Info_env.new(@opt.fns)
- @dal="#{@env.path.dal}"
- if @opt.fns.empty? or @opt.cmd.empty?; @fnb=''
- else
- @md=SiSU_Param::Parameters.new(@opt).get
- @fnb=@md.fnb
- end
- @suffix=@opt.fns[/(?:.+?)(?:\.ssm\.sst|\.-?sst)/,1]
- @fnm="#@dal/#{@opt.fns}.meta.rbm"
- @@seg,@@seg_full='','' #create? consider placing field just before clean text as opposed to seg which contains seg(.html) name info seg_full would contain seg info for levels 5 & 6 where available eg seg_full may be 7.3 (level 5) and 7.3.1 (level 6) where seg is 7
- @col=Hash.new('')
- @col[:ocn]=''
- @counter={}
- @db=SiSU_Env::Info_db.new
- @driver_sqlite3=false
- @driver_sqlite3=true if @conn.inspect.match(/^(.{10})/)[1] == @db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]
- sql='SELECT MAX(lid) FROM documents'
- begin
- @col[:lid] ||=0
- @col[:lid]=if @driver_sqlite3
- @conn.execute( sql ).join.to_i
- else @conn.execute( sql ) { |x| x.fetch_all.to_s.to_i }
- end
- rescue
- puts "#{__FILE__}:#{__LINE__}" if @opt.cmd =~/M/
- end
- @col[:lid]=0 if @col[:lid].nil? or @col[:lid].to_s.empty?
- sql='SELECT MAX(nid) FROM endnotes'
- begin
- @id_n ||=0
- @id_n=if @driver_sqlite3
- @conn.execute( sql ).join.to_i
- else
- @id_n=@conn.execute( sql ) { |x| x.fetch_all.to_s.to_i }
- end
- rescue
- puts "#{__FILE__}:#{__LINE__}" if @opt.cmd =~/M/
- end
- @id_n =0 if @col[:lid].nil? or @col[:lid].to_s.empty?
- @col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=0
- @db=SiSU_Env::Info_db.new
- @@dl ||=SiSU_Env::Info_env.new.digest.length
- end
- def marshal_load
- require "#{SiSU_lib}/dal"
- @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"#{@db.psql.db}::#{@opt.fns}")
- tell.puts_blue unless @opt.cmd =~/q/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'Marshal Load',@fnm)
- tell.print_grey if @opt.cmd =~/v/
- file_exist=if @sql_type=~/sqlite/; nil
- else
- @conn.select_one(%{ SELECT metadata.tid FROM metadata WHERE metadata.filename ~ '#{@opt.fns}'; })
- end
- if (@sql_type!~/sqlite/ and not file_exist) \
- or @sql_type=~/sqlite/
- t_d=[] # transaction_data
- t_d << db_import_metadata
- t_d << db_import_documents(@dal_array)
- t_d << db_import_urls(@dal_array,@fnc) #import OID on/off
- t_d=t_d.flatten
- if @opt.cmd =~/[MV]/
- puts @conn.class if defined? @conn.class
- puts @conn.driver_name if defined? @conn.driver_name
- puts @conn.driver if defined? @conn.driver
- end
- begin
- @conn.transaction do |conn|
- t_d.each do |sql|
- conn.execute(sql)
- end
- end
- rescue
- SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- puts "#{__FILE__}:#{__LINE__}" if @opt.cmd =~/M/
- ensure
- #@conn.execute("COMMIT")
- end
- if @sql_type=~/sqlite/ \
- and @opt.cmd =~/[MV]/
- puts "\n" + @conn.inspect
- puts "\nat #{__FILE__}:#{__LINE__}"
- end
- else
- if file_exist
- @db=SiSU_Env::Info_db.new
- puts "\n#{@cX.grey}file #{@cX.off} #{@cX.blue}#{@opt.fns}#{@cX.off} #{@cX.grey}already exists in database#{@cX.off} #{@cX.blue}#{@db.psql.db}#{@cX.off} #{@cX.brown}update instead?#{@cX.off}"
- end
- end
- end
- def special_character_escape(str)
- str.gsub!(/'/,"''") #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'")
- str.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/," \n")
- str.gsub!(/#{Mx[:gr_o]}(?:code|alt|group|verse)(?:-end)?#{Mx[:gr_c]}/,'')
- str.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
- str.gsub!(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/,'[image: \1] \2')
- str.gsub!(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2')
- end
- def strip_markup(str) #define rules, make same as in dal clean
- str.gsub!(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]')
- str.gsub!(/#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/,'')
- str.gsub!(/(?: \\;|#{Mx[:nbsp]})+/,' ')
- str.gsub!(/#{Mx[:gr_o]}T[h]?#{Mx[:tc_p]}.+?#{Mx[:gr_c]}/u,"[TABLE]\n") #tables #CHECK should take whole table
- str.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}\d+(.+)#{Mx[:tc_c]}/u,'\1') #tables
- str.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' ') #tables
- str.gsub!(/#{Mx[:tc_p]}/u,' ') #tables tidy later
- str.gsub!(/<.+?>/,'')
- str.gsub!(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search
- str.gsub!(/\s\s+/,' ')
- str.strip!
- end
- #% import into database tables
- def pf_db_import_transaction_open
- end
- def pf_db_import_transaction_close
- end
- def db_import_metadata #% import documents - populate database
- print %{ #{@cX.grey}import documents dbi_unit #{@cX.off} } unless @opt.cmd =~/q/
- @tp={}
- @md=SiSU_Param::Parameters.new(@opt).get
- if @md.title; @tp[:title]=@md.title
- special_character_escape(@tp[:title])
- @tp[:title_f],@tp[:title_i]='title, ',"'#{@tp[:title]}', "
- sql='SELECT MAX(tid) FROM metadata'
- begin
- @@id_t ||=0
- id_t=if @driver_sqlite3
- @conn.execute( sql ).join.to_i # { |x| id_t=x.join.to_i }
- else @conn.execute( sql ) { |x| x.fetch_all.to_s.to_i }
- end
- @@id_t=id_t if id_t
- rescue
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- @@id_t =0 if @col[:lid].nil? or @col[:lid].to_s.empty?
- @@id_t+=1 #bug related, needs to be performed once at start of file, but consider moving, as, placed here it means program will fail if document header lacks 0~title
- puts %{\n#{@cX.grey}Processing file number#{@cX.off}: #{@cX.green}#{@@id_t}#{@@cX.off}} unless @opt.cmd =~/q/
- end
- if @md.full_title; @tp[:long_title]=@md.full_title #dc
- #sql='SELECT MAX(tid) FROM metadata'
- #id_t=@conn.execute( sql ) { |x| x.fetch_all.to_s.to_i }
- #@@id_t=id_t if id_t
- #@@id_t ||=0
- #@@id_t+=1 #bug related, needs to be performed once at start of file, but consider moving, as, placed here it means program will fail if document header lacks 0~title
- #puts %{\n#{@cX.grey}Processing file number#{@cX.off}: #{@cX.green}#{@@id_t}#{@@cX.off}}
- end
- if @md.subtitle; txt=@md.subtitle
- special_character_escape(txt)
- @tp[:subtitle_f],@tp[:subtitle_i]='subtitle, ',"'#{txt}', "
- end
- if @md.author; txt=@md.author #dc
- special_character_escape(txt)
- @tp[:creator_f],@tp[:creator_i]='creator, ',"'#{txt}', "
- end
- if @md.contributor; txt=@md.contributor #dc
- special_character_escape(txt)
- @tp[:contributor_f],@tp[:contributor_i]='contributor, ',"'#{txt}', "
- end
- if @md.translator; txt=@md.translator
- special_character_escape(txt)
- @tp[:translator_f],@tp[:translator_i]='translator, ',"'#{txt}', "
- end
- if @md.illustrator; txt=@md.illustrator
- special_character_escape(txt)
- @tp[:illustrator_f],@tp[:illustrator_i]='illustrator, ',"'#{txt}', "
- end
- if @md.publisher; txt=@md.publisher #dc
- special_character_escape(txt)
- @tp[:publisher_f],@tp[:publisher_i]='publisher, ',"'#{txt}', "
- end
- if @md.prepared_by; txt=@md.prepared_by
- special_character_escape(txt)
- @tp[:prepared_by_f],@tp[:prepared_by_i]='prepared_by, ',"'#{txt}', "
- end
- if @md.digitized_by; txt=@md.digitized_by
- special_character_escape(txt)
- @tp[:digitized_by_f],@tp[:digitized_by_i]='digitized_by, ',"'#{txt}', "
- end
- if @md.subject; txt=@md.subject #dc
- special_character_escape(txt)
- @tp[:subject_f],@tp[:subject_i]='subject, ',"'#{txt}', "
- end
- if @md.description; txt=@md.description #dc
- special_character_escape(txt)
- @tp[:description_f],@tp[:description_i]='description, ',"'#{txt}', "
- end
- if @md.abstract; txt=@md.abstract
- special_character_escape(txt)
- @tp[:abstract_f],@tp[:abstract_i]='abstract, ',"'#{txt}', "
- end
- if @md.type; txt=@md.type #dc
- special_character_escape(txt)
- @tp[:type_f],@tp[:type_i]='type, ',"'#{txt}', "
- end
- #if @md.owner; txt=@md.owner
- # special_character_escape(txt)
- # @tp[:owner_f],@tp[:owner_i]='owner, ',"'#{txt}', "
- #end
- #if @md.copyright; txt=@md.copyright
- # special_character_escape(txt)
- # @tp[:copyright_f],@tp[:copyright_i]='copyright, ',"'#{txt}', "
- #end
- if @md.rights; txt=@md.rights #dc
- special_character_escape(txt)
- @tp[:rights_f],@tp[:rights_i]='rights, ',"'#{txt}', "
- end
- if @md.date; txt=@md.date #dc
- special_character_escape(txt)
- @tp[:date_f],@tp[:date_i]='date, ',"'#{txt}', "
- end
- if @md.date_created; txt=@md.date_created #dc
- special_character_escape(txt)
- @tp[:date_created_f],@tp[:date_created_i]='date_created, ',"'#{txt}', "
- end
- if @md.date_issued; txt=@md.date_issued #dc
- special_character_escape(txt)
- @tp[:date_issued_f],@tp[:date_issued_i]='date_issued, ',"'#{txt}', "
- end
- if @md.date_available; txt=@md.date_available #dc
- special_character_escape(txt)
- @tp[:date_available_f],@tp[:date_available_i]='date_available, ',"'#{txt}', "
- end
- if @md.date_modified; txt=@md.date_modified #dc
- special_character_escape(txt)
- @tp[:date_modified_f],@tp[:date_modified_i]='date_modified, ',"'#{txt}', "
- end
- if @md.date_valid; txt=@md.date_valid #dc
- special_character_escape(txt)
- @tp[:date_valid_f],@tp[:date_valid_i]='date_valid, ',"'#{txt}', "
- end
- if @md.language[:name]; txt=@md.language[:name] #dc
- special_character_escape(txt)
- @tp[:language_f],@tp[:language_i]='language, ',"'#{txt}', "
- end
- if @md.language_original[:name]; txt=@md.language_original[:name]
- special_character_escape(txt)
- @tp[:language_original_f],@tp[:language_original_i]='language_original, ',"'#{txt}', "
- end
- if @md.format; txt=@md.format #dc
- special_character_escape(txt)
- @tp[:format_f],@tp[:format_i]='format, ',"'#{txt}', "
- end
- if @md.identifier; txt=@md.identifier #dc
- special_character_escape(txt)
- @tp[:identifier_f],@tp[:identifier_i]='identifier, ',"'#{txt}', "
- end
- if @md.source; txt=@md.source #dc
- special_character_escape(txt)
- @tp[:source_f],@tp[:source_i]='source, ',"'#{txt}', "
- end
- if @md.relation; txt=@md.relation #dc
- special_character_escape(txt)
- @tp[:relation_f],@tp[:relation_i]='relation, ',"'#{txt}', "
- end
- if @md.coverage; txt=@md.coverage #dc
- special_character_escape(txt)
- @tp[:coverage_f],@tp[:coverage_i]='coverage, ',"'#{txt}', "
- end
- if @md.keywords; txt=@md.keywords
- special_character_escape(txt)
- @tp[:keywords_f],@tp[:keywords_i]='keywords, ',"'#{txt}', "
- end
- if @md.comments; txt=@md.comments
- special_character_escape(txt)
- @tp[:comments_f],@tp[:comments_i]='comments, ',"'#{txt}', "
- end
- if @md.cls_loc; txt=@md.cls_loc
- special_character_escape(txt)
- @tp[:cls_loc_f],@tp[:cls_loc_i]='cls_loc, ',"'#{txt}', "
- end
- if @md.cls_dewey; txt=@md.cls_dewey
- special_character_escape(txt)
- @tp[:cls_dewey_f],@tp[:cls_dewey_i]='cls_dewey, ',"'#{txt}', "
- end
- if @md.cls_pg; txt=@md.cls_pg
- special_character_escape(txt)
- @tp[:cls_pg_f],@tp[:cls_pg_i]='cls_pg, ',"'#{txt}', "
- end
- if @md.cls_isbn; txt=@md.cls_isbn
- special_character_escape(txt)
- @tp[:cls_isbn_f],@tp[:cls_isbn_i]='cls_isbn, ',"'#{txt}', "
- end
- if @md.prefix_a; txt=@md.prefix_a
- special_character_escape(txt)
- @tp[:prefix_a_f],@tp[:prefix_a_i]='prefix_a, ',"'#{txt}', "
- end
- if @md.prefix_b; txt=@md.prefix_b
- special_character_escape(txt)
- @tp[:prefix_b_f],@tp[:prefix_b_i]='prefix_b, ',"'#{txt}', "
- end
- #if @md.suffix; txt=@md.suffix
- # special_character_escape(txt)
- # @tp[:suffix_f],@tp[:suffix_i]='suffix, ',"'#{txt}', "
- #end
- if @md.fns; txt=@md.fns
- special_character_escape(txt)
- @tp[:fns_f],@tp[:fns_i]="filename, ","'#{txt}', "
- end
- #if @md.en[:mismatch] > 0
- # id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})"
- #end
- if @md.wc_words; txt=@md.wc_words
- @tp[:wc_words_f],@tp[:wc_words_i]='wc_words, ',"'#{txt}', "
- end
- if @md.dgst; txt=@md.dgst
- @tp[:dgst_f],@tp[:dgst_i]='dgst, ',"'#{txt}', "
- end
- if @md.sc_number; txt=@md.sc_number
- @tp[:sc_number_f],@tp[:sc_number_i]='sc_number, ',"'#{txt}', "
- end
- if @md.sc_date; txt=@md.sc_date
- @tp[:sc_date_f],@tp[:sc_date_i]='sc_date, ',"'#{txt}', "
- end
- if @md.generated; txt=@md.generated
- @tp[:generated_f],@tp[:generated_i]='generated, ',"'#{@txt}', "
- end
- #if @md.sisu_version; special_character_escape(@md.sisu_version)
- # #id,info='Generated by',"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})"
- #end
- #if @md.ruby_version; special_character_escape(@md.ruby_version)
- SiSU_DB_DBI::Test.new(self,@opt).verify #% import title names, filenames (tuple)
- t=SiSU_DB_tuple::Load_metadata.new(@conn,@tp,@@id_t,@opt,@file)
- tuple=t.tuple
- tuple
- end
- def db_import_documents(dal_array) #% import documents - populate main database table
- #% import into substantive database tables (tuple)
- begin
- @col[:tid]=@@id_t
- @en,@en_ast,@en_pls=[],[],[]
- @col[:en_a]=nil
- @col[:en_z]=nil
- @tuple_array=[]
- dal_array.each do |data|
- #data.gsub!(/<[biu]>(.+?)<\/[biu]>/,'\1') # remove bold, italics, underscore
- 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 =~/#{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[/^#{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 =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
- endnotes(txt).range
- if txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
- end
- if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
- end
- if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_o]}/; @en_pls << endnotes(txt).plus
- end
- txt=endnotes(txt).clean_text
- end
- txt_obj={:txt =>txt,:col =>@col}
- @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).lev4_minus
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- strip_markup(@col[:plaintext])
- if @en[0]; @en_a,@en_z=@en[0].first,@en[0].last
- end
- if @en_ast[0]; @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last
- end
- if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last
- end
- t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file)
- @tuple_array << t.tuple
- case @col[:lev]
- when /1/; @col[:lv1]+=1
- when /2/; @col[:lv2]+=1
- when /3/; @col[:lv3]+=1
- end
- @col[:lev]=@col[:plaintext]=@col[:body]=''
- 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
- @col[:lid]+=1
- @col[:lev]=4
- @hname=if @col[:seg] \
- and not @col[:seg].to_s.empty?
- @@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 =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
- endnotes(txt).range
- if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
- end
- if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
- end
- if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus
- end
- txt=endnotes(txt).clean_text(@base_url)
- end
- txt_obj={:txt =>txt,:col =>@col}
- @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).lev4_plus
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- strip_markup(@col[:plaintext])
- if @en[0]; @en_a,@en_z=@en[0].first,@en[0].last
- end
- if @en_ast[0]; @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last
- end
- if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last
- end
- t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file)
- @tuple_array << t.tuple
- @col[:lev]=@col[:plaintext]=@col[:body]=''
- 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=/^#{Mx[:lv_o]}5:(\S*?)#{Mx[:lv_c]}/
- @@seg_full=re.match(data)[1] if data=~re #create?
- @@seg ||='' #nil # watch
- @col[:seg]=@@seg
- @col[:lv5]+=1
- @col[:lid]+=1
- @col[:lev]=5
- @hname=if @col[:seg] \
- and not @col[:seg].to_s.empty?
- @@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 =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
- endnotes(txt).range
- if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
- end
- if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
- end
- if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus
- end
- txt=endnotes(txt).clean_text(@base_url)
- end
- txt_obj={:txt =>txt,:col =>@col}
- @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).lev4_plus
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- strip_markup(@col[:plaintext])
- if @en[0]; @en_a,@en_z=@en[0].first,@en[0].last
- end
- if @en_ast[0]; @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last
- end
- if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last
- end
- t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file)
- @tuple_array << t.tuple
- @col[:lev]=@col[:plaintext]=@col[:body]=''
- 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=/^#{Mx[:lv_o]}6:(\S*?)#{Mx[:lv_c]}/
- @@seg_full=re.match(data)[1] if data=~re #create?
- @@seg ||='' #nil # watch
- @col[:seg]=@@seg
- @col[:lv6]+=1
- @col[:lid]+=1
- @col[:lev]=6
- @hname=if @col[:seg] \
- and not @col[:seg].to_s.empty?
- @@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 =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
- endnotes(txt).range
- if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
- end
- if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
- end
- if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus
- end
- txt=endnotes(txt).clean_text(@base_url)
- end
- txt_obj={:txt =>txt,:col =>@col}
- @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).lev4_plus
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- strip_markup(@col[:plaintext])
- if @en[0]; @en_a,@en_z=@en[0].first,@en[0].last
- end
- if @en_ast[0]; @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last
- end
- if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last
- end
- t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file)
- @tuple_array << t.tuple
- @col[:lev]=@col[:plaintext]=@col[:body]=''
- else #% regular text
- @col[:lid]+=1
- txt=''
- 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
- else @@hname
- end
- @env=SiSU_Env::Info_env.new(@md.fns)
- @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html"
- 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 =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
- end
- if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
- end
- if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus
- end
- txt=endnotes(txt).clean_text(@base_url)
- end
- if @sql_type=~/pg/ \
- and txt.size > (document_clean - 1) #% examine pg build & remove limitation
- puts "\n\nTOO LARGE (TXT - see error log)\n\n"
- open("#{Dir.pwd}/pg_documents_error_log",'a') do |error|
- error.puts("\n#{@opt.fns}\nTEXT BODY\n#{@col[:body].size} object #{@col[:ocn]} -> #{@col[:body].slice(0..500)}")
- end
- txt=%{\n\nLARGE TEXT BLOCK OMITTED\n\n}
- end
- if @en[0]; @en_a,@en_z=@en[0].first,@en[0].last
- end
- if @en_ast[0]; @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last
- end
- if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last
- end
- @col[:body]=if txt=~/#{Mx[:gr_o]}T[h]?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/ #watch
- txt_obj={:txt =>txt,:col =>@col}
- SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).html_table
- elsif txt=~/^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/
- txt_obj={:txt =>txt,:col =>@col}
- SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).indent($1)
- else
- txt_obj={:txt =>txt,:col =>@col}
- SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).norm
- end
- special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- strip_markup(@col[:plaintext])
- t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file)
- @tuple_array << t.tuple
- @en,@en_ast,@en_pls=[],[],[]
- @col[:en_a]=@col[:en_z]=nil
- @col[:lev]=@col[:plaintext]=@col[:body]=''
- end
- 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[/#{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
- txt_obj={:txt =>txt,:col =>@col,:endnote_nr =>nr}
- body=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).endnote
- special_character_escape(body)
- special_character_escape(txt)
- strip_markup(txt)
- if txt.size > (endnote_clean - 1)
- puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n"
- open("#{Dir.pwd}/pg_documents_error_log",'a') do |error|
- error.puts("\n#{@opt.fns}\nENDNOTE\n#{txt.size} object #{@col[:ocn]},#{@col[:ocnd]},#{@col[:ocns]} -> #{txt.slice(0..500)}")
- end
- txt=%{\n\nLARGE TEXT BLOCK OMITTED\n\n}
- end
- if txt
- en={}
- en={ :type => 'endnotes',
- :id => @id_n,
- :lid => @col[:lid],
- :nr => nr,
- :txt => txt,
- :body => body,
- :ocn => @col[:ocn],
- :ocnd => @col[:ocnd],
- :ocns => @col[:ocns],
- :id_t => @@id_t,
- :hash => digest_clean
- }
- t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file)
- @tuple_array << t.tuple
- end
- end
- end
- word_mode=notedata.scan(/\S+/)
- end
- 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[/#{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
- txt_obj={:txt =>txt,:col =>@col,:endnote_nr =>nr}
- body=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).endnote
- special_character_escape(body)
- special_character_escape(txt)
- strip_markup(txt)
- if txt.size > (endnote_clean - 1)
- puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n"
- open("#{Dir.pwd}/pg_documents_error_log",'a') do |error|
- error.puts("\n#{@opt.fns}\nENDNOTE\n#{txt.size} object #{@col[:ocn]},#{@col[:ocnd]},#{@col[:ocns]} -> #{txt.slice(0..500)}")
- end
- txt=%{\n\nLARGE TEXT BLOCK OMITTED\n\n}
- end
- if txt
- #puts "'#{@id_n}', '#{@col[:lid]}', '#{en}', '#{txt}', '#{body}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@@id_t}'" #% endnotes
- en={}
- en={ :type => 'endnotes_asterisk',
- :id => @id_n,
- :lid => @col[:lid],
- :nr => nr,
- :txt => txt,
- :body => body,
- :ocn => @col[:ocn],
- :ocnd => @col[:ocnd],
- :ocns => @col[:ocns],
- :id_t => @@id_t,
- :hash => digest_clean
- }
- t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file)
- @tuple_array << t.tuple
- end
- end
- end
- word_mode=notedata.scan(/\S+/)
- end
- 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[/#{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
- txt_obj={:txt =>txt,:col =>@col,:endnote_nr =>nr}
- body=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).endnote
- special_character_escape(body)
- special_character_escape(txt)
- strip_markup(txt)
- if txt.size > (endnote_clean - 1)
- puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n"
- open("#{Dir.pwd}/pg_documents_error_log",'a') do |error|
- error.puts("\n#{@opt.fns}\nENDNOTE\n#{txt.size} object #{@col[:ocn]},#{@col[:ocnd]},#{@col[:ocns]} -> #{txt.slice(0..500)}")
- end
- txt=%{\n\nLARGE TEXT BLOCK OMITTED\n\n}
- end
- if txt
- en={}
- en={ :type => 'endnotes_plus',
- :id => @id_n,
- :lid => @col[:lid],
- :nr => nr,
- :txt => txt,
- :body => body,
- :ocn => @col[:ocn],
- :ocnd => @col[:ocnd],
- :ocns => @col[:ocns],
- :id_t => @@id_t,
- :hash => digest_clean
- }
- t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file)
- @tuple_array << t.tuple
- end
- end
- end
- word_mode=notedata.scan(/\S+/)
- end
- end
- end
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- @tuple_array
- end
- def endnotes(txt)
- @txt=txt
- def standard
- 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 =~/#{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 =~/#{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!(/#{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!(/#{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 =~/#{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[/(?:#{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]
- end
- end
- end
- @col
- end
- self
- end
- def db_import_urls(dbi_unit,meta) #% import documents OID - populate database
- begin
- @fnm=meta
- @env=SiSU_Env::Info_env.new(@opt.fns)
- base=@env.url.root
- out=@env.path.output
- f,u={},{}
- if @fnb.empty? \
- or @fnb.nil?
- p 'file output path error' #remove
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:plain]}")==true)
- f[:txt],u[:txt]='plaintext,', "'#{base}/#@fnb/#{@md.fn[:plain]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:toc]}")==true)
- f[:html_toc],u[:html_toc]='html_toc,', "'#{base}/#@fnb/#{@md.fn[:toc]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:doc]}")==true)
- f[:html_doc],u[:html_doc]='html_doc,', "'#{base}/#@fnb/#{@md.fn[:doc]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:xhtml]}")==true)
- f[:xhtml],u[:xhtml]='xhtml,', "'#{base}/#@fnb/#{@md.fn[:xhtml]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:sax]}")==true)
- f[:xml_sax],u[:xml_sax]='xml_sax,', "'#{base}/#@fnb/#{@md.fn[:sax]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:dom]}")==true)
- f[:xml_dom],u[:xml_dom]='xml_dom,', "'#{base}/#@fnb/#{@md.fn[:dom]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:odf]}")==true)
- f[:odf],u[:odf]='odf,', "'#{base}/#@fnb/#{@md.fn[:odf]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:pdf_p]}")==true)
- f[:pdf_p],u[:pdf_p]='pdf_p,', "'#{base}/#@fnb/#{@md.fn[:pdf_p]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:pdf_l]}")==true)
- f[:pdf_l],u[:pdf_l]='pdf_l,', "'#{base}/#@fnb/#{@md.fn[:pdf_l]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:concordance]}")==true)
- f[:concordance],u[:concordance]='concordance,', "'#{base}/#@fnb/#{@md.fn[:concordance]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.tex")==true)
- f[:latex_p],u[:latex_p]='latex_p,', "'#{base}/#@fnb/#{@opt.fns}.tex',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.landscape.tex")==true)
- f[:latex_l],u[:latex_l]='latex_l,', "'#{base}/#@fnb/#@opt.fns}.landscape.tex',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:digest]}")==true)
- f[:digest],u[:digest]='digest,', "'#{base}/#@fnb/#{@md.fn[:digest]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:manifest]}")==true) #revisit, was to be text, this is html
- f[:manifest],u[:manifest]='manifest,', "'#{base}/#@fnb/#{@md.fn[:manifest]}',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.meta")==true)
- f[:markup],u[:markup]='markup,', "'#{base}/#@fnb/#{@opt.fns}.meta',"
- end
- if @opt.cmd !~/e/ \
- or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.tgz")==true)
- f[:sisupod],u[:sisupod]='sisupod,', "'#{base}/#@fnb/#{@opt.fns}.tgz',"
- end
- t=SiSU_DB_tuple::Load_urls.new(@conn,f,u,@@id_t,@opt,@file)
- tuple=t.tuple
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
- ensure
- end
- tuple
- end
- end
-end
-__END__
diff --git a/lib/sisu/v0/db_indexes.rb b/lib/sisu/v0/db_indexes.rb
deleted file mode 100644
index 315ae199..00000000
--- a/lib/sisu/v0/db_indexes.rb
+++ /dev/null
@@ -1,111 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_index
- class Index # create documents Indexes def initialize(opt,conn='',sql_type='')
- def initialize(opt,conn,file,sql_type='')
- @opt,@conn,@file,@sql_type=opt,conn,file,sql_type
- end
- def create_indexes # check added from pg not tested
- def conn_execute_array(sql_arr)
- @conn.transaction do |conn|
- sql_arr.each do |sql|
- conn.execute(sql)
- end
- end
- end
- def base
- print "\n create documents common indexes\n" unless @opt.cmd =~/q/
- sql_arr=[
- %{CREATE INDEX object_nr ON documents(ocn);},
- %{CREATE INDEX digest_clean ON documents(digest_clean);},
- %{CREATE INDEX digest_all ON documents(digest_all);},
- %{CREATE INDEX lev1 ON documents(lev1);},
- %{CREATE INDEX lev2 ON documents(lev2);},
- %{CREATE INDEX lev3 ON documents(lev3);},
- %{CREATE INDEX lev4 ON documents(lev4);},
- %{CREATE INDEX lev5 ON documents(lev5);},
- %{CREATE INDEX lev6 ON documents(lev6);},
- %{CREATE INDEX endnote_nr ON endnotes(nr);},
- %{CREATE INDEX digest_en ON endnotes(digest_clean);},
- %{CREATE INDEX endnote_nr_asterisk ON endnotes_asterisk(nr);},
- %{CREATE INDEX endnote_asterisk ON endnotes_asterisk(clean);},
- %{CREATE INDEX digest_en_asterisk ON endnotes_asterisk(digest_clean);},
- %{CREATE INDEX endnote_nr_plus ON endnotes_plus(nr);},
- %{CREATE INDEX endnote_plus ON endnotes_plus(clean);},
- %{CREATE INDEX digest_en_plus ON endnotes_plus(digest_clean);},
- %{CREATE INDEX title ON metadata(title);},
- %{CREATE INDEX filename ON metadata(filename)},
- ]
- conn_execute_array(sql_arr)
- end
- def text
- print "\n create documents text indexes\n" unless @opt.cmd =~/q/
- sql_arr=[
- %{CREATE INDEX clean ON documents(clean);},
- %{CREATE INDEX endnote ON endnotes(clean);}
- ]
- conn_execute_array(sql_arr)
- end
- base
- @opt.cmd=~/D/ || @opt.mod=~/psql/ ? '' : text
- end
- end
-end
-__END__
diff --git a/lib/sisu/v0/db_load_tuple.rb b/lib/sisu/v0/db_load_tuple.rb
deleted file mode 100644
index 447e9354..00000000
--- a/lib/sisu/v0/db_load_tuple.rb
+++ /dev/null
@@ -1,155 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-
-
-
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
-
-
-
- * Download:
-
-
- * Ralph Amissah
-
-
-
- ** Description: modules shared by the different db types, dbi, postgresql,
- sqlite
-
-=end
-module SiSU_DB_tuple
- class Load_documents
- require "#{SiSU_lib}/param"
- include SiSU_Param
- def initialize(conn,col,opt,file)
- @conn,@col,@opt,@file=conn,col,opt,file
- @col[:lev]=@col[:lev].to_i
- unless @col[:lev]=~/^[1-6]/ \
- or @col[:lev]==1 \
- or @col[:lev]==2 \
- or @col[:lev]==3 \
- or @col[:lev]==4 \
- or @col[:lev]==5 \
- or @col[:lev]==6 #changed from \d+ ??
- @col[:lev]=0
- end
- @col[:ocn]=0 unless @col[:ocn]=~/\d+/
- @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
- end
- def tuple #% import line
- sql_entry=if @col[:en_a]
- "INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, en_a, en_z, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
- else
- "INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
- end
- if @opt.cmd =~/M/
- if @opt.cmd =~/V/
- puts @file.inspect
- puts sql_entry
- end
- @file.puts sql_entry
- else
- @file.puts sql_entry if @opt.cmd =~/V/
- end
- if @opt.cmd =~/v/
- if @col[:lev].inspect =~/[1235678]/
- lev=case @col[:lev].inspect
- when /1/; ':A'
- when /2/; ':B'
- when /3/; ':C'
- when /5/; ' 2'
- when /6/; ' 3'
- end
- puts %{#{lev}>\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:ocnd]}\t#{@col[:ocns]}}
- elsif @col[:lev].inspect =~/[4]/
- puts %{ #{@cX.green}1>#{@cX.off}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:ocnd]}\t#{@col[:ocns]}\t#{@col[:seg]}}
- end
- end
- sql_entry
- end
- end
- class Load_metadata
- def initialize(conn,tp,id,opt,file)
- @conn,@tp,@id,@opt,@file=conn,tp,id,opt,file
- end
- def tuple
- sql_entry="INSERT INTO metadata (#{@tp[:fns_f]} #{@tp[:suffix_f]} #{@tp[:title_f]} #{@tp[:subtitle_f]} #{@tp[:creator_f]} #{@tp[:illustrator_f]} #{@tp[:translator_f]} #{@tp[:subject_f]} #{@tp[:description_f]} #{@tp[:publisher_f]} #{@tp[:contributor_f]} #{@tp[:prepared_by_f]} #{@tp[:digitized_by_f]} #{@tp[:date_f]} #{@tp[:date_created_f]} #{@tp[:date_issued_f]} #{@tp[:date_valid_f]} #{@tp[:date_available_f]} #{@tp[:date_modified_f]} #{@tp[:type_f]} #{@tp[:format_f]} #{@tp[:identifier_f]} #{@tp[:source_f]} #{@tp[:language_f]} #{@tp[:language_original_f]} #{@tp[:relation_f]} #{@tp[:coverage_f]} #{@tp[:rights_f]} #{@tp[:copyright_f]} #{@tp[:owner_f]} #{@tp[:keywords_f]} #{@tp[:abstract_f]} #{@tp[:comment_f]} #{@tp[:loc_f]} #{@tp[:dewey_f]} #{@tp[:isbn_f]} #{@tp[:pg_f]} #{@tp[:prefix_a_f]} #{@tp[:prefix_b_f]} tid) VALUES (#{@tp[:fns_i]} #{@tp[:suffix_i]} #{@tp[:title_i]} #{@tp[:subtitle_i]} #{@tp[:creator_i]} #{@tp[:illustrator_i]} #{@tp[:translator_i]} #{@tp[:subject_i]} #{@tp[:description_i]} #{@tp[:publisher_i]} #{@tp[:contributor_i]} #{@tp[:prepared_by_i]} #{@tp[:digitized_by_i]} #{@tp[:date_i]} #{@tp[:date_created_i]} #{@tp[:date_issued_i]} #{@tp[:date_valid_i]} #{@tp[:date_available_i]} #{@tp[:date_modified_i]} #{@tp[:type_i]} #{@tp[:format_i]} #{@tp[:identifier_i]} #{@tp[:source_i]} #{@tp[:language_i]} #{@tp[:language_original_i]} #{@tp[:relation_i]} #{@tp[:coverage_i]} #{@tp[:rights_i]} #{@tp[:copyright_i]} #{@tp[:owner_i]} #{@tp[:keywords_i]} #{@tp[:abstract_i]} #{@tp[:comment_i]} #{@tp[:loc_i]} #{@tp[:dewey_i]} #{@tp[:isbn_i]} #{@tp[:pg_i]} #{@tp[:prefix_a_i]} #{@tp[:prefix_b_i]} #{@id});"
- if @opt.cmd =~/M/
- puts "maintenance mode on: creating sql transaction file (for last transaction set (document) only):\n\t#{@file.inspect}"
- @file.puts sql_entry
- else
- @file.puts sql_entry if @opt.cmd =~/V/
- end
- sql_entry
- end
- end
- class Load_urls
- def initialize(conn,f,u,id,opt,file)
- @conn,@f,@u,@id,@opt,@file=conn,f,u,id,opt,file
- end
- def tuple
- sql_entry="INSERT INTO urls (#{@f[:txt]} #{@f[:html_toc]} #{@f[:html_doc]} #{@f[:xhtml]} #{@f[:xml_sax]} #{@f[:xml_dom]} #{@f[:odf]} #{@f[:pdf_p]} #{@f[:pdf_l]} #{@f[:concordance]} #{@f[:latex_p]} #{@f[:latex_l]} #{@f[:manifest]} #{@f[:digest]} #{@f[:markup]} #{@f[:sisupod]} metadata_tid) VALUES (#{@u[:txt]} #{@u[:html_toc]} #{@u[:html_doc]} #{@u[:xhtml]} #{@u[:xml_sax]} #{@u[:xml_dom]} #{@u[:odf]} #{@u[:pdf_p]} #{@u[:pdf_l]} #{@u[:concordance]} #{@u[:latex_p]} #{@u[:latex_l]} #{@u[:manifest]} #{@u[:digest]} #{@u[:markup]} #{@u[:sisupod]} #{@id});"
- if @opt.cmd =~/M/
- @file.puts sql_entry
- else
- @file.puts sql_entry if @opt.cmd =~/V/
- end
- sql_entry
- end
- end
- class Load_endnotes
- def initialize(conn,en,opt,file)
- @conn,@en,@opt,@file=conn,en,opt,file
- end
- def tuple
- sql_entry="INSERT INTO #{@en[:type]} (nid, document_lid, nr, clean, body, ocn, ocnd, ocns, metadata_tid, digest_clean) VALUES ('#{@en[:id]}', '#{@en[:lid]}', '#{@en[:nr]}', '#{@en[:txt]}', '#{@en[:body]}', '#{@en[:ocn]}', '#{@en[:ocnd]}', '#{@en[:ocns]}', '#{@en[:id_t]}', '#{@en[:hash]}');"
- if @opt.cmd =~/M/
- @file.puts sql_entry
- else
- @file.puts sql_entry if @opt.cmd =~/V/
- end
- sql_entry
- end
- end
-end
-__END__
diff --git a/lib/sisu/v0/db_remove.rb b/lib/sisu/v0/db_remove.rb
deleted file mode 100644
index bde5c891..00000000
--- a/lib/sisu/v0/db_remove.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-# coding: utf-8
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997 - 2009 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see .
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
-
-
-
-