json, an output representation, first pass
[software/sisu] / lib / sisu / constants.rb
1 # encoding: utf-8
2 =begin
3
4 * Name: SiSU
5
6 ** Description: documents, structuring, processing, publishing, search
7 *** constants, system environment, resource control and configuration details
8
9 ** Author: Ralph Amissah
10 [ralph@amissah.com]
11 [ralph.amissah@gmail.com]
12
13 ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 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 ** SiSU uses:
42 * Standard SiSU markup syntax,
43 * Standard SiSU meta-markup syntax, and the
44 * Standard SiSU object citation numbering and system
45
46 ** Hompages:
47 [http://www.jus.uio.no/sisu]
48 [http://www.sisudoc.org]
49
50 ** Git
51 [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary]
52 [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/constants.rb;hb=HEAD]
53
54 =end
55 #Ax,Xx,Mx,Rx,Hx,Dx,Px,Ep,Db,Gt,Tex=Array.new(11){{}}
56 YEAR='2016'
57 Sfx={
58 txt: '.txt',
59 txt_textile: '.textile',
60 txt_asciidoc: '.ad',
61 txt_markdown: '.md',
62 txt_rst: '.rst',
63 txt_orgmode: '.org',
64 html: '.html',
65 xhtml: '.xhtml',
66 xml: '.xml',
67 xml_sax: '.sax.xml',
68 xml_dom: '.dom.xml',
69 xml_scaffold: '.scaffold.xml',
70 xml_scaffold_structure_sisu: '.scaffold.sisu.xml',
71 xml_scaffold_structure_collapse: '.scaffold.collapse.xml',
72 xml_docbook: '.docbook.xml',
73 xml_docbook_article: '.article.docbook.xml',
74 xml_docbook_book: '.book.docbook.xml',
75 xml_fictionbook: '.fb2',
76 epub: '.epub',
77 epub_xhtml: '.xhtml',
78 odt: '.odt',
79 json: '.json',
80 pdf: '.pdf',
81 manpage: '.1',
82 info: '.info',
83 texinfo: '.texinfo',
84 sql: '.sql.db',
85 }
86 Ax={
87 tab: "\t",
88 comment: '%',
89 spaces: ' ',
90 }
91 Xx={
92 protect: '☞',
93 split: '✠',
94 segment: 'Ф',
95 relative_path: '☼',
96 html_relative2: '※※',
97 html_relative1: '※',
98 }
99 Mx={
100 segname_prefix_auto_num_extract: 'c',
101 segname_prefix_auto_num_provide: 's',
102 segname_prefix_auto_num_other: 'x',
103 ocn_id_char: '', #'o', now as before; remove for html5
104 note: 'note_',
105 note_ref: 'noteref_',
106 note_astx: 'note_astx_',
107 note_ref_astx: 'noteref_astx_',
108 note_plus: 'note_plus_',
109 note_ref_plus: 'noteref_plus_',
110 meta_o: '〔@', meta_c: '〕',
111 lv_o_0: 0,
112 lv_o_1: 1,
113 lv_o_2: 2,
114 lv_o_3: 3,
115 lv_o_4: 4,
116 lv_o_5: 5,
117 lv_o_6: 6,
118 lv_o_7: 7,
119 lv_o_8: 8,
120 lv_o_9: 9,
121 lv_o: '〔', lv_c: '〕',
122 en_a_o: '【', en_a_c: '】', #endnote Mx[:en_a_o]='~{'; Mx[:en_a_c]='}~'
123 en_b_o: '〖', en_b_c: '〗', #endnote Mx[:en_b_o]='~['; Mx[:en_b_c]=']~'
124 bl_o: '〔', bl_c: '〕', #block text mark
125 gr_o: '〔', gr_c: '〕', #group text mark #REPLACE & RETIRE
126 id_o: '〔', id_c: '〕', #object id mark
127 tc_o: '『', tc_c: "』", #table row mark #Mx[:tc_c]="』\n"
128 tc_p: '┆', #table col/misc mark
129 pa_o: '〔', pa_c: '〕', #affects paragraph mark
130 mk_o: '〔', mk_c: '〕', #generic mark
131 gl_o: '〔', gl_c: '〕', #glyph
132 fa_o: '〔', fa_o_c: '¤', fa_c_o: '¤', fa_c: '〕',
133 idx_o: '▩', idx_c: '▩',
134 nbsp: '░', #'▭ '
135 br_line: '╱', #lB ▌ 9612 ┘ ¶
136 br_nl: '╲', #lB ▌ 』 ┘
137 br_paragraph: '█', #FB █ 9608 # PP ∥ 8741 #▐ #'┘' #'¶' #FB █ 9608 lB ▌ 9612 RB ▐ 9616
138 br_obj: 'break_obj',
139 br_page_line: '▭',
140 br_page: '┼',
141 br_page_new: '╋',
142 lnk_o: '⌠', lnk_c: '⌡', #'⌈' '⌋' '⌠' '⌡' #Mx[:lnk_o: '◁'; Mx[:lnk_c: '▷' #‹ ›
143 url_o: '◘', url_c: '◙',
144 rel_o: '⌈', rel_c: '⌋',
145 tag_o: '⌊', tag_c: '⌉',
146 sm_set_o: '◢', sm_set_c: '◣',
147 sm_subset_o: '◢', sm_subset_c: '◣',
148 vline: '┆', # ¦ |
149 src_bold_o: '!{', src_bold_c: '}!',
150 src_italics_o: '/{', src_italics_c: '}/',
151 src_underscore_o: '_{', src_underscore_c: '}_',
152 src_cite_o: '"{', src_cite_c: '}"',
153 src_insert_o: '+{', src_insert_c: '}+',
154 src_strike_o: '-{', src_strike_c: '}-',
155 src_superscript_o: '^{', src_superscript_c: '}^',
156 src_subscript_o: ',{', src_subscript_c: '}',
157 src_hilite_o: '*{', src_hilite_c: '}*',
158 src_monospace_o: '#{', src_monospace_c: '}#',
159 srcrgx_bold_o: '\!\{', srcrgx_bold_c: '\}\!',
160 srcrgx_italics_o: '\/\{', srcrgx_italics_c: '\}\/',
161 srcrgx_underscore_o: '_\{', srcrgx_underscore_c: '\}_',
162 srcrgx_cite_o: '"\{', srcrgx_cite_c: '\}"',
163 srcrgx_insert_o: '\+\{', srcrgx_insert_c: '\}\+',
164 srcrgx_strike_o: '\-\{', srcrgx_strike_c: '\}\-',
165 srcrgx_superscript_o: '\^\{', srcrgx_superscript_c: '\}\^',
166 srcrgx_subscript_o: ',\{', srcrgx_subscript_c: '\},',
167 srcrgx_hilite_o: '\*\{', srcrgx_hilite_c: '\}\*',
168 srcrgx_monospace_o: '\#\{', srcrgx_monospace_c: '\}\#',
169 }
170 Mx[:fa_bold_o]= "#{Mx[:fa_o]}b#{Mx[:fa_o_c]}"
171 Mx[:fa_bold_c]= "#{Mx[:fa_c_o]}b#{Mx[:fa_c]}"
172 Mx[:fa_italics_o]= "#{Mx[:fa_o]}i#{Mx[:fa_o_c]}"
173 Mx[:fa_italics_c]= "#{Mx[:fa_c_o]}i#{Mx[:fa_c]}"
174 Mx[:fa_underscore_o]= "#{Mx[:fa_o]}u#{Mx[:fa_o_c]}"
175 Mx[:fa_underscore_c]= "#{Mx[:fa_c_o]}u#{Mx[:fa_c]}"
176 Mx[:fa_cite_o]= "#{Mx[:fa_o]}cite#{Mx[:fa_o_c]}"
177 Mx[:fa_cite_c]= "#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"
178 Mx[:fa_insert_o]= "#{Mx[:fa_o]}ins#{Mx[:fa_o_c]}"
179 Mx[:fa_insert_c]= "#{Mx[:fa_c_o]}ins#{Mx[:fa_c]}"
180 Mx[:fa_strike_o]= "#{Mx[:fa_o]}del#{Mx[:fa_o_c]}"
181 Mx[:fa_strike_c]= "#{Mx[:fa_c_o]}del#{Mx[:fa_c]}"
182 Mx[:fa_superscript_o]= "#{Mx[:fa_o]}sup#{Mx[:fa_o_c]}"
183 Mx[:fa_superscript_c]= "#{Mx[:fa_c_o]}sup#{Mx[:fa_c]}"
184 Mx[:fa_subscript_o]= "#{Mx[:fa_o]}sub#{Mx[:fa_o_c]}"
185 Mx[:fa_subscript_c]= "#{Mx[:fa_c_o]}sub#{Mx[:fa_c]}"
186 Mx[:fa_hilite_o]= "#{Mx[:fa_o]}hi#{Mx[:fa_o_c]}"
187 Mx[:fa_hilite_c]= "#{Mx[:fa_c_o]}hi#{Mx[:fa_c]}"
188 Mx[:fa_monospace_o]= "#{Mx[:fa_o]}mono#{Mx[:fa_o_c]}"
189 Mx[:fa_monospace_c]= "#{Mx[:fa_c_o]}mono#{Mx[:fa_c]}"
190 Mx[:gl_bullet]= "#{Mx[:gl_o]}#{Mx[:gl_c]}"
191 Mx[:br_endnotes]= "#{Mx[:mk_o]}ENDNOTES#{Mx[:mk_c]}"
192 Mx[:br_eof]= "#{Mx[:mk_o]}EOF#{Mx[:mk_c]}"
193 Mx[:pa_non_object_dummy_heading]="#{Mx[:pa_o]}-##{Mx[:pa_c]}" #unnumbered paragraph, delete when not required [used in dummy headings, eg. for segmented html] (place marker at end of paragraph)
194 Mx[:pa_non_object_no_heading]="#{Mx[:pa_o]}~##{Mx[:pa_c]}" #unnumbered paragraph (place marker at end of paragraph)
195 Hx={
196 br_obj: { obj: Mx[:br_obj] }, # line sep
197 br_page_line: { obj: Mx[:br_page_line] }, # line across page
198 br_page: { obj: Mx[:br_page] }, # newpage
199 br_page_new: { obj: Mx[:br_page_new] }, # clearpage
200 }
201 #Mx[:sm_set_o]='∈ '; Mx[:sm_set_c]='∋ '
202 #Mx[:sm_subset_o]='∈ '; Mx[:sm_subset_c]='∋ '
203 Rx={
204 mx_fa_clean: /#{Mx[:fa_o]}.+?#{Mx[:fa_c]}|#{Mx[:pa_o]}.+?#{Mx[:pa_c]}|#{Mx[:mk_o]}.+?#{Mx[:mk_c]}/,
205 lv: /〔([0-9]):(\S*?)〕/,
206 lv_0: /#{Mx[:lv_o_0]}(\S*?)#{Mx[:lv_c]}/,
207 lv_1: /#{Mx[:lv_o_1]}(\S*?)#{Mx[:lv_c]}/,
208 lv_2: /#{Mx[:lv_o_2]}(\S*?)#{Mx[:lv_c]}/,
209 lv_3: /#{Mx[:lv_o_3]}(\S*?)#{Mx[:lv_c]}/,
210 lv_4: /#{Mx[:lv_o_4]}(\S*?)#{Mx[:lv_c]}/,
211 lv_5: /#{Mx[:lv_o_5]}(\S*?)#{Mx[:lv_c]}/,
212 lv_6: /#{Mx[:lv_o_6]}(\S*?)#{Mx[:lv_c]}/,
213 lv_7: /#{Mx[:lv_o_7]}(\S*?)#{Mx[:lv_c]}/,
214 lv_8: /#{Mx[:lv_o_8]}(\S*?)#{Mx[:lv_c]}/,
215 lv_9: /#{Mx[:lv_o_9]}(\S*?)#{Mx[:lv_c]}/,
216 meta: /#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}/,
217 }
218 Dx={
219 ocn_o: '「', ocn_c: '」',
220 url_o: '‹', url_c: '›',
221 url_o_xml: '<', url_c_xml: '>',
222 rel_o: '‹', rel_c: '›',
223 lt_xml: '<', gt_xml: '>',
224 }
225 Tex={
226 backslash: "\\\\",
227 backslash: "\\\\",
228 tilde: '\\\\\\~',
229 }
230 Px={
231 bold_o: '*', bold_c: '*',
232 italics_o: '/', italics_c: '/',
233 underscore_o: '_', underscore_c: '_',
234 #emphasis_o: '*', emphasis_c: '*',
235 #bold_o: '!', bold_c: '!',
236 cite_o: '"', cite_c: '"',
237 insert_o: '+', insert_c: '+',
238 strike_o: '-', strike_c: '-',
239 superscript_o: '^', superscript_c: '^',
240 subscript_o: '[', subscript_c: ']',
241 hilite_o: '*', hilite_c: '*',
242 monospace_o: '', monospace_c: '',
243 lng_lst: SiSU_is.language_list?,
244 lng_lst_rgx: SiSU_is.language_list_regex?,
245 lv1: '*',
246 lv2: '=',
247 lv3: '=',
248 lv4: '-',
249 lv5: '.',
250 lv6: '.',
251 }
252 Px[:lng_lst_rgx]=Px[:lng_lst].join('|')
253 Ep={
254 alt: :on,
255 d_oebps: 'OEBPS',
256 d_image: 'OEBPS/image',
257 d_css: 'OEBPS/css',
258 f_ncx: 'toc.ncx',
259 f_opf: 'content.opf',
260 }
261 $ep=if Ep[:alt]==:on
262 {
263 o: 'opf:',
264 hsp: ' ',
265 }
266 else
267 {
268 o: '',
269 hsp: ' ',
270 }
271 end
272 Db={
273 name_prefix: "SiSU.#{SiSU_is.version_major?}a.",
274 name_prefix_db: "sisu_#{SiSU_is.version_major?}a_",
275 col_title: 800,
276 col_title_part: 400,
277 col_title_edition: 10,
278 col_name: 600,
279 col_creator_misc_short: 100,
280 col_language: 100,
281 col_language_char: 6,
282 col_date_text: 10,
283 col_txt_long: 600,
284 col_txt_short: 200,
285 col_identify_hash: 256,
286 col_library: 30,
287 col_small: 16,
288 col_filename: 256,
289 col_digest: 128,
290 col_filesize: 10,
291 col_info_note: 2500,
292 }
293 Gt={
294 grotto: 'sisu_src',
295 git: 'sisu:',
296 src: 'src',
297 pods: 'pods',
298 sisupod: 'sisupod',
299 pod: 'pod',
300 files: 'files',
301 doc: 'doc',
302 po: 'po4a/po',
303 pot: 'po4a/pot',
304 image: 'image',
305 audio: 'audio',
306 video: 'video',
307 conf: 'doc/_sisu',
308 }
309 S_CONF={
310 header_make: 'sisu_document_make',
311 rc_yml: 'sisurc.yml',
312 }
313 ANSI_C={
314 red: "\033[#{31}m",
315 green: "\033[#{32}m",
316 yellow: "\033[#{33}m",
317 blue: "\033[#{34}m",
318 fuchsia: "\033[#{35}m",
319 cyan: "\033[#{36}m",
320 inv_red: "\033[#{41}m",
321 inv_green: "\033[#{42}m",
322 inv_yellow: "\033[#{43}m",
323 inv_blue: "\033[#{44}m",
324 inv_fuchsia: "\033[#{45}m",
325 inv_cyan: "\033[#{46}m",
326 b_red: "\033[#{91}m",
327 b_green: "\033[#{92}m",
328 b_yellow: "\033[#{93}m",
329 b_blue: "\033[#{94}m",
330 b_fuchsia: "\033[#{95}m",
331 b_cyan: "\033[#{96}m",
332 off: "\033[m"
333 }
334 DISABLE={
335 epub: {
336 internal_navigation: true,
337 per_section_title: true,
338 ncx_navpoint_unique_id: true,
339 },
340 }
341 DEVELOPER={
342 maintenance: :false,
343 under_construction: '_CONSTRUCTION_ZONE',
344 }
345 __END__
346 utils.rb
347 consider:
348 〔comment〕
349 〔links?????〕
350 import document?
351 check:
352 bold line
353
354 ┆┆⋮┇┊┋
355 『』
356 「」
357 〔〕
358 【】
359
360 ·
361 ¤
362 #˝ " λ Ω β α π Ѫ Ж Я Ѳ ѳ Ф ✠ ㈣
363 Ѳ ѳ Ф
364 ♩ ♭  ✠  ▭ ▬ ▪
365 【】〖〗◢ ◣ ◀ ▶ ◘ ◙ « ▲ »
366 《》「」
367 ‹ › ∗  ∴ ∷
368 '〔lv1〕','〔lv2〕','〔lv3〕','〔lv4〕','〔lv5〕','〔lv6〕','〔lv7〕','〔lv8〕','〔lv9〕'
369 '〔 Ѳ1','〔 Ѳ2','〔 Ѳ3','〔 Ѳ4','〔 Ѳ5','〔Ѳ6','〔Ѳ7','〔Ѳ8','〔Ѳ9'
370 ◁▷
371 ◀this is text or an image▶ http://
372 p __FILE__ +':'+ __LINE__.to_s
373 p __FILE__ + ' ' + __LINE__.to_s + ' ' + html
374 puts "#{__FILE__} #{__LINE__} #{o.inspect}"
375 puts __FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect
376 puts %{-\t#{__FILE__}::#{__LINE__}::#{caller}:\n"#{name}"}
377 p "\t" + txt.obj + " << #{__FILE__} #{__LINE__} >>"
378 p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + dob.inspect) if dob.is==:heading
379 data.each {|o| p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect) if o.is==:heading}
380 puts "#{__FILE__} #{__LINE__} #{para}" if @opt.act[:maintenance][:set]==:on
381 puts "#{__FILE__} #{__LINE__} #{t_o}" if @opt.act[:maintenance][:set]==:on
382 dr ┌ 9484 dR ┍ 9485 Dr ┎ 9486 DR ┏ 9487 dl ┐ 9488 dL ┑ 9489 Dl ┒ 9490 LD ┓ 9491 ur └ 9492 uR ┕ 9493 Ur ┖ 9494 UR ┗ 9495 ul ┘ 9496 uL ┙ 9497 Ul ┚ 9498 UL ┛ 9499 vr ├
383 dr ┌ 9484 dR ┍ 9485 Dr ┎ 9486 DR ┏ 9487 dl ┐ 9488 dL ┑ 9489 Dl ┒ 9490 LD ┓ 9491 ur └ 9492 uR ┕ 9493 Ur ┖ 9494 UR ┗ 9495 ul ┘ 9496 uL ┙ 9497 Ul ┚ 9498 UL ┛ 9499 vr ├
384 └ ┘
385 Iu ⌠ 8992 Il ⌡ <78968 >78969 7<8970 7>8971
386 <" 『 12302 >"12303
387 <' 「 12300 >'12301