sisu 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,482 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
=begin
|
3
|
+
|
4
|
+
* Name: SiSU
|
5
|
+
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
7
|
+
*** A conversion script for canned substitutions, a fairly generic
|
8
|
+
simple tool that can be used to store other canned conversions, used here for
|
9
|
+
altering SiSU markup
|
10
|
+
|
11
|
+
** Author: Ralph Amissah
|
12
|
+
<ralph@amissah.com>
|
13
|
+
<ralph.amissah@gmail.com>
|
14
|
+
|
15
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
16
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
17
|
+
All Rights Reserved.
|
18
|
+
|
19
|
+
** License: GPL 3 or later:
|
20
|
+
|
21
|
+
SiSU, a framework for document structuring, publishing and search
|
22
|
+
|
23
|
+
Copyright (C) Ralph Amissah
|
24
|
+
|
25
|
+
This program is free software: you can redistribute it and/or modify it
|
26
|
+
under the terms of the GNU General Public License as published by the Free
|
27
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
28
|
+
any later version.
|
29
|
+
|
30
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
31
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
32
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
33
|
+
more details.
|
34
|
+
|
35
|
+
You should have received a copy of the GNU General Public License along with
|
36
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
37
|
+
|
38
|
+
If you have Internet connection, the latest version of the GPL should be
|
39
|
+
available at these locations:
|
40
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
41
|
+
<http://www.gnu.org/licenses/gpl.html>
|
42
|
+
|
43
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
44
|
+
|
45
|
+
** SiSU uses:
|
46
|
+
* Standard SiSU markup syntax,
|
47
|
+
* Standard SiSU meta-markup syntax, and the
|
48
|
+
* Standard SiSU object citation numbering and system
|
49
|
+
|
50
|
+
** Hompages:
|
51
|
+
<http://www.jus.uio.no/sisu>
|
52
|
+
<http://www.sisudoc.org>
|
53
|
+
|
54
|
+
** Git
|
55
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
56
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/sst_identify_markup.rb;hb=HEAD>
|
57
|
+
|
58
|
+
=end
|
59
|
+
module SiSU_Markup
|
60
|
+
class MarkupInform
|
61
|
+
attr_accessor :version
|
62
|
+
def initialize(version,message,declared_markup='',declared_type='')
|
63
|
+
@version,@message,@declared_markup,@declared_type=version,message,declared_markup,declared_type
|
64
|
+
end
|
65
|
+
def version
|
66
|
+
@version
|
67
|
+
end
|
68
|
+
def message
|
69
|
+
@message
|
70
|
+
end
|
71
|
+
def declared_version
|
72
|
+
@declared_markup
|
73
|
+
end
|
74
|
+
def declared_type
|
75
|
+
@declared_type
|
76
|
+
end
|
77
|
+
def history
|
78
|
+
MarkupHistory.new(@version).query
|
79
|
+
end
|
80
|
+
end
|
81
|
+
class MarkupIdentify
|
82
|
+
def initialize(opt)
|
83
|
+
@opt=opt
|
84
|
+
@description='This is a script attempts to identify the version of markup used in SiSU (and provides information on changes in markup)'
|
85
|
+
end
|
86
|
+
def help
|
87
|
+
print <<WOK
|
88
|
+
|
89
|
+
#{@description}
|
90
|
+
|
91
|
+
WOK
|
92
|
+
exit
|
93
|
+
end
|
94
|
+
def identify
|
95
|
+
f=@opt.fns
|
96
|
+
if f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])$/ \
|
97
|
+
and File.exist?(f)
|
98
|
+
file=File.open(f,'r')
|
99
|
+
cont=file.readlines
|
100
|
+
file.close
|
101
|
+
links,oldlinks='',''
|
102
|
+
markup=nil
|
103
|
+
@declared_type,@declared_markup='[text?]',''
|
104
|
+
if cont[0] =~ /^(?:%\s+)?SiSU\s+(text|master|insert)\s+([0-9](?:\.[0-9]+){1,2})/ \
|
105
|
+
or cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/
|
106
|
+
@declared_type,@declared_markup=$1,$2
|
107
|
+
elsif cont[0] =~ /^(?:%\s+)?SiSU\s+([0-9](?:\.[0-9]+){1,2})/ \
|
108
|
+
or cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/
|
109
|
+
@declared_markup=$1
|
110
|
+
end
|
111
|
+
@flag_2_0,@flag_1_0,@flag_69,@flag_66,@flag_57,@flag_38=false,false,false,false,false,false
|
112
|
+
cont.each_with_index do |y,i|
|
113
|
+
if y =~/^(?:0\{?~links?|@links?:)\s/ \
|
114
|
+
and f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])/
|
115
|
+
links=unless y =~/\{.+?\}\S+/; oldlinks=' (pre 0.20.4 header links)'
|
116
|
+
else ' (post 0.20.4 header links)'
|
117
|
+
end
|
118
|
+
end
|
119
|
+
if @flag_2_0 \
|
120
|
+
or y =~/^@make:|^@classify|^\s\s?:[a-z_-]+?:\s+\S/
|
121
|
+
version=2.0.to_f
|
122
|
+
markup=MarkupInform.new(version,'2.0' + oldlinks,@declared_markup,@declared_type)
|
123
|
+
@flag_2_0=true
|
124
|
+
break
|
125
|
+
end
|
126
|
+
unless @flag_38
|
127
|
+
if (y =~/^:?A~/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
|
128
|
+
version='0.38'
|
129
|
+
markup=MarkupInform.new(version,'0.38' + oldlinks,@declared_markup,@declared_type)
|
130
|
+
@flag_38=true
|
131
|
+
end
|
132
|
+
end
|
133
|
+
if @flag_38
|
134
|
+
if @flag_1_0 \
|
135
|
+
or y =~/^=\{.+?\}\s*$/
|
136
|
+
version='0.69'
|
137
|
+
markup=MarkupInform.new(version,'0.69' + oldlinks,@declared_markup,@declared_type)
|
138
|
+
@flag_1_0=true
|
139
|
+
break
|
140
|
+
end
|
141
|
+
if @flag_66 \
|
142
|
+
or y =~/[a-z+][:;]\{.+?\}[:;][a-z+]/
|
143
|
+
version='0.66'
|
144
|
+
markup=MarkupInform.new(version,'0.66' + oldlinks,@declared_markup,@declared_type)
|
145
|
+
@flag_66=true
|
146
|
+
break
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
unless @flag_2_0 \
|
151
|
+
or @flag_1_0 \
|
152
|
+
or @flag_66
|
153
|
+
cont.each_with_index do |y,i|
|
154
|
+
if y =~/^(?:0\{?~links?|@links?:)\s/ \
|
155
|
+
and f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])/
|
156
|
+
links=unless y =~/\{.+?\}\S+/; oldlinks=' (pre 0.20.4 header links)'
|
157
|
+
else ' (post 0.20.4 header links)'
|
158
|
+
end
|
159
|
+
end
|
160
|
+
if @flag_57 \
|
161
|
+
or (y =~/^:?A~\?? @title/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
|
162
|
+
version='0.57'
|
163
|
+
markup=MarkupInform.new(version,'0.57' + oldlinks,@declared_markup,@declared_type)
|
164
|
+
@flag_57=true
|
165
|
+
break
|
166
|
+
end
|
167
|
+
if @flag_38 \
|
168
|
+
or (y =~/^:?A~/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
|
169
|
+
version='0.38'
|
170
|
+
markup=MarkupInform.new(version,'0.38' + oldlinks,@declared_markup,@declared_type)
|
171
|
+
@flag_38=true
|
172
|
+
break if i >= 200
|
173
|
+
if y =~ /(?:~{\*+|~\[\*|~\[\+)\s/
|
174
|
+
version='0.42'
|
175
|
+
markup=MarkupInform.new(version,'0.42' + oldlinks,@declared_markup,@declared_type)
|
176
|
+
break
|
177
|
+
end
|
178
|
+
end
|
179
|
+
if (y =~/^1~/ and f =~/(?:\.sst|\.ssm|\.ssi)/) \
|
180
|
+
and not @flag_38
|
181
|
+
version='0.37'
|
182
|
+
markup=MarkupInform.new(version,'0.37 is substantially 0.16 - 0.36 markup with new file-extension' + oldlinks,@declared_markup,@declared_type)
|
183
|
+
break
|
184
|
+
end
|
185
|
+
if y =~/^1~/ \
|
186
|
+
and f =~/\.([rs])([123])/ \
|
187
|
+
and not @flag_38
|
188
|
+
t,n=$1,$2
|
189
|
+
version='0.16'
|
190
|
+
instruct=if t =~/r/
|
191
|
+
" (change file extension from .#{t}#{n} to .ssm)"
|
192
|
+
else " (change file extension from .#{t}#{n} to .sst)"
|
193
|
+
end
|
194
|
+
markup=MarkupInform.new(version,'0.16 - 0.36' + instruct + links,@declared_markup,@declared_type)
|
195
|
+
break
|
196
|
+
end
|
197
|
+
if y =~/^0\{~/ \
|
198
|
+
and not @flag_38
|
199
|
+
version='0.1'
|
200
|
+
markup=MarkupInform.new(version,'0.1 - 0.15',@declared_markup,@declared_type)
|
201
|
+
break
|
202
|
+
end
|
203
|
+
if y =~/^0\{{3}/ \
|
204
|
+
and not @flag_38
|
205
|
+
markup=MarkupInform.new('circa. 1997','old, check date',@declared_markup,@declared_type)
|
206
|
+
break
|
207
|
+
end
|
208
|
+
markup='Not a recognised file type '
|
209
|
+
end
|
210
|
+
end
|
211
|
+
markup
|
212
|
+
else MarkupHistory.new(@opt).help_query
|
213
|
+
end
|
214
|
+
end
|
215
|
+
def determine_markup_version
|
216
|
+
if @opt.fns.nil? \
|
217
|
+
or @opt.fns.empty?
|
218
|
+
MarkupHistory.new(@opt).help_identify
|
219
|
+
end
|
220
|
+
if File.exist?(@opt.fns)
|
221
|
+
if @opt.fns =~/\.(?:sst|ssm|ssi|s[123i]|r[123])/
|
222
|
+
markup=identify #(@opt.fns)
|
223
|
+
if defined? markup.version
|
224
|
+
unless @opt.act[:quiet][:set]==:on
|
225
|
+
message=unless markup.declared_version.empty?
|
226
|
+
"#{@opt.fns}\n markup Type Declared as SiSU #{markup.declared_version} #{markup.declared_type}\n appears to be SiSU #{markup.version}"
|
227
|
+
else
|
228
|
+
"Markup Type Appears to be SiSU #{markup.version}\n in file #{@opt.fns}"
|
229
|
+
end
|
230
|
+
puts message
|
231
|
+
puts %{"sisu --query-#{markup.version}" for a brief description of markup type}
|
232
|
+
end
|
233
|
+
end
|
234
|
+
else puts 'file-type not recognised: ' + @opt.fns
|
235
|
+
end
|
236
|
+
else puts 'file not found: ' + @opt.fns
|
237
|
+
end
|
238
|
+
(defined? markup.version) \
|
239
|
+
? markup.version
|
240
|
+
: 'markup type/version not determined'
|
241
|
+
end
|
242
|
+
def markup_version?
|
243
|
+
if @opt.fns.empty?
|
244
|
+
@opt.files.each do |fns|
|
245
|
+
@opt.fns=fns
|
246
|
+
determine_markup_version
|
247
|
+
end
|
248
|
+
else determine_markup_version
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
class MarkupHistory
|
253
|
+
def initialize(opt)
|
254
|
+
@opt=opt
|
255
|
+
end
|
256
|
+
def sisu_3_0
|
257
|
+
<<WOK
|
258
|
+
SiSU 3.0 same as 2.0, apart from change to headers
|
259
|
+
|
260
|
+
see document markup samples, and sisu --help headers
|
261
|
+
|
262
|
+
WOK
|
263
|
+
end
|
264
|
+
def sisu_2_0
|
265
|
+
<<WOK
|
266
|
+
SiSU 2.0 same as 1.0, apart from the changing of headers and the addition of a monospace tag
|
267
|
+
related headers now grouped, e.g.
|
268
|
+
|
269
|
+
@title:
|
270
|
+
:subtitle:
|
271
|
+
|
272
|
+
@creator:
|
273
|
+
:author:
|
274
|
+
:translator:
|
275
|
+
:illustrator:
|
276
|
+
|
277
|
+
see document markup samples, and sisu --help headers
|
278
|
+
|
279
|
+
the monospace tag takes the form of a has '#' \#{ this enclosed text would be monospaced }#
|
280
|
+
|
281
|
+
WOK
|
282
|
+
end
|
283
|
+
def sisu_1_0
|
284
|
+
<<WOK
|
285
|
+
SiSU 1.0 same as 0.69
|
286
|
+
|
287
|
+
WOK
|
288
|
+
end
|
289
|
+
def sisu_0_69
|
290
|
+
<<WOK
|
291
|
+
SiSU 0.69 (same as 1.0) as previous (0.57) with the addition of book index tags
|
292
|
+
/^=\{.+?\}$/
|
293
|
+
e.g. appended to a paragraph, on a new-line (without a blank line in between)
|
294
|
+
logical structure produced assuming this is the first text "object"
|
295
|
+
={GNU/Linux community distribution:Debian+2|Fedora|Gentoo;Free Software Foundation+5}
|
296
|
+
|
297
|
+
Free Software Foundation, 1-6
|
298
|
+
GNU/Linux community distribution, 1
|
299
|
+
Debian, 1-3
|
300
|
+
Fedora, 1
|
301
|
+
Gentoo,
|
302
|
+
|
303
|
+
WOK
|
304
|
+
end
|
305
|
+
def sisu_0_66
|
306
|
+
<<WOK
|
307
|
+
SiSU 0.66 same as previous, adds semantic tags
|
308
|
+
/[:;]\{.+?\}[:;][a-z+]/
|
309
|
+
e.g. :{ Ralph last;{Amissah};last }:author
|
310
|
+
|
311
|
+
WOK
|
312
|
+
end
|
313
|
+
def sisu_0_65
|
314
|
+
<<WOK
|
315
|
+
SiSU 0.65 same as previous, adds semantic tags
|
316
|
+
/[a-z+][:;]\{.+?\}[:;][a-z+]/
|
317
|
+
e.g. author:{ Ralph last;{Amissah};last }:author
|
318
|
+
|
319
|
+
WOK
|
320
|
+
end
|
321
|
+
def sisu_0_57
|
322
|
+
<<WOK
|
323
|
+
|
324
|
+
SiSU 0.57 (a subset of 1.0) is the same as 0.42 with the introduction of some
|
325
|
+
a shortcut to use the headers @title and @creator in the first heading
|
326
|
+
[expanded using the contents of the headers @title: and @author:]
|
327
|
+
|
328
|
+
:A~ @title by @author
|
329
|
+
|
330
|
+
WOK
|
331
|
+
end
|
332
|
+
def sisu_0_42
|
333
|
+
<<WOK
|
334
|
+
SiSU 0.42 (a subset of 1.0) is the same as 0.38 with the introduction of some additional endnote types,
|
335
|
+
|
336
|
+
Introduces some varations on endnotes, in particular the use of the asterisk
|
337
|
+
~{* for example for describing an author }~ and ~{** for describing a second author }~
|
338
|
+
|
339
|
+
* for example for describing an author
|
340
|
+
|
341
|
+
** for describing a second author
|
342
|
+
|
343
|
+
and ~[* my note ]~ or ~[+ another note ]~ which numerically increments an
|
344
|
+
asterisk and plus respectively
|
345
|
+
|
346
|
+
*1 my note
|
347
|
+
+1 another note
|
348
|
+
|
349
|
+
WOK
|
350
|
+
end
|
351
|
+
def sisu_0_38
|
352
|
+
<<WOK
|
353
|
+
|
354
|
+
SiSU 0.38 (a subset of 1.0) introduced alternative experimental header and heading/structure markers,
|
355
|
+
|
356
|
+
@headername: and headers :A~ :B~ :C~ 1~ 2~ 3~
|
357
|
+
|
358
|
+
as the equivalent of (the superceded)
|
359
|
+
|
360
|
+
0~headername and headers 1~ 2~ 3~ 4~ 5~ 6~
|
361
|
+
|
362
|
+
The internal document markup of SiSU 0.16 remains valid and standard
|
363
|
+
Though note that SiSU 0.37 introduced a new file naming convention
|
364
|
+
|
365
|
+
SiSU has in effect two sets of levels to be considered, using 0.38 notation
|
366
|
+
A-C headings/levels, pre-ordinary paragraphs /pre-substantive text, and
|
367
|
+
1-3 headings/levels, levels which are followed by ordinary text.
|
368
|
+
This may be conceptualised as levels A,B,C, 1,2,3, and using such letter
|
369
|
+
number notation, in effect:
|
370
|
+
A must exist, optional B and C may follow in sequence (not strict)
|
371
|
+
1 must exist, optional 2 and 3 may follow in sequence
|
372
|
+
i.e. there are two independent heading level sequences A,B,C and 1,2,3
|
373
|
+
(using the 0.16 standard notation 1,2,3 and 4,5,6)
|
374
|
+
on the positive side:
|
375
|
+
* the 0.38 A,B,C,1,2,3 alternative makes explicit an aspect of structuring
|
376
|
+
documents in SiSU that is not otherwise obvious to the newcomer (though
|
377
|
+
it appears more complicated, is more in your face and likely to be
|
378
|
+
understood fairly quickly)
|
379
|
+
* the substantive text follows levels 1,2,3 and it is 'nice' to do
|
380
|
+
most work in those levels
|
381
|
+
WOK
|
382
|
+
end
|
383
|
+
def sisu_0_37
|
384
|
+
<<WOK
|
385
|
+
|
386
|
+
SiSU 0.37 introduced the file naming convention, that remains in use in SiSU
|
387
|
+
v1 and v2, using the file extensions .sst .ssm and .ssi
|
388
|
+
to replace .s1 .s2 .s3 .r1 .r2 .r3 and .si
|
389
|
+
|
390
|
+
this is captured by the following file 'rename' instruction:
|
391
|
+
|
392
|
+
rename 's/\.s[123]$/\.sst/' *.s{1,2,3}
|
393
|
+
rename 's/\.r[123]$/\.ssm/' *.r{1,2,3}
|
394
|
+
rename 's/\.si$/\.ssi/' *.si
|
395
|
+
|
396
|
+
The internal document markup remains unchanged, from SiSU 0.16
|
397
|
+
WOK
|
398
|
+
end
|
399
|
+
def sisu_0_16
|
400
|
+
<<WOK
|
401
|
+
|
402
|
+
SiSU 0.16 (0.15 development branch) introduced the use of
|
403
|
+
|
404
|
+
the header 0~ and headings/structure 1~ 2~ 3~ 4~ 5~ 6~
|
405
|
+
|
406
|
+
in place of the 0.1 header, heading/structure notation
|
407
|
+
WOK
|
408
|
+
end
|
409
|
+
def sisu_0_1
|
410
|
+
<<WOK
|
411
|
+
|
412
|
+
SiSU 0.1 headers and headings structure represented by
|
413
|
+
header 0{~ and headings/structure 1{ 2{ 3{ 4{~ 5{ 6{
|
414
|
+
WOK
|
415
|
+
end
|
416
|
+
def help_query
|
417
|
+
<<WOK
|
418
|
+
|
419
|
+
sisu --query=[sisu version [0.38] or 'history]
|
420
|
+
provides a short history of changes to SiSU markup
|
421
|
+
|
422
|
+
WOK
|
423
|
+
end
|
424
|
+
def help_identify
|
425
|
+
<<WOK
|
426
|
+
|
427
|
+
sisu --identify [filename]
|
428
|
+
attempts to identify the SiSU markup used in a file
|
429
|
+
|
430
|
+
WOK
|
431
|
+
end
|
432
|
+
def query
|
433
|
+
tell=if @opt.selections.str =~/--query/
|
434
|
+
tell=case @opt.selections.str
|
435
|
+
when /history/
|
436
|
+
"#{sisu_3_0}#{sisu_2_0}#{sisu_1_0}#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}\n#{sisu_0_37}\n#{sisu_0_16}\n#{sisu_0_1}"
|
437
|
+
when /3.0/
|
438
|
+
"#{sisu_3_0}#{sisu_2_0}#{sisu_1_0}#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
|
439
|
+
when /2.0/
|
440
|
+
"#{sisu_2_0}#{sisu_1_0}#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
|
441
|
+
when /1.0/
|
442
|
+
"#{sisu_1_0}#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
|
443
|
+
when /0.69/
|
444
|
+
"#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
|
445
|
+
when /0.66/
|
446
|
+
"#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
|
447
|
+
when /0.65/
|
448
|
+
"#{sisu_0_65}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
|
449
|
+
when /0.57/
|
450
|
+
"#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
|
451
|
+
when /0.42/
|
452
|
+
"#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
|
453
|
+
when /0.38/
|
454
|
+
"#{sisu_0_38}#{sisu_0_16}"
|
455
|
+
when /0.37/
|
456
|
+
"#{sisu_0_37}\n#{sisu_0_16}"
|
457
|
+
when /0.1[6-9]|0.2[0-9]|0.3[0-6]/
|
458
|
+
"#{sisu_0_16}\n#{sisu_0_1}"
|
459
|
+
when /0.[1-9]|0.1[1-4]/
|
460
|
+
sisu_0_1
|
461
|
+
else puts "NOT RECOGNISED: #{@opt.selections.str}"
|
462
|
+
help_query
|
463
|
+
end
|
464
|
+
tell
|
465
|
+
else help_query
|
466
|
+
end
|
467
|
+
end
|
468
|
+
end
|
469
|
+
end
|
470
|
+
__END__
|
471
|
+
#%% to use as independent program ------------------------->
|
472
|
+
f=$*
|
473
|
+
cf=f[0].to_s
|
474
|
+
f.shift
|
475
|
+
match_and_replace=[]
|
476
|
+
unless f.length > 0; f=Dir.glob("[a-z]*.ss?") #restricted to sisu type files, it need not be
|
477
|
+
end
|
478
|
+
puts "SiSU files:"
|
479
|
+
puts f
|
480
|
+
f.each do |x|
|
481
|
+
SiSU_Markup::MarkupIdentify.new(x).markup_version?
|
482
|
+
end
|