sisu 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/sisu +367 -0
- data/bin/sisugem +367 -0
- data/data/sisu/image/arrow_next_red.png +0 -0
- data/data/sisu/image/arrow_prev_red.png +0 -0
- data/data/sisu/image/arrow_up_red.png +0 -0
- data/data/sisu/image/b_bluebell.png +0 -0
- data/data/sisu/image/b_doc.png +0 -0
- data/data/sisu/image/b_epub.png +0 -0
- data/data/sisu/image/b_home.png +0 -0
- data/data/sisu/image/b_info.png +0 -0
- data/data/sisu/image/b_odf.png +0 -0
- data/data/sisu/image/b_pdf.png +0 -0
- data/data/sisu/image/b_search.png +0 -0
- data/data/sisu/image/b_toc.png +0 -0
- data/data/sisu/image/bullet_08.png +0 -0
- data/data/sisu/image/bullet_09.png +0 -0
- data/data/sisu/image/bullet_10.png +0 -0
- data/data/sisu/image/bullet_11.png +0 -0
- data/data/sisu/image/bullet_12.png +0 -0
- data/data/sisu/image/bullet_doc.png +0 -0
- data/data/sisu/image/bullet_red.png +0 -0
- data/data/sisu/image/dot_clear.png +0 -0
- data/data/sisu/image/dot_white.png +0 -0
- data/data/sisu/image/gplv3.png +0 -0
- data/data/sisu/image/gplv3_free_software.png +0 -0
- data/data/sisu/image/next.png +0 -0
- data/data/sisu/image/previous.png +0 -0
- data/data/sisu/image/rb7.ico +0 -0
- data/data/sisu/image/sisu.png +0 -0
- data/data/sisu/image/toctoc.png +0 -0
- data/data/sisu/version.yml +5 -0
- data/lib/sisu.rb +94 -0
- data/lib/sisu/air.rb +80 -0
- data/lib/sisu/ao.rb +590 -0
- data/lib/sisu/ao_character_check.rb +102 -0
- data/lib/sisu/ao_composite.rb +286 -0
- data/lib/sisu/ao_doc_objects.rb +565 -0
- data/lib/sisu/ao_doc_str.rb +2269 -0
- data/lib/sisu/ao_endnotes.rb +136 -0
- data/lib/sisu/ao_expand_insertions.rb +514 -0
- data/lib/sisu/ao_hash_digest.rb +174 -0
- data/lib/sisu/ao_idx.rb +422 -0
- data/lib/sisu/ao_images.rb +187 -0
- data/lib/sisu/ao_metadata.rb +86 -0
- data/lib/sisu/ao_misc_arrange.rb +207 -0
- data/lib/sisu/ao_numbering.rb +720 -0
- data/lib/sisu/ao_persist.rb +194 -0
- data/lib/sisu/ao_references.rb +502 -0
- data/lib/sisu/ao_syntax.rb +640 -0
- data/lib/sisu/cgi.rb +84 -0
- data/lib/sisu/cgi_pgsql.rb +270 -0
- data/lib/sisu/cgi_sql_common.rb +986 -0
- data/lib/sisu/cgi_sqlite.rb +244 -0
- data/lib/sisu/conf.rb +287 -0
- data/lib/sisu/constants.rb +388 -0
- data/lib/sisu/css.rb +3484 -0
- data/lib/sisu/db_columns.rb +1997 -0
- data/lib/sisu/db_create.rb +689 -0
- data/lib/sisu/db_dbi.rb +90 -0
- data/lib/sisu/db_drop.rb +207 -0
- data/lib/sisu/db_import.rb +877 -0
- data/lib/sisu/db_indexes.rb +146 -0
- data/lib/sisu/db_load_tuple.rb +323 -0
- data/lib/sisu/db_remove.rb +182 -0
- data/lib/sisu/db_select.rb +230 -0
- data/lib/sisu/db_sqltxt.rb +173 -0
- data/lib/sisu/db_tests.rb +114 -0
- data/lib/sisu/dbi.rb +166 -0
- data/lib/sisu/dbi_discrete.rb +206 -0
- data/lib/sisu/digests.rb +306 -0
- data/lib/sisu/dp.rb +1606 -0
- data/lib/sisu/dp_identify_markup.rb +161 -0
- data/lib/sisu/dp_make.rb +668 -0
- data/lib/sisu/embedded.rb +149 -0
- data/lib/sisu/errors.rb +84 -0
- data/lib/sisu/generic_parts.rb +131 -0
- data/lib/sisu/git.rb +277 -0
- data/lib/sisu/html.rb +775 -0
- data/lib/sisu/html_concordance.rb +391 -0
- data/lib/sisu/html_format.rb +1348 -0
- data/lib/sisu/html_harvest.rb +109 -0
- data/lib/sisu/html_harvest_author_format.rb +111 -0
- data/lib/sisu/html_harvest_authors.rb +466 -0
- data/lib/sisu/html_harvest_topics.rb +893 -0
- data/lib/sisu/html_lite_shared.rb +324 -0
- data/lib/sisu/html_manifest.rb +1032 -0
- data/lib/sisu/html_minitoc.rb +230 -0
- data/lib/sisu/html_parts.rb +437 -0
- data/lib/sisu/html_persist.rb +237 -0
- data/lib/sisu/html_promo.rb +440 -0
- data/lib/sisu/html_scroll.rb +235 -0
- data/lib/sisu/html_segments.rb +716 -0
- data/lib/sisu/html_shared.rb +62 -0
- data/lib/sisu/html_table.rb +64 -0
- data/lib/sisu/html_tune.rb +301 -0
- data/lib/sisu/hub.rb +277 -0
- data/lib/sisu/hub_actions.rb +1122 -0
- data/lib/sisu/hub_loop_markup_files.rb +170 -0
- data/lib/sisu/hub_options.rb +1695 -0
- data/lib/sisu/i18n.rb +702 -0
- data/lib/sisu/manpage.rb +377 -0
- data/lib/sisu/manpage_format.rb +85 -0
- data/lib/sisu/object_munge.rb +307 -0
- data/lib/sisu/prog_text_translation.rb +1702 -0
- data/lib/sisu/qrcode.rb +754 -0
- data/lib/sisu/relaxng.rb +1153 -0
- data/lib/sisu/remote.rb +246 -0
- data/lib/sisu/rexml.rb +148 -0
- data/lib/sisu/se.rb +158 -0
- data/lib/sisu/se_cleanoutput.rb +145 -0
- data/lib/sisu/se_clear.rb +105 -0
- data/lib/sisu/se_createsite.rb +273 -0
- data/lib/sisu/se_css.rb +221 -0
- data/lib/sisu/se_date.rb +92 -0
- data/lib/sisu/se_db.rb +214 -0
- data/lib/sisu/se_envcall.rb +326 -0
- data/lib/sisu/se_file_op.rb +2758 -0
- data/lib/sisu/se_filemap.rb +247 -0
- data/lib/sisu/se_get_init.rb +238 -0
- data/lib/sisu/se_hub_particulars.rb +234 -0
- data/lib/sisu/se_info_env.rb +2179 -0
- data/lib/sisu/se_info_port.rb +70 -0
- data/lib/sisu/se_info_system.rb +202 -0
- data/lib/sisu/se_load.rb +108 -0
- data/lib/sisu/se_processing.rb +659 -0
- data/lib/sisu/se_programs.rb +394 -0
- data/lib/sisu/se_remotes.rb +553 -0
- data/lib/sisu/se_standardise_lang.rb +176 -0
- data/lib/sisu/se_version.rb +174 -0
- data/lib/sisu/shared_images.rb +137 -0
- data/lib/sisu/shared_markup_alt.rb +336 -0
- data/lib/sisu/shared_metadata.rb +1361 -0
- data/lib/sisu/shared_sem.rb +156 -0
- data/lib/sisu/sisu_thor_lib.rb +407 -0
- data/lib/sisu/sitemaps.rb +224 -0
- data/lib/sisu/src_kdissert_share.rb +102 -0
- data/lib/sisu/src_po4a_share.rb +309 -0
- data/lib/sisu/src_po4a_shelf.rb +1217 -0
- data/lib/sisu/src_po4a_shelf_set.rb +297 -0
- data/lib/sisu/src_po4a_sst_ao_sst.rb +893 -0
- data/lib/sisu/src_po4a_sst_ao_sst_set.rb +284 -0
- data/lib/sisu/src_po4a_sstm.rb +135 -0
- data/lib/sisu/src_shared.rb +347 -0
- data/lib/sisu/src_sisupod_make.rb +171 -0
- data/lib/sisu/src_sisupod_sstm.rb +109 -0
- data/lib/sisu/sst_convert_markup.rb +323 -0
- data/lib/sisu/sst_do_inline_footnotes.rb +440 -0
- data/lib/sisu/sst_from_xml.rb +178 -0
- data/lib/sisu/sst_identify_markup.rb +482 -0
- data/lib/sisu/sst_to_s_xml_sax.rb +471 -0
- data/lib/sisu/termsheet.rb +163 -0
- data/lib/sisu/texinfo.rb +430 -0
- data/lib/sisu/texinfo_format.rb +541 -0
- data/lib/sisu/texpdf.rb +1162 -0
- data/lib/sisu/texpdf_format.rb +1689 -0
- data/lib/sisu/texpdf_parts.rb +235 -0
- data/lib/sisu/txt_asciidoc.rb +354 -0
- data/lib/sisu/txt_asciidoc_decorate.rb +207 -0
- data/lib/sisu/txt_markdown.rb +389 -0
- data/lib/sisu/txt_markdown_decorate.rb +207 -0
- data/lib/sisu/txt_orgmode.rb +376 -0
- data/lib/sisu/txt_orgmode_decorate.rb +186 -0
- data/lib/sisu/txt_output.rb +86 -0
- data/lib/sisu/txt_plain.rb +410 -0
- data/lib/sisu/txt_plain_decorate.rb +189 -0
- data/lib/sisu/txt_read.rb +109 -0
- data/lib/sisu/txt_rst.rb +371 -0
- data/lib/sisu/txt_rst_decorate.rb +186 -0
- data/lib/sisu/txt_shared.rb +241 -0
- data/lib/sisu/txt_textile.rb +367 -0
- data/lib/sisu/txt_textile_decorate.rb +186 -0
- data/lib/sisu/update.rb +141 -0
- data/lib/sisu/urls.rb +696 -0
- data/lib/sisu/utils.rb +232 -0
- data/lib/sisu/utils_composite.rb +115 -0
- data/lib/sisu/utils_response.rb +114 -0
- data/lib/sisu/utils_screen_text_color.rb +472 -0
- data/lib/sisu/utils_spell.rb +99 -0
- data/lib/sisu/webrick.rb +191 -0
- data/lib/sisu/wikispeak.rb +375 -0
- data/lib/sisu/xhtml.rb +472 -0
- data/lib/sisu/xhtml_epub2.rb +890 -0
- data/lib/sisu/xhtml_epub2_concordance.rb +322 -0
- data/lib/sisu/xhtml_epub2_format.rb +2272 -0
- data/lib/sisu/xhtml_epub2_persist.rb +278 -0
- data/lib/sisu/xhtml_epub2_segments.rb +599 -0
- data/lib/sisu/xhtml_epub2_tune.rb +330 -0
- data/lib/sisu/xhtml_parts.rb +183 -0
- data/lib/sisu/xhtml_shared.rb +62 -0
- data/lib/sisu/xhtml_table.rb +97 -0
- data/lib/sisu/xml_docbook5.rb +376 -0
- data/lib/sisu/xml_dom.rb +624 -0
- data/lib/sisu/xml_fictionbook2.rb +389 -0
- data/lib/sisu/xml_format.rb +865 -0
- data/lib/sisu/xml_md_oai_pmh_dc.rb +229 -0
- data/lib/sisu/xml_odf_odt.rb +887 -0
- data/lib/sisu/xml_odf_odt_format.rb +674 -0
- data/lib/sisu/xml_parts.rb +191 -0
- data/lib/sisu/xml_persist.rb +126 -0
- data/lib/sisu/xml_sax.rb +521 -0
- data/lib/sisu/xml_scaffold_structure_collapsed.rb +198 -0
- data/lib/sisu/xml_scaffold_structure_sisu.rb +201 -0
- data/lib/sisu/xml_shared.rb +665 -0
- data/lib/sisu/xml_tables.rb +261 -0
- data/lib/sisu/zap.rb +90 -0
- metadata +251 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** spellchecking
|
|
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/utils_spell.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_SpellUtility
|
|
58
|
+
class Spell
|
|
59
|
+
def initialize(input,filesrc,flg)
|
|
60
|
+
@flg=flg
|
|
61
|
+
@filename, @filetype = /(.+?)(\.\w\w\w0$)/.match(filesrc)[1,2] #.gsub(/\.\w\w\w0$/, "")
|
|
62
|
+
@input=input
|
|
63
|
+
@allwords=[]
|
|
64
|
+
puts @filename
|
|
65
|
+
@speller='aspell' # 'ispell'
|
|
66
|
+
@dictionary='british'
|
|
67
|
+
@lang='en_GB'
|
|
68
|
+
end
|
|
69
|
+
def check
|
|
70
|
+
@input.each do |data|
|
|
71
|
+
data=data.gsub(/(https?|www|ftp|gopher|png|jpg|gif|html|htm)\S+/i,' ').
|
|
72
|
+
gsub(/( |#{Mx[:nbsp]})/i,' ').
|
|
73
|
+
gsub(/<\/?(table|tr|td|b|p|href).*?>/i,' ').
|
|
74
|
+
gsub(/(<==.+|<:\S+>|<!.+?!>|^@\S+?:.+|\{\{\{|~)/,' ').
|
|
75
|
+
gsub(/(["|<>)(\n'`.;&_-]|\=)/,' ').
|
|
76
|
+
gsub(/\b(altExternal|
|
|
77
|
+
target|externalimg|
|
|
78
|
+
srcimagebext|
|
|
79
|
+
img|src|toc|pdf|
|
|
80
|
+
cd|org|
|
|
81
|
+
helvetica|roman
|
|
82
|
+
)\b/i,' ').
|
|
83
|
+
gsub(/EOF/,'')
|
|
84
|
+
@words=data.scan(/\S+/)
|
|
85
|
+
@words.each { |y| @allwords << y }
|
|
86
|
+
end
|
|
87
|
+
@allwords=@allwords.uniq
|
|
88
|
+
if @flg =~ /S/
|
|
89
|
+
File.open('/home/ralph/spell_error','a+') do |file| #fix
|
|
90
|
+
file.puts %{\n\n<<#{@filename}>>}
|
|
91
|
+
end
|
|
92
|
+
@allwords.each { |y| puts y.inspect; system(%{cat #{y} | /usr/bin/#{@speller} -l -d #{@dictionary} >> ~/spell_error })}
|
|
93
|
+
else
|
|
94
|
+
@allwords.each { |y| sp=%x{echo #{y}|#{@speller} -l }; puts sp unless sp.empty?}
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
__END__
|
data/lib/sisu/webrick.rb
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** webrick share - note sisu by default does not link with file suffixes,
|
|
8
|
+
see man pages for options
|
|
9
|
+
|
|
10
|
+
** Author: Ralph Amissah
|
|
11
|
+
<ralph@amissah.com>
|
|
12
|
+
<ralph.amissah@gmail.com>
|
|
13
|
+
|
|
14
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
15
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
16
|
+
All Rights Reserved.
|
|
17
|
+
|
|
18
|
+
** License: GPL 3 or later:
|
|
19
|
+
|
|
20
|
+
SiSU, a framework for document structuring, publishing and search
|
|
21
|
+
|
|
22
|
+
Copyright (C) Ralph Amissah
|
|
23
|
+
|
|
24
|
+
This program is free software: you can redistribute it and/or modify it
|
|
25
|
+
under the terms of the GNU General Public License as published by the Free
|
|
26
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
27
|
+
any later version.
|
|
28
|
+
|
|
29
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
30
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
31
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
32
|
+
more details.
|
|
33
|
+
|
|
34
|
+
You should have received a copy of the GNU General Public License along with
|
|
35
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
36
|
+
|
|
37
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
38
|
+
available at these locations:
|
|
39
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
40
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
41
|
+
|
|
42
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
43
|
+
|
|
44
|
+
** SiSU uses:
|
|
45
|
+
* Standard SiSU markup syntax,
|
|
46
|
+
* Standard SiSU meta-markup syntax, and the
|
|
47
|
+
* Standard SiSU object citation numbering and system
|
|
48
|
+
|
|
49
|
+
** Hompages:
|
|
50
|
+
<http://www.jus.uio.no/sisu>
|
|
51
|
+
<http://www.sisudoc.org>
|
|
52
|
+
|
|
53
|
+
** Git
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
55
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/webrick.rb;hb=HEAD>
|
|
56
|
+
|
|
57
|
+
=end
|
|
58
|
+
module SiSU_Webserv
|
|
59
|
+
class WebrickStart
|
|
60
|
+
begin
|
|
61
|
+
require 'time'
|
|
62
|
+
require 'webrick'
|
|
63
|
+
include WEBrick
|
|
64
|
+
rescue LoadError
|
|
65
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
66
|
+
error('time or webrick NOT FOUND (LoadError)')
|
|
67
|
+
end
|
|
68
|
+
require_relative 'se' # se.rb
|
|
69
|
+
include SiSU_Env
|
|
70
|
+
include SiSU_Screen
|
|
71
|
+
def initialize
|
|
72
|
+
@cX=SiSU_Screen::Ansi.new('yes').cX
|
|
73
|
+
@env=SiSU_Env::InfoEnv.new
|
|
74
|
+
port=SiSU_Env::InfoPort.new
|
|
75
|
+
@host=@env.url.webrick
|
|
76
|
+
@port=port.webrick
|
|
77
|
+
@serve=[]
|
|
78
|
+
Dir.foreach(@env.path.webserv) do |x|
|
|
79
|
+
if x !~/^\./ \
|
|
80
|
+
and FileTest.directory?("#{@env.path.webserv}/#{x}")
|
|
81
|
+
@serve << x
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
@mount=[]
|
|
85
|
+
@serve.each {|x| @mount << ["/#{x}", "#{@env.path.webserv}/#{x}"]}
|
|
86
|
+
@pwd=Dir.pwd
|
|
87
|
+
@week=Time.now.strftime(%{%Yw%W})
|
|
88
|
+
puts "\n"
|
|
89
|
+
@mount.each { |x,y|
|
|
90
|
+
puts " * #{@cX.blue}#{@host}:#{@port}#{x}/#{@cX.off}"
|
|
91
|
+
}
|
|
92
|
+
get=Dir.pwd
|
|
93
|
+
brick(@port,get)
|
|
94
|
+
end
|
|
95
|
+
def brick(port,get='')
|
|
96
|
+
cgidir=if get=~/pwd/ then Dir.pwd
|
|
97
|
+
else '/usr/lib/cgi-bin'
|
|
98
|
+
end
|
|
99
|
+
port=SiSU_Env::InfoPort.new.webrick
|
|
100
|
+
begin
|
|
101
|
+
s=HTTPServer.new(
|
|
102
|
+
Port: port,
|
|
103
|
+
DocumentRoot: Dir::pwd + '/htdocs',
|
|
104
|
+
CGIPathEnv: ENV['PATH']
|
|
105
|
+
)
|
|
106
|
+
cgi_dir=File.expand_path(cgidir)
|
|
107
|
+
@mount.each { |x,y| # mount subdirectories
|
|
108
|
+
s.mount(x, HTTPServlet::FileHandler, y, true)
|
|
109
|
+
}
|
|
110
|
+
s.mount('/cgi-bin', HTTPServlet::FileHandler, cgi_dir, { FancyIndexing: true })
|
|
111
|
+
trap("INT"){ s.shutdown }
|
|
112
|
+
s.start
|
|
113
|
+
rescue
|
|
114
|
+
SiSU_Errors::Rescued.new($!,$@,'-W',nil).location do #fix
|
|
115
|
+
__LINE__.to_s + ':' + __FILE__
|
|
116
|
+
end
|
|
117
|
+
ensure
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
def wb_cgi
|
|
121
|
+
begin #%
|
|
122
|
+
wb_s2=''
|
|
123
|
+
#% writes file wb.cgi to shared directories ...
|
|
124
|
+
#% wb_top
|
|
125
|
+
wb_top=%q(#!/usr/bin/env ruby
|
|
126
|
+
# * arch-tag: webrick info on environment, mounted directories, and contents of pwd
|
|
127
|
+
begin
|
|
128
|
+
require 'time'
|
|
129
|
+
require 'cgi'
|
|
130
|
+
require 'fcgi'
|
|
131
|
+
rescue LoadError
|
|
132
|
+
puts 'time, cgi or fcgi NOT FOUND (LoadError)'
|
|
133
|
+
end
|
|
134
|
+
ls=Dir.entries('./')
|
|
135
|
+
dir_contents=[]
|
|
136
|
+
ls.each { |x| dir_contents << "<a href=\"./#{x}/\">#{x}</a><br>" unless x =~/^(\.)+$/ }
|
|
137
|
+
dir_contents=dir_contents.sort.join(' ')
|
|
138
|
+
#host=ENV['HOSTNAME']
|
|
139
|
+
#host=%x{echo $HOSTNAME}
|
|
140
|
+
)
|
|
141
|
+
wb_s1=<<-WOK
|
|
142
|
+
|
|
143
|
+
page=CGI.new "html3"
|
|
144
|
+
page.out {
|
|
145
|
+
page.html {
|
|
146
|
+
page.head { page.title {"#{@host} Webrick Report"} } +
|
|
147
|
+
page.body {
|
|
148
|
+
page.h1 {"Webrick #{@host}"} +
|
|
149
|
+
page.p {"Webrick is Ruby's built in webserver."} +
|
|
150
|
+
page.center {"Host name: " + page.b{"#{@host} "} + "(#{@host}) port: " + page.b{"#{@port}"}} +
|
|
151
|
+
page.center {"#{Time.now}"} +
|
|
152
|
+
page.center {"#{Time.now.strftime(%{%Yw%W})}"} +
|
|
153
|
+
page.p {''} +
|
|
154
|
+
page.p {''} +
|
|
155
|
+
page.p {page.b{"Webrick Served Directories: "}} +
|
|
156
|
+
WOK
|
|
157
|
+
#% wb_s2 (mounts)
|
|
158
|
+
@mount.each do |x,y| wb_s2 += <<-WOK
|
|
159
|
+
page.p {%{<a href="#{@host}:#{@port}#{x}/">#{x}</a> } +
|
|
160
|
+
%{<a href="#{@host}:#{@port}#{x}/">#{@host}:#{@port}#{x}</a> (mounts: #{y}/) <a href="#{@host}:#{@port}#{x}/wb.cgi">info (wb.cgi)</a>}} +
|
|
161
|
+
WOK
|
|
162
|
+
end
|
|
163
|
+
#% wb_end
|
|
164
|
+
wb_end=<<-WOK
|
|
165
|
+
page.p {page.b{"Contents of PWD (see URL): "}} +
|
|
166
|
+
page.p {"#\{dir_contents}"}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
WOK
|
|
171
|
+
@mount.each { |x,y| #% wb puts
|
|
172
|
+
puts y
|
|
173
|
+
filename=File.new("#{y}/wb.cgi",'w')
|
|
174
|
+
filename << wb_top
|
|
175
|
+
filename << wb_s1
|
|
176
|
+
filename << wb_s2
|
|
177
|
+
filename << wb_end
|
|
178
|
+
filename.close
|
|
179
|
+
FileUtils::chmod(0755,"#{y}/wb.cgi &") if FileTest.file?("#{y}/wb.cgi &")
|
|
180
|
+
}
|
|
181
|
+
rescue
|
|
182
|
+
SiSU_Errors::Rescued.new($!,$@,'-W',nil).location do #fix
|
|
183
|
+
__LINE__.to_s + ':' + __FILE__
|
|
184
|
+
end
|
|
185
|
+
ensure
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
ensure
|
|
190
|
+
end
|
|
191
|
+
__END__
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** wiki text generation, stripped wiki output (unix, linefeed)
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
|
|
11
|
+
<ralph@amissah.com>
|
|
12
|
+
<ralph.amissah@gmail.com>
|
|
13
|
+
|
|
14
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
15
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
16
|
+
All Rights Reserved.
|
|
17
|
+
|
|
18
|
+
** License: GPL 3 or later:
|
|
19
|
+
|
|
20
|
+
SiSU, a framework for document structuring, publishing and search
|
|
21
|
+
|
|
22
|
+
Copyright (C) Ralph Amissah
|
|
23
|
+
|
|
24
|
+
This program is free software: you can redistribute it and/or modify it
|
|
25
|
+
under the terms of the GNU General Public License as published by the Free
|
|
26
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
27
|
+
any later version.
|
|
28
|
+
|
|
29
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
30
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
31
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
32
|
+
more details.
|
|
33
|
+
|
|
34
|
+
You should have received a copy of the GNU General Public License along with
|
|
35
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
36
|
+
|
|
37
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
38
|
+
available at these locations:
|
|
39
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
40
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
41
|
+
|
|
42
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
43
|
+
|
|
44
|
+
** SiSU uses:
|
|
45
|
+
* Standard SiSU markup syntax,
|
|
46
|
+
* Standard SiSU meta-markup syntax, and the
|
|
47
|
+
* Standard SiSU object citation numbering and system
|
|
48
|
+
|
|
49
|
+
** Hompages:
|
|
50
|
+
<http://www.jus.uio.no/sisu>
|
|
51
|
+
<http://www.sisudoc.org>
|
|
52
|
+
|
|
53
|
+
** Git
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
55
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/wikispeak.rb;hb=HEAD>
|
|
56
|
+
|
|
57
|
+
=end
|
|
58
|
+
module SiSU_Wikispeak
|
|
59
|
+
require_relative 'ao' # ao.rb
|
|
60
|
+
require_relative 'se' # se.rb
|
|
61
|
+
include SiSU_Env
|
|
62
|
+
include SiSU_Param
|
|
63
|
+
require_relative 'plaintext_format' # plaintext_format.rb
|
|
64
|
+
include Format
|
|
65
|
+
require_relative 'html_parts' # html_parts.rb
|
|
66
|
+
require_relative 'txt_shared'
|
|
67
|
+
@@alt_id_count,@@alt_id_count=0,0
|
|
68
|
+
@@tablefoot=''
|
|
69
|
+
class Source
|
|
70
|
+
def initialize(opt)
|
|
71
|
+
@opt=opt
|
|
72
|
+
@@dostype='msdos footnotes'
|
|
73
|
+
end
|
|
74
|
+
def read
|
|
75
|
+
begin
|
|
76
|
+
@md=SiSU_Param::Parameters.new(@opt).get
|
|
77
|
+
@env=SiSU_Env::InfoEnv.new(@opt.fns)
|
|
78
|
+
path=@env.path.output_tell
|
|
79
|
+
tool=(@opt.act[:verbose][:set]==:on \
|
|
80
|
+
|| @opt.act[:verbose_plus][:set]==:on \
|
|
81
|
+
|| @opt.act[:maintenance][:set]==:on) \
|
|
82
|
+
? "#{@env.program.text_editor} #{path}/#{@md.fnb}/#{@md.fn[:wiki]}"
|
|
83
|
+
: ''
|
|
84
|
+
SiSU_Screen::Ansi.new(
|
|
85
|
+
@opt.act[:color_state][:set],
|
|
86
|
+
'Wikispeak',
|
|
87
|
+
tool
|
|
88
|
+
).green_hi_blue unless @opt.act[:quiet][:set]==:on
|
|
89
|
+
if (@opt.act[:verbose_plus][:set]==:on \
|
|
90
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
91
|
+
SiSU_Screen::Ansi.new(
|
|
92
|
+
@opt.act[:color_state][:set],
|
|
93
|
+
@opt.fns,
|
|
94
|
+
"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}"
|
|
95
|
+
).flow
|
|
96
|
+
end
|
|
97
|
+
@ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
|
|
98
|
+
SiSU_Wikispeak::Source::Scroll.new(@ao_array,@md).songsheet
|
|
99
|
+
rescue
|
|
100
|
+
SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
|
|
101
|
+
__LINE__.to_s + ':' + __FILE__
|
|
102
|
+
end
|
|
103
|
+
ensure
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
private
|
|
107
|
+
class SplitTextObject <Source
|
|
108
|
+
require_relative 'plaintext_format' # plaintext_format.rb
|
|
109
|
+
include Format
|
|
110
|
+
@@alt_id_count=0
|
|
111
|
+
@@dp=nil
|
|
112
|
+
attr_reader :format,:lev,:text,:ocn,:lev_para_ocn
|
|
113
|
+
def initialize(para)
|
|
114
|
+
@para=para
|
|
115
|
+
@format,@ocn='ordinary','ordinary'
|
|
116
|
+
@dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern
|
|
117
|
+
end
|
|
118
|
+
def lev_segname_para_ocn
|
|
119
|
+
@text=nil
|
|
120
|
+
if @para =~/^(\d~|<:.+?>).+?#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/
|
|
121
|
+
if /^(([1-6])~(\S+))\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/m.match(@para)
|
|
122
|
+
@format,@lev,segname,@text,@ocn=$1,$2,$3,$4,$5
|
|
123
|
+
elsif /^(([1-6])~)\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/m.match(@para)
|
|
124
|
+
@format,@lev,@text,@ocn=$1,$2,$3,$4
|
|
125
|
+
elsif /<:(.+?)>\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/m.match(@para)
|
|
126
|
+
@format,@text,@ocn=$1,$2,$3
|
|
127
|
+
elsif /^(([1-6])~(\S+))\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;[um]\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/m.match(@para)
|
|
128
|
+
@@alt_id_count+=1
|
|
129
|
+
@format,@lev,segname,@text,@ocn=$1,$2,$3,$4,"x#{@@alt_id_count}"
|
|
130
|
+
elsif /^(([1-6])~)\s+(\S.+?)#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/m.match(@para)
|
|
131
|
+
@@alt_id_count+=1
|
|
132
|
+
@format,@lev,@text,@ocn=$1,$2,$3,"x#{@@alt_id_count}"
|
|
133
|
+
end
|
|
134
|
+
else
|
|
135
|
+
if /(.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/m.match(@para)
|
|
136
|
+
@text,@ocn=$1,$2
|
|
137
|
+
end
|
|
138
|
+
if @para !~/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$|^$/ #added 2002w06
|
|
139
|
+
@text=/(.+?)/m.match(@para)[1]
|
|
140
|
+
end
|
|
141
|
+
if /^((\d)~(?:~\S+)?)\s+(.+)/m.match(@para)
|
|
142
|
+
@format,@lev,@text=$1,$2,$3
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
format=@format.dup
|
|
146
|
+
@lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/
|
|
147
|
+
Format::FormatTextObject.new(format,@text,@ocn)
|
|
148
|
+
else
|
|
149
|
+
Format::FormatTextObject.new(format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}")
|
|
150
|
+
end
|
|
151
|
+
self
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
class Scroll <Source
|
|
155
|
+
include SiSU_TextUtils
|
|
156
|
+
include SiSU_Parts_HTML
|
|
157
|
+
@@endnotes_para=[]
|
|
158
|
+
@@wiki={ body: [], open: [], close: [], head: [], metadata: [], tail: [], endnotes: [] }
|
|
159
|
+
@@dp=nil
|
|
160
|
+
def initialize(data,md)
|
|
161
|
+
@data,@md=data,md
|
|
162
|
+
@dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern
|
|
163
|
+
@regx=/^(?:(?:#{Mx[:br_line]}\s*|#{Mx[:br_nl]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]}\s*)?(.+)/ #fix Mx[:lv_o] #m # 2004w18 pb pn removal added
|
|
164
|
+
@tab="\t"
|
|
165
|
+
@@dostype='unix footnotes'
|
|
166
|
+
@br="\n"
|
|
167
|
+
end
|
|
168
|
+
def songsheet
|
|
169
|
+
markup
|
|
170
|
+
publish
|
|
171
|
+
end
|
|
172
|
+
# Used for extraction of endnotes from paragraphs
|
|
173
|
+
def extract_endnotes(para='') #check
|
|
174
|
+
para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#{@dp}#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
|
|
175
|
+
end
|
|
176
|
+
def wiki_metadata(meta)
|
|
177
|
+
util=SiSU_TextUtils::Wrap.new(meta.text,70,15,1)
|
|
178
|
+
txt=util.line_wrap
|
|
179
|
+
@@wiki[:metadata] <<= if meta.type=='meta'
|
|
180
|
+
<<WOK
|
|
181
|
+
|
|
182
|
+
#{@tab}#{meta.el}: #{txt}
|
|
183
|
+
WOK
|
|
184
|
+
else ''
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
def wiki_tail
|
|
188
|
+
generator="Generated by: #{@md.project_details.project} #{@md.project_details.version} of #{@md.project_details.date_stamp} (#{@md.project_details.date})" if @md.project_details.version
|
|
189
|
+
lastdone="Last Generated on: #{Time.now}"
|
|
190
|
+
rubyv="Ruby version: #{@md.ruby_version}"
|
|
191
|
+
sc=if @md.sc_info
|
|
192
|
+
"Source file: #{@md.sc_filename}#{@br}Version number: #{@md.sc_number}#{@br}Version date: #{@md.sc_date}#{@br}"
|
|
193
|
+
else ''
|
|
194
|
+
end
|
|
195
|
+
@@wiki[:tail] <<<<WOK
|
|
196
|
+
#{@br}
|
|
197
|
+
Other versions of this document: #{@br}
|
|
198
|
+
manifest:
|
|
199
|
+
#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:manifest]}#{@br}
|
|
200
|
+
html:
|
|
201
|
+
#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:toc]}#{@br}
|
|
202
|
+
pdf:
|
|
203
|
+
#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:pdf_p]}
|
|
204
|
+
#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:pdf_l]}#{@br}
|
|
205
|
+
plaintext (plain text):
|
|
206
|
+
#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:plain]}#{@br}
|
|
207
|
+
at:
|
|
208
|
+
#{vz.url_site}#{@br}
|
|
209
|
+
|
|
210
|
+
#{sc}
|
|
211
|
+
* #{generator}
|
|
212
|
+
* #{rubyv}
|
|
213
|
+
* #{lastdone}
|
|
214
|
+
* SiSU #{vz.url_sisu}
|
|
215
|
+
WOK
|
|
216
|
+
end
|
|
217
|
+
def wiki_structure(para='',lv='',ocn='',hname='') #% Used to extract the structure of a document
|
|
218
|
+
lv=lv.to_i
|
|
219
|
+
lv=nil if lv==0
|
|
220
|
+
extract_endnotes(para)
|
|
221
|
+
para.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(?:[\d*+]+)\s+(.+?)#{Mx[:id_o]}#{@dp}#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'<ref>\1</ref>') # endnote marker marked up
|
|
222
|
+
para.gsub!(/^#{Rx[:lv]}\S*\s+/,'') # endnote marker marked up
|
|
223
|
+
para.gsub!(/<\S+?>#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}/,'') # endnote marker marked up
|
|
224
|
+
if lv
|
|
225
|
+
@@wiki[:body] << case lv
|
|
226
|
+
when 1 then '='*2 << para.strip << @br*2
|
|
227
|
+
when 2..3 then '='*2 << para.strip << @br*2
|
|
228
|
+
when 4 then '='*4 << para.strip << @br*2
|
|
229
|
+
when 5..6 then '='*4 << para.strip << @br*2
|
|
230
|
+
end
|
|
231
|
+
else @@wiki[:body] << para << @br*2 # main text, contents, body KEEP
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
def markup # Used for major markup instructions
|
|
235
|
+
data=@data
|
|
236
|
+
SiSU_Env::InfoEnv.new(@md.fns)
|
|
237
|
+
@data_mod,@endnotes,@level,@cont,@copen,@wiki_contents_close=Array.new(6){[]}
|
|
238
|
+
(0..6).each { |x| @cont[x]=@level[x]=false }
|
|
239
|
+
(4..6).each { |x| @wiki_contents_close[x]='' }
|
|
240
|
+
wiki_tail
|
|
241
|
+
table_message='[table omitted, see other document formats]'
|
|
242
|
+
data.each do |para|
|
|
243
|
+
para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{@br}#{table_message}") #fix
|
|
244
|
+
para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check
|
|
245
|
+
para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down
|
|
246
|
+
para.gsub!(/©/,'©') # bullet markup, marked down
|
|
247
|
+
para.gsub!(/&/,'&') # bullet markup, marked down
|
|
248
|
+
para.gsub!(/<sup>(.+?)<\/sup>/,'^\1^')
|
|
249
|
+
para.gsub!(/<sub>(.+?)<\/sub>/,'[\1]')
|
|
250
|
+
para.gsub!(/<i>(.+?)<\/i>/,"''\\1''")
|
|
251
|
+
para.gsub!(/<b>(.+?)<\/b>/,"'''\\1'''")
|
|
252
|
+
para.gsub!(/<u>(.+?)<\/u>/,'_\1_')
|
|
253
|
+
para.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'[\2 \1]')
|
|
254
|
+
para.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'[\1]')
|
|
255
|
+
para.gsub!(/<:(?:block|group|verse|alt|code)(?:-end)?>(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]})?/,'')
|
|
256
|
+
para.gsub!(/<:p[bn]>/,'') # remove page breaks
|
|
257
|
+
para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/,'') # remove empty lines - check
|
|
258
|
+
para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')
|
|
259
|
+
para.gsub!(/<:name#\S+?>/,'') # remove name links
|
|
260
|
+
para.gsub!(/ |#{Mx[:nbsp]}/,' ') # decide on
|
|
261
|
+
para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
|
|
262
|
+
para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]')
|
|
263
|
+
if para =~/^@(\S+?):\s+(.+?)\Z/m # for headers
|
|
264
|
+
d_meta=SiSU_TextUtils::HeaderScan.new(@md,para).meta
|
|
265
|
+
if d_meta; wiki_metadata(d_meta)
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
if para !~/(^@\S+?:|#{Mx[:br_endnotes]}|#{Mx[:br_eof]})/
|
|
269
|
+
if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change
|
|
270
|
+
paranum=para[@regx,3]
|
|
271
|
+
@p_num=Format::ParagraphNumber.new(paranum)
|
|
272
|
+
end
|
|
273
|
+
@sto=SplitTextObject.new(para).lev_segname_para_ocn
|
|
274
|
+
### problem in scroll, it appears tables are getting paragraph numbers
|
|
275
|
+
m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/
|
|
276
|
+
if para =~m \
|
|
277
|
+
and para=~/\S+/
|
|
278
|
+
para=case @sto.format
|
|
279
|
+
when /^(1)~(?:(\S+))?/
|
|
280
|
+
wiki_structure(para,$1,@sto.ocn,$2)
|
|
281
|
+
@sto.lev_para_ocn.heading_body1
|
|
282
|
+
when /^(2)~(?:(\S+))?/
|
|
283
|
+
wiki_structure(para,$1,@sto.ocn,$2)
|
|
284
|
+
@sto.lev_para_ocn.heading_body2
|
|
285
|
+
when /^(3)~(?:(\S+))?/
|
|
286
|
+
wiki_structure(para,$1,@sto.ocn,$2)
|
|
287
|
+
@sto.lev_para_ocn.heading_body3
|
|
288
|
+
when /^(4)~(\S+)/ # work on see SiSU_text_parts::SplitTextObject
|
|
289
|
+
wiki_structure(para,$1,@sto.ocn,$2)
|
|
290
|
+
@sto.lev_para_ocn.heading_body4
|
|
291
|
+
when /^(5)~(?:(\S+))?/
|
|
292
|
+
wiki_structure(para,$1,@sto.ocn,$2)
|
|
293
|
+
@sto.lev_para_ocn.heading_body5
|
|
294
|
+
when /^(6)~(?:(\S+))?/
|
|
295
|
+
wiki_structure(para,$1,@sto.ocn,$2)
|
|
296
|
+
@sto.lev_para_ocn.heading_body6
|
|
297
|
+
else
|
|
298
|
+
wiki_structure(para,nil,nil,nil) #watch may be problematic
|
|
299
|
+
para
|
|
300
|
+
end
|
|
301
|
+
elsif para =~/#{table_message}/
|
|
302
|
+
@@wiki[:body] << para << @br
|
|
303
|
+
elsif para =~/(Note|Endnotes?)/ \
|
|
304
|
+
and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/
|
|
305
|
+
elsif para =~/(MetaData)/ \
|
|
306
|
+
and para =~/#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/ #debug 2003w46 add rc info ####suspect visit
|
|
307
|
+
elsif para.include? 'Owner Details' \
|
|
308
|
+
and para !~/#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/
|
|
309
|
+
elsif para =~/(#{Mx[:tc_p]}|#{Mx[:gr_o]}Th?)/u #tables ! #fix
|
|
310
|
+
elsif para =~/(.*)<!#!>(.*)/
|
|
311
|
+
one,two=$1,$2
|
|
312
|
+
format_text=FormatTextObject.new(one,two)
|
|
313
|
+
para=format_text.seg_no_paranum
|
|
314
|
+
end
|
|
315
|
+
if (para =~/<a name="n\d+">/ \
|
|
316
|
+
and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
|
|
317
|
+
para=''
|
|
318
|
+
end
|
|
319
|
+
case para
|
|
320
|
+
when /<:i1>/
|
|
321
|
+
if para =~/.*<:#>.*$/
|
|
322
|
+
format_text=FormatTextObject.new(para,'')
|
|
323
|
+
para=format_text.scr_indent_one_no_paranum
|
|
324
|
+
end
|
|
325
|
+
when /<:i2>/
|
|
326
|
+
if para =~/.*<:#>.*$/
|
|
327
|
+
format_text=FormatTextObject.new(para,'')
|
|
328
|
+
para=format_text.scr_indent_one_no_paranum
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
if para !~/#{the_margin.txt_0}|#{the_margin.txt_1}|#{the_margin.txt_2}/
|
|
332
|
+
# i don't get the condition for no paranum
|
|
333
|
+
end
|
|
334
|
+
if para =~/<:center>/
|
|
335
|
+
one,two=/(.*)<:center>(.*)/.match(para)[1,2]
|
|
336
|
+
format_text=FormatTextObject.new(one,two)
|
|
337
|
+
para=format_text.center
|
|
338
|
+
end
|
|
339
|
+
para.gsub!(/<!.+!>/,' ') if para ## Clean Prepared Text
|
|
340
|
+
para.gsub!(/<:\S+>/,' ') if para ## Clean Prepared Text
|
|
341
|
+
end
|
|
342
|
+
end
|
|
343
|
+
end
|
|
344
|
+
def publish
|
|
345
|
+
content=[]
|
|
346
|
+
content << @@wiki[:open]
|
|
347
|
+
content << @@wiki[:head]
|
|
348
|
+
content << @@wiki[:body]
|
|
349
|
+
Output.new(content.join,@md).wiki
|
|
350
|
+
@@wiki[:head],@@wiki[:body],@@wiki[:tail],@@wiki[:metadata]=[],[],[],[]
|
|
351
|
+
end
|
|
352
|
+
end
|
|
353
|
+
class Output <Source
|
|
354
|
+
include SiSU_Param
|
|
355
|
+
include SiSU_Env
|
|
356
|
+
def initialize(content,md)
|
|
357
|
+
@content,@md=content,md
|
|
358
|
+
end
|
|
359
|
+
def wiki #%wiki output
|
|
360
|
+
SiSU_Env::FileOp.new(@md).mkdir
|
|
361
|
+
filename_wiki=SiSU_Env::FileOp.new(@md,@md.fn[:wiki]).mkfile
|
|
362
|
+
@sisu=[]
|
|
363
|
+
@content.each do |para| # this is a hack
|
|
364
|
+
if para =~/^\S/
|
|
365
|
+
if para !~/^([*=-]|\.){5}/; filename_wiki.puts para #unix wiki
|
|
366
|
+
else filename_wiki.puts para #unix wiki
|
|
367
|
+
end
|
|
368
|
+
else filename_wiki.puts para # if para =~/^\s/
|
|
369
|
+
end
|
|
370
|
+
end
|
|
371
|
+
end
|
|
372
|
+
end
|
|
373
|
+
end
|
|
374
|
+
end
|
|
375
|
+
__END__
|