aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/wikispeak.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/wikispeak.rb')
-rw-r--r--lib/sisu/v5/wikispeak.rb16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/sisu/v5/wikispeak.rb b/lib/sisu/v5/wikispeak.rb
index e9ada3be..ea6c8fe1 100644
--- a/lib/sisu/v5/wikispeak.rb
+++ b/lib/sisu/v5/wikispeak.rb
@@ -68,7 +68,6 @@ module SiSU_Wikispeak
require_relative 'plaintext_format' # plaintext_format.rb
include Format
require_relative 'shared_txt'
- pwd=Dir.pwd
@@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
@@tablefoot=''
class Source
@@ -136,7 +135,7 @@ module SiSU_Wikispeak
end
end
format=@format.dup
- @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]}$/
+ @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]}$/
Format::FormatTextObject.new(format,@text,@ocn)
else
Format::FormatTextObject.new(format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}")
@@ -164,9 +163,8 @@ module SiSU_Wikispeak
publish
end
# Used for extraction of endnotes from paragraphs
- def extract_endnotes(para='')
- notes=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]})/)
- @n=[]
+ def extract_endnotes(para='') #check
+ 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]})/)
end
def wiki_metadata(meta)
util=SiSU_TextUtils::Wrap.new(meta.text,70,15,1)
@@ -212,8 +210,6 @@ WOK
end
def wiki_structure(para='',lv='',ocn='',hname='') #% Used to extract the structure of a document
lv=lv.to_i
- n=lv - 1
- n3=lv + 2
lv=nil if lv==0
extract_endnotes(para)
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
@@ -231,13 +227,12 @@ WOK
end
def markup # Used for major markup instructions
data=@data
- dir=SiSU_Env::InfoEnv.new(@md.fns)
+ SiSU_Env::InfoEnv.new(@md.fns)
@data_mod,@endnotes,@level,@cont,@copen,@wiki_contents_close=Array.new(6){[]}
(0..6).each { |x| @cont[x]=@level[x]=false }
(4..6).each { |x| @wiki_contents_close[x]='' }
wiki_tail
table_message='[table omitted, see other document formats]'
- fix=[]
data.each do |para|
para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{@br}#{table_message}") #fix
para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check
@@ -259,7 +254,6 @@ WOK
para.gsub!(/&nbsp;|#{Mx[:nbsp]}/,' ') # decide on
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 ]")
para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]')
- wordlist=para.scan(/\S+/)
if para =~/^@(\S+?):\s+(.+?)\Z/m # for headers
d_meta=SiSU_TextUtils::HeaderScan.new(@md,para).meta
if d_meta; wiki_metadata(d_meta)
@@ -342,9 +336,7 @@ WOK
end
end
def publish
- divider="="
content=[]
- data=@data
content << @@wiki[:open]
content << @@wiki[:head]
content << @@wiki[:body]