sisu 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/sisu +367 -0
- data/bin/sisugem +367 -0
- data/data/sisu/image/arrow_next_red.png +0 -0
- data/data/sisu/image/arrow_prev_red.png +0 -0
- data/data/sisu/image/arrow_up_red.png +0 -0
- data/data/sisu/image/b_bluebell.png +0 -0
- data/data/sisu/image/b_doc.png +0 -0
- data/data/sisu/image/b_epub.png +0 -0
- data/data/sisu/image/b_home.png +0 -0
- data/data/sisu/image/b_info.png +0 -0
- data/data/sisu/image/b_odf.png +0 -0
- data/data/sisu/image/b_pdf.png +0 -0
- data/data/sisu/image/b_search.png +0 -0
- data/data/sisu/image/b_toc.png +0 -0
- data/data/sisu/image/bullet_08.png +0 -0
- data/data/sisu/image/bullet_09.png +0 -0
- data/data/sisu/image/bullet_10.png +0 -0
- data/data/sisu/image/bullet_11.png +0 -0
- data/data/sisu/image/bullet_12.png +0 -0
- data/data/sisu/image/bullet_doc.png +0 -0
- data/data/sisu/image/bullet_red.png +0 -0
- data/data/sisu/image/dot_clear.png +0 -0
- data/data/sisu/image/dot_white.png +0 -0
- data/data/sisu/image/gplv3.png +0 -0
- data/data/sisu/image/gplv3_free_software.png +0 -0
- data/data/sisu/image/next.png +0 -0
- data/data/sisu/image/previous.png +0 -0
- data/data/sisu/image/rb7.ico +0 -0
- data/data/sisu/image/sisu.png +0 -0
- data/data/sisu/image/toctoc.png +0 -0
- data/data/sisu/version.yml +5 -0
- data/lib/sisu.rb +94 -0
- data/lib/sisu/air.rb +80 -0
- data/lib/sisu/ao.rb +590 -0
- data/lib/sisu/ao_character_check.rb +102 -0
- data/lib/sisu/ao_composite.rb +286 -0
- data/lib/sisu/ao_doc_objects.rb +565 -0
- data/lib/sisu/ao_doc_str.rb +2269 -0
- data/lib/sisu/ao_endnotes.rb +136 -0
- data/lib/sisu/ao_expand_insertions.rb +514 -0
- data/lib/sisu/ao_hash_digest.rb +174 -0
- data/lib/sisu/ao_idx.rb +422 -0
- data/lib/sisu/ao_images.rb +187 -0
- data/lib/sisu/ao_metadata.rb +86 -0
- data/lib/sisu/ao_misc_arrange.rb +207 -0
- data/lib/sisu/ao_numbering.rb +720 -0
- data/lib/sisu/ao_persist.rb +194 -0
- data/lib/sisu/ao_references.rb +502 -0
- data/lib/sisu/ao_syntax.rb +640 -0
- data/lib/sisu/cgi.rb +84 -0
- data/lib/sisu/cgi_pgsql.rb +270 -0
- data/lib/sisu/cgi_sql_common.rb +986 -0
- data/lib/sisu/cgi_sqlite.rb +244 -0
- data/lib/sisu/conf.rb +287 -0
- data/lib/sisu/constants.rb +388 -0
- data/lib/sisu/css.rb +3484 -0
- data/lib/sisu/db_columns.rb +1997 -0
- data/lib/sisu/db_create.rb +689 -0
- data/lib/sisu/db_dbi.rb +90 -0
- data/lib/sisu/db_drop.rb +207 -0
- data/lib/sisu/db_import.rb +877 -0
- data/lib/sisu/db_indexes.rb +146 -0
- data/lib/sisu/db_load_tuple.rb +323 -0
- data/lib/sisu/db_remove.rb +182 -0
- data/lib/sisu/db_select.rb +230 -0
- data/lib/sisu/db_sqltxt.rb +173 -0
- data/lib/sisu/db_tests.rb +114 -0
- data/lib/sisu/dbi.rb +166 -0
- data/lib/sisu/dbi_discrete.rb +206 -0
- data/lib/sisu/digests.rb +306 -0
- data/lib/sisu/dp.rb +1606 -0
- data/lib/sisu/dp_identify_markup.rb +161 -0
- data/lib/sisu/dp_make.rb +668 -0
- data/lib/sisu/embedded.rb +149 -0
- data/lib/sisu/errors.rb +84 -0
- data/lib/sisu/generic_parts.rb +131 -0
- data/lib/sisu/git.rb +277 -0
- data/lib/sisu/html.rb +775 -0
- data/lib/sisu/html_concordance.rb +391 -0
- data/lib/sisu/html_format.rb +1348 -0
- data/lib/sisu/html_harvest.rb +109 -0
- data/lib/sisu/html_harvest_author_format.rb +111 -0
- data/lib/sisu/html_harvest_authors.rb +466 -0
- data/lib/sisu/html_harvest_topics.rb +893 -0
- data/lib/sisu/html_lite_shared.rb +324 -0
- data/lib/sisu/html_manifest.rb +1032 -0
- data/lib/sisu/html_minitoc.rb +230 -0
- data/lib/sisu/html_parts.rb +437 -0
- data/lib/sisu/html_persist.rb +237 -0
- data/lib/sisu/html_promo.rb +440 -0
- data/lib/sisu/html_scroll.rb +235 -0
- data/lib/sisu/html_segments.rb +716 -0
- data/lib/sisu/html_shared.rb +62 -0
- data/lib/sisu/html_table.rb +64 -0
- data/lib/sisu/html_tune.rb +301 -0
- data/lib/sisu/hub.rb +277 -0
- data/lib/sisu/hub_actions.rb +1122 -0
- data/lib/sisu/hub_loop_markup_files.rb +170 -0
- data/lib/sisu/hub_options.rb +1695 -0
- data/lib/sisu/i18n.rb +702 -0
- data/lib/sisu/manpage.rb +377 -0
- data/lib/sisu/manpage_format.rb +85 -0
- data/lib/sisu/object_munge.rb +307 -0
- data/lib/sisu/prog_text_translation.rb +1702 -0
- data/lib/sisu/qrcode.rb +754 -0
- data/lib/sisu/relaxng.rb +1153 -0
- data/lib/sisu/remote.rb +246 -0
- data/lib/sisu/rexml.rb +148 -0
- data/lib/sisu/se.rb +158 -0
- data/lib/sisu/se_cleanoutput.rb +145 -0
- data/lib/sisu/se_clear.rb +105 -0
- data/lib/sisu/se_createsite.rb +273 -0
- data/lib/sisu/se_css.rb +221 -0
- data/lib/sisu/se_date.rb +92 -0
- data/lib/sisu/se_db.rb +214 -0
- data/lib/sisu/se_envcall.rb +326 -0
- data/lib/sisu/se_file_op.rb +2758 -0
- data/lib/sisu/se_filemap.rb +247 -0
- data/lib/sisu/se_get_init.rb +238 -0
- data/lib/sisu/se_hub_particulars.rb +234 -0
- data/lib/sisu/se_info_env.rb +2179 -0
- data/lib/sisu/se_info_port.rb +70 -0
- data/lib/sisu/se_info_system.rb +202 -0
- data/lib/sisu/se_load.rb +108 -0
- data/lib/sisu/se_processing.rb +659 -0
- data/lib/sisu/se_programs.rb +394 -0
- data/lib/sisu/se_remotes.rb +553 -0
- data/lib/sisu/se_standardise_lang.rb +176 -0
- data/lib/sisu/se_version.rb +174 -0
- data/lib/sisu/shared_images.rb +137 -0
- data/lib/sisu/shared_markup_alt.rb +336 -0
- data/lib/sisu/shared_metadata.rb +1361 -0
- data/lib/sisu/shared_sem.rb +156 -0
- data/lib/sisu/sisu_thor_lib.rb +407 -0
- data/lib/sisu/sitemaps.rb +224 -0
- data/lib/sisu/src_kdissert_share.rb +102 -0
- data/lib/sisu/src_po4a_share.rb +309 -0
- data/lib/sisu/src_po4a_shelf.rb +1217 -0
- data/lib/sisu/src_po4a_shelf_set.rb +297 -0
- data/lib/sisu/src_po4a_sst_ao_sst.rb +893 -0
- data/lib/sisu/src_po4a_sst_ao_sst_set.rb +284 -0
- data/lib/sisu/src_po4a_sstm.rb +135 -0
- data/lib/sisu/src_shared.rb +347 -0
- data/lib/sisu/src_sisupod_make.rb +171 -0
- data/lib/sisu/src_sisupod_sstm.rb +109 -0
- data/lib/sisu/sst_convert_markup.rb +323 -0
- data/lib/sisu/sst_do_inline_footnotes.rb +440 -0
- data/lib/sisu/sst_from_xml.rb +178 -0
- data/lib/sisu/sst_identify_markup.rb +482 -0
- data/lib/sisu/sst_to_s_xml_sax.rb +471 -0
- data/lib/sisu/termsheet.rb +163 -0
- data/lib/sisu/texinfo.rb +430 -0
- data/lib/sisu/texinfo_format.rb +541 -0
- data/lib/sisu/texpdf.rb +1162 -0
- data/lib/sisu/texpdf_format.rb +1689 -0
- data/lib/sisu/texpdf_parts.rb +235 -0
- data/lib/sisu/txt_asciidoc.rb +354 -0
- data/lib/sisu/txt_asciidoc_decorate.rb +207 -0
- data/lib/sisu/txt_markdown.rb +389 -0
- data/lib/sisu/txt_markdown_decorate.rb +207 -0
- data/lib/sisu/txt_orgmode.rb +376 -0
- data/lib/sisu/txt_orgmode_decorate.rb +186 -0
- data/lib/sisu/txt_output.rb +86 -0
- data/lib/sisu/txt_plain.rb +410 -0
- data/lib/sisu/txt_plain_decorate.rb +189 -0
- data/lib/sisu/txt_read.rb +109 -0
- data/lib/sisu/txt_rst.rb +371 -0
- data/lib/sisu/txt_rst_decorate.rb +186 -0
- data/lib/sisu/txt_shared.rb +241 -0
- data/lib/sisu/txt_textile.rb +367 -0
- data/lib/sisu/txt_textile_decorate.rb +186 -0
- data/lib/sisu/update.rb +141 -0
- data/lib/sisu/urls.rb +696 -0
- data/lib/sisu/utils.rb +232 -0
- data/lib/sisu/utils_composite.rb +115 -0
- data/lib/sisu/utils_response.rb +114 -0
- data/lib/sisu/utils_screen_text_color.rb +472 -0
- data/lib/sisu/utils_spell.rb +99 -0
- data/lib/sisu/webrick.rb +191 -0
- data/lib/sisu/wikispeak.rb +375 -0
- data/lib/sisu/xhtml.rb +472 -0
- data/lib/sisu/xhtml_epub2.rb +890 -0
- data/lib/sisu/xhtml_epub2_concordance.rb +322 -0
- data/lib/sisu/xhtml_epub2_format.rb +2272 -0
- data/lib/sisu/xhtml_epub2_persist.rb +278 -0
- data/lib/sisu/xhtml_epub2_segments.rb +599 -0
- data/lib/sisu/xhtml_epub2_tune.rb +330 -0
- data/lib/sisu/xhtml_parts.rb +183 -0
- data/lib/sisu/xhtml_shared.rb +62 -0
- data/lib/sisu/xhtml_table.rb +97 -0
- data/lib/sisu/xml_docbook5.rb +376 -0
- data/lib/sisu/xml_dom.rb +624 -0
- data/lib/sisu/xml_fictionbook2.rb +389 -0
- data/lib/sisu/xml_format.rb +865 -0
- data/lib/sisu/xml_md_oai_pmh_dc.rb +229 -0
- data/lib/sisu/xml_odf_odt.rb +887 -0
- data/lib/sisu/xml_odf_odt_format.rb +674 -0
- data/lib/sisu/xml_parts.rb +191 -0
- data/lib/sisu/xml_persist.rb +126 -0
- data/lib/sisu/xml_sax.rb +521 -0
- data/lib/sisu/xml_scaffold_structure_collapsed.rb +198 -0
- data/lib/sisu/xml_scaffold_structure_sisu.rb +201 -0
- data/lib/sisu/xml_shared.rb +665 -0
- data/lib/sisu/xml_tables.rb +261 -0
- data/lib/sisu/zap.rb +90 -0
- metadata +251 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** system environment, resource control and configuration details
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
<ralph@amissah.com>
|
|
11
|
+
<ralph.amissah@gmail.com>
|
|
12
|
+
|
|
13
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
14
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
15
|
+
All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
** License: GPL 3 or later:
|
|
18
|
+
|
|
19
|
+
SiSU, a framework for document structuring, publishing and search
|
|
20
|
+
|
|
21
|
+
Copyright (C) Ralph Amissah
|
|
22
|
+
|
|
23
|
+
This program is free software: you can redistribute it and/or modify it
|
|
24
|
+
under the terms of the GNU General Public License as published by the Free
|
|
25
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
26
|
+
any later version.
|
|
27
|
+
|
|
28
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
29
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
31
|
+
more details.
|
|
32
|
+
|
|
33
|
+
You should have received a copy of the GNU General Public License along with
|
|
34
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
|
|
36
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
37
|
+
available at these locations:
|
|
38
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
39
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
40
|
+
|
|
41
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
42
|
+
|
|
43
|
+
** SiSU uses:
|
|
44
|
+
* Standard SiSU markup syntax,
|
|
45
|
+
* Standard SiSU meta-markup syntax, and the
|
|
46
|
+
* Standard SiSU object citation numbering and system
|
|
47
|
+
|
|
48
|
+
** Hompages:
|
|
49
|
+
<http://www.jus.uio.no/sisu>
|
|
50
|
+
<http://www.sisudoc.org>
|
|
51
|
+
|
|
52
|
+
** Git
|
|
53
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_character_check.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_AO_CharacterCheck
|
|
58
|
+
class Check
|
|
59
|
+
def initialize(data)
|
|
60
|
+
@data=data
|
|
61
|
+
@comment='%'
|
|
62
|
+
@endnote_array=[]
|
|
63
|
+
end
|
|
64
|
+
def character_check_and_oldstyle_endnote_array
|
|
65
|
+
data=@data
|
|
66
|
+
@endnote_array=[]
|
|
67
|
+
endnote_no=1
|
|
68
|
+
@tuned_file=data.select do |dob|
|
|
69
|
+
unless dob.is ==:table
|
|
70
|
+
dob.obj=dob.obj.strip.
|
|
71
|
+
gsub(/^[{~}]\s*$/,'').
|
|
72
|
+
gsub(/~#\s*/,"#{Mx[:pa_non_object_no_heading]}").
|
|
73
|
+
gsub(/-#\s*/,"#{Mx[:pa_non_object_dummy_heading]}").
|
|
74
|
+
gsub(/(#{Mx[:en_a_o]})\s*\s+/,'\1 ').
|
|
75
|
+
gsub(/(~\{\s*)\s+/,'\1 ').
|
|
76
|
+
gsub(/ \/\//,"#{Mx[:br_line]}").
|
|
77
|
+
gsub(/<br>/,"#{Mx[:br_line]}"). #needed by xml, xhtml etc.
|
|
78
|
+
gsub(/\t/,' ').
|
|
79
|
+
gsub(/\342\200\231/u,"'"). #if dob =~/’/ #Avoid #‘ ’ #“ ”
|
|
80
|
+
gsub(/\\copy(?:right)?\b/,'©').
|
|
81
|
+
gsub(/\\trademark\b|\\tm\b/,'®')
|
|
82
|
+
dob.obj=dob.obj + "\n"
|
|
83
|
+
unless dob.is ==:code
|
|
84
|
+
case dob.obj
|
|
85
|
+
when /\^~/ #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+
|
|
86
|
+
sub_dob=dob.obj.dup
|
|
87
|
+
@endnote_array << sub_dob.gsub(/\n/,'').
|
|
88
|
+
gsub(/\^~\s+(.+)\s*/,
|
|
89
|
+
%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).
|
|
90
|
+
strip
|
|
91
|
+
endnote_no+=1
|
|
92
|
+
dob=nil if dob.obj =~/\^~ .+/ #watch, removes 'binary' endnote now in endnote array for later insertion
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
dob if dob.is_a?(Object)
|
|
97
|
+
end.flatten.compact
|
|
98
|
+
[@tuned_file,@endnote_array]
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
__END__
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** composite documents, assemble/build documents from other documents
|
|
8
|
+
or parts of marked up text
|
|
9
|
+
|
|
10
|
+
** Author: Ralph Amissah
|
|
11
|
+
<ralph@amissah.com>
|
|
12
|
+
<ralph.amissah@gmail.com>
|
|
13
|
+
|
|
14
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
15
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
16
|
+
All Rights Reserved.
|
|
17
|
+
|
|
18
|
+
** License: GPL 3 or later:
|
|
19
|
+
|
|
20
|
+
SiSU, a framework for document structuring, publishing and search
|
|
21
|
+
|
|
22
|
+
Copyright (C) Ralph Amissah
|
|
23
|
+
|
|
24
|
+
This program is free software: you can redistribute it and/or modify it
|
|
25
|
+
under the terms of the GNU General Public License as published by the Free
|
|
26
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
27
|
+
any later version.
|
|
28
|
+
|
|
29
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
30
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
31
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
32
|
+
more details.
|
|
33
|
+
|
|
34
|
+
You should have received a copy of the GNU General Public License along with
|
|
35
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
36
|
+
|
|
37
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
38
|
+
available at these locations:
|
|
39
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
40
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
41
|
+
|
|
42
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
43
|
+
|
|
44
|
+
** SiSU uses:
|
|
45
|
+
* Standard SiSU markup syntax,
|
|
46
|
+
* Standard SiSU meta-markup syntax, and the
|
|
47
|
+
* Standard SiSU object citation numbering and system
|
|
48
|
+
|
|
49
|
+
** Hompages:
|
|
50
|
+
<http://www.jus.uio.no/sisu>
|
|
51
|
+
<http://www.sisudoc.org>
|
|
52
|
+
|
|
53
|
+
** Git
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
55
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_composite.rb;hb=HEAD>
|
|
56
|
+
|
|
57
|
+
=end
|
|
58
|
+
module SiSU_Assemble
|
|
59
|
+
require_relative 'se' # se.rb
|
|
60
|
+
require_relative 'utils_composite' # utils_composite.rb
|
|
61
|
+
class RemoteImage
|
|
62
|
+
def initialize
|
|
63
|
+
@env=SiSU_Env::InfoEnv.new
|
|
64
|
+
end
|
|
65
|
+
def image(dir)
|
|
66
|
+
images=[]
|
|
67
|
+
images[0]=dir
|
|
68
|
+
images
|
|
69
|
+
end
|
|
70
|
+
def download_images(images_info)
|
|
71
|
+
path="#{@env.processing_path.processing}/external_document/image"
|
|
72
|
+
FileUtils::mkdir_p(path) \
|
|
73
|
+
unless FileTest.directory?(path)
|
|
74
|
+
download_from=images_info.shift
|
|
75
|
+
images_info.each do |i|
|
|
76
|
+
image="#{path}/#{i}"
|
|
77
|
+
imagefile=File.new(image,'w+')
|
|
78
|
+
open("#{download_from}/#{i}") do |g|
|
|
79
|
+
imagefile << g.read
|
|
80
|
+
end
|
|
81
|
+
imagefile.close
|
|
82
|
+
end
|
|
83
|
+
output_path="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external"
|
|
84
|
+
FileUtils::mkdir_p(output_path) \
|
|
85
|
+
unless FileTest.directory?(output_path)
|
|
86
|
+
SiSU_Env::SystemCall.new("#{path}/*",output_path,'q').rsync
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
class Composite
|
|
90
|
+
include SiSU_Composite_Doc_Utils # composite doc, .ssm, extract all related insert files, array of filenames test
|
|
91
|
+
def initialize(opt)
|
|
92
|
+
@opt=opt
|
|
93
|
+
@env=SiSU_Env::InfoEnv.new
|
|
94
|
+
end
|
|
95
|
+
def read
|
|
96
|
+
begin
|
|
97
|
+
pwd=Dir.pwd
|
|
98
|
+
Dir.chdir(@opt.f_pth[:pth])
|
|
99
|
+
if @opt.fno =~/\S+?\.ssm$/
|
|
100
|
+
SiSU_Screen::Ansi.new(
|
|
101
|
+
@opt.act[:color_state][:set],
|
|
102
|
+
'Composite Document',
|
|
103
|
+
"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}",
|
|
104
|
+
).grey_title_hi unless @opt.act[:quiet][:set]==:on
|
|
105
|
+
composite_and_imported_filenames_array(@opt.fno) # composite doc, .ssm, extract all related insert files, array of filenames test
|
|
106
|
+
assembled=loadfile(@opt.fno)
|
|
107
|
+
write(assembled)
|
|
108
|
+
end
|
|
109
|
+
Dir.chdir(pwd)
|
|
110
|
+
rescue
|
|
111
|
+
SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).
|
|
112
|
+
location do
|
|
113
|
+
__LINE__.to_s + ':' + __FILE__
|
|
114
|
+
end
|
|
115
|
+
ensure
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
def insert?(para)
|
|
119
|
+
if para =~ /^<<\s+((?:https?|file):\/\/\S+?\.ss[it])$/ # and NetTest
|
|
120
|
+
url($1.strip)
|
|
121
|
+
elsif para =~/^<<\s+(\S+?\.ss[it])$/
|
|
122
|
+
loadfilename=$1.strip
|
|
123
|
+
insert_array=loadfile(loadfilename)
|
|
124
|
+
file=insertion(loadfilename,insert_array)
|
|
125
|
+
file[:prepared]
|
|
126
|
+
else para
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
def loadfile(loadfilename)
|
|
130
|
+
begin
|
|
131
|
+
if FileTest.file?(loadfilename)
|
|
132
|
+
insert_array=IO.readlines(loadfilename,'')
|
|
133
|
+
if loadfilename =~/\S+?\.ss[itm]$/
|
|
134
|
+
if (@opt.act[:verbose][:set]==:on \
|
|
135
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
136
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
137
|
+
SiSU_Screen::Ansi.new(
|
|
138
|
+
@opt.act[:color_state][:set],
|
|
139
|
+
'loading:',
|
|
140
|
+
loadfilename,
|
|
141
|
+
).txt_grey
|
|
142
|
+
end
|
|
143
|
+
tuned_file=if loadfilename =~/\S+?\.ss[im]$/
|
|
144
|
+
insert_array.each.map do |para|
|
|
145
|
+
insert?(para)
|
|
146
|
+
end
|
|
147
|
+
elsif loadfilename =~/\S+?\.sst$/
|
|
148
|
+
insert_array.each.map do |para|
|
|
149
|
+
para
|
|
150
|
+
end
|
|
151
|
+
end.flatten.compact
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
rescue
|
|
155
|
+
SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
|
|
156
|
+
__LINE__.to_s + ':' + __FILE__
|
|
157
|
+
end
|
|
158
|
+
ensure
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
def url(loadfilename)
|
|
162
|
+
if loadfilename =~ /((?:https?|file):\/\/\S+?\.ss[it])$/ # and NetTest
|
|
163
|
+
loadfilename=$1
|
|
164
|
+
begin
|
|
165
|
+
require 'uri'
|
|
166
|
+
require 'open-uri'
|
|
167
|
+
require 'pp'
|
|
168
|
+
rescue LoadError
|
|
169
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
170
|
+
error('uri, open-uri or pp NOT FOUND (LoadError)')
|
|
171
|
+
end
|
|
172
|
+
insert=open(loadfilename)
|
|
173
|
+
insert_array=insert.dup
|
|
174
|
+
insert.close
|
|
175
|
+
file=insertion(loadfilename,insert_array)
|
|
176
|
+
file[:prepared]
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
def write(assembled)
|
|
180
|
+
assembled_file=File.new("#{@env.processing_path.composite_file}/#{@opt.fnb}.ssm.sst",'w+')
|
|
181
|
+
assembled.each {|a| assembled_file << a }
|
|
182
|
+
assembled_file.close
|
|
183
|
+
end
|
|
184
|
+
def download_images(download_from,images_array)
|
|
185
|
+
path="#{@env.processing_path.processing}/external_document/image"
|
|
186
|
+
FileUtils::mkdir_p(path) unless FileTest.directory?(path)
|
|
187
|
+
images_array.each do |i|
|
|
188
|
+
image="#{path}/#{i}"
|
|
189
|
+
unless FileTest.exists?(image)
|
|
190
|
+
imagefile=File.new(image,'w+')
|
|
191
|
+
open("#{download_from}/#{i}") do |g|
|
|
192
|
+
imagefile << g.read
|
|
193
|
+
end
|
|
194
|
+
imagefile.close
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
def insertion(fni,insert_array)
|
|
199
|
+
file={ prepared: [], images: [] }
|
|
200
|
+
rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
|
|
201
|
+
file[:prepared] << "\n% |#{fni}|@|^|>>ok\n\n"
|
|
202
|
+
@code_flag=false
|
|
203
|
+
insert_array.each do |i|
|
|
204
|
+
@code_flag=if i =~/^code\{/ then true
|
|
205
|
+
elsif i =~/^\}code/ then false
|
|
206
|
+
else @code_flag
|
|
207
|
+
end
|
|
208
|
+
if not @code_flag \
|
|
209
|
+
and i !~/^%+\s/
|
|
210
|
+
i=i.
|
|
211
|
+
gsub(/^([123]|:?[ABCD])~\? /,
|
|
212
|
+
'% [conditional heading:] \1~ ') #off conditional heading (consider syntax)
|
|
213
|
+
if i =~/^@\S+?:/
|
|
214
|
+
i=i.gsub(/\n/m,"\n% ").
|
|
215
|
+
gsub(/\n%\s+$/m,'').
|
|
216
|
+
gsub(/^@\S+?:/m,"\n% [imported header:] ") #off imported headers
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
file[:prepared] << i
|
|
220
|
+
if i !~/^%+\s/ \
|
|
221
|
+
and i =~rgx_image
|
|
222
|
+
file[:images] << i.scan(rgx_image).uniq
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
file[:prepared] << "\n% end import" << "\n\n"
|
|
226
|
+
if file[:images].length > 0
|
|
227
|
+
file[:images]=file[:images].flatten.uniq
|
|
228
|
+
file[:images].delete_if {|x| x =~/https?:\/\// }
|
|
229
|
+
end
|
|
230
|
+
file
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
class CompositeFileList
|
|
234
|
+
def initialize(opt)
|
|
235
|
+
@opt=opt
|
|
236
|
+
@env=SiSU_Env::InfoEnv.new
|
|
237
|
+
end
|
|
238
|
+
def read
|
|
239
|
+
begin
|
|
240
|
+
@opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm') #FIX earlier, hub
|
|
241
|
+
fns_array=IO.readlines(@opt.fns,'')
|
|
242
|
+
insertions?(fns_array)
|
|
243
|
+
rescue
|
|
244
|
+
SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
|
|
245
|
+
__LINE__.to_s + ':' + __FILE__
|
|
246
|
+
end
|
|
247
|
+
ensure
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
def insertions?(fns_array)
|
|
251
|
+
tuned_file=[]
|
|
252
|
+
SiSU_Screen::Ansi.new(
|
|
253
|
+
@opt.act[:color_state][:set],
|
|
254
|
+
'Composite Document',
|
|
255
|
+
@opt.fno
|
|
256
|
+
).grey_title_hi unless @opt.act[:quiet][:set]==:on
|
|
257
|
+
@ssm=[@opt.fns]
|
|
258
|
+
fns_array.each do |para|
|
|
259
|
+
if para =~/^<<\s+(\S+?\.ss[it])$/
|
|
260
|
+
loadfilename=$1.strip
|
|
261
|
+
if (@opt.act[:verbose][:set]==:on \
|
|
262
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
263
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
264
|
+
SiSU_Screen::Ansi.new(
|
|
265
|
+
@opt.act[:color_state][:set],
|
|
266
|
+
'loading:',
|
|
267
|
+
loadfilename,
|
|
268
|
+
).txt_grey
|
|
269
|
+
end
|
|
270
|
+
tuned_file << if loadfilename =~ /(?:https?|file):\/\/\S+?\.ss[it]$/
|
|
271
|
+
@ssm << loadfilename
|
|
272
|
+
elsif loadfilename =~ /\.ss[it]$/ \
|
|
273
|
+
and FileTest.file?(loadfilename)
|
|
274
|
+
@ssm << loadfilename
|
|
275
|
+
else
|
|
276
|
+
STDERR.puts %{SKIPPED processing file: [#{@opt.lng}] "#{@opt.fns}" it requires an invalid or non-existent file: "#{loadfilename}"}
|
|
277
|
+
$process_document = :skip; break #remove this line to continue processing documents that have missing include files
|
|
278
|
+
para
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
@ssm
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
end
|
|
286
|
+
__END__
|
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** document abstraction
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
<ralph@amissah.com>
|
|
11
|
+
<ralph.amissah@gmail.com>
|
|
12
|
+
|
|
13
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
14
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
15
|
+
All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
** License: GPL 3 or later:
|
|
18
|
+
|
|
19
|
+
SiSU, a framework for document structuring, publishing and search
|
|
20
|
+
|
|
21
|
+
Copyright (C) Ralph Amissah
|
|
22
|
+
|
|
23
|
+
This program is free software: you can redistribute it and/or modify it
|
|
24
|
+
under the terms of the GNU General Public License as published by the Free
|
|
25
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
26
|
+
any later version.
|
|
27
|
+
|
|
28
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
29
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
31
|
+
more details.
|
|
32
|
+
|
|
33
|
+
You should have received a copy of the GNU General Public License along with
|
|
34
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
|
|
36
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
37
|
+
available at these locations:
|
|
38
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
39
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
40
|
+
|
|
41
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
42
|
+
|
|
43
|
+
** SiSU uses:
|
|
44
|
+
* Standard SiSU markup syntax,
|
|
45
|
+
* Standard SiSU meta-markup syntax, and the
|
|
46
|
+
* Standard SiSU object citation numbering and system
|
|
47
|
+
|
|
48
|
+
** Hompages:
|
|
49
|
+
<http://www.jus.uio.no/sisu>
|
|
50
|
+
<http://www.sisudoc.org>
|
|
51
|
+
|
|
52
|
+
** Git
|
|
53
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_doc_objects.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_AO_DocumentStructure
|
|
58
|
+
class Extract
|
|
59
|
+
def extract(h,o)
|
|
60
|
+
h ? h : o
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
class ObjectMetadata
|
|
64
|
+
attr_accessor :is,:of,:tags,:obj,:digest
|
|
65
|
+
def initialize
|
|
66
|
+
@tags={}
|
|
67
|
+
@is=@tmp=@digest=nil
|
|
68
|
+
@of=:meta
|
|
69
|
+
end
|
|
70
|
+
def metadata(tags)
|
|
71
|
+
of = @of #Symbol, classification - group
|
|
72
|
+
is = :meta #Symbol, classification - specific type
|
|
73
|
+
tags = tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag
|
|
74
|
+
obj = nil
|
|
75
|
+
@of,@is,@tags,@obj=of,is,tags,obj
|
|
76
|
+
self
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
class ObjectMeta
|
|
80
|
+
attr_accessor :obj,:is,:of,:tag,:digest,:tmp
|
|
81
|
+
def initialize
|
|
82
|
+
@is=@obj=@tag=@digest=@digest=@tmp=nil
|
|
83
|
+
@of=:meta
|
|
84
|
+
end
|
|
85
|
+
def metadata(h,o=nil)
|
|
86
|
+
of = @of #Symbol, classification - group
|
|
87
|
+
is = :meta #Symbol, classification - specific type
|
|
88
|
+
tag = h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag
|
|
89
|
+
obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
90
|
+
tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
91
|
+
digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
|
|
92
|
+
@of,@is,@tag,@obj,@digest,@tmp=of,is,tag,obj,digest,tmp
|
|
93
|
+
self
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
class ObjectHeading
|
|
97
|
+
attr_accessor :obj,:is,:tags,:of,:lv,:ln,:lc,:use_,:name,:idx,:ocn,:odv,:osp,:node,:parent,:ocn_,:note_,:autonum_,:digest,:tmp
|
|
98
|
+
def initialize
|
|
99
|
+
@of=:para
|
|
100
|
+
@is=@obj=@lv=@ln=@lc=@use_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil
|
|
101
|
+
@tags=[]
|
|
102
|
+
end
|
|
103
|
+
def heading_ln(lv)
|
|
104
|
+
case lv
|
|
105
|
+
when /A/ then 0
|
|
106
|
+
when /B/ then 1
|
|
107
|
+
when /C/ then 2
|
|
108
|
+
when /D/ then 3
|
|
109
|
+
when /1/ then 4
|
|
110
|
+
when /2/ then 5
|
|
111
|
+
when /3/ then 6
|
|
112
|
+
when /4/ then 7
|
|
113
|
+
when /5/ then 8
|
|
114
|
+
when /6/ then 9
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
def heading_lv(ln)
|
|
118
|
+
case ln.to_s
|
|
119
|
+
when /0/ then 'A'
|
|
120
|
+
when /1/ then 'B'
|
|
121
|
+
when /2/ then 'C'
|
|
122
|
+
when /3/ then 'D'
|
|
123
|
+
when /4/ then '1'
|
|
124
|
+
when /5/ then '2'
|
|
125
|
+
when /6/ then '3'
|
|
126
|
+
when /7/ then '4'
|
|
127
|
+
when /8/ then '5'
|
|
128
|
+
when /9/ then '6'
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
def heading(h,o=nil)
|
|
132
|
+
if not h[:ln] \
|
|
133
|
+
and (h[:lv] and h[:lv]=~/[1-6A-D]/)
|
|
134
|
+
h[:ln]=heading_ln(h[:lv])
|
|
135
|
+
elsif not h[:lv] \
|
|
136
|
+
and (h[:ln] and h[:ln].to_s=~/[0-9]/)
|
|
137
|
+
h[:lv]=heading_lv(h[:ln])
|
|
138
|
+
end
|
|
139
|
+
of = @of #Symbol, classification - group
|
|
140
|
+
is = :heading #Symbol, classification - specific type
|
|
141
|
+
name = h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
|
|
142
|
+
tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
|
|
143
|
+
obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
144
|
+
idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
|
|
145
|
+
ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
|
|
146
|
+
odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
|
|
147
|
+
osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
|
|
148
|
+
node = h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
|
|
149
|
+
parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
|
|
150
|
+
lv = h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6
|
|
151
|
+
ln = h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
|
|
152
|
+
lc = h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure)
|
|
153
|
+
use_ = if lv \
|
|
154
|
+
and lv == '1'
|
|
155
|
+
h[:use_] || ((defined? o.use_) ? o.use_ : :ok)
|
|
156
|
+
elsif not lv.empty? \
|
|
157
|
+
and lv =~ /[A-D2-3]/
|
|
158
|
+
:ok
|
|
159
|
+
else
|
|
160
|
+
h[:use_] || ((defined? o.use_) ? o.use_ : :ok)
|
|
161
|
+
end
|
|
162
|
+
ocn_ = if h[:ocn_].nil?
|
|
163
|
+
((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
|
|
164
|
+
else h[:ocn_]
|
|
165
|
+
end
|
|
166
|
+
autonum_ = if h[:autonum_].nil?
|
|
167
|
+
((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses
|
|
168
|
+
else h[:autonum_]
|
|
169
|
+
end
|
|
170
|
+
note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
|
|
171
|
+
digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
|
|
172
|
+
tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
173
|
+
@of,@is,@lv,@ln,@lc,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@use_,@ocn_,@note_,@autonum_,@digest,@tmp=
|
|
174
|
+
of, is, lv, ln, lc, name, tags, obj, idx, ocn, odv, osp, node, parent, use_, ocn_, note_, autonum_, digest, tmp
|
|
175
|
+
self
|
|
176
|
+
end
|
|
177
|
+
def heading_insert(h,o=nil)
|
|
178
|
+
heading(h,o=nil)
|
|
179
|
+
@is = :heading_insert #String, classification - specific type
|
|
180
|
+
self
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
class ObjectPara
|
|
184
|
+
attr_accessor :obj,:is,:tags,:of,:name,:idx,:quote_,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp
|
|
185
|
+
def initialize
|
|
186
|
+
@of=:para
|
|
187
|
+
@is=@obj=@name=@idx=@quote_=@bullet_=@indent=@hang=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil
|
|
188
|
+
@tags=[]
|
|
189
|
+
end
|
|
190
|
+
def paragraph(h,o=nil)
|
|
191
|
+
of = @of #Symbol, classification - group
|
|
192
|
+
is = :para #Symbol, classification - specific type
|
|
193
|
+
name = h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
|
|
194
|
+
tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
|
|
195
|
+
obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
196
|
+
idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
|
|
197
|
+
ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
|
|
198
|
+
odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
|
|
199
|
+
osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
|
|
200
|
+
parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
|
|
201
|
+
indent = h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level
|
|
202
|
+
hang = h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level
|
|
203
|
+
bullet_ = h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted?
|
|
204
|
+
quote_ = h[:quote_] || ((defined? o.quote_) ? o.quote_ : false) #Bool, quote (blockquote)?
|
|
205
|
+
note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
|
|
206
|
+
image_ = h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
|
|
207
|
+
ocn_ = if h[:ocn_].nil?
|
|
208
|
+
((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
|
|
209
|
+
else h[:ocn_]
|
|
210
|
+
end
|
|
211
|
+
digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
|
|
212
|
+
tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
213
|
+
@of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@quote_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=
|
|
214
|
+
of, is, name, tags, obj, indent, hang, bullet_, quote_, idx, ocn, odv, osp, parent, image_, note_, ocn_, digest, tmp
|
|
215
|
+
self
|
|
216
|
+
end
|
|
217
|
+
def docinfo(h,o=nil)
|
|
218
|
+
of = @of #String, classification - group
|
|
219
|
+
is = :docinfo #String, classification - specific type
|
|
220
|
+
name = h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
|
|
221
|
+
tags = h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any
|
|
222
|
+
obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
223
|
+
idx = nil #String, book index provided?
|
|
224
|
+
ocn = nil #Integer, sequential on substantive-content objects
|
|
225
|
+
odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
|
|
226
|
+
osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
|
|
227
|
+
parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
|
|
228
|
+
indent = nil #Integer, indent level
|
|
229
|
+
hang = nil #Integer, indent level
|
|
230
|
+
bullet_ = false #Bool, bulleted?
|
|
231
|
+
note_ = false #Bool, endnotes/footnotes? (processing optimization)
|
|
232
|
+
image_ = h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
|
|
233
|
+
ocn_ = if h[:ocn_].nil?
|
|
234
|
+
((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
|
|
235
|
+
else h[:ocn_]
|
|
236
|
+
end
|
|
237
|
+
digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
|
|
238
|
+
tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
239
|
+
@of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=
|
|
240
|
+
of, is, name, tags, obj, indent, hang, bullet_, idx, ocn, odv, osp, parent, image_, note_, ocn_, digest, tmp
|
|
241
|
+
self
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
class ObjectBlockTxt
|
|
245
|
+
attr_accessor :obj,:is,:of,:tags,:lngsyn,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp
|
|
246
|
+
def initialize
|
|
247
|
+
@of=:block
|
|
248
|
+
@is=@obj=@lngsyn=@idx=@ocn=@odv=@osp=@parent=@note_=@number_=@ocn_=@digest=@tmp=nil
|
|
249
|
+
@tags=[]
|
|
250
|
+
end
|
|
251
|
+
def code(h,o=nil)
|
|
252
|
+
of = @of #Symbol, classification - group #alt 'code'
|
|
253
|
+
is = :code #Symbol, classification - specific type
|
|
254
|
+
tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
|
|
255
|
+
obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
256
|
+
lngsyn = h[:lngsyn] || ((defined? o.lngsyn) ? o.lngsyn : :txt) #symbol, code lngsyn
|
|
257
|
+
idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
|
|
258
|
+
ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
|
|
259
|
+
odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
|
|
260
|
+
osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
|
|
261
|
+
parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
|
|
262
|
+
number_ = h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not?
|
|
263
|
+
note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
|
|
264
|
+
ocn_ = if h[:ocn_].nil?
|
|
265
|
+
((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
|
|
266
|
+
else h[:ocn_]
|
|
267
|
+
end
|
|
268
|
+
num = h[:num] || ((defined? o.num) ? o.num : nil)
|
|
269
|
+
digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
|
|
270
|
+
tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
271
|
+
@of,@is,@tags,@obj,@lngsyn,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@num,@digest,@tmp=
|
|
272
|
+
of, is, tags, obj, lngsyn, idx, ocn, odv, osp, parent, number_, note_, ocn_, num, digest, tmp
|
|
273
|
+
self
|
|
274
|
+
end
|
|
275
|
+
def box(h,o=nil)
|
|
276
|
+
of = @of #Symbol, classification - group
|
|
277
|
+
is = :box #Symbol, classification - specific type
|
|
278
|
+
tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
|
|
279
|
+
obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
280
|
+
idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
|
|
281
|
+
ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
|
|
282
|
+
odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
|
|
283
|
+
osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
|
|
284
|
+
parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
|
|
285
|
+
note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
|
|
286
|
+
ocn_ = if h[:ocn_].nil?
|
|
287
|
+
((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
|
|
288
|
+
else h[:ocn_]
|
|
289
|
+
end
|
|
290
|
+
num = h[:num] || ((defined? o.num) ? o.num : nil)
|
|
291
|
+
digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
|
|
292
|
+
tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
293
|
+
@of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=
|
|
294
|
+
of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp
|
|
295
|
+
self
|
|
296
|
+
end
|
|
297
|
+
def block(h,o=nil)
|
|
298
|
+
of = @of #Symbol, classification - group
|
|
299
|
+
is = :block #Symbol, classification - specific type
|
|
300
|
+
tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
|
|
301
|
+
obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
302
|
+
idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
|
|
303
|
+
ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
|
|
304
|
+
odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
|
|
305
|
+
osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
|
|
306
|
+
parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
|
|
307
|
+
note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
|
|
308
|
+
ocn_ = if h[:ocn_].nil?
|
|
309
|
+
((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
|
|
310
|
+
else h[:ocn_]
|
|
311
|
+
end
|
|
312
|
+
num = h[:num] || ((defined? o.num) ? o.num : nil)
|
|
313
|
+
digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
|
|
314
|
+
tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
315
|
+
@of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=
|
|
316
|
+
of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp
|
|
317
|
+
self
|
|
318
|
+
end
|
|
319
|
+
def group(h,o=nil)
|
|
320
|
+
of = @of #Symbol, classification - group
|
|
321
|
+
is = :group #Symbol, classification - specific type
|
|
322
|
+
tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
|
|
323
|
+
obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
324
|
+
idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
|
|
325
|
+
ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
|
|
326
|
+
odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
|
|
327
|
+
osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
|
|
328
|
+
parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
|
|
329
|
+
note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
|
|
330
|
+
ocn_ = if h[:ocn_].nil?
|
|
331
|
+
((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
|
|
332
|
+
else h[:ocn_]
|
|
333
|
+
end
|
|
334
|
+
num = h[:num] || ((defined? o.num) ? o.num : nil)
|
|
335
|
+
digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
|
|
336
|
+
tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
337
|
+
@of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=
|
|
338
|
+
of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp
|
|
339
|
+
self
|
|
340
|
+
end
|
|
341
|
+
def alt(h,o=nil) #see block
|
|
342
|
+
of = @of #Symbol, classification - group
|
|
343
|
+
is = :alt #Symbol, classification - specific type
|
|
344
|
+
tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
|
|
345
|
+
obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
346
|
+
idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
|
|
347
|
+
ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
|
|
348
|
+
odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
|
|
349
|
+
osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
|
|
350
|
+
parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
|
|
351
|
+
note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
|
|
352
|
+
ocn_ = if h[:ocn_].nil?
|
|
353
|
+
((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
|
|
354
|
+
else h[:ocn_]
|
|
355
|
+
end
|
|
356
|
+
num = h[:num] || ((defined? o.num) ? o.num : nil)
|
|
357
|
+
digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
|
|
358
|
+
tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
359
|
+
@of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=
|
|
360
|
+
of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp
|
|
361
|
+
self
|
|
362
|
+
end
|
|
363
|
+
def verse(h,o=nil) #part of poem decide how you deal with this
|
|
364
|
+
of = @of #Symbol, classification - group
|
|
365
|
+
is = :verse #Symbol, classification - specific type
|
|
366
|
+
tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
|
|
367
|
+
obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
368
|
+
idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
|
|
369
|
+
ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
|
|
370
|
+
odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
|
|
371
|
+
osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
|
|
372
|
+
parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
|
|
373
|
+
ocn_ = if h[:ocn_].nil?
|
|
374
|
+
((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
|
|
375
|
+
else h[:ocn_]
|
|
376
|
+
end
|
|
377
|
+
num = h[:num] || ((defined? o.num) ? o.num : nil)
|
|
378
|
+
digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
|
|
379
|
+
tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
380
|
+
@of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=
|
|
381
|
+
of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp
|
|
382
|
+
@h=nil
|
|
383
|
+
self
|
|
384
|
+
end
|
|
385
|
+
end
|
|
386
|
+
class ObjectTable
|
|
387
|
+
attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:num,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp
|
|
388
|
+
def initialize
|
|
389
|
+
@of=:block
|
|
390
|
+
@is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@num,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@num=@digest=@tmp=nil
|
|
391
|
+
@tags=[]
|
|
392
|
+
end
|
|
393
|
+
def table(h,o=nil)
|
|
394
|
+
of = @of #Symbol, classification - group
|
|
395
|
+
is = :table #Symbol, classification - specific type
|
|
396
|
+
tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
|
|
397
|
+
cols = h[:cols] || ((defined? o.cols) ? o.cols : nil)
|
|
398
|
+
widths = h[:widths] || ((defined? o.widths) ? o.widths : nil)
|
|
399
|
+
obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
400
|
+
idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
|
|
401
|
+
ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
|
|
402
|
+
odv = h[:odv] || ((defined? o.odv) ? o.odv : nil)
|
|
403
|
+
osp = h[:osp] || ((defined? o.osp) ? o.osp : nil)
|
|
404
|
+
parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
|
|
405
|
+
head_ = h[:head_] || ((defined? o.head_) ? o.head_ : false)
|
|
406
|
+
note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
|
|
407
|
+
ocn_ = if h[:ocn_].nil?
|
|
408
|
+
((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
|
|
409
|
+
else h[:ocn_]
|
|
410
|
+
end
|
|
411
|
+
num = h[:num] || ((defined? o.num) ? o.num : nil)
|
|
412
|
+
digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
|
|
413
|
+
tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
414
|
+
@of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@num,@digest,@tmp=
|
|
415
|
+
of, is, tags, cols, widths, obj, idx, ocn, odv, osp, parent, head_, note_, ocn_, num, digest, tmp
|
|
416
|
+
self
|
|
417
|
+
end
|
|
418
|
+
end
|
|
419
|
+
class ObjectImage
|
|
420
|
+
attr_accessor :obj,:is,:of,:lv,:idx,:size,:ocn,:parent,:note_,:ocn_,:digest,:tmp
|
|
421
|
+
def initialize
|
|
422
|
+
@of=:image
|
|
423
|
+
@is=@obj=@lv=@idx=@size=@ocn=@parent=@note_=@ocn_=@tmp=@digest=nil
|
|
424
|
+
@tags=[]
|
|
425
|
+
end
|
|
426
|
+
def image(h,o=nil) #not yet used, and what of a paragraph containing several images, consider
|
|
427
|
+
of= @of #Symbol, classification - group
|
|
428
|
+
is= :image #Symbol, classification - specific type
|
|
429
|
+
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
|
|
430
|
+
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
431
|
+
size= h[:size] || ((defined? o.size) ? o.size : nil)
|
|
432
|
+
idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
|
|
433
|
+
ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
|
|
434
|
+
odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
|
|
435
|
+
osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
|
|
436
|
+
parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
|
|
437
|
+
note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
|
|
438
|
+
ocn_=if h[:ocn_].nil?
|
|
439
|
+
((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
|
|
440
|
+
else h[:ocn_]
|
|
441
|
+
end
|
|
442
|
+
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
|
|
443
|
+
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
444
|
+
@of,@is,@tags,@obj,@size,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,size,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
|
|
445
|
+
self
|
|
446
|
+
end
|
|
447
|
+
end
|
|
448
|
+
class ObjectStructure
|
|
449
|
+
attr_accessor :obj,:tag,:node,:lv,:ln,:lc,:status,:is,:of,:tmp
|
|
450
|
+
def initialize
|
|
451
|
+
@of=:structure
|
|
452
|
+
@is=@obj=@node=@lv=@ln=@lc=@status=@tmp=nil
|
|
453
|
+
end
|
|
454
|
+
def xml_dom(h,o=nil)
|
|
455
|
+
of= @of #Symbol, classification - group
|
|
456
|
+
is= :xml_dom #Symbol, classification - specific type
|
|
457
|
+
obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content
|
|
458
|
+
lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6
|
|
459
|
+
ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
|
|
460
|
+
lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure)
|
|
461
|
+
node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
|
|
462
|
+
status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status Symbol :open or :close
|
|
463
|
+
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
464
|
+
@of,@is,@obj,@status,@node,@lv,@ln,@lc,@tmp=of,is,obj,status,node,lv,ln,lc,tmp
|
|
465
|
+
self
|
|
466
|
+
end
|
|
467
|
+
end
|
|
468
|
+
class ObjectFlag
|
|
469
|
+
attr_accessor :obj,:is,:of,:flag,:act,:selections,:tmp
|
|
470
|
+
def initialize
|
|
471
|
+
@of=:flag
|
|
472
|
+
@is=@obj=@flag=@act=@selections=@tmp=nil
|
|
473
|
+
end
|
|
474
|
+
def flag(h,o=nil)
|
|
475
|
+
of= @of #Symbol, classification - group
|
|
476
|
+
is= :flag #Symbol, classification - specific type
|
|
477
|
+
obj= nil #String, text content
|
|
478
|
+
flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #String, text content
|
|
479
|
+
act= h[:act] || ((defined? o.act) ? o.act : nil) #String, text content
|
|
480
|
+
selections= h[:selections] || ((defined? o.selections) ? o.selections : nil) #String, text content
|
|
481
|
+
tmp= h[:flag] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
482
|
+
@of, @is,@obj,@flag,@act,@selections,@tmp=
|
|
483
|
+
of,is, obj, flag, act, selections, tmp
|
|
484
|
+
self
|
|
485
|
+
end
|
|
486
|
+
def flag_ocn(h,o=nil)
|
|
487
|
+
of= @of #Symbol, classification - group
|
|
488
|
+
is= :flag_ocn #Symbol, classification - specific type
|
|
489
|
+
obj= nil #String, text content
|
|
490
|
+
flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #String, text content
|
|
491
|
+
act= h[:act] || ((defined? o.act) ? o.act : nil) #String, text content
|
|
492
|
+
selections= h[:selections] || ((defined? o.selections) ? o.selections : nil) #String, text content
|
|
493
|
+
tmp= h[:flag] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
494
|
+
@of, @is,@obj,@flag,@act,@selections,@tmp=
|
|
495
|
+
of,is, obj, flag, act, selections,tmp
|
|
496
|
+
self
|
|
497
|
+
end
|
|
498
|
+
def flag_lng(h,o=nil)
|
|
499
|
+
of= @of #Symbol, classification - group
|
|
500
|
+
is= :flag_lng
|
|
501
|
+
obj= nil #String, text content
|
|
502
|
+
flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #Symbol, :lng_on or :lng_off
|
|
503
|
+
act= h[:act] || ((defined? o.act) ? o.act : nil) #Symbol, language set to :en etc.
|
|
504
|
+
selections= h[:selections] || ((defined? o.selections) ? o.selections : nil) #String, text content
|
|
505
|
+
tmp= h[:act] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
506
|
+
@of, @is,@obj,@flag,@act,@selections,@tmp=
|
|
507
|
+
of,is, obj, flag, act, selections,tmp
|
|
508
|
+
self
|
|
509
|
+
end
|
|
510
|
+
end
|
|
511
|
+
class ObjectLayout
|
|
512
|
+
attr_accessor :obj,:sym,:attr,:is,:is_for,:of,:from,:tmp,:num
|
|
513
|
+
def initialize
|
|
514
|
+
@of=:layout
|
|
515
|
+
@is=@is_for=@obj=@from=@tmp=@num=nil
|
|
516
|
+
end
|
|
517
|
+
def break(h,f=nil) #decide how to deal with
|
|
518
|
+
of= @of #Symbol, classification - group
|
|
519
|
+
is= :break #Symbol, classification - specific type
|
|
520
|
+
obj= h[:obj] #String, text content
|
|
521
|
+
from= f
|
|
522
|
+
tmp= h[:tmp] #available for processing, empty after use
|
|
523
|
+
@of,@is,@obj,@from,@tmp=of,is,obj,from,tmp
|
|
524
|
+
self
|
|
525
|
+
end
|
|
526
|
+
def insert(h,o=nil) #decide how to deal with, could mimic paragraph?
|
|
527
|
+
of= @of #Symbol, classification - group
|
|
528
|
+
is= :insert #Symbol, classification - specific type
|
|
529
|
+
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
530
|
+
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
531
|
+
@of,@is,@obj,@tmp=of,is,obj,tmp
|
|
532
|
+
self
|
|
533
|
+
end
|
|
534
|
+
def open_close(h,o=nil) #useful for poem & quote
|
|
535
|
+
of= @of #Symbol, classification - group
|
|
536
|
+
is= :open_close_tags #Symbol, classification - specific type
|
|
537
|
+
is_for= h[:is_for] || ((defined? o.is_for) ? o.is_for : nil) #String, text content
|
|
538
|
+
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
539
|
+
sym= h[:sym] || ((defined? o.sym) ? o.sym : nil) #Symbol tag_open, tag_close
|
|
540
|
+
attr= h[:attr] || ((defined? o.attr) ? o.attr : nil) #String, text content
|
|
541
|
+
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
542
|
+
num= h[:num] || ((defined? o.num) ? o.num : nil)
|
|
543
|
+
@of,@is,@is_for,@obj,@sym,@attr,@tmp,@num=
|
|
544
|
+
of, is, is_for, obj, sym, attr, tmp, num
|
|
545
|
+
self
|
|
546
|
+
end
|
|
547
|
+
end
|
|
548
|
+
class ObjectComment
|
|
549
|
+
attr_accessor :obj,:is,:of,:tmp
|
|
550
|
+
def initialize
|
|
551
|
+
@of=:comment
|
|
552
|
+
@is=@obj=@tmp=nil
|
|
553
|
+
end
|
|
554
|
+
def comment(h,o=nil)
|
|
555
|
+
of= @of #Symbol, classification - group
|
|
556
|
+
is= :comment #Symbol, classification - specific type
|
|
557
|
+
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
|
|
558
|
+
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
|
|
559
|
+
@of,@is,@obj,@tmp=of,is,obj,tmp
|
|
560
|
+
self
|
|
561
|
+
end
|
|
562
|
+
end
|
|
563
|
+
end
|
|
564
|
+
__END__
|
|
565
|
+
# ~# |-# no paragraph number # -# not included in toc
|