aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2008-11-03 13:44:24 -0500
committerRalph Amissah <ralph@amissah.com>2008-11-03 13:44:24 -0500
commit9458eedd5d4c5b5ece6c258e96d4c37f3cf0cb7b (patch)
tree6dd4b035c24f6f86d0e23b348a4d16c52026fd86 /lib
parentsoftware libré, accent (diff)
dal and param various changes (some affecting other files)
dal, minor changes including related to bold line instruction and, variable name change affecting other files param, header tag for document index, create site index of documents use, add info on document content, harvest info provided from document set for metadata to create site index of documents (similar sub-sytax to book index) also variable name others variable name change, made earlier in dal and param
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v0/dal.rb4
-rw-r--r--lib/sisu/v0/dal_idx.rb10
-rw-r--r--lib/sisu/v0/dal_syntax.rb15
-rw-r--r--lib/sisu/v0/html_segments.rb2
-rw-r--r--lib/sisu/v0/param.rb11
-rw-r--r--lib/sisu/v0/sysenv.rb2
6 files changed, 29 insertions, 15 deletions
diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb
index 094cf53c..1a8f6733 100644
--- a/lib/sisu/v0/dal.rb
+++ b/lib/sisu/v0/dal.rb
@@ -203,7 +203,7 @@ module SiSU_DAL
File.open(marshal_meta,'w'){|f| Marshal.dump(@data.to_a,f)}
end
def idx_html_hard_output
- if @md.book_index and @md.cmd =~/M/
+ if @md.book_idx and @md.cmd =~/M/
filename_meta=@my_make.file_meta_idx_html
@data.each {|s| filename_meta.puts s.strip + "\n" unless s.strip.empty?}
else
@@ -248,7 +248,7 @@ module SiSU_DAL
data=SiSU_images::Images.new(@md,data).images
data=SiSU_document_structure::Tables.new(@md,data).tables
data=SiSU_numbering::Numbering.new(@md,data).numbering_song
- data,book_index,html_idx=SiSU_book_index::Book_index.new(@md,data,@env).indexing_song if @md.book_index
+ data,book_index,html_idx=SiSU_book_index::Book_index.new(@md,data,@env).indexing_song if @md.book_idx
data=SiSU_endnotes::Endnotes.new(@md,data,endnote_array).endnotes
data=SiSU_hash::Object_digest.new(@md,data,@env).object_digest
meta=SiSU_metadata::Metadata.new(@md,data).metadata
diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb
index 36489e74..0b5c74c7 100644
--- a/lib/sisu/v0/dal_idx.rb
+++ b/lib/sisu/v0/dal_idx.rb
@@ -95,7 +95,7 @@ module SiSU_book_index
the_idx=construct_book_index(idx_array)
#screen_print(the_idx) if @md.cmd.inspect =~/V/
sisu_markup_idx,html_idx=nil,nil
- if @md.book_index
+ if @md.book_idx
idx=index(the_idx)
output_html_idx(idx[:html])
html_idx=idx[:html]
@@ -188,7 +188,7 @@ module SiSU_book_index
while letter < f
if alph.length > 0
letter=alph.shift
- @idx[:html] << %{\n<hr />\n<p class="book_index_lev1"><a name="#{letter}">#{letter}</a></p>}
+ @idx[:html] << %{\n<hr />\n<p class="book_index_lev1"><a name="#{letter}">#{letter}</a><p class="book_index_lev1"><a name="#{letter.downcase}"> </a></p>}
else break
end
end
@@ -292,11 +292,11 @@ module SiSU_book_index
end
end
def output_html_idx(html_idx)
- if @md.book_index
+ if @md.book_idx
path="#{@env.path.output}/#{@md.fnb}"
Dir.mkdir(path) unless FileTest.directory?(path)
- html_index_file=File.new("#{path}/#{@md.fn[:book_index]}",'w')
- #puts "#{path}/#{@md.fn[:book_index]}"
+ html_index_file=File.new("#{path}/#{@md.fn[:book_idx]}",'w')
+ #puts "#{path}/#{@md.fn[:book_idx]}"
html_idx.each {|x| html_index_file << x }
html_index_file.close
end
diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb
index cbcd42f9..84ddef92 100644
--- a/lib/sisu/v0/dal_syntax.rb
+++ b/lib/sisu/v0/dal_syntax.rb
@@ -76,6 +76,7 @@ module SiSU_Syntax
tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)}
tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?}
bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)}
+ ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)}
@line_scan_ital=if defined? @md.make_italic[:str] \
and defined? @vz.markup_make_italic[:str]
/#@http_m|#{bold_line}|#@manmkp_ital#{tail_m_ital}|(?:#{@md.make_italic[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/
@@ -150,11 +151,19 @@ module SiSU_Syntax
line
end
def embolden(given)
+ given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})http:\/\/\S+.*?)(<br>)/,"#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2")
+ given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})http:\/\/\S+.*)/,"#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}")
given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)(<br>)/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
given.gsub!(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
end
+ def italicise(given)
+ given.gsub!(/^\/_\s*(.+?)(<br>)/,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2")
+ given.gsub!(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2")
+ given.gsub!(/^\/_\s*(.+?)\s*([~-]#)$/,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2")
+ given.gsub!(/^\/_\s+(.*)?\s*$/,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
+ end
def wordlist_bold(line)
line=line.dup
if (defined? @md.make_bold[:str] \
@@ -177,6 +186,7 @@ module SiSU_Syntax
end
else
if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
+ elsif w =~/^\/_\s+/; italicise(w)
end
end
line_array << w
@@ -189,6 +199,9 @@ module SiSU_Syntax
and line =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/
embolden(line)
end
+ if line =~ /\/_\s+/
+ italicise(line)
+ end
end
line
end
@@ -227,7 +240,7 @@ module SiSU_Syntax
word=line.scan(/\S+|\n/) unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit
if word
word.each do |w| # _ - / # | : ! ^ ~
- unless w =~/^#{Mx[:lv_o]}[0-9]:\S*?#{Mx[:lv_c]}|~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table/
+ unless w =~/^#{Mx[:lv_o]}[0-9]:\S*?#{Mx[:lv_c]}|~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|http:\/\/\S+/
w.gsub!(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
#w.gsub!(/~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}")
end
diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb
index a280a8c8..a67b11b3 100644
--- a/lib/sisu/v0/html_segments.rb
+++ b/lib/sisu/v0/html_segments.rb
@@ -143,7 +143,7 @@ module SiSU_HTML_seg
@h_sfx=@md.sfx if @md.file_type =~/html/
@h_sfx='.html' if @md.file_type =~/html/ #used in creating file, not to be omitted.
idx_html=nil
- if @md.book_index
+ if @md.book_idx
my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
idx_html=SiSU_Particulars::Combined_singleton.instance.get_html_idx(@md.opt).html_idx
idx_html.each {|x| @@seg[:idx] << x }
diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb
index 02d20ed7..6ab30e86 100644
--- a/lib/sisu/v0/param.rb
+++ b/lib/sisu/v0/param.rb
@@ -119,13 +119,13 @@ module SiSU_Param
@doc={ :lv=>[] }
@doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','',''
@@publisher='SiSU scribe'
- attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,: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,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,:dgst,:dgst_skin,: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,:man_section,:man_name,:man_synopsis,:ec,:opt,:sem_tag,:book_index
+ attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,: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,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,:dgst,:dgst_skin,: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,:man_section,:man_name,:man_synopsis,:ec,:opt,:sem_tag,:book_idx,:doc_cont_idx
def initialize(fns_array,opt)
- @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@sfx=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@dc_title=@html_title=@subtitle=@subtitle_tex=@creator_home=@dc_creator=@translator=@illustrator=@prepared_by=@digitized_by=@dc_subject=@dc_description=@dc_publisher=@dc_contributor=@dc_date=@dc_date_created=@dc_date_issued=@dc_date_available=@dc_date_valid=@dc_date_modified=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@dc_type=@dc_format=@dc_identifier=@dc_source=@dc_language=@language_original=@dc_relation=@dc_coverage=@dc_rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_auto_heading_num=@make_bold=@make_italic=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@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=@file_size=@firstseg=@programs=@creator_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@man_synopsis=nil
+ @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@sfx=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@dc_title=@html_title=@subtitle=@subtitle_tex=@creator_home=@dc_creator=@translator=@illustrator=@prepared_by=@digitized_by=@dc_subject=@dc_description=@dc_publisher=@dc_contributor=@dc_date=@dc_date_created=@dc_date_issued=@dc_date_available=@dc_date_valid=@dc_date_modified=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@dc_type=@dc_format=@dc_identifier=@dc_source=@dc_language=@language_original=@dc_relation=@dc_coverage=@dc_rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_auto_heading_num=@make_bold=@make_italic=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@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=@file_size=@firstseg=@programs=@creator_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@man_synopsis=@doc_cont_idx=nil
@man_section=1
@man_name='man page "name/whatis" information not provided, set in header @man: name=[whatis information]'
@data,@fns,@cmd,@mod,@opt=fns_array,opt.fns,opt.cmd,opt.mod,opt #@data used as data
- @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_index=false,false,false,false,false,false,false
+ @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=false,false,false,false,false,false,false
@seg_autoname_safe=true
@sem_tag=false
@markup_instruction,@markup_declared,@image='','','' #check which other values should be set to empty rather than nil
@@ -517,6 +517,7 @@ module SiSU_Param
end
when /^(?:0~suffix|@suffix:)\s+(.+?)$/m; @suffix=$1 #% metainfo
when /^(?:0~information|@information:)\s+(.+?)$/m; @information=$1 #% metainfo
+ when /^(?:0~doc_cont(?:ent)?_in?de?x|@doc_cont(?:ent)?_in?de?x:)\s+(.+?)$/m; @doc_cont_idx=$1 #% metainfo, similar syntax to book index, leave out the ={} i.e. use equivalent of ={(.+?)}
when /^(?:0~contact|@contact:)\s+(.+?)$/m; @contact=$1 #% metainfo
when /^(?:0~icon|@icon:)\s+(.+?)$/m; @icon=$1 #% processing
when /^(?:0~promo|@promo:)\s+(.+?)$/m
@@ -575,8 +576,8 @@ module SiSU_Param
end
end
end
- if not @book_index and para =~/^=\{(.+?)\}\s*$/
- @book_index=true
+ if not @book_idx and para =~/^=\{(.+?)\}\s*$/
+ @book_idx=true
end
unless @code_flag
case para
diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb
index 677c6d09..2481cbdc 100644
--- a/lib/sisu/v0/sysenv.rb
+++ b/lib/sisu/v0/sysenv.rb
@@ -519,7 +519,7 @@ module SiSU_Env
:sxd => filename(code,@fnb,'.sxd.xml'),
:sxn => filename(code,@fnb,'.sxn.xml'),
:sisupod => filename(nil,@fnz,''),
- :book_index => filename(code,'book_index','.html'),
+ :book_idx => filename(code,'book_index','.html'),
}
@fn
end