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
data/lib/sisu/digests.rb
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** document digests (md5|sha256) and structure processing
|
|
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/digests.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_DigestView
|
|
58
|
+
require_relative 'se_hub_particulars' # se_hub_particulars.rb
|
|
59
|
+
require_relative 'prog_text_translation' # prog_text_translation.rb
|
|
60
|
+
require_relative 'shared_markup_alt.rb' # shared_markup_alt.rb
|
|
61
|
+
class Source
|
|
62
|
+
@@dg=nil
|
|
63
|
+
def initialize(opt)
|
|
64
|
+
@opt=opt
|
|
65
|
+
@fnb=@opt.fnb
|
|
66
|
+
@@endnotes_para=[]
|
|
67
|
+
@@dg=nil
|
|
68
|
+
@dg=@@dg ||=SiSU_Env::InfoEnv.new.digest(opt).type
|
|
69
|
+
@particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
|
|
70
|
+
end
|
|
71
|
+
def read
|
|
72
|
+
begin
|
|
73
|
+
@env,@md,@ao_array=@particulars.env,@particulars.md,@particulars.ao_array
|
|
74
|
+
unless @opt.act[:quiet][:set]==:on
|
|
75
|
+
tool=(@opt.act[:verbose][:set]==:on \
|
|
76
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
77
|
+
|| @opt.act[:maintenance][:set]==:on) \
|
|
78
|
+
? "#{@env.program.text_editor} file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}"
|
|
79
|
+
: "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
|
|
80
|
+
(@opt.act[:verbose][:set]==:on \
|
|
81
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
82
|
+
|| @opt.act[:maintenance][:set]==:on) \
|
|
83
|
+
? SiSU_Screen::Ansi.new(
|
|
84
|
+
@opt.act[:color_state][:set],
|
|
85
|
+
"Document #{@dg} Digests",
|
|
86
|
+
tool
|
|
87
|
+
).green_hi_blue
|
|
88
|
+
: SiSU_Screen::Ansi.new(
|
|
89
|
+
@opt.act[:color_state][:set],
|
|
90
|
+
"Document #{@dg} Digests",
|
|
91
|
+
tool
|
|
92
|
+
).green_title_hi
|
|
93
|
+
if @opt.act[:verbose_plus][:set]==:on \
|
|
94
|
+
or @opt.act[:maintenance][:set]==:on
|
|
95
|
+
SiSU_Screen::Ansi.new(
|
|
96
|
+
@opt.act[:color_state][:set],
|
|
97
|
+
@opt.fns,
|
|
98
|
+
"file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}"
|
|
99
|
+
).flow
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
if SiSU_Env::SystemCall.new.openssl
|
|
103
|
+
SiSU_DigestView::Source::Scroll.new(@particulars).songsheet
|
|
104
|
+
else
|
|
105
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('*EXITED* hash digests will not run without openssl')
|
|
106
|
+
end
|
|
107
|
+
rescue
|
|
108
|
+
SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
|
|
109
|
+
__LINE__.to_s + ':' + __FILE__
|
|
110
|
+
end
|
|
111
|
+
ensure
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
private
|
|
115
|
+
class Scroll <Source
|
|
116
|
+
@@dl=nil
|
|
117
|
+
@@ds={
|
|
118
|
+
digests_clean: [],
|
|
119
|
+
digests_with_markup: [],
|
|
120
|
+
tree: [],
|
|
121
|
+
summary: [],
|
|
122
|
+
}
|
|
123
|
+
@@description,@@sc_info=[],[]
|
|
124
|
+
def initialize(particulars)
|
|
125
|
+
@particulars=particulars
|
|
126
|
+
@data,@env,@md=@particulars.ao_array,@particulars.env,@particulars.md
|
|
127
|
+
SiSU_Env::FileOp.new(@md).mkdir
|
|
128
|
+
@@dg ||=@env.digest(@md.opt).type
|
|
129
|
+
@@dl ||=@env.digest(@md.opt).length
|
|
130
|
+
@dg,@dl=@@dg,@@dl
|
|
131
|
+
l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
|
|
132
|
+
@language=l[:n]
|
|
133
|
+
@tr=SiSU_Translate::Source.new(@md,@language)
|
|
134
|
+
@sp=' '
|
|
135
|
+
end
|
|
136
|
+
def songsheet
|
|
137
|
+
@@description,@@ds[:digests_clean],@@ds[:digests_with_markup],@@ds[:tree],@@ds[:summary],@@sc_info=[],[],[],[],[],[]
|
|
138
|
+
message_digest
|
|
139
|
+
ao_structure
|
|
140
|
+
supplementary
|
|
141
|
+
output
|
|
142
|
+
end
|
|
143
|
+
def spaces
|
|
144
|
+
Ax[:spaces]
|
|
145
|
+
end
|
|
146
|
+
def description(f,e='')
|
|
147
|
+
puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on
|
|
148
|
+
@@description << f << e
|
|
149
|
+
end
|
|
150
|
+
def digests_clean(f,e='')
|
|
151
|
+
puts f if @md.opt.act[:verbose_plus][:set]==:on
|
|
152
|
+
@@ds[:digests_clean] << f + "\n"
|
|
153
|
+
end
|
|
154
|
+
def digests_with_markup(f)
|
|
155
|
+
puts f if @md.opt.act[:verbose_plus][:set]==:on
|
|
156
|
+
@@ds[:digests_with_markup] << f + "\n"
|
|
157
|
+
end
|
|
158
|
+
def ao_structure_tree(f,e='')
|
|
159
|
+
puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on
|
|
160
|
+
@@ds[:tree] << f << e
|
|
161
|
+
end
|
|
162
|
+
def ao_structure_summary(f,e='')
|
|
163
|
+
puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on
|
|
164
|
+
@@ds[:summary] << f << e
|
|
165
|
+
end
|
|
166
|
+
def rcinfo(f,e='')
|
|
167
|
+
puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on
|
|
168
|
+
@@sc_info << f << e
|
|
169
|
+
end
|
|
170
|
+
def output
|
|
171
|
+
file=SiSU_Env::FileOp.new(@md)
|
|
172
|
+
filename_digest=file.write_file.hash_digest
|
|
173
|
+
filename_digest << @@description.join << @@ds[:digests_clean].join << @@ds[:digests_with_markup].join << @@ds[:tree].join << @@ds[:summary].join << @@sc_info.join
|
|
174
|
+
end
|
|
175
|
+
def rgx_txt(txt)
|
|
176
|
+
txt=txt.gsub(/([()])/,"\\\\\\1")
|
|
177
|
+
end
|
|
178
|
+
def message_digest
|
|
179
|
+
@p=[]
|
|
180
|
+
@g,@v,@r='','',''
|
|
181
|
+
manifest="#{@env.url.root}/#{@md.fnb}/sisu_manifest.html"
|
|
182
|
+
description("#{@md.title.full}\n")
|
|
183
|
+
description("#{@md.author}\n")
|
|
184
|
+
description("#{@md.fns}\n")
|
|
185
|
+
description("----------------------------------------------\n")
|
|
186
|
+
description("SiSU Document Content Certificate (Digest/DCC)\n")
|
|
187
|
+
description("----------------------------------------------\n")
|
|
188
|
+
description(" #{@dg} digests\n")
|
|
189
|
+
description("------------\n")
|
|
190
|
+
description("Sourcefile digest: #{@md.dgst[1]}\n")
|
|
191
|
+
description(" source filename: #{@md.fns}\n")
|
|
192
|
+
description("available outputs: #{manifest}\n")
|
|
193
|
+
description("------------\n")
|
|
194
|
+
description("Document Digests\n")
|
|
195
|
+
end
|
|
196
|
+
def ao_structure
|
|
197
|
+
a=%{\nocn digests (#{@dg}) clean text (stripped markup)}
|
|
198
|
+
digests_clean(a)
|
|
199
|
+
data=@data
|
|
200
|
+
endnotes=nil
|
|
201
|
+
data.each do |t_o|
|
|
202
|
+
dgst=SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst
|
|
203
|
+
if dgst
|
|
204
|
+
if t_o.is==:heading
|
|
205
|
+
digests_clean("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:is]} #{t_o.lv}")
|
|
206
|
+
elsif t_o.is==:heading_insert
|
|
207
|
+
digests_clean("#{@sp*0}[#{dgst[:ocn]}]#{@sp*(6-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:is]} #{t_o.lv}")
|
|
208
|
+
else
|
|
209
|
+
digests_clean("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:is]}")
|
|
210
|
+
if dgst[:images]
|
|
211
|
+
dgst[:images].each do |img|
|
|
212
|
+
digests_clean("#{@sp*8}#{img[:img_dgst]}#{@sp*66}#{img[:img_type]} #{img[:img_name]}")
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
if dgst[:endnotes]
|
|
217
|
+
dgst[:endnotes].each do |en|
|
|
218
|
+
digests_clean("#{@sp*8}#{en[:note_dgst]} note [#{en[:note_number]}]")
|
|
219
|
+
endnotes=en[:note_number]
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
b=%{\nocn object (#{@dg}) digests (object includes its markup & endnotes (if any))}
|
|
225
|
+
digests_with_markup(b)
|
|
226
|
+
data.each do |t_o|
|
|
227
|
+
dgst=SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst
|
|
228
|
+
if dgst
|
|
229
|
+
if t_o.is==:heading
|
|
230
|
+
digests_with_markup("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_markedup_txt]} #{dgst[:is]} #{t_o.lv}")
|
|
231
|
+
elsif t_o.is==:heading_insert
|
|
232
|
+
digests_with_markup("#{@sp*0}[#{dgst[:ocn]}]#{@sp*(6-dgst[:ocn].to_s.length)}#{dgst[:dgst_markedup_txt]} #{dgst[:is]} #{t_o.lv}")
|
|
233
|
+
else
|
|
234
|
+
digests_with_markup("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_markedup_txt]} #{dgst[:is]}")
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
l=Hash.new(0)
|
|
239
|
+
ocn=nil
|
|
240
|
+
ao_structure_tree("------------\n")
|
|
241
|
+
ao_structure_tree("document structure[*]\n")
|
|
242
|
+
data.each do |t_o|
|
|
243
|
+
if t_o.is==:heading
|
|
244
|
+
x=case t_o.ln
|
|
245
|
+
when 0 then l[0] +=1
|
|
246
|
+
spaces*0 << ':A'
|
|
247
|
+
when 1 then l[1] +=1
|
|
248
|
+
spaces*1 << ':B'
|
|
249
|
+
when 2 then l[2] +=1
|
|
250
|
+
spaces*2 << ':C'
|
|
251
|
+
when 3 then l[3] +=1
|
|
252
|
+
spaces*3 << ':D'
|
|
253
|
+
when 4 then l[4] +=1
|
|
254
|
+
spaces*4 << '1'
|
|
255
|
+
when 5 then l[5] +=1
|
|
256
|
+
spaces*5 << '2'
|
|
257
|
+
when 6 then l[6] +=1
|
|
258
|
+
spaces*6 << '3'
|
|
259
|
+
else nil
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
ocn=t_o.ocn if defined? t_o.ocn and t_o.is !=:heading_insert
|
|
263
|
+
ao_structure_tree("#{x}\n") if x and not x.empty?
|
|
264
|
+
end
|
|
265
|
+
ao_structure_tree(" [*] heading levels\n")
|
|
266
|
+
ao_structure_summary("------------\n")
|
|
267
|
+
ao_structure_summary("document structure[*]\n")
|
|
268
|
+
[0,1,2,3,4,5,6].each do |y|
|
|
269
|
+
v=case y
|
|
270
|
+
when 0 then ':A'
|
|
271
|
+
when 1 then ':B'
|
|
272
|
+
when 2 then ':C'
|
|
273
|
+
when 3 then ':D'
|
|
274
|
+
when 4 then '1 '
|
|
275
|
+
when 5 then '2 '
|
|
276
|
+
when 6 then '3 '
|
|
277
|
+
end
|
|
278
|
+
ao_structure_summary("#{v} = #{l[y]}\n") if l[y] > 0
|
|
279
|
+
end
|
|
280
|
+
ao_structure_summary("objects (ocn) = #{ocn}\n")
|
|
281
|
+
ao_structure_summary("endnotes = #{endnotes}\n")
|
|
282
|
+
ao_structure_summary(" [*] number of headers (@) and of each heading level (:A to :D and 1 to 3)\n")
|
|
283
|
+
end
|
|
284
|
+
def supplementary
|
|
285
|
+
if defined? @md.sc_number \
|
|
286
|
+
and @md.sc_number
|
|
287
|
+
rcinfo("------------\n")
|
|
288
|
+
rcinfo("source control information\n")
|
|
289
|
+
rcinfo(" (the following information while not important for document content certification\n may help the publisher in locating the version referred to)\n")
|
|
290
|
+
rcinfo(" rcs version number: #{@md.sc_number}\n")
|
|
291
|
+
if defined? @md.sc_date \
|
|
292
|
+
and @md.sc_date
|
|
293
|
+
rcinfo(" rcs date: #{@md.sc_date}\n")
|
|
294
|
+
end
|
|
295
|
+
if defined? @md.sc_time \
|
|
296
|
+
and @md.sc_time
|
|
297
|
+
rcinfo(" rcs time: #{@md.sc_time}\n")
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
rcinfo("------------\n")
|
|
301
|
+
rcinfo("Note: the time generated related fields (text and digests) will vary between otherwise identical document outputs\n")
|
|
302
|
+
end
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
__END__
|
data/lib/sisu/dp.rb
ADDED
|
@@ -0,0 +1,1606 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** document parameters extracted from input files for program use
|
|
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/dp.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_Param
|
|
58
|
+
begin
|
|
59
|
+
require 'uri'
|
|
60
|
+
require 'pstore'
|
|
61
|
+
rescue LoadError
|
|
62
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
63
|
+
error('uri or pstore NOT FOUND (LoadError)')
|
|
64
|
+
end
|
|
65
|
+
require_relative 'se' # se.rb
|
|
66
|
+
include SiSU_Env
|
|
67
|
+
require_relative 'dp_make' # dp_make.rb
|
|
68
|
+
require_relative 'dp_identify_markup' # dp_identify_markup.rb
|
|
69
|
+
@@date=SiSU_Env::InfoDate.new
|
|
70
|
+
@doc={
|
|
71
|
+
initialise: nil,
|
|
72
|
+
markup: '',
|
|
73
|
+
lnks: '',
|
|
74
|
+
stmp: '',
|
|
75
|
+
req: {},
|
|
76
|
+
}
|
|
77
|
+
@@trigger=nil
|
|
78
|
+
@@lv,@@flag={},{}
|
|
79
|
+
@@tex_backslash="\\\\"
|
|
80
|
+
class Parameters
|
|
81
|
+
@@publisher='SiSU scribe'
|
|
82
|
+
@@md=@@fns=@@pth=nil
|
|
83
|
+
def initialize(opt)
|
|
84
|
+
@opt=opt
|
|
85
|
+
@cX||=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set])
|
|
86
|
+
@fns=if @opt.act[:psql][:set] == [:on] #revisit CHECK
|
|
87
|
+
opt.fns
|
|
88
|
+
else opt.fns.gsub(/\.ssm$/,'.ssm.sst')
|
|
89
|
+
end
|
|
90
|
+
SiSU_Param::Instantiate.new.param_instantiate
|
|
91
|
+
@env=SiSU_Env::InfoEnv.new(@fns)
|
|
92
|
+
@pstorefile="#{@env.processing_path.ao}/#{@fns}.pstore"
|
|
93
|
+
end
|
|
94
|
+
def get
|
|
95
|
+
if @opt.f_pth \
|
|
96
|
+
and @opt.f_pth[:pth] != Dir.pwd #BUG check
|
|
97
|
+
# you may need to change Dir.pwd to @opt.f_pth[:pth] where the latter
|
|
98
|
+
# has a path value that is different, however, f_pth is not always set!
|
|
99
|
+
Dir.chdir(@opt.f_pth[:pth])
|
|
100
|
+
end
|
|
101
|
+
if @@fns !=@fns \
|
|
102
|
+
or @@pth !=Dir.pwd #@opt.f_pth[:pth]
|
|
103
|
+
@@fns,@@pth=@fns,Dir.pwd #@opt.f_pth[:pth]
|
|
104
|
+
@@md=nil
|
|
105
|
+
end
|
|
106
|
+
if @@md.nil? \
|
|
107
|
+
or @opt.act[:maintenance][:set]==:on #not particularly helpful, as current cycle is through output types, with files changing, only helpful if deal with a file all output types before going to next file
|
|
108
|
+
if File.exist?(@pstorefile)
|
|
109
|
+
param_msg='Parameters from pstore'
|
|
110
|
+
store=PStore.new(@pstorefile)
|
|
111
|
+
store.transaction do
|
|
112
|
+
@md=store['md']
|
|
113
|
+
end
|
|
114
|
+
@md
|
|
115
|
+
else
|
|
116
|
+
param_msg='Parameters extracted'
|
|
117
|
+
fns_array=@env.read_source_file(@opt.fns)
|
|
118
|
+
@md=SiSU_Param::Parameters::Instructions.new(fns_array,@opt).extract
|
|
119
|
+
@md
|
|
120
|
+
end
|
|
121
|
+
if defined? @md.title.main # on removal check problems with -U
|
|
122
|
+
if (@opt.act[:verbose][:set]==:on \
|
|
123
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
124
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
125
|
+
SiSU_Screen::Ansi.new(
|
|
126
|
+
@opt.act[:color_state][:set],
|
|
127
|
+
param_msg,
|
|
128
|
+
@md.title.main
|
|
129
|
+
).txt_grey
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
@@md=@md
|
|
133
|
+
else @@md
|
|
134
|
+
end
|
|
135
|
+
begin
|
|
136
|
+
@@md.opt=@opt
|
|
137
|
+
@@md
|
|
138
|
+
rescue
|
|
139
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
140
|
+
mark('has an existing option been selected?')
|
|
141
|
+
exit
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
class MdDefault
|
|
145
|
+
def rights(author,date)
|
|
146
|
+
@author,@date=author,date
|
|
147
|
+
def assignment(author)
|
|
148
|
+
'copyright not explicitly stated, ' \
|
|
149
|
+
+ 'program "assigning" copyright to author: ' \
|
|
150
|
+
+ author
|
|
151
|
+
end
|
|
152
|
+
def all
|
|
153
|
+
s=nil
|
|
154
|
+
if @author
|
|
155
|
+
#puts assignment(@author)
|
|
156
|
+
s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \
|
|
157
|
+
? ("Copyright (C) #{$1} #{@author}")
|
|
158
|
+
: ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d
|
|
159
|
+
end
|
|
160
|
+
s
|
|
161
|
+
end
|
|
162
|
+
def copyright_and_license
|
|
163
|
+
s=nil
|
|
164
|
+
if @author
|
|
165
|
+
#puts assignment(@author)
|
|
166
|
+
s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \
|
|
167
|
+
? ("Copyright (C) #{$1} #{@author}")
|
|
168
|
+
: ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d
|
|
169
|
+
end
|
|
170
|
+
s
|
|
171
|
+
end
|
|
172
|
+
def text
|
|
173
|
+
all
|
|
174
|
+
end
|
|
175
|
+
def copyright
|
|
176
|
+
def all
|
|
177
|
+
s=nil
|
|
178
|
+
if @author
|
|
179
|
+
s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \
|
|
180
|
+
? ("Copyright (C) #{$1} #{@author}")
|
|
181
|
+
: ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d
|
|
182
|
+
end
|
|
183
|
+
s
|
|
184
|
+
end
|
|
185
|
+
def text
|
|
186
|
+
all
|
|
187
|
+
end
|
|
188
|
+
self
|
|
189
|
+
end
|
|
190
|
+
self
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
class MdMake < SiSU_Param_Make::MdMake
|
|
194
|
+
end
|
|
195
|
+
class Md
|
|
196
|
+
def initialize(str,opt,env)
|
|
197
|
+
@s,@opt,@env=str,opt,env
|
|
198
|
+
end
|
|
199
|
+
def validate_length(s,l,n)
|
|
200
|
+
#s=(s.length <= l) ? s : nil
|
|
201
|
+
s=if s.is_a?(String) \
|
|
202
|
+
and s.length <= l
|
|
203
|
+
s
|
|
204
|
+
elsif s.is_a?(NilClass)
|
|
205
|
+
nil
|
|
206
|
+
elsif s.class !=String
|
|
207
|
+
STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}"
|
|
208
|
+
s
|
|
209
|
+
else
|
|
210
|
+
SiSU_Screen::Ansi.new(
|
|
211
|
+
'v',
|
|
212
|
+
"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",
|
|
213
|
+
@opt.fns
|
|
214
|
+
).warn unless @opt.act[:quiet][:set]==:on
|
|
215
|
+
nil
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
def name_format(name)
|
|
219
|
+
if name
|
|
220
|
+
name=name.strip
|
|
221
|
+
@name_a_h=[]
|
|
222
|
+
authors=name.scan(/[^;]+/)
|
|
223
|
+
authors.each_with_index do |a,i|
|
|
224
|
+
b=((a =~/\s*\|\s*/) ? (a.split(/\|/)) : [a])
|
|
225
|
+
if b[0] =~/"(.+?)"/
|
|
226
|
+
@name_a_h << { the: $1 }
|
|
227
|
+
else
|
|
228
|
+
x=b[0].scan(/[^,]+/)
|
|
229
|
+
if x.length==1
|
|
230
|
+
@name_a_h << { the: x[0].strip }
|
|
231
|
+
elsif x.length==2
|
|
232
|
+
@name_a_h << { the: x[0].strip, others: x[1].strip }
|
|
233
|
+
else #p x.length
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
b.delete_at(0)
|
|
237
|
+
b.each do |d|
|
|
238
|
+
k,c=nil
|
|
239
|
+
k,c=/^(\S+)\s+(.*)/.match(d)[1,2] if d
|
|
240
|
+
@name_a_h[i][:hon]=c.strip if k=='hon'
|
|
241
|
+
@name_a_h[i][:affiliation]=c.strip if k=='affiliation'
|
|
242
|
+
@name_a_h[i][:nationality]=c.strip if k=='nationality'
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
l=@name_a_h.length
|
|
246
|
+
name_str=''
|
|
247
|
+
@name_a_h.each_with_index do |a,i|
|
|
248
|
+
name_str += if a[:others]
|
|
249
|
+
z=(((l - i) > 1) ? ', ' : '')
|
|
250
|
+
"#{a[:others].strip} #{a[:the].strip}" + z
|
|
251
|
+
else
|
|
252
|
+
z=(((l - i) > 2) ? ', ' : '')
|
|
253
|
+
"#{a[:the].strip}" + z
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
{ name_a_h: @name_a_h, name_str: name_str }
|
|
257
|
+
else nil
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
def build_hash(arr)
|
|
261
|
+
@h={}
|
|
262
|
+
arr.each_with_index do |x,i|
|
|
263
|
+
a,b=nil,nil
|
|
264
|
+
if x =~/^%\s/ #ignore comment
|
|
265
|
+
elsif x =~/:(\S+?):\s+(.+)/
|
|
266
|
+
a,b=/:(\S+?):\s+(.+)\Z/m.match(x)[1,2]
|
|
267
|
+
b=b.gsub(/\s*<br(?: \/)?>\s*/,' \\\\\\ ')
|
|
268
|
+
b=if b =~/\n/m
|
|
269
|
+
(b =~/;\n/m) \
|
|
270
|
+
? (b.split(/;\s*\n\s*/).join(';'))
|
|
271
|
+
: (b.split(/\s*\n\s*/).join(' '))
|
|
272
|
+
else
|
|
273
|
+
b
|
|
274
|
+
end
|
|
275
|
+
elsif i == 0
|
|
276
|
+
a='main'
|
|
277
|
+
b=x
|
|
278
|
+
else
|
|
279
|
+
end
|
|
280
|
+
@h[a]=b
|
|
281
|
+
end
|
|
282
|
+
@h
|
|
283
|
+
end
|
|
284
|
+
def title
|
|
285
|
+
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
|
|
286
|
+
@h=build_hash(a)
|
|
287
|
+
def main
|
|
288
|
+
s=@h['main']
|
|
289
|
+
l,n=Db[:col_title_part],'title.main'
|
|
290
|
+
validate_length(s,l,n)
|
|
291
|
+
end
|
|
292
|
+
def sub
|
|
293
|
+
s=@h['subtitle']
|
|
294
|
+
l,n=Db[:col_title_part],'title.subtitle'
|
|
295
|
+
validate_length(s,l,n)
|
|
296
|
+
end
|
|
297
|
+
def edition
|
|
298
|
+
s=@h['edition']
|
|
299
|
+
l,n=Db[:col_title_edition],'title.edition'
|
|
300
|
+
validate_length(s,l,n)
|
|
301
|
+
end
|
|
302
|
+
def note
|
|
303
|
+
s=@h['note']
|
|
304
|
+
l,n=Db[:col_info_note],'title.note'
|
|
305
|
+
validate_length(s,l,n)
|
|
306
|
+
end
|
|
307
|
+
def short
|
|
308
|
+
s=@h['short'] \
|
|
309
|
+
? @h['short']
|
|
310
|
+
: @h['main']
|
|
311
|
+
l,n=Db[:col_title_part],'title.short'
|
|
312
|
+
validate_length(s,l,n)
|
|
313
|
+
end
|
|
314
|
+
def full
|
|
315
|
+
s=@h['subtitle'] \
|
|
316
|
+
? (@h['main'] + ' - ' + @h['subtitle'])
|
|
317
|
+
: @h['main']
|
|
318
|
+
l,n=Db[:col_title],'title.full'
|
|
319
|
+
validate_length(s,l,n)
|
|
320
|
+
end
|
|
321
|
+
def language
|
|
322
|
+
s=@h['language']
|
|
323
|
+
l,n=Db[:col_language],'title.language'
|
|
324
|
+
validate_length(s,l,n)
|
|
325
|
+
end
|
|
326
|
+
def language_char # look into, this must be set, from 1 directory stub (.fi), 2 filename (~fi), [3 (not used) document header (@title:\n :language_char: fi)]
|
|
327
|
+
s=@h['language_char']
|
|
328
|
+
l,n=Db[:col_language_char],'title.language_char'
|
|
329
|
+
validate_length(s,l,n)
|
|
330
|
+
end
|
|
331
|
+
self
|
|
332
|
+
end
|
|
333
|
+
def creator #there are sub categories that need to be catered for and sometimes more than one author etc.; implement array.to_s.length validation test later, current test on string approximate as string is not used
|
|
334
|
+
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
|
|
335
|
+
@h=build_hash(a)
|
|
336
|
+
def author
|
|
337
|
+
@h['author']=(@h['author'] \
|
|
338
|
+
? @h['author']
|
|
339
|
+
: @h['main'])
|
|
340
|
+
names=name_format(@h['author'])
|
|
341
|
+
s=names[:name_str]
|
|
342
|
+
l,n=Db[:col_name],'creator.author'
|
|
343
|
+
validate_length(s,l,n)
|
|
344
|
+
end
|
|
345
|
+
def author_detail
|
|
346
|
+
s=@h['author'] \
|
|
347
|
+
? @h['author']
|
|
348
|
+
: @h['main']
|
|
349
|
+
names=name_format(s)
|
|
350
|
+
names[:name_a_h]
|
|
351
|
+
end
|
|
352
|
+
def editor
|
|
353
|
+
names=@h['editor'] \
|
|
354
|
+
? name_format(@h['editor'])
|
|
355
|
+
: nil
|
|
356
|
+
s=(names.is_a?(Hash)) \
|
|
357
|
+
? names[:name_str]
|
|
358
|
+
: nil
|
|
359
|
+
s=if s
|
|
360
|
+
l,n=Db[:col_name],'creator.editor'
|
|
361
|
+
validate_length(s,l,n)
|
|
362
|
+
else nil
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
def editor_detail
|
|
366
|
+
names=@h['editor'] \
|
|
367
|
+
? name_format(@h['editor'])
|
|
368
|
+
: nil
|
|
369
|
+
(names.is_a?(Hash)) \
|
|
370
|
+
? names[:name_a_h]
|
|
371
|
+
: nil
|
|
372
|
+
end
|
|
373
|
+
def contributor
|
|
374
|
+
names=@h['contributor'] \
|
|
375
|
+
? name_format(@h['contributor'])
|
|
376
|
+
: nil
|
|
377
|
+
s=(names.is_a?(Hash)) \
|
|
378
|
+
? names[:name_str]
|
|
379
|
+
: nil
|
|
380
|
+
s=if s
|
|
381
|
+
l,n=Db[:col_name],'creator.author'
|
|
382
|
+
validate_length(s,l,n)
|
|
383
|
+
else nil
|
|
384
|
+
end
|
|
385
|
+
end
|
|
386
|
+
def contributor_detail
|
|
387
|
+
names=@h['contributor'] \
|
|
388
|
+
? name_format(@h['contributor'])
|
|
389
|
+
: nil
|
|
390
|
+
(names.is_a?(Hash)) \
|
|
391
|
+
? names[:name_a_h]
|
|
392
|
+
: nil
|
|
393
|
+
end
|
|
394
|
+
def illustrator
|
|
395
|
+
names=@h['illustrator'] \
|
|
396
|
+
? name_format(@h['illustrator'])
|
|
397
|
+
: nil
|
|
398
|
+
s=(names.is_a?(Hash)) \
|
|
399
|
+
? names[:name_str]
|
|
400
|
+
: nil
|
|
401
|
+
s=if s
|
|
402
|
+
l,n=Db[:col_name],'creator.illustrator'
|
|
403
|
+
validate_length(s,l,n)
|
|
404
|
+
else nil
|
|
405
|
+
end
|
|
406
|
+
end
|
|
407
|
+
def illustrator_detail
|
|
408
|
+
names=@h['illustrator'] \
|
|
409
|
+
? name_format(@h['illustrator'])
|
|
410
|
+
: nil
|
|
411
|
+
(names.is_a?(Hash)) \
|
|
412
|
+
? names[:name_a_h]
|
|
413
|
+
: nil
|
|
414
|
+
end
|
|
415
|
+
def photographer
|
|
416
|
+
names=@h['photographer'] \
|
|
417
|
+
? name_format(@h['photographer'])
|
|
418
|
+
: nil
|
|
419
|
+
s=(names.is_a?(Hash)) \
|
|
420
|
+
? names[:name_str]
|
|
421
|
+
: nil
|
|
422
|
+
s=if s
|
|
423
|
+
l,n=Db[:col_name],'creator.photographer'
|
|
424
|
+
validate_length(s,l,n)
|
|
425
|
+
else nil
|
|
426
|
+
end
|
|
427
|
+
end
|
|
428
|
+
def photographer_detail
|
|
429
|
+
names=@h['photographer'] \
|
|
430
|
+
? name_format(@h['photographer'])
|
|
431
|
+
: nil
|
|
432
|
+
(names.is_a?(Hash)) \
|
|
433
|
+
? names[:name_a_h]
|
|
434
|
+
: nil
|
|
435
|
+
end
|
|
436
|
+
def translator
|
|
437
|
+
names=@h['translator'] \
|
|
438
|
+
? name_format(@h['translator'])
|
|
439
|
+
: nil
|
|
440
|
+
s=(names.is_a?(Hash)) \
|
|
441
|
+
? names[:name_str]
|
|
442
|
+
: nil
|
|
443
|
+
s=if s
|
|
444
|
+
l,n=Db[:col_name],'creator.translator'
|
|
445
|
+
validate_length(s,l,n)
|
|
446
|
+
else nil
|
|
447
|
+
end
|
|
448
|
+
end
|
|
449
|
+
def translator_detail
|
|
450
|
+
names=@h['translator'] \
|
|
451
|
+
? name_format(@h['translator'])
|
|
452
|
+
: nil
|
|
453
|
+
(names.is_a?(Hash)) \
|
|
454
|
+
? names[:name_a_h]
|
|
455
|
+
: nil
|
|
456
|
+
end
|
|
457
|
+
def audio
|
|
458
|
+
names=@h['audio'] \
|
|
459
|
+
? name_format(@h['audio'])
|
|
460
|
+
: nil
|
|
461
|
+
s=(names.is_a?(Hash)) \
|
|
462
|
+
? names[:name_str]
|
|
463
|
+
: nil
|
|
464
|
+
s=if s
|
|
465
|
+
l,n=Db[:col_name],'creator.audio'
|
|
466
|
+
validate_length(s,l,n)
|
|
467
|
+
else nil
|
|
468
|
+
end
|
|
469
|
+
end
|
|
470
|
+
def audio_detail
|
|
471
|
+
names=@h['audio'] \
|
|
472
|
+
? name_format(@h['audio'])
|
|
473
|
+
: nil
|
|
474
|
+
(names.is_a?(Hash)) \
|
|
475
|
+
? names[:name_a_h]
|
|
476
|
+
: nil
|
|
477
|
+
end
|
|
478
|
+
def digitized_by
|
|
479
|
+
names=@h['digitized_by'] \
|
|
480
|
+
? name_format(@h['digitized_by'])
|
|
481
|
+
: nil
|
|
482
|
+
s=(names.is_a?(Hash)) \
|
|
483
|
+
? names[:name_str]
|
|
484
|
+
: nil
|
|
485
|
+
s=if s
|
|
486
|
+
l,n=Db[:col_name],'creator.digitized_by'
|
|
487
|
+
validate_length(s,l,n)
|
|
488
|
+
else nil
|
|
489
|
+
end
|
|
490
|
+
end
|
|
491
|
+
def digitized_by_detail
|
|
492
|
+
names=@h['digitized_by'] \
|
|
493
|
+
? name_format(@h['digitized_by'])
|
|
494
|
+
: nil
|
|
495
|
+
(names.is_a?(Hash)) \
|
|
496
|
+
? names[:name_a_h]
|
|
497
|
+
: nil
|
|
498
|
+
end
|
|
499
|
+
def prepared_by
|
|
500
|
+
names=@h['prepared_by'] \
|
|
501
|
+
? name_format(@h['prepared_by'])
|
|
502
|
+
: nil
|
|
503
|
+
s=(names.is_a?(Hash)) \
|
|
504
|
+
? names[:name_str]
|
|
505
|
+
: nil
|
|
506
|
+
s=if s
|
|
507
|
+
l,n=Db[:col_name],'creator.prepared_by'
|
|
508
|
+
validate_length(s,l,n)
|
|
509
|
+
else nil
|
|
510
|
+
end
|
|
511
|
+
end
|
|
512
|
+
def prepared_by_detail
|
|
513
|
+
names=@h['prepared_by'] \
|
|
514
|
+
? name_format(@h['prepared_by'])
|
|
515
|
+
: nil
|
|
516
|
+
names=name_format(@h['prepared_by'])
|
|
517
|
+
(names.is_a?(Hash)) \
|
|
518
|
+
? names[:name_a_h]
|
|
519
|
+
: nil
|
|
520
|
+
end
|
|
521
|
+
self
|
|
522
|
+
end
|
|
523
|
+
def rights
|
|
524
|
+
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
|
|
525
|
+
@h=build_hash(a)
|
|
526
|
+
def copyright
|
|
527
|
+
def text #you may wish to expand to take from all
|
|
528
|
+
s=if @h['copyright'] then @h['copyright']
|
|
529
|
+
elsif @h['text'] then @h['text']
|
|
530
|
+
elsif @h['main'] then @h['main']
|
|
531
|
+
else
|
|
532
|
+
SiSU_Screen::Ansi.new(
|
|
533
|
+
@opt.act[:color_state][:set],
|
|
534
|
+
'WARNING Document Copyright missing; provide @rights: :copyright:'
|
|
535
|
+
).warn if (@opt.act[:verbose][:set]==:on \
|
|
536
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
537
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
538
|
+
''
|
|
539
|
+
end
|
|
540
|
+
l,n=Db[:col_info_note],'rights.copyright.text'
|
|
541
|
+
validate_length(s,l,n)
|
|
542
|
+
end
|
|
543
|
+
def translation
|
|
544
|
+
s=@h['translation'] \
|
|
545
|
+
? @h['translation']
|
|
546
|
+
: nil
|
|
547
|
+
l,n=Db[:col_info_note],'rights.copyright.translation'
|
|
548
|
+
validate_length(s,l,n)
|
|
549
|
+
end
|
|
550
|
+
def illustrations
|
|
551
|
+
s=@h['illustrations'] \
|
|
552
|
+
? @h['illustrations']
|
|
553
|
+
: nil
|
|
554
|
+
l,n=Db[:col_info_note],'rights.copyright.illustrations'
|
|
555
|
+
validate_length(s,l,n)
|
|
556
|
+
end
|
|
557
|
+
def photographs
|
|
558
|
+
s=@h['photographs'] \
|
|
559
|
+
? @h['photographs']
|
|
560
|
+
: nil
|
|
561
|
+
l,n=Db[:col_info_note],'rights.copyright.photographs'
|
|
562
|
+
validate_length(s,l,n)
|
|
563
|
+
end
|
|
564
|
+
def digitization
|
|
565
|
+
s=@h['digitization'] \
|
|
566
|
+
? @h['digitization']
|
|
567
|
+
: nil
|
|
568
|
+
l,n=Db[:col_info_note],'rights.copyright.digitization'
|
|
569
|
+
validate_length(s,l,n)
|
|
570
|
+
end
|
|
571
|
+
def audio
|
|
572
|
+
s=@h['audio'] \
|
|
573
|
+
? @h['audio']
|
|
574
|
+
: nil
|
|
575
|
+
l,n=Db[:col_info_note],'rights.copyright.audio'
|
|
576
|
+
validate_length(s,l,n)
|
|
577
|
+
end
|
|
578
|
+
self
|
|
579
|
+
end
|
|
580
|
+
def license
|
|
581
|
+
s=@h['license'] \
|
|
582
|
+
? @h['license']
|
|
583
|
+
: nil
|
|
584
|
+
l,n=Db[:col_info_note],'rights.license'
|
|
585
|
+
validate_length(s,l,n)
|
|
586
|
+
end
|
|
587
|
+
def sep(str)
|
|
588
|
+
' \\\\ '
|
|
589
|
+
end
|
|
590
|
+
def copyright_and_license
|
|
591
|
+
s=if @h['copyright_and_license'] then @h['copyright_and_license']
|
|
592
|
+
else
|
|
593
|
+
s=''
|
|
594
|
+
if defined? copyright.text \
|
|
595
|
+
and copyright.text \
|
|
596
|
+
and not copyright.text.empty?
|
|
597
|
+
v=sep(copyright.text)
|
|
598
|
+
s +=copyright.text + v
|
|
599
|
+
end
|
|
600
|
+
if defined? copyright.license \
|
|
601
|
+
and copyright.license \
|
|
602
|
+
and not copyright.license.empty?
|
|
603
|
+
s +=copyright.license
|
|
604
|
+
end
|
|
605
|
+
if s.empty?
|
|
606
|
+
SiSU_Screen::Ansi.new(
|
|
607
|
+
@opt.act[:color_state][:set],
|
|
608
|
+
'WARNING Document Rights information missing; provide @rights: :copyright:'
|
|
609
|
+
).warn if (@opt.act[:verbose][:set]==:on \
|
|
610
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
611
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
612
|
+
else
|
|
613
|
+
l,n=Db[:col_info_note],'rights.all'
|
|
614
|
+
validate_length(s,l,n)
|
|
615
|
+
end
|
|
616
|
+
s=s.gsub(/ [\\]+\s+$/,'')
|
|
617
|
+
end
|
|
618
|
+
s
|
|
619
|
+
end
|
|
620
|
+
def all
|
|
621
|
+
s=if @h['all'] then @h['all']
|
|
622
|
+
else
|
|
623
|
+
s=''
|
|
624
|
+
if defined? copyright.text \
|
|
625
|
+
and copyright.text \
|
|
626
|
+
and not copyright.text.empty?
|
|
627
|
+
v=sep(copyright.text)
|
|
628
|
+
s +='Copyright: ' + copyright.text + v
|
|
629
|
+
end
|
|
630
|
+
if defined? copyright.translation \
|
|
631
|
+
and copyright.translation \
|
|
632
|
+
and not copyright.translation.empty?
|
|
633
|
+
v=sep(copyright.translation)
|
|
634
|
+
s +='translation: ' + copyright.translation + v
|
|
635
|
+
end
|
|
636
|
+
if defined? copyright.illustrations \
|
|
637
|
+
and copyright.illustrations \
|
|
638
|
+
and not copyright.illustrations.empty?
|
|
639
|
+
v=sep(copyright.illustrations)
|
|
640
|
+
s +='illustrations: ' + copyright.illustrations + v
|
|
641
|
+
end
|
|
642
|
+
if defined? copyright.photographs \
|
|
643
|
+
and copyright.photographs \
|
|
644
|
+
and not copyright.photographs.empty?
|
|
645
|
+
v=sep(copyright.photographs)
|
|
646
|
+
s +='photographs: ' + copyright.photographs + v
|
|
647
|
+
end
|
|
648
|
+
if defined? copyright.digitization \
|
|
649
|
+
and copyright.digitization \
|
|
650
|
+
and not copyright.digitization.empty?
|
|
651
|
+
v=sep(copyright.digitization)
|
|
652
|
+
s +='digitization: ' + copyright.digitization + v
|
|
653
|
+
end
|
|
654
|
+
if defined? copyright.audio \
|
|
655
|
+
and copyright.audio \
|
|
656
|
+
and not copyright.audio.empty?
|
|
657
|
+
v=sep(copyright.audio)
|
|
658
|
+
s +='audio: ' + copyright.audio + v
|
|
659
|
+
end
|
|
660
|
+
if defined? copyright.license \
|
|
661
|
+
and copyright.license \
|
|
662
|
+
and not copyright.license.empty?
|
|
663
|
+
s +='License: ' + copyright.license
|
|
664
|
+
end
|
|
665
|
+
if s.empty?
|
|
666
|
+
SiSU_Screen::Ansi.new(
|
|
667
|
+
@opt.act[:color_state][:set],
|
|
668
|
+
'WARNING Document Rights information missing; provide @rights: :copyright:'
|
|
669
|
+
).warn if (@opt.act[:verbose][:set]==:on \
|
|
670
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
671
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
672
|
+
else
|
|
673
|
+
l,n=Db[:col_info_note],'rights.all'
|
|
674
|
+
validate_length(s,l,n)
|
|
675
|
+
end
|
|
676
|
+
s=s.gsub(/ [\\]+\s+$/,'')
|
|
677
|
+
end
|
|
678
|
+
s
|
|
679
|
+
end
|
|
680
|
+
self
|
|
681
|
+
end
|
|
682
|
+
def identifier
|
|
683
|
+
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
|
|
684
|
+
@h=build_hash(a)
|
|
685
|
+
def oclc
|
|
686
|
+
s=@h['oclc']
|
|
687
|
+
l,n=Db[:col_library],'identifier.oclc'
|
|
688
|
+
validate_length(s,l,n)
|
|
689
|
+
end
|
|
690
|
+
def isbn
|
|
691
|
+
s=@h['isbn']
|
|
692
|
+
l,n=Db[:col_small],'identifier.isbn'
|
|
693
|
+
validate_length(s,l,n)
|
|
694
|
+
end
|
|
695
|
+
def pg
|
|
696
|
+
s=@h['pg']
|
|
697
|
+
l,n=Db[:col_small],'identifier.pg'
|
|
698
|
+
validate_length(s,l,n)
|
|
699
|
+
end
|
|
700
|
+
self
|
|
701
|
+
end
|
|
702
|
+
def classify
|
|
703
|
+
a=@s.split(/(\n%\s.+?$|[ ]*)(?:\n[ ]*(?=:)|\Z)/m)
|
|
704
|
+
@h=build_hash(a)
|
|
705
|
+
def topic_register
|
|
706
|
+
s=@h['topic_register']
|
|
707
|
+
l,n=Db[:col_info_note],'classify.topic_register'
|
|
708
|
+
validate_length(s,l,n)
|
|
709
|
+
end
|
|
710
|
+
def subject
|
|
711
|
+
s=@h['subject']
|
|
712
|
+
l,n=Db[:col_txt_long],'classify.subject'
|
|
713
|
+
validate_length(s,l,n)
|
|
714
|
+
end
|
|
715
|
+
def keywords
|
|
716
|
+
s=@h['keywords']
|
|
717
|
+
l,n=Db[:col_txt_long],'classify.keywords'
|
|
718
|
+
validate_length(s,l,n)
|
|
719
|
+
end
|
|
720
|
+
def loc
|
|
721
|
+
s=@h['loc']
|
|
722
|
+
l,n=Db[:col_library],'classify.loc'
|
|
723
|
+
validate_length(s,l,n)
|
|
724
|
+
end
|
|
725
|
+
def dewey
|
|
726
|
+
s=@h['dewey']
|
|
727
|
+
l,n=Db[:col_library],'classify.dewey'
|
|
728
|
+
validate_length(s,l,n)
|
|
729
|
+
end
|
|
730
|
+
self
|
|
731
|
+
end
|
|
732
|
+
def publisher
|
|
733
|
+
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
|
|
734
|
+
@h=build_hash(a)
|
|
735
|
+
s=@h['main']
|
|
736
|
+
l,n=Db[:col_name],'publisher'
|
|
737
|
+
validate_length(s,l,n)
|
|
738
|
+
end
|
|
739
|
+
def date
|
|
740
|
+
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
|
|
741
|
+
@h=build_hash(a)
|
|
742
|
+
def added_to_site
|
|
743
|
+
s=@h['added_to_site']
|
|
744
|
+
l,n=Db[:col_date_text],'date.added_to_site'
|
|
745
|
+
validate_length(s,l,n)
|
|
746
|
+
end
|
|
747
|
+
def available
|
|
748
|
+
s=@h['available']
|
|
749
|
+
l,n=Db[:col_date_text],'date.available'
|
|
750
|
+
validate_length(s,l,n)
|
|
751
|
+
end
|
|
752
|
+
def created
|
|
753
|
+
s=@h['created']
|
|
754
|
+
l,n=Db[:col_date_text],'date.created'
|
|
755
|
+
validate_length(s,l,n)
|
|
756
|
+
end
|
|
757
|
+
def issued
|
|
758
|
+
s=@h['issued']
|
|
759
|
+
l,n=Db[:col_date_text],'date.issued'
|
|
760
|
+
validate_length(s,l,n)
|
|
761
|
+
end
|
|
762
|
+
def modified
|
|
763
|
+
s=@h['modified']
|
|
764
|
+
l,n=Db[:col_date_text],'date.modified'
|
|
765
|
+
validate_length(s,l,n)
|
|
766
|
+
end
|
|
767
|
+
def published
|
|
768
|
+
s=@h['published']=(@h['published'] ? @h['published'] : @h['main'])
|
|
769
|
+
l,n=Db[:col_date_text],'date.published'
|
|
770
|
+
validate_length(s,l,n)
|
|
771
|
+
end
|
|
772
|
+
def valid
|
|
773
|
+
s=@h['valid']
|
|
774
|
+
l,n=Db[:col_date_text],'date.valid'
|
|
775
|
+
validate_length(s,l,n)
|
|
776
|
+
end
|
|
777
|
+
self
|
|
778
|
+
end
|
|
779
|
+
#def language # as things stand this should really be populated from title.language and original.language, resolve
|
|
780
|
+
# a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
|
|
781
|
+
# @h=build_hash(a)
|
|
782
|
+
# def document
|
|
783
|
+
# s=@h['document']=(@h['document'] ? @h['document'] : @h['main'])
|
|
784
|
+
# l,n=Db[:col_language],'language.document'
|
|
785
|
+
# validate_length(s,l,n)
|
|
786
|
+
# end
|
|
787
|
+
# def document_char
|
|
788
|
+
# s=@h['document_char']=(@h['document_char'] ? @h['document_char'] : nil)
|
|
789
|
+
# l,n=Db[:col_language_char],'language.document_char'
|
|
790
|
+
# validate_length(s,l,n)
|
|
791
|
+
# end
|
|
792
|
+
# def original
|
|
793
|
+
# s=@h['original']
|
|
794
|
+
# l,n=Db[:col_language],'language.original'
|
|
795
|
+
# validate_length(s,l,n)
|
|
796
|
+
# end
|
|
797
|
+
# def original_char
|
|
798
|
+
# s=@h['original_char']
|
|
799
|
+
# l,n=Db[:col_language_char],'language.original_char'
|
|
800
|
+
# validate_length(s,l,n)
|
|
801
|
+
# end
|
|
802
|
+
# self
|
|
803
|
+
#end
|
|
804
|
+
def current_publisher
|
|
805
|
+
@s
|
|
806
|
+
end
|
|
807
|
+
def original
|
|
808
|
+
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
|
|
809
|
+
@h=build_hash(a)
|
|
810
|
+
def publisher
|
|
811
|
+
s=@h['publisher']
|
|
812
|
+
l,n=Db[:col_name],'original.publisher'
|
|
813
|
+
validate_length(s,l,n)
|
|
814
|
+
end
|
|
815
|
+
def language
|
|
816
|
+
s=@h['language']
|
|
817
|
+
l,n=Db[:col_language],'original.language'
|
|
818
|
+
validate_length(s,l,n)
|
|
819
|
+
end
|
|
820
|
+
def language_char
|
|
821
|
+
s=@h['language_char']
|
|
822
|
+
l,n=Db[:col_language_char],'original.language_char'
|
|
823
|
+
validate_length(s,l,n)
|
|
824
|
+
end
|
|
825
|
+
def source
|
|
826
|
+
s=@h['source']
|
|
827
|
+
l,n=Db[:col_name],'original.source'
|
|
828
|
+
validate_length(s,l,n)
|
|
829
|
+
end
|
|
830
|
+
def institution
|
|
831
|
+
s=@h['institution']
|
|
832
|
+
l,n=Db[:col_name],'original.institution'
|
|
833
|
+
validate_length(s,l,n)
|
|
834
|
+
end
|
|
835
|
+
def nationality
|
|
836
|
+
s=@h['nationality']
|
|
837
|
+
l,n=Db[:col_language],'original.nationality'
|
|
838
|
+
validate_length(s,l,n)
|
|
839
|
+
end
|
|
840
|
+
self
|
|
841
|
+
end
|
|
842
|
+
def notes
|
|
843
|
+
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
|
|
844
|
+
@h=build_hash(a)
|
|
845
|
+
def description
|
|
846
|
+
s=@h['description']
|
|
847
|
+
l,n=Db[:col_info_note],'notes.description'
|
|
848
|
+
validate_length(s,l,n)
|
|
849
|
+
end
|
|
850
|
+
def abstract
|
|
851
|
+
s=@h['abstract']
|
|
852
|
+
l,n=Db[:col_info_note],'notes.abstract'
|
|
853
|
+
validate_length(s,l,n)
|
|
854
|
+
end
|
|
855
|
+
def comment
|
|
856
|
+
s=@h['comment']
|
|
857
|
+
l,n=Db[:col_info_note],'notes.comment'
|
|
858
|
+
validate_length(s,l,n)
|
|
859
|
+
end
|
|
860
|
+
def coverage
|
|
861
|
+
s=@h['coverage']
|
|
862
|
+
l,n=Db[:col_info_note],'notes.coverage'
|
|
863
|
+
validate_length(s,l,n)
|
|
864
|
+
end
|
|
865
|
+
def relation
|
|
866
|
+
s=@h['relation']
|
|
867
|
+
l,n=Db[:col_info_note],'notes.relation'
|
|
868
|
+
validate_length(s,l,n)
|
|
869
|
+
end
|
|
870
|
+
def source
|
|
871
|
+
s=@h['source']
|
|
872
|
+
l,n=Db[:col_txt_long],'notes.source'
|
|
873
|
+
validate_length(s,l,n)
|
|
874
|
+
end
|
|
875
|
+
def history
|
|
876
|
+
s=@h['history']
|
|
877
|
+
l,n=Db[:col_txt_long],'notes.history'
|
|
878
|
+
validate_length(s,l,n)
|
|
879
|
+
end
|
|
880
|
+
def type
|
|
881
|
+
s=@h['type']
|
|
882
|
+
l,n=Db[:col_txt_long],'notes.relation'
|
|
883
|
+
validate_length(s,l,n)
|
|
884
|
+
end
|
|
885
|
+
def format
|
|
886
|
+
s=@h['format']
|
|
887
|
+
l,n=Db[:col_txt_short],'notes.format'
|
|
888
|
+
validate_length(s,l,n)
|
|
889
|
+
end
|
|
890
|
+
def prefix
|
|
891
|
+
@h['prefix']
|
|
892
|
+
end
|
|
893
|
+
self
|
|
894
|
+
end
|
|
895
|
+
end
|
|
896
|
+
class Instructions
|
|
897
|
+
@doc={ lv: [] }
|
|
898
|
+
@doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','',''
|
|
899
|
+
@@publisher='SiSU scribe'
|
|
900
|
+
attr_accessor :make,:env,:path,:file,:fn,:fns,:fno,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:sisu,:project_details,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv0,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:pageline,:num_top,:bold_match_list,:italics_match_list,:substitution_match_list,:emphasis_set_to,:toc_lev_limit,:flag_biblio,:flag_auto_biblio,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:flag_tables,:vocabulary,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:lang_code_insert,:en,:notes,:dgst,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy,:home_button_image,:home_button_links,:footer_links,:cover_image,:man_section
|
|
901
|
+
def initialize(fns_array,opt)
|
|
902
|
+
@env=@path,@file=@fn=@fns=@fno=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_biblio=@flag_auto_biblio=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@sisu=@project_details=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv0=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@pageline=@num_top=@bold_match_list=@italics_match_list=@substitution_match_list=@emphasis_set_to=@toc_lev_limit=@flag_tables=@vocabulary=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@lang_code_insert=@en=@notes=@dgst=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=@home_button_image=@home_button_links=@cover_image=@man_section=nil
|
|
903
|
+
@data, @path, @fns, @fno, @opt=
|
|
904
|
+
fns_array,opt.pth,opt.fns,opt.fno,opt #@data used as data
|
|
905
|
+
@flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=
|
|
906
|
+
false, false, false, false, false, false, false
|
|
907
|
+
@seg_autoname_safe=true
|
|
908
|
+
@daisy,@sem_tag=false,false
|
|
909
|
+
@authorship,@markup_instruction,@image='','','','' #check which other values should be set to empty rather than nil
|
|
910
|
+
@markup=@markup_instruction #use @markup_instruction
|
|
911
|
+
@doc,@fn,@make_italic,@tag_hash,@ec={},{},{},{},{},{}
|
|
912
|
+
@flv,@lang,@seg_names,@tags,@tag_array,@tag_a,@ec[:image],@ec[:audio],@ec[:multimedia]=Array.new(9){[]}
|
|
913
|
+
@authors,@topic_register_array,@papersize_array=[],[],[]
|
|
914
|
+
@lvs=[nil,0,0,0,0,0,0]
|
|
915
|
+
@emphasis_set_to='bold'
|
|
916
|
+
@lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt).language_code_insert
|
|
917
|
+
@footer_links= { left: { say: '', url: '' }, center: { say: '', url: '' } }
|
|
918
|
+
@rgx_image=/(?:^|[^_\\])\{(?:\s*|\~\^\s+)(\S+?\.(?:png|jpg|gif)\b)/m
|
|
919
|
+
@rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/
|
|
920
|
+
@rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg
|
|
921
|
+
Dir.chdir(@opt.f_pth[:pth])
|
|
922
|
+
begin
|
|
923
|
+
rescue
|
|
924
|
+
SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@fns).location do
|
|
925
|
+
__LINE__.to_s + ':' + __FILE__
|
|
926
|
+
end
|
|
927
|
+
ensure
|
|
928
|
+
end
|
|
929
|
+
@header_make_links_append=:no
|
|
930
|
+
common_makes=(defined? @opt.make_instructions_pod) \
|
|
931
|
+
&& @opt.make_instructions_pod !=nil \
|
|
932
|
+
&& @opt.make_instructions_pod[:makeset]==true \
|
|
933
|
+
? @opt.make_instructions_pod
|
|
934
|
+
: @opt.make_instructions
|
|
935
|
+
if common_makes[:makeset]
|
|
936
|
+
@pagenew=common_makes[:pagenew]
|
|
937
|
+
@pagebreak=common_makes[:pagebreak]
|
|
938
|
+
@pageline=common_makes[:pageline]
|
|
939
|
+
@toc=common_makes[:toc]
|
|
940
|
+
@lv0=common_makes[:lv0]
|
|
941
|
+
@lv1=common_makes[:lv1]
|
|
942
|
+
@lv2=common_makes[:lv2]
|
|
943
|
+
@lv3=common_makes[:lv3]
|
|
944
|
+
@lv4=common_makes[:lv4]
|
|
945
|
+
@lv5=common_makes[:lv5]
|
|
946
|
+
@lv6=common_makes[:lv6]
|
|
947
|
+
@num_top=common_makes[:num_top]
|
|
948
|
+
@i18n=common_makes[:i18n]
|
|
949
|
+
@man_section=common_makes[:man_section]
|
|
950
|
+
@emphasis_set_to=common_makes[:emphasis_set_to]
|
|
951
|
+
@bold_match_list=common_makes[:bold_match_list]
|
|
952
|
+
@italics_match_list=common_makes[:italics_match_list]
|
|
953
|
+
@substitution_match_list=common_makes[:substitution_match_list]
|
|
954
|
+
@footer_links=common_makes[:footer_links]
|
|
955
|
+
@home_button_links=common_makes[:home_button_links]
|
|
956
|
+
@home_button_image=common_makes[:home_button_image]
|
|
957
|
+
@cover_image=common_makes[:cover_image]
|
|
958
|
+
@lnk=@links=common_makes[:links]
|
|
959
|
+
@header_make_links_append=common_makes[:links_append]
|
|
960
|
+
end
|
|
961
|
+
end
|
|
962
|
+
#protected
|
|
963
|
+
def extract
|
|
964
|
+
begin
|
|
965
|
+
@user,@home,@hostname,@pwd=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD']
|
|
966
|
+
@programs,@wc,@language,@language_original={},{},{},{}
|
|
967
|
+
@en={ sum: 0, mark: 0, note: 0, mismatch: 0 }
|
|
968
|
+
@prog=SiSU_Env::InfoSettings.new
|
|
969
|
+
@sys=SiSU_Env::SystemCall.new
|
|
970
|
+
@env=SiSU_Env::InfoEnv.new(@fns) #watch
|
|
971
|
+
if (@opt.act[:verbose_plus][:set]==:on \
|
|
972
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
973
|
+
puts 'system locale: ' + @sys.locale
|
|
974
|
+
end
|
|
975
|
+
if @prog.wc \
|
|
976
|
+
and @sys.wc
|
|
977
|
+
wc=%x{wc #{fns}}
|
|
978
|
+
wca=wc.scan(/\d+/)
|
|
979
|
+
@wc_lines,@wc_words,@wc_bytes=wca[0].to_i,wca[1].to_i,wca[2].to_i
|
|
980
|
+
else
|
|
981
|
+
fns_a=@data.dup
|
|
982
|
+
tmp=fns_a.join
|
|
983
|
+
fns_a=tmp.scan(/\S+/)
|
|
984
|
+
@wc_words=fns_a.length
|
|
985
|
+
fns_a=tmp=nil
|
|
986
|
+
end
|
|
987
|
+
@concord_make=(@wc_words > @env.concord_max) ? false : true
|
|
988
|
+
@locale=@sys.locale
|
|
989
|
+
@file_encoding=@sys.file_encoding(fns,@opt.act)
|
|
990
|
+
# programs set here for things that affect output appearance only
|
|
991
|
+
@programs[:pdf]=SiSU_Env::SystemCall.new.program_found?('pdflatex')
|
|
992
|
+
if @opt.act[:psql][:set] == [:ok]
|
|
993
|
+
m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/ #watch added match for sss
|
|
994
|
+
@fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3]
|
|
995
|
+
@flv=@env.document_language_versions_found[:f]
|
|
996
|
+
else
|
|
997
|
+
m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss
|
|
998
|
+
@fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3]
|
|
999
|
+
@flv=@env.document_language_versions_found[:f]
|
|
1000
|
+
@fnz=(@fns =~/\.(?:ssm\.sst|ssm)$/) ? (@fnn + '.ssm.txz') : (@fnn + '.sst.txz')
|
|
1001
|
+
end
|
|
1002
|
+
@papersize=@env.papersize #'A4' #default size #get first from SiSU_Env:: # @env is probably no longer most appropriate name! as default info is more general
|
|
1003
|
+
@sfx_src=@fns[m,2]
|
|
1004
|
+
if @fns =~ /(?:-|ssm\.)?sst$/ \
|
|
1005
|
+
and not @opt.act[:psql][:set] == [:ok]
|
|
1006
|
+
@env_out_root=@env.path.output
|
|
1007
|
+
@dir_out="#{@env.path.output}/#{@fnb}"
|
|
1008
|
+
@dir_tex=@env.processing_path.tex
|
|
1009
|
+
@dir_lout=@env.processing_path.lout
|
|
1010
|
+
@@publisher='SiSU http://www.jus.uio.no/sisu'
|
|
1011
|
+
end
|
|
1012
|
+
@txt_path=@txt_path ||= @env.path.output
|
|
1013
|
+
@stmp=%{#{@fns}}[/^(.+?)\..*/m,1]
|
|
1014
|
+
@fnstex=@fns.gsub(/_/,'\_\-').gsub(/\./,'.\-')
|
|
1015
|
+
@flag_endnotes,@flag_auto_endnotes,@flag_separate_endnotes=false,false,false
|
|
1016
|
+
@flag_separate_endnotes_make=true
|
|
1017
|
+
@flag_biblio,@flag_auto_biblio=false,false
|
|
1018
|
+
ver=SiSU_Env::InfoVersion.instance
|
|
1019
|
+
@project_details=ver.get_version
|
|
1020
|
+
@ruby_version=ver.rbversion
|
|
1021
|
+
@generated=Time.now
|
|
1022
|
+
fns_array=@data.dup
|
|
1023
|
+
skip unless fns_array # consider
|
|
1024
|
+
@code_flag=false
|
|
1025
|
+
flag_code_curly=:not_code_curly
|
|
1026
|
+
flag_code_tics=:not_code_tics
|
|
1027
|
+
fns_array.each do |para| #% scan document
|
|
1028
|
+
if para !~/^%+\s/ \
|
|
1029
|
+
and para =~/<![abcdeghijklmnopqrstuvwxyz]/i # <!f not included
|
|
1030
|
+
raise "Old markup style in file #{@fns}, current version #{@project_details.project} #{@project_details.version} #{@project_details.date_stamp} #{@project_details.date}:\n\t\t#{para}\n\n"
|
|
1031
|
+
end
|
|
1032
|
+
if para =~/^code\{/
|
|
1033
|
+
flag_code_curly=:code_curly
|
|
1034
|
+
elsif para =~/^\}code/
|
|
1035
|
+
flag_code_curly=:not_code_curly
|
|
1036
|
+
elsif para =~/^``` code/
|
|
1037
|
+
flag_code_tics=:code_tics
|
|
1038
|
+
elsif flag_code_tics ==:code_tics \
|
|
1039
|
+
and para =~/^```/
|
|
1040
|
+
flag_code_tics=:not_code_tics
|
|
1041
|
+
end
|
|
1042
|
+
@code_flag=if flag_code_curly==:code_curly \
|
|
1043
|
+
or flag_code_tics==:code_tics
|
|
1044
|
+
true
|
|
1045
|
+
else false
|
|
1046
|
+
end
|
|
1047
|
+
regx_header=/^@\S+?:[+-]?\s/
|
|
1048
|
+
if para =~regx_header \
|
|
1049
|
+
and not @code_flag #or para=~/^(?:1|:?A)~/
|
|
1050
|
+
case para
|
|
1051
|
+
when /^@title:(.+)/m #% * header metadata - title
|
|
1052
|
+
@title=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).title
|
|
1053
|
+
when /^@creator:(.+)/m #% * header metadata - creator
|
|
1054
|
+
@creator=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).creator
|
|
1055
|
+
@authorship=@author=@creator.author
|
|
1056
|
+
@authors=@creator.author_detail
|
|
1057
|
+
when /^@date:(.+)/m #% * header metadata - date
|
|
1058
|
+
@date=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).date
|
|
1059
|
+
when /^@publisher:\s+(.+)/m #% * header metadata - publisher
|
|
1060
|
+
@publisher=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).current_publisher
|
|
1061
|
+
@current_publisher=@publisher
|
|
1062
|
+
when /^@rights:(.+)/m #% * header metadata - rights
|
|
1063
|
+
@rights=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).rights
|
|
1064
|
+
when /^@classify:(.+)/m #% * header metadata - classify
|
|
1065
|
+
@classify=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).classify
|
|
1066
|
+
when /^@identifier:(.+)/m #% * header metadata - identifier
|
|
1067
|
+
@identifier=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).identifier
|
|
1068
|
+
when /^@original:(.+)/m #% * header metadata - original (document)
|
|
1069
|
+
@original=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).original
|
|
1070
|
+
@source=@original.source
|
|
1071
|
+
when /^@notes?:\s(.+)\Z/m #% * header metadata - notes
|
|
1072
|
+
@notes=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).notes
|
|
1073
|
+
when /^@links:\s+(.+?)\Z/m #% * header metadata - links
|
|
1074
|
+
links=SiSU_Param::Parameters::MdMake.new($1.strip,@opt,@env).make_links.links
|
|
1075
|
+
@lnk=@links=if @header_make_links_append == :yes
|
|
1076
|
+
(links) \
|
|
1077
|
+
? (links + @links)
|
|
1078
|
+
: @links
|
|
1079
|
+
else
|
|
1080
|
+
(links) \
|
|
1081
|
+
? (links)
|
|
1082
|
+
: @links
|
|
1083
|
+
end
|
|
1084
|
+
when /^@make:(.+)/m #% * header processing - make
|
|
1085
|
+
@make=SiSU_Param::Parameters::MdMake.new($1.strip,@opt,@env).make
|
|
1086
|
+
makes=SiSU_Param_Make::MakeHead.new(@make).make_instruct
|
|
1087
|
+
@pagenew=(makes[:pagenew]) \
|
|
1088
|
+
? (makes[:pagenew]) \
|
|
1089
|
+
: @pagenew
|
|
1090
|
+
@pagebreak=(makes[:pagebreak]) \
|
|
1091
|
+
? (makes[:pagebreak]) \
|
|
1092
|
+
: @pagebreak
|
|
1093
|
+
@pageline=(makes[:pageline]) \
|
|
1094
|
+
? (makes[:pageline]) \
|
|
1095
|
+
: @pageline
|
|
1096
|
+
@toc=(makes[:toc]) ? (makes[:toc]) : @toc
|
|
1097
|
+
@lv0=(makes[:lv0]) ? (makes[:lv0]) : @lv0
|
|
1098
|
+
@lv1=(makes[:lv1]) ? (makes[:lv1]) : @lv1
|
|
1099
|
+
@lv2=(makes[:lv2]) ? (makes[:lv2]) : @lv2
|
|
1100
|
+
@lv3=(makes[:lv3]) ? (makes[:lv3]) : @lv3
|
|
1101
|
+
@lv4=(makes[:lv4]) ? (makes[:lv4]) : @lv4
|
|
1102
|
+
@lv5=(makes[:lv5]) ? (makes[:lv5]) : @lv5
|
|
1103
|
+
@lv6=(makes[:lv6]) ? (makes[:lv6]) : @lv6
|
|
1104
|
+
@num_top=
|
|
1105
|
+
(makes[:num_top]) \
|
|
1106
|
+
? (makes[:num_top]) \
|
|
1107
|
+
: @num_top
|
|
1108
|
+
@substitution_match_list=
|
|
1109
|
+
(makes[:substitution_match_list]) \
|
|
1110
|
+
? (makes[:substitution_match_list]) \
|
|
1111
|
+
: @substitution_match_list
|
|
1112
|
+
@bold_match_list=
|
|
1113
|
+
(makes[:bold_match_list]) \
|
|
1114
|
+
? (makes[:bold_match_list]) \
|
|
1115
|
+
: @bold_match_list
|
|
1116
|
+
@italics_match_list=
|
|
1117
|
+
(makes[:italics_match_list]) \
|
|
1118
|
+
? (makes[:italics_match_list]) \
|
|
1119
|
+
: @italics_match_list
|
|
1120
|
+
@emphasis_set_to=
|
|
1121
|
+
(makes[:emphasis_set_to]) \
|
|
1122
|
+
? (makes[:emphasis_set_to]) \
|
|
1123
|
+
: @emphasis_set_to
|
|
1124
|
+
@i18n=
|
|
1125
|
+
(makes[:i18n]) \
|
|
1126
|
+
? (makes[:i18n]) \
|
|
1127
|
+
: @i18n
|
|
1128
|
+
@man_section=
|
|
1129
|
+
(makes[:man_section]) \
|
|
1130
|
+
? (makes[:man_section]) \
|
|
1131
|
+
: @man_section
|
|
1132
|
+
@footer_links=
|
|
1133
|
+
(makes[:footer_links]) \
|
|
1134
|
+
? (makes[:footer_links]) \
|
|
1135
|
+
: @footer_links
|
|
1136
|
+
@home_button_links=
|
|
1137
|
+
(makes[:home_button_links]) \
|
|
1138
|
+
? (makes[:home_button_links]) \
|
|
1139
|
+
: @home_button_links
|
|
1140
|
+
@home_button_image=
|
|
1141
|
+
(makes[:home_button_image]) \
|
|
1142
|
+
? (makes[:home_button_image]) \
|
|
1143
|
+
: @home_button_image
|
|
1144
|
+
@cover_image=
|
|
1145
|
+
(makes[:cover_image]) \
|
|
1146
|
+
? (makes[:cover_image]) \
|
|
1147
|
+
: @cover_image
|
|
1148
|
+
end
|
|
1149
|
+
@lv0 ||=/^0~/
|
|
1150
|
+
@lv1 ||=/^1~/
|
|
1151
|
+
@lv2 ||=/^2~/
|
|
1152
|
+
@lv3 ||=/^3~/
|
|
1153
|
+
@lv4 ||=/^4~/
|
|
1154
|
+
@lv5 ||=/^5~/
|
|
1155
|
+
@lv6 ||=/^6~/
|
|
1156
|
+
else #% *
|
|
1157
|
+
l_0=l_1=l_2=l_3=l_4=l_5=''
|
|
1158
|
+
if defined? @make.headings[0]
|
|
1159
|
+
l_0=if defined? @make.headings[0][0] \
|
|
1160
|
+
and @make.headings[0][0] =~/\S+/
|
|
1161
|
+
"|^#{@make.headings[0][0]}"
|
|
1162
|
+
end
|
|
1163
|
+
l_1=if defined? @make.headings[0][1] \
|
|
1164
|
+
and @make.headings[0][1] =~/\S+/
|
|
1165
|
+
"|^#{@make.headings[0][1]}"
|
|
1166
|
+
end
|
|
1167
|
+
l_2=if defined? @make.headings[0][2] \
|
|
1168
|
+
and @make.headings[0][2] =~/\S+/
|
|
1169
|
+
"|^#{@make.headings[0][2]}"
|
|
1170
|
+
end
|
|
1171
|
+
l_3=if defined? @make.headings[0][3] \
|
|
1172
|
+
and @make.headings[0][3] =~/\S+/
|
|
1173
|
+
"|^#{@make.headings[0][3]}"
|
|
1174
|
+
end
|
|
1175
|
+
l_4=if defined? @make.headings[0][4] \
|
|
1176
|
+
and @make.headings[0][4] =~/\S+/
|
|
1177
|
+
"|^#{@make.headings[0][4]}"
|
|
1178
|
+
end
|
|
1179
|
+
l_5=if defined? @make.headings[0][5] \
|
|
1180
|
+
and @make.headings[0][5] =~/\S+/
|
|
1181
|
+
"|^#{@make.headings[0][5]}"
|
|
1182
|
+
end
|
|
1183
|
+
end
|
|
1184
|
+
case para
|
|
1185
|
+
#when /^:?A~/
|
|
1186
|
+
when /^:?B~#{l_0}/
|
|
1187
|
+
@lvs[1]=1
|
|
1188
|
+
when /^:?C~#{l_1}/
|
|
1189
|
+
@lvs[2]=1
|
|
1190
|
+
when /^:?D~#{l_2}/
|
|
1191
|
+
@lvs[3]=1
|
|
1192
|
+
when /^1~#{l_3}/
|
|
1193
|
+
@lvs[4]=1
|
|
1194
|
+
when /^2~#{l_4}/
|
|
1195
|
+
@lvs[5]=1
|
|
1196
|
+
when /^3~#{l_5}/
|
|
1197
|
+
@lvs[6]=1
|
|
1198
|
+
end
|
|
1199
|
+
if para =~ /^:?A~/ #% processing
|
|
1200
|
+
if not defined? @title.full.nil?
|
|
1201
|
+
tf=para[/^:A~\S*(.+)$/m,1]
|
|
1202
|
+
tf="@title: #{tf}"
|
|
1203
|
+
@title=SiSU_Param::Parameters::Md.new(tf.strip,@opt,@env).title
|
|
1204
|
+
end
|
|
1205
|
+
creator=(@creator.is_a?(SiSU_Param::Parameters::Md) \
|
|
1206
|
+
&& defined? @creator.author \
|
|
1207
|
+
&& @creator.author.is_a?(String)) \
|
|
1208
|
+
? " #{@creator.author}"
|
|
1209
|
+
: ''
|
|
1210
|
+
title=@title.full.gsub(/\s*(?:<p>|<p \/>|<br>|<br \/>)\s*/,' ').
|
|
1211
|
+
gsub(/~\{.+?\}~/,'')
|
|
1212
|
+
SiSU_Screen::Ansi.new(
|
|
1213
|
+
@opt.act[:color_state][:set],
|
|
1214
|
+
'Document Parameters',
|
|
1215
|
+
%{#{title}#{creator}}
|
|
1216
|
+
).txt_grey if @opt.act[:verbose][:set]==:on
|
|
1217
|
+
end
|
|
1218
|
+
unless @code_flag
|
|
1219
|
+
if para =~/^1~biblio(?:graphy)?/
|
|
1220
|
+
@flag_auto_biblio,@flag_biblio=false,true
|
|
1221
|
+
#@flag_biblio=true
|
|
1222
|
+
elsif @flag_biblio ==true \
|
|
1223
|
+
and @flag_auto_biblio ==false \
|
|
1224
|
+
and para =~/^(?:au|author):/m
|
|
1225
|
+
@flag_auto_biblio =true
|
|
1226
|
+
end
|
|
1227
|
+
end
|
|
1228
|
+
if not @book_idx \
|
|
1229
|
+
and para =~/^=\{(.+?)\}[\s`]*\Z/m
|
|
1230
|
+
@book_idx=true
|
|
1231
|
+
end
|
|
1232
|
+
unless @code_flag
|
|
1233
|
+
case para
|
|
1234
|
+
when /~\{\s+.+?\}~/m #% processing
|
|
1235
|
+
en=para.scan(/~\{.+?\}~/m)
|
|
1236
|
+
en.each { |e| @en[:sum] +=1 }
|
|
1237
|
+
when /~\^(?:\s|$)/m #% processing
|
|
1238
|
+
mk=para.scan(/~\^(?:\s|$)/)
|
|
1239
|
+
mk.each { |e| @en[:mark] +=1 }
|
|
1240
|
+
when /^\^~\s+\S/ then @en[:note] +=1 #% processing
|
|
1241
|
+
end
|
|
1242
|
+
end
|
|
1243
|
+
if para =~/~\{|\^~ |~\^|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m
|
|
1244
|
+
@flag_auto_endnotes,@flag_endnotes=true,true
|
|
1245
|
+
end
|
|
1246
|
+
if para =~/^(?:table\{|\{table)/i
|
|
1247
|
+
@flag_tables=true
|
|
1248
|
+
end
|
|
1249
|
+
end
|
|
1250
|
+
if para =~/^:?A~/
|
|
1251
|
+
@set_heading_top=true
|
|
1252
|
+
end
|
|
1253
|
+
if para =~/^1~/
|
|
1254
|
+
m=nil
|
|
1255
|
+
if para =~/^1~(\S+)\s+(.+)$/
|
|
1256
|
+
m,t=$1,$2
|
|
1257
|
+
elsif para =~/^1~\s+(.+)$/
|
|
1258
|
+
t=$1
|
|
1259
|
+
end
|
|
1260
|
+
unless @heading_seg_first_flag # extract first segment name
|
|
1261
|
+
@heading_seg_first=t
|
|
1262
|
+
@heading_seg_first_flag=true
|
|
1263
|
+
end
|
|
1264
|
+
if m # list all segment names
|
|
1265
|
+
@seg_names << m
|
|
1266
|
+
@set_heading_seg=true
|
|
1267
|
+
if m=~/^\d{1,3}/ \
|
|
1268
|
+
and m !~/^0/
|
|
1269
|
+
@seg_autoname_safe=false
|
|
1270
|
+
end
|
|
1271
|
+
end
|
|
1272
|
+
end
|
|
1273
|
+
para=para.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image)
|
|
1274
|
+
if para !~/^%+\s/ \
|
|
1275
|
+
and para =~@rgx_image
|
|
1276
|
+
@ec[:image] << para.scan(@rgx_image).uniq
|
|
1277
|
+
end
|
|
1278
|
+
@ec[:audio] << para.scan(@rgx_audio).uniq if para =~@rgx_audio #embedded content
|
|
1279
|
+
@ec[:multimedia] << para.scan(@rgx_mm).uniq if para =~@rgx_mm #embedded content
|
|
1280
|
+
unless @sem_tag
|
|
1281
|
+
@sem_tag=true if para=~/[:;]\{.+?\}[:;][a-z+]/ #refix later
|
|
1282
|
+
end
|
|
1283
|
+
end #% here endeth the document loop
|
|
1284
|
+
unless @make
|
|
1285
|
+
if (@opt.act[:verbose_plus][:set]==:on \
|
|
1286
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
1287
|
+
SiSU_Screen::Ansi.new(
|
|
1288
|
+
@opt.act[:color_state][:set],
|
|
1289
|
+
'@make:',
|
|
1290
|
+
'header absent'
|
|
1291
|
+
).warn
|
|
1292
|
+
end
|
|
1293
|
+
@make=SiSU_Param::Parameters::MdMake.new('@make: ',@opt,@env).make
|
|
1294
|
+
end
|
|
1295
|
+
if @cover_image \
|
|
1296
|
+
and @cover_image.is_a?(Hash) \
|
|
1297
|
+
and (@cover_image[:cover] =~@rgx_image \
|
|
1298
|
+
or @cover_image[:cover] =~/\S+?.(?:jpg|png|gif)/)
|
|
1299
|
+
@ec[:image] << @cover_image[:cover]
|
|
1300
|
+
end
|
|
1301
|
+
if @home_button_image \
|
|
1302
|
+
and @home_button_image.is_a?(Hash) \
|
|
1303
|
+
and (@home_button_image =~@rgx_image \
|
|
1304
|
+
or @home_button_image =~/\S+?\.(?:jpg|png|gif)/)
|
|
1305
|
+
@ec[:image] << @home_button_image
|
|
1306
|
+
end
|
|
1307
|
+
if @ec[:image].length > 0
|
|
1308
|
+
@ec[:image]=@ec[:image].flatten.uniq
|
|
1309
|
+
@ec[:image].delete_if {|x| x =~/https?:\/\// }
|
|
1310
|
+
@ec[:image]=@ec[:image].sort
|
|
1311
|
+
end
|
|
1312
|
+
@ec[:audio]=@ec[:audio].uniq.flatten.sort
|
|
1313
|
+
@ec[:multimedia]=@ec[:multimedia].uniq.flatten.sort
|
|
1314
|
+
unless @rights
|
|
1315
|
+
if defined? @creator.author \
|
|
1316
|
+
and @creator.author.is_a?(String) \
|
|
1317
|
+
and defined? @date.published \
|
|
1318
|
+
and @date.published.is_a?(String)
|
|
1319
|
+
@rights=SiSU_Param::Parameters::MdDefault.new.rights(@creator.author,@date.published)
|
|
1320
|
+
elsif defined? @creator.author \
|
|
1321
|
+
and @creator.author.is_a?(String)
|
|
1322
|
+
@rights=SiSU_Param::Parameters::MdDefault.new.rights("[#{@creator.author}]",'')
|
|
1323
|
+
end
|
|
1324
|
+
end
|
|
1325
|
+
if defined? @classify.topic_register \
|
|
1326
|
+
and @classify.topic_register.is_a?(String) \
|
|
1327
|
+
and @classify.topic_register.length >3
|
|
1328
|
+
topic_register=@classify.topic_register
|
|
1329
|
+
u=topic_register.scan(/[^;]+/m).sort
|
|
1330
|
+
v=[]
|
|
1331
|
+
u.each do |l|
|
|
1332
|
+
v << l.scan(/[^:]+/m)
|
|
1333
|
+
end
|
|
1334
|
+
v.each do |s|
|
|
1335
|
+
s[-1]=s[-1].scan(/[^|]+/m) if s[-1] =~/[|]/m
|
|
1336
|
+
@topic_register_array << s
|
|
1337
|
+
end
|
|
1338
|
+
@topic_register_array
|
|
1339
|
+
end
|
|
1340
|
+
if @i18n
|
|
1341
|
+
@i18n=@i18n.uniq
|
|
1342
|
+
@i18n << 'en' unless @i18n.find_index("en")
|
|
1343
|
+
else
|
|
1344
|
+
@i18n=[ 'en' ]
|
|
1345
|
+
end
|
|
1346
|
+
translated=[]
|
|
1347
|
+
translate_list=[@pagenew,@pagebreak,@pageline,@num_top,@toc_lev_limit]
|
|
1348
|
+
translate_list.each do |t|
|
|
1349
|
+
translate=t.to_s if t
|
|
1350
|
+
translated << if translate
|
|
1351
|
+
translate.gsub!(/3/,'6')
|
|
1352
|
+
translate.gsub!(/2/,'5')
|
|
1353
|
+
translate.gsub!(/1/,'4')
|
|
1354
|
+
translate.gsub!(/:?C/,'3')
|
|
1355
|
+
translate.gsub!(/:?B/,'2')
|
|
1356
|
+
translate.gsub!(/:?A/,'1')
|
|
1357
|
+
# looks like an ok substituion for the above but is not, causes problems, check why
|
|
1358
|
+
#translate=translate.gsub(/3/,'6').
|
|
1359
|
+
# gsub(/2/,'5').
|
|
1360
|
+
# gsub(/1/,'4').
|
|
1361
|
+
# gsub(/:?C/,'3').
|
|
1362
|
+
# gsub(/:?B/,'2').
|
|
1363
|
+
# gsub(/:?A/,'1')
|
|
1364
|
+
translate=(translate =~/^\d+$/) \
|
|
1365
|
+
? translate.to_i
|
|
1366
|
+
: translate
|
|
1367
|
+
else nil
|
|
1368
|
+
end
|
|
1369
|
+
end
|
|
1370
|
+
@pagenew,@pagebreak,@pageline,@num_top,@toc_lev_limit=translated
|
|
1371
|
+
@markup=@markup.gsub(/page_new\s*=\s*([\dA-C])/,"page_new=#{@pagenew}").
|
|
1372
|
+
gsub(/page_break\s*=\s*([\dA-C])/,"page_break=#{@pagebreak}").
|
|
1373
|
+
gsub(/page_line\s*=\s*([\dA-C])/,"page_line=#{@pageline}").
|
|
1374
|
+
gsub(/num_top\s*=\s*([\dA-C])/,"num_top=#{@num_top}").
|
|
1375
|
+
gsub(/toc_lev_limit\s*=\s*([\dA-C])/,"toc_lev_limit=#{@toc_lev_limit}")
|
|
1376
|
+
papersize_array_rc=@papersize.downcase.scan(/(?:a4|letter|legal|book|a5|b5)/)
|
|
1377
|
+
papersize_array_opt=[
|
|
1378
|
+
((@opt.act[:pdf_a4][:set]==:on) ? 'a4' : ''),
|
|
1379
|
+
((@opt.act[:pdf_a5][:set]==:on) ? 'a5' : ''),
|
|
1380
|
+
((@opt.act[:pdf_b5][:set]==:on) ? 'b5' : ''),
|
|
1381
|
+
((@opt.act[:pdf_letter][:set]==:on) ? 'letter' : ''),
|
|
1382
|
+
((@opt.act[:pdf_legal][:set]==:on) ? 'legal' : ''),
|
|
1383
|
+
] - [""]
|
|
1384
|
+
@papersize_array=(papersize_array_opt.length > 0) \
|
|
1385
|
+
? papersize_array_opt
|
|
1386
|
+
: papersize_array_rc
|
|
1387
|
+
fn=@opt.fno #decide what to do a filesize on .ssm tells very little about actual document size
|
|
1388
|
+
@filesize=(File.size(fn)).to_s
|
|
1389
|
+
if @sys.openssl !=false \
|
|
1390
|
+
and FileTest.file?(@env.source_file_with_path)
|
|
1391
|
+
@dgst=[]
|
|
1392
|
+
case @env.digest(@opt).type
|
|
1393
|
+
when :sha512
|
|
1394
|
+
dgst=@sys.sha512(@env.source_file_with_path)
|
|
1395
|
+
@dgst=dgst[1].length==128 ? dgst : nil
|
|
1396
|
+
puts 'check document (sha512) digest' if not @dgst
|
|
1397
|
+
when :sha256
|
|
1398
|
+
dgst=@sys.sha256(@env.source_file_with_path)
|
|
1399
|
+
@dgst=dgst[1].length==64 ? dgst : nil
|
|
1400
|
+
puts 'check document (sha256) digest' if not @dgst
|
|
1401
|
+
when :md5
|
|
1402
|
+
dgst=@sys.md5(@env.source_file_with_path)
|
|
1403
|
+
@dgst=dgst[1].length==32 ? dgst : nil
|
|
1404
|
+
puts 'check document (md5) digest' if not @dgst
|
|
1405
|
+
else
|
|
1406
|
+
dgst=@sys.sha256(@env.source_file_with_path)
|
|
1407
|
+
@dgst=dgst[1].length==64 ? dgst : nil
|
|
1408
|
+
puts 'check document (sha256) digest' if not @dgst
|
|
1409
|
+
end
|
|
1410
|
+
elsif not FileTest.file?(@env.source_file_with_path)
|
|
1411
|
+
#puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia)
|
|
1412
|
+
end
|
|
1413
|
+
@publisher ||= "#{@@publisher} (this copy)"
|
|
1414
|
+
fn_set_lang=SiSU_Env::StandardiseLanguage.new(@opt.lng).language
|
|
1415
|
+
unless @language[:code] \
|
|
1416
|
+
and @language[:name]
|
|
1417
|
+
lang=@env.i18n.language #default language settings for directory by name, or in sysrc.yml
|
|
1418
|
+
@language[:code] ||= lang.code
|
|
1419
|
+
@language[:name] ||= lang.title
|
|
1420
|
+
end
|
|
1421
|
+
unless fn_set_lang[:d]==true #decide, naming convention overrides other settings, within document, etc.
|
|
1422
|
+
@language[:code]=fn_set_lang[:c]
|
|
1423
|
+
@language[:name]=fn_set_lang[:n]
|
|
1424
|
+
end
|
|
1425
|
+
@fnl=@env.i18n.lang_filename(fn_set_lang[:c])
|
|
1426
|
+
@lang=@lang.uniq
|
|
1427
|
+
@fn=SiSU_Env::EnvCall.new(@fns).lang(fn_set_lang[:c])
|
|
1428
|
+
if @en[:note] > 0 \
|
|
1429
|
+
and @en[:sum] > 0
|
|
1430
|
+
if @en[:sum] > 0
|
|
1431
|
+
else
|
|
1432
|
+
SiSU_Screen::Ansi.new(
|
|
1433
|
+
@opt.act[:color_state][:set],
|
|
1434
|
+
'*WARN* both endnote styles used',
|
|
1435
|
+
"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}"
|
|
1436
|
+
).warn unless @opt.act[:quiet][:set]==:on
|
|
1437
|
+
end
|
|
1438
|
+
end
|
|
1439
|
+
if @en[:mark] != @en[:note] \
|
|
1440
|
+
and @en[:note] > 0
|
|
1441
|
+
@en[:mismatch]=@en[:note] - @en[:mark]
|
|
1442
|
+
SiSU_Screen::Ansi.new(
|
|
1443
|
+
@opt.act[:color_state][:set],
|
|
1444
|
+
'*WARN* endnote number mismatch',
|
|
1445
|
+
"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} " \
|
|
1446
|
+
+ "(difference = #{@en[:mismatch]})"
|
|
1447
|
+
).warn unless @opt.act[:quiet][:set]==:on
|
|
1448
|
+
footnote_conversion_errors=File.new("#{Dir.pwd}/footnote_conversion_errors.txt",'a')
|
|
1449
|
+
footnote_conversion_errors <<
|
|
1450
|
+
"#{@fns}:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} " \
|
|
1451
|
+
+ "(difference = #{@en[:mismatch]})\n"
|
|
1452
|
+
end
|
|
1453
|
+
if not @title \
|
|
1454
|
+
or not defined? @title.main \
|
|
1455
|
+
or @title.main !~/[\S]/
|
|
1456
|
+
if @fns =~/\.ssm$/ \
|
|
1457
|
+
and @opt.inspect =~/P/
|
|
1458
|
+
#@title=Md.new('Text Insert',@opt,@env).title
|
|
1459
|
+
else
|
|
1460
|
+
SiSU_Screen::Ansi.new(
|
|
1461
|
+
@opt.act[:color_state][:set],
|
|
1462
|
+
'WARNING: Document Title missing',
|
|
1463
|
+
'please provide @title:'
|
|
1464
|
+
).warn if (@opt.act[:verbose][:set]==:on \
|
|
1465
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
1466
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
1467
|
+
end
|
|
1468
|
+
end
|
|
1469
|
+
if @author !~/[\S]/
|
|
1470
|
+
if @fns =~/\.ssm$/ \
|
|
1471
|
+
and @opt.inspect =~/P/
|
|
1472
|
+
#@creator=SiSU_Param::Md.new('Text Insert',@opt,@env).creator
|
|
1473
|
+
else
|
|
1474
|
+
SiSU_Screen::Ansi.new(
|
|
1475
|
+
@opt.act[:color_state][:set],
|
|
1476
|
+
'WARNING: Document Author missing',
|
|
1477
|
+
'please provide @creator: :author:'
|
|
1478
|
+
).warn if (@opt.act[:verbose][:set]==:on \
|
|
1479
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
1480
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
1481
|
+
end
|
|
1482
|
+
end
|
|
1483
|
+
@struct={}
|
|
1484
|
+
doc_struct=Hash.new(0)
|
|
1485
|
+
if @lv1.nil?
|
|
1486
|
+
fns_array.each do |para|
|
|
1487
|
+
if para =~/^(Part|Chapter|Section|Article)\b/i
|
|
1488
|
+
case para
|
|
1489
|
+
when /^(Part|PART)\b/
|
|
1490
|
+
@struct[:part]=doc_struct[:part]
|
|
1491
|
+
doc_struct[:part]=doc_struct[:part] + 1
|
|
1492
|
+
when /^(Chapter|CHAPTER)\b/
|
|
1493
|
+
@struct[:chapter]=doc_struct[:chapter]
|
|
1494
|
+
doc_struct[:chapter]=doc_struct[:chapter] + 1
|
|
1495
|
+
when /^(Section|SECTION)\b/
|
|
1496
|
+
@struct[:section]=doc_struct[:section]
|
|
1497
|
+
doc_struct[:section]=doc_struct[:section] + 1
|
|
1498
|
+
when /^(Article|ARTICLE)\b/
|
|
1499
|
+
@struct[:article]=doc_struct[:article]
|
|
1500
|
+
doc_struct[:article]=doc_struct[:article] + 1
|
|
1501
|
+
when /^(Clause|CLAUSE)\b/
|
|
1502
|
+
@struct[:clause]=doc_struct[:clause]
|
|
1503
|
+
doc_struct[:clause]=doc_struct[:clause] + 1
|
|
1504
|
+
when /^\d\..*[^\.]$/
|
|
1505
|
+
@struct[:number]=doc_struct[:number]
|
|
1506
|
+
doc_struct[:number]=doc_struct[:number] + 1
|
|
1507
|
+
end
|
|
1508
|
+
end
|
|
1509
|
+
end
|
|
1510
|
+
if doc_struct[:article] > 2 #%~level 4
|
|
1511
|
+
@lv4=/^(?:Article|ARTICLE)\b/
|
|
1512
|
+
elsif doc_struct[:chapter] > 2 \
|
|
1513
|
+
and doc_struct[:article] \
|
|
1514
|
+
and doc_struct[:article] < 3
|
|
1515
|
+
@lv4=/^(?:Chapter|CHAPTER)\b/
|
|
1516
|
+
elsif doc_struct[:clause] > 2
|
|
1517
|
+
@lv4=/^(?:Clause|CLAUSE)\b/
|
|
1518
|
+
elsif doc_struct[:number] > 2
|
|
1519
|
+
@lv4="^\d\..*[^\.]$"
|
|
1520
|
+
end
|
|
1521
|
+
if doc_struct[:section] > 2 #%~level 3
|
|
1522
|
+
@lv3=/^(?:Section|SECTION)\b/
|
|
1523
|
+
end
|
|
1524
|
+
if doc_struct[:chapter] > 2 \
|
|
1525
|
+
and doc_struct[:article] \
|
|
1526
|
+
and doc_struct[:article] > 2
|
|
1527
|
+
@lv2=/^(?:Chapter|CHAPTER)\b/
|
|
1528
|
+
end
|
|
1529
|
+
if doc_struct[:part] > 2 \
|
|
1530
|
+
and @lv[2].nil?
|
|
1531
|
+
@lv2=/^(?:Part|PART)\b/
|
|
1532
|
+
end
|
|
1533
|
+
if doc_struct[:part] > 2 \
|
|
1534
|
+
and @lv[2].inspect !~/Part/ \
|
|
1535
|
+
and @lv[1].nil?
|
|
1536
|
+
@lv1=/^(Part|PART)\b/
|
|
1537
|
+
end
|
|
1538
|
+
end
|
|
1539
|
+
@lnk=@lnk.compact if @lnk
|
|
1540
|
+
@lv0 ||=/^0~/
|
|
1541
|
+
@lv1 ||=/^1~/
|
|
1542
|
+
@lv2 ||=/^2~/
|
|
1543
|
+
@lv3 ||=/^3~/
|
|
1544
|
+
@lv4 ||=/^4~/
|
|
1545
|
+
@lv5 ||=/^5~/
|
|
1546
|
+
@lv6 ||=/^6~/
|
|
1547
|
+
@data=nil #else whole file's contents are stored in md pstore & is not required to be... big waste actually
|
|
1548
|
+
@file=SiSU_Env::FileOp.new(self) #watch
|
|
1549
|
+
Store.new(self,@env).store #% pstore
|
|
1550
|
+
self
|
|
1551
|
+
rescue
|
|
1552
|
+
if @opt.act[:harvest][:set]==:on
|
|
1553
|
+
exit
|
|
1554
|
+
end
|
|
1555
|
+
end
|
|
1556
|
+
end
|
|
1557
|
+
private
|
|
1558
|
+
class Store
|
|
1559
|
+
def initialize(md,env)
|
|
1560
|
+
@md,@env=md,env
|
|
1561
|
+
end
|
|
1562
|
+
def store
|
|
1563
|
+
begin
|
|
1564
|
+
pstorefile="#{@env.processing_path.ao}/#{@md.fns}.pstore"
|
|
1565
|
+
File.unlink(pstorefile) if FileTest.file?(pstorefile)
|
|
1566
|
+
if (@md.opt.act[:verbose_plus][:set]==:on \
|
|
1567
|
+
|| @md.opt.act[:maintenance][:set]==:on)
|
|
1568
|
+
SiSU_Screen::Ansi.new(
|
|
1569
|
+
@md.opt.act[:color_state][:set],
|
|
1570
|
+
"PStore -> #{pstorefile}"
|
|
1571
|
+
).txt_grey
|
|
1572
|
+
end
|
|
1573
|
+
store=PStore.new(pstorefile)
|
|
1574
|
+
store.transaction do
|
|
1575
|
+
store['md']=@md
|
|
1576
|
+
store.commit
|
|
1577
|
+
end
|
|
1578
|
+
@@md=@md=nil
|
|
1579
|
+
rescue
|
|
1580
|
+
SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
|
|
1581
|
+
__LINE__.to_s + ':' + __FILE__
|
|
1582
|
+
end
|
|
1583
|
+
ensure
|
|
1584
|
+
end
|
|
1585
|
+
end
|
|
1586
|
+
end
|
|
1587
|
+
end
|
|
1588
|
+
end
|
|
1589
|
+
class Instantiate
|
|
1590
|
+
def param_instantiate
|
|
1591
|
+
@@date=SiSU_Env::InfoDate.new
|
|
1592
|
+
@doc={
|
|
1593
|
+
initialise: nil,
|
|
1594
|
+
markup: '',
|
|
1595
|
+
lnks: '',
|
|
1596
|
+
stmp: '',
|
|
1597
|
+
prefix_a: '',
|
|
1598
|
+
prefix_b: '',
|
|
1599
|
+
req: {}
|
|
1600
|
+
}
|
|
1601
|
+
@@flag={}
|
|
1602
|
+
@@publisher='SiSU scribe'
|
|
1603
|
+
end
|
|
1604
|
+
end
|
|
1605
|
+
end
|
|
1606
|
+
__END__
|