diff options
author | Ralph Amissah <ralph@amissah.com> | 2008-02-24 22:24:00 +0000 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2008-02-24 22:24:00 +0000 |
commit | 936201557bdd924cf2748570becae1574b1e2866 (patch) | |
tree | 3b070d9cb8e6440c4a3264073a6d280043b6e1ca /lib | |
parent | Updated sisu-0.65.0 (diff) | |
parent | clean screen output (diff) |
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib')
92 files changed, 327 insertions, 57 deletions
diff --git a/lib/sisu/v0/cgi.rb b/lib/sisu/v0/cgi.rb index 4b917360..2318be69 100644 --- a/lib/sisu/v0/cgi.rb +++ b/lib/sisu/v0/cgi.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/cgi_pgsql.rb b/lib/sisu/v0/cgi_pgsql.rb index 540e5d72..148905f4 100644 --- a/lib/sisu/v0/cgi_pgsql.rb +++ b/lib/sisu/v0/cgi_pgsql.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/cgi_sql_common.rb b/lib/sisu/v0/cgi_sql_common.rb index d4be484e..fb011cc0 100644 --- a/lib/sisu/v0/cgi_sql_common.rb +++ b/lib/sisu/v0/cgi_sql_common.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/cgi_sqlite.rb b/lib/sisu/v0/cgi_sqlite.rb index e94986d4..87714f6c 100644 --- a/lib/sisu/v0/cgi_sqlite.rb +++ b/lib/sisu/v0/cgi_sqlite.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/character_encoding.rb b/lib/sisu/v0/character_encoding.rb index e7e1d0ec..60c2f335 100644 --- a/lib/sisu/v0/character_encoding.rb +++ b/lib/sisu/v0/character_encoding.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/composite.rb b/lib/sisu/v0/composite.rb index e0b53bb5..21b6781b 100644 --- a/lib/sisu/v0/composite.rb +++ b/lib/sisu/v0/composite.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index 8408deaf..1b5bbe78 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/conf.rb b/lib/sisu/v0/conf.rb index 2e76d3de..639847ab 100644 --- a/lib/sisu/v0/conf.rb +++ b/lib/sisu/v0/conf.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/css.rb b/lib/sisu/v0/css.rb index 75aa3330..d1798a77 100644 --- a/lib/sisu/v0/css.rb +++ b/lib/sisu/v0/css.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 5edc77be..577c3b9e 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/dal_doc_str.rb b/lib/sisu/v0/dal_doc_str.rb index 68529c38..27e37826 100644 --- a/lib/sisu/v0/dal_doc_str.rb +++ b/lib/sisu/v0/dal_doc_str.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/dal_doc_str_code.rb b/lib/sisu/v0/dal_doc_str_code.rb index 65da8d1f..9596bb69 100644 --- a/lib/sisu/v0/dal_doc_str_code.rb +++ b/lib/sisu/v0/dal_doc_str_code.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/dal_doc_str_tables.rb b/lib/sisu/v0/dal_doc_str_tables.rb index fd5d6fe4..a17eb63f 100644 --- a/lib/sisu/v0/dal_doc_str_tables.rb +++ b/lib/sisu/v0/dal_doc_str_tables.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index a6c48af0..22ec72b0 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU @@ -99,6 +100,7 @@ module Syntax end def songsheet @data.each do |line| + line=if @md.sem_tag then sem(line) else line end line=pre(line) line=wordlist_italics(line) line=wordlist_bold(line) @@ -107,9 +109,11 @@ module Syntax end @data_new end + def sem(line) + line=SiSU_sem::Tags.new(line,@md).rm.all + end def pre(line) line=line.dup - line=SiSU_sem::Tags.new(line).rm.all if line =~/\{(?:t|table)(?:~h)?\s*c?[\d; ]*\}/; line.gsub!(/(\n)/,';;\1') #markup for alternative tables end line diff --git a/lib/sisu/v0/db_columns.rb b/lib/sisu/v0/db_columns.rb index 9adcaa4d..fcb37812 100644 --- a/lib/sisu/v0/db_columns.rb +++ b/lib/sisu/v0/db_columns.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/db_create.rb b/lib/sisu/v0/db_create.rb index ac8f78bf..bf622bef 100644 --- a/lib/sisu/v0/db_create.rb +++ b/lib/sisu/v0/db_create.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/db_dbi.rb b/lib/sisu/v0/db_dbi.rb index 82b0750c..2ecf2816 100644 --- a/lib/sisu/v0/db_dbi.rb +++ b/lib/sisu/v0/db_dbi.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/db_drop.rb b/lib/sisu/v0/db_drop.rb index eb027fb7..fc7b7b61 100644 --- a/lib/sisu/v0/db_drop.rb +++ b/lib/sisu/v0/db_drop.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb index 0c53e5e5..fde6b307 100644 --- a/lib/sisu/v0/db_import.rb +++ b/lib/sisu/v0/db_import.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/db_indexes.rb b/lib/sisu/v0/db_indexes.rb index 457ad124..ab33b450 100644 --- a/lib/sisu/v0/db_indexes.rb +++ b/lib/sisu/v0/db_indexes.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/db_load_tuple.rb b/lib/sisu/v0/db_load_tuple.rb index c69f279b..9098f0ae 100644 --- a/lib/sisu/v0/db_load_tuple.rb +++ b/lib/sisu/v0/db_load_tuple.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/db_remove.rb b/lib/sisu/v0/db_remove.rb index f84e3e05..63d69b64 100644 --- a/lib/sisu/v0/db_remove.rb +++ b/lib/sisu/v0/db_remove.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/db_select.rb b/lib/sisu/v0/db_select.rb index 337fb3e0..0b456262 100644 --- a/lib/sisu/v0/db_select.rb +++ b/lib/sisu/v0/db_select.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/db_tests.rb b/lib/sisu/v0/db_tests.rb index 6974455e..73e0400f 100644 --- a/lib/sisu/v0/db_tests.rb +++ b/lib/sisu/v0/db_tests.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/dbi.rb b/lib/sisu/v0/dbi.rb index 2e633bad..fbe3014b 100644 --- a/lib/sisu/v0/dbi.rb +++ b/lib/sisu/v0/dbi.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 1671bf8b..ef33be04 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/digests.rb b/lib/sisu/v0/digests.rb index 2382fb88..0d2707ff 100644 --- a/lib/sisu/v0/digests.rb +++ b/lib/sisu/v0/digests.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/embedded.rb b/lib/sisu/v0/embedded.rb index 2bd295e2..92853fa6 100644 --- a/lib/sisu/v0/embedded.rb +++ b/lib/sisu/v0/embedded.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/errors.rb b/lib/sisu/v0/errors.rb index 0b7b7a21..2351613c 100644 --- a/lib/sisu/v0/errors.rb +++ b/lib/sisu/v0/errors.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/help.rb b/lib/sisu/v0/help.rb index 35448cd6..f470e0eb 100644 --- a/lib/sisu/v0/help.rb +++ b/lib/sisu/v0/help.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index 740d09c4..b425356a 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 4ca2ff96..fd3089ca 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/html_format_css.rb b/lib/sisu/v0/html_format_css.rb index e00cf410..8ffb4e0d 100644 --- a/lib/sisu/v0/html_format_css.rb +++ b/lib/sisu/v0/html_format_css.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/html_promo.rb b/lib/sisu/v0/html_promo.rb index 973344e9..e769cf1e 100644 --- a/lib/sisu/v0/html_promo.rb +++ b/lib/sisu/v0/html_promo.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/html_scroll.rb b/lib/sisu/v0/html_scroll.rb index ccbb2406..97a1a02e 100644 --- a/lib/sisu/v0/html_scroll.rb +++ b/lib/sisu/v0/html_scroll.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index 687000f1..a2d06ed9 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/html_table.rb b/lib/sisu/v0/html_table.rb index 1ac39daf..556c46be 100644 --- a/lib/sisu/v0/html_table.rb +++ b/lib/sisu/v0/html_table.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 43b0fe70..2e2c5f3e 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb index da1c6324..1e051c24 100644 --- a/lib/sisu/v0/hub.rb +++ b/lib/sisu/v0/hub.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/i18n.rb b/lib/sisu/v0/i18n.rb index 2dc084aa..8ac3ffc8 100644 --- a/lib/sisu/v0/i18n.rb +++ b/lib/sisu/v0/i18n.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/manifest.rb b/lib/sisu/v0/manifest.rb index 2f49c3dd..5ea0baab 100644 --- a/lib/sisu/v0/manifest.rb +++ b/lib/sisu/v0/manifest.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb index 0657b0b6..e267de48 100644 --- a/lib/sisu/v0/manpage.rb +++ b/lib/sisu/v0/manpage.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/manpage_format.rb b/lib/sisu/v0/manpage_format.rb index 7ec699f0..978cc6b4 100644 --- a/lib/sisu/v0/manpage_format.rb +++ b/lib/sisu/v0/manpage_format.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index f168ddc4..12c84ac3 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/odf_format.rb b/lib/sisu/v0/odf_format.rb index f704ea45..54a32e25 100644 --- a/lib/sisu/v0/odf_format.rb +++ b/lib/sisu/v0/odf_format.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/options.rb b/lib/sisu/v0/options.rb index 8ac17330..e433c304 100644 --- a/lib/sisu/v0/options.rb +++ b/lib/sisu/v0/options.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index 546606af..f9d15a22 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU @@ -118,7 +119,7 @@ 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,: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 + 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,: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 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 @man_section=1 @@ -126,6 +127,7 @@ module SiSU_Param @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=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 @markup=@markup_instruction #use @markup_instruction @doc,@fn,@make_italic,@make_bold,@tag_hash,@ec={},{},{},{},{},{},{} @@ -214,6 +216,7 @@ module SiSU_Param fns_array=@data.dup skip unless fns_array # consider @markup_version=SiSU_Markup_type::Markup_identify.new(fns_array,@opt).markup_version? #% determine markup version + if @markup_version >= 0.65 then @sem_tag=true end if fns_array[0] =~ /^(?:% )?(?:SiSU\s+(?:master\s+)?[\d.]*|sisu-[\d.]+)$/ #check markup and markup version if fns_array[0] =~ /^(?:% )?(?:SiSU\s+(?:master\s+)?|sisu-)[\d.]+$/ #check markup and markup version @markup_version_declared=fns_array[0].match(/^(?:% )?(?:SiSU\s+(?:master\s+)?|sisu-)([\d.]+)$/)[1] diff --git a/lib/sisu/v0/param_identify_markup.rb b/lib/sisu/v0/param_identify_markup.rb index 5124e89b..056fcc49 100644 --- a/lib/sisu/v0/param_identify_markup.rb +++ b/lib/sisu/v0/param_identify_markup.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU @@ -76,28 +77,54 @@ module SiSU_Markup_type or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ @version_declared=$1 end - @flag_57,@flag_38=false,false + @flat_66,@flag_57,@flag_38=false,false,false @cont.each_with_index do |y,i| - if @flag_57 \ - or y =~/^:?A~\?? @title/ - @version_determined=0.57 - @flag_57=true - break + if y =~/^(?:0\{?~links?|@links?:)\s/ + links=unless y =~/\{.+?\}\S+/; oldlinks=' (pre 0.20.4 header links)' + else ' (post 0.20.4 header links)' + end + end + unless @flag_38 + if y =~/^:?A~/ + version='0.38' + @version_determined=version + @flag_38=true + end end - if @flag_38 \ - or y =~/^:?A~/ - @version_determined=0.38 - @flag_38=true - break if i >= 200 - if y =~ /(?:~{\*+|~\[\*|~\[\+)\s/ - @version_determined=0.42 #0.38 can safely be treated as 0.42 + if @flag_38 + if @flag_66 \ + or y =~/[:;]\{.+?\}[:;][a-z+]/ + version='0.66' + @version_determined=version + @flag_66=true break end end - if y =~/^0~/ \ - and not @flag_38 - @version_determined=0.16 - break + end + @flag_57,@flag_38=false,false + unless @flag_66 + @cont.each_with_index do |y,i| + if @flag_57 \ + or y =~/^:?A~\?? @title/ + @version_determined=0.57 + @flag_57=true + break + end + if @flag_38 \ + or y =~/^:?A~/ + @version_determined=0.38 + @flag_38=true + break if i >= 200 + if y =~ /(?:~{\*+|~\[\*|~\[\+)\s/ + @version_determined=0.42 #0.38 can safely be treated as 0.42 + break + end + end + if y =~/^0~/ \ + and not @flag_38 + @version_determined=0.16 + break + end end end @@fns=@opt.fns diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index 5beac25e..2cf26b93 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/plaintext_format.rb b/lib/sisu/v0/plaintext_format.rb index 9afe4450..1840daa6 100644 --- a/lib/sisu/v0/plaintext_format.rb +++ b/lib/sisu/v0/plaintext_format.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/relaxng.rb b/lib/sisu/v0/relaxng.rb index fd847fac..1b78651b 100644 --- a/lib/sisu/v0/relaxng.rb +++ b/lib/sisu/v0/relaxng.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/remote.rb b/lib/sisu/v0/remote.rb index 3f2a5850..4cfa9347 100644 --- a/lib/sisu/v0/remote.rb +++ b/lib/sisu/v0/remote.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/response.rb b/lib/sisu/v0/response.rb index b8835c64..ba3c1a82 100644 --- a/lib/sisu/v0/response.rb +++ b/lib/sisu/v0/response.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/rexml.rb b/lib/sisu/v0/rexml.rb index 4b01ebef..4620c3ab 100644 --- a/lib/sisu/v0/rexml.rb +++ b/lib/sisu/v0/rexml.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/screen_text_color.rb b/lib/sisu/v0/screen_text_color.rb index f6b7c850..0a2fb713 100644 --- a/lib/sisu/v0/screen_text_color.rb +++ b/lib/sisu/v0/screen_text_color.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/share_src.rb b/lib/sisu/v0/share_src.rb index e7a23e6c..87569cfa 100644 --- a/lib/sisu/v0/share_src.rb +++ b/lib/sisu/v0/share_src.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/share_src_kdissert.rb b/lib/sisu/v0/share_src_kdissert.rb index fe7985fd..3f9cdebb 100644 --- a/lib/sisu/v0/share_src_kdissert.rb +++ b/lib/sisu/v0/share_src_kdissert.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/shared_html.rb b/lib/sisu/v0/shared_html.rb index aced56c7..bb570347 100644 --- a/lib/sisu/v0/shared_html.rb +++ b/lib/sisu/v0/shared_html.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index 9f646790..106a56af 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/shared_sem.rb b/lib/sisu/v0/shared_sem.rb index a082cfc2..0fd5b46c 100644 --- a/lib/sisu/v0/shared_sem.rb +++ b/lib/sisu/v0/shared_sem.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU @@ -60,45 +61,72 @@ =end module SiSU_sem + require "#{SiSU_lib}/param" class Tags - def initialize(para) - @para=para + def initialize(para,md) + @para,@md=para,md end def rgx def exclude - /^<:code>/ + /^(?:<:code>|%+ )/ end def each_csc - /\b[a-z]+[:;]\{|\}[:;][a-z]+\b/m - #/\b(?:[a-z]+(?:[_.][a-z]+)+|[a-z]+)[:;]\{|\}[:;](?:[a-z]+(?:[_.][a-z]+)+|[a-z]+)\b/m + /(?:;|(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]*):)\{|\}[:;][a-z]+(?:[_:.][a-z]+)*/m end def each_c - /\b[a-z]+:\{|\}:[a-z]+\b/m - #/\b(?:[a-z]+(?:[_.][a-z]+)+|[a-z]+):\{|\}:(?:[a-z]+(?:[_.][a-z]+)+|[a-z]+)\b/m + /(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]*):\{|\}:[a-z]+(?:[_:.][a-z]+)*/m end def each_sc - /\b[a-z]+;\{|\};[a-z]+\b/m - #/\b(?:[a-z]+(?:[_.][a-z]+)+|[a-z]+);\{|\};(?:[a-z]+(?:[_.][a-z]+)+|[a-z]+)\b/m + /(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]*);\{|\};[a-z]+(?:[_:.][a-z]+)*/m end def pair_csc - /(([a-z]+)(?::\{(.+?)\}:\2|;\{(.+?)\};\2))/m - #/(([a-z]+(?:[_.][a-z]+)+|[a-z]+)(?::\{(.+?)\}:\2|;\{(.+?)\};\2))/m + /(([a-z]+(?:[_:.][a-z]+)+|[a-z]+)(?::\{(.+?)\}:\2)|([:;])\{(.+?)\}\4[a-z]+(?:[_:.][a-z]+)*)/m end def pair_c - /(([a-z]+):\{(.+?)\}:\2)/m - #/(([a-z]+(?:[_.][a-z]+)+|[a-z]+):\{(.+?)\}:\2)/m + /(([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\2)|:\{(.+?)\}:[a-z]+(?:[_:.][a-z]+)*)/m end def pair_sc - /(([a-z]+);\{.+?\};\2)/m - #/(([a-z]+(?:[_.][a-z]+)+|[a-z]+);\{.+?\};\2)/m + /(;\{.+?\};[a-z]+(?:[_:.][a-z]+)*)/m end def whole_csc_ae - /(([a-z]+)(?::\[(.+?)\]:\2|;\[(.+?)\];\2))/m - #/(([a-z]+(?:[_.][a-z]+)+|[a-z]+)(?::\[(.+?)\]:\2|;\[(.+?)\];\2))/m + /(([a-z]+(?:[_.][a-z]+)+|[a-z]*)(?::\[(.+?)\]:\2)|;\{(.+?)\};(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]+)\b)/m end def each_csc_ae - /\b[a-z]+[:;]\[|\][:;][a-z]+\b/m - #/\b(?:[a-z]+(?:[_.][a-z]+)+|[a-z]+)[:;]\[|\][:;](?:[a-z]+(?:[_.][a-z]+)+|[a-z]+)\b/m + /(?:;|(?:[a-z]+(?:[_:.][a-z]+)+)*:|[a-z]*:)\[|\][:;](?:[a-z]+(?:[_:.][a-z]+)+|[a-z]+)/m + end + self + end + def print + def scan_pair_c + if @para =~ rgx.pair_c + matched=@para.scan(rgx.pair_c).flatten + puts matched[0] unless matched[0].nil? + end + end + def scan_pair_sc + matched=@para.scan(rgx.pair_sc).flatten + puts matched[0] unless matched[0].nil? + end + def if_pair_c + if @para=~/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m; puts "#{$1}:{ #{$2} }:#{$1}" + end + end + def if_pair_sc + if @para=~/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/; puts ";{ #{$1} };#{$2}" + end + end + def match_pair_c + matched=[] + matched=rgx.pair_c.match(@para)[1] if @para =~ rgx.pair_c + puts matched unless matched.nil? + end + def match_pair_sc + matched=[] + matched=rgx.pair_sc.match(@para)[1] if @para =~ rgx.pair_sc + puts matched unless matched.nil? + end + def matching + scan_pair_c end self end @@ -118,8 +146,12 @@ module SiSU_sem @para end def all - sem_marker_parts - sem_marker_added_extra_parts + if @md.sem_tag + #print.matching + sem_marker_parts + sem_marker_added_extra_parts + end + @para end self end diff --git a/lib/sisu/v0/shared_txt.rb b/lib/sisu/v0/shared_txt.rb index 82b99cb1..aaa2d4d7 100644 --- a/lib/sisu/v0/shared_txt.rb +++ b/lib/sisu/v0/shared_txt.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index fd27c664..abc6cc1a 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU @@ -154,10 +155,44 @@ module SiSU_XML_munge class Trans require "#{SiSU_lib}/defaults" def initialize(md) + @md=md @sys=SiSU_Env::System_call.new - @dir=SiSU_Env::Info_env.new(md.fns) + @dir=SiSU_Env::Info_env.new(@md.fns) @dp=SiSU_Env::Info_env.new.digest.pattern @url_brace=SiSU_Viz::Skin.new.url_decoration + if @md.sem_tag + @ab ||=semantic_tags.default + end + end + def semantic_tags + def default + { + :pub => 'publication', + :ref => 'reference', + :desc => 'description', + :conv => 'convention', + :vol => 'volume', + :pg => 'page', + :ct => 'cite', + :cty => 'city', + :org => 'organization', + :d => 'date', + :t => 'title', + :a => 'author', + :n => 'name', + :fn => 'firstname', + :f => 'firstname', + :mn => 'middlename', + :m => 'middlename', + :ln => 'lastname', + :l => 'lastname', + :i => 'initials', + :q => 'quote', + :y => 'year', + :ab => 'abreviation', + } + end + self end def char_enc #character encode def utf8(para='') @@ -348,10 +383,8 @@ module SiSU_XML_munge end end def markup(para='') - #if para !~/^<:code>/ - wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 - para=tidywords(wordlist).join(' ').strip - #end + wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 + para=tidywords(wordlist).join(' ').strip para.gsub!(/(^|\s+)<\s+/,'\1< '); para.gsub!(/\s+>(\s+|$)/,' >\1') para.gsub!(/<:pb>\s*/,'') para.gsub!(/<+[-~]#>+/,'') @@ -426,6 +459,52 @@ module SiSU_XML_munge para.gsub!(/<(\/?en)>/,'<\1>') para end + def xml_sem_block_paired(matched) # colon depth: many, recurs + matched.gsub!(/\b(a):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:a]} depth="many">\\2</sem:#{@ab[:a]}>}) # sem : + matched.gsub!(/\b(vol):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:vol]} depth="many">\\2</sem:#{@ab[:vol]}>}) # sem : + matched.gsub!(/\b(pub):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:pub]} depth="many">\\2</sem:#{@ab[:pub]}>}) # sem : + matched.gsub!(/\b(ref):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ref]} depth="many">\\2</sem:#{@ab[:ref]}>}) # sem : + matched.gsub!(/\b(desc):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:desc]} depth="many">\\2</sem:#{@ab[:desc]}>}) # sem : + matched.gsub!(/\b(conv):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:conv]} depth="many">\\2</sem:#{@ab[:conv]}>}) # sem : + matched.gsub!(/\b(ct):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ct]} depth="many">\\2</sem:#{@ab[:ct]}>}) # sem : + matched.gsub!(/\b(cty):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:cty]} depth="many">\\2</sem:#{@ab[:cty]}>}) # sem : + matched.gsub!(/\b(org):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:org]} depth="many">\\2</sem:#{@ab[:org]}>}) # sem : + matched.gsub!(/\b(d):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:d]} depth="many">\\2</sem:#{@ab[:d]}>}) # sem : + matched.gsub!(/\b(n):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:n]} depth="many">\\2</sem:#{@ab[:n]}>}) # sem : + matched.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m,'<sem:\1 depth="many">\2</sem:\1>') # sem : + end + def xml_semantic_tags(para) + if @md.sem_tag + para.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) } # sem : + para.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) } # sem : + para.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) } # sem : + #colon one / single / flat / shallow + para.gsub!(/:\{(.+?)\}:a\b/m, %{<sem:#{@ab[:a]} depth="one">\\1</sem:#{@ab[:a]}>}) # sem : + para.gsub!(/:\{(.+?)\}:n\b/m, %{<sem:#{@ab[:n]} depth="one">\\1</sem:#{@ab[:n]}>}) # sem : + para.gsub!(/:\{(.+?)\}:t\b/m, %{<sem:#{@ab[:t]} depth="one">\\1</sem:#{@ab[:t]}>}) # sem : + para.gsub!(/:\{(.+?)\}:ref\b/m, %{<sem:#{@ab[:ref]} depth="one">\\1</sem:#{@ab[:ref]}>}) # sem : + para.gsub!(/:\{(.+?)\}:desc\b/m, %{<sem:#{@ab[:desc]} depth="one">\\1</sem:#{@ab[:desc]}>}) # sem : + para.gsub!(/:\{(.+?)\}:cty\b/m, %{<sem:#{@ab[:cty]} depth="one">\\1</sem:#{@ab[:cty]}>}) # sem : + para.gsub!(/:\{(.+?)\}:org\b/m, %{<sem:#{@ab[:org]} depth="one">\\1</sem:#{@ab[:org]}>}) # sem : + para.gsub!(/:\{(.+?)\}:([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="one">\1</sem:\2>') # sem : + #semicolon zero / none + para.gsub!(/;\{([^}]+(?![;]))\};t\b/m, %{<sem:#{@ab[:t]} depth="zero">\\1</sem:#{@ab[:t]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};q\b/m, %{<sem:#{@ab[:q]} depth="zero">\\1</sem:#{@ab[:q]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};ref\b/m, %{<sem:#{@ab[:ref]} depth="zero">\\1</sem:#{@ab[:ref]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};desc\b/m,%{<sem:#{@ab[:desc]} depth="zero">\\1</sem:#{@ab[:desc]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};y\b/m, %{<sem:#{@ab[:y]} depth="zero">\\1</sem:#{@ab[:y]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};ab\b/m, %{<sem:#{@ab[:ab]} depth="zero">\\1</sem:#{@ab[:ab]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};pg\b/m, %{<sem:#{@ab[:pg]} depth="zero">\\1</sem:#{@ab[:pg]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};fn?\b/m, %{<sem:#{@ab[:fn]} depth="zero">\\1</sem:#{@ab[:fn]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};mn?\b/m, %{<sem:#{@ab[:mn]} depth="zero">\\1</sem:#{@ab[:mn]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};ln?\b/m, %{<sem:#{@ab[:ln]} depth="zero">\\1</sem:#{@ab[:ln]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};i\b/m, %{<sem:#{@ab[:i]} depth="zero">\\1</sem:#{@ab[:i]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};org\b/m, %{<sem:#{@ab[:org]} depth="zero">\\1</sem:#{@ab[:org]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};cty\b/m, %{<sem:#{@ab[:cty]} depth="zero">\\1</sem:#{@ab[:cty]}>}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="zero">\1</sem:\2>') # sem ; + end + para + end end end module SiSU_XML_tags #Format diff --git a/lib/sisu/v0/sisupod_make.rb b/lib/sisu/v0/sisupod_make.rb index 669ff49f..cb627bcf 100644 --- a/lib/sisu/v0/sisupod_make.rb +++ b/lib/sisu/v0/sisupod_make.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/sitemaps.rb b/lib/sisu/v0/sitemaps.rb index 3742a786..2805d0a6 100644 --- a/lib/sisu/v0/sitemaps.rb +++ b/lib/sisu/v0/sitemaps.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/spell.rb b/lib/sisu/v0/spell.rb index 03badae9..477a472f 100644 --- a/lib/sisu/v0/spell.rb +++ b/lib/sisu/v0/spell.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/sst_convert_markup.rb b/lib/sisu/v0/sst_convert_markup.rb index 6ae38396..dfad95d9 100644 --- a/lib/sisu/v0/sst_convert_markup.rb +++ b/lib/sisu/v0/sst_convert_markup.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/sst_do_inline_footnotes.rb b/lib/sisu/v0/sst_do_inline_footnotes.rb index c59c29fc..3ee301f2 100644 --- a/lib/sisu/v0/sst_do_inline_footnotes.rb +++ b/lib/sisu/v0/sst_do_inline_footnotes.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/sst_from_kdissert.rb b/lib/sisu/v0/sst_from_kdissert.rb index 75352ca5..04e71b49 100644 --- a/lib/sisu/v0/sst_from_kdissert.rb +++ b/lib/sisu/v0/sst_from_kdissert.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/sst_from_xml.rb b/lib/sisu/v0/sst_from_xml.rb index d93e68b8..af43e611 100644 --- a/lib/sisu/v0/sst_from_xml.rb +++ b/lib/sisu/v0/sst_from_xml.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU @@ -99,6 +100,10 @@ module SiSU_sst_from_xml text.gsub!(/<i>(.+?)<\/i>/,'/{\1}/') text.gsub!(/<b>(.+?)<\/b>/,'*{\1}*') text.gsub!(/<u>(.+?)<\/u>/,'_{\1}_') + text.gsub!(/<sem:([a-z_]+)\s+depth=['"]zero['"]>(\s*.+?\s*)<\/sem:\1>/,';{ \2 };\1') + text.gsub!(/<sem:([a-z_]+)\s+depth=['"]one['"]>(\s*.+?\s*)<\/sem:\1>/,':{ \2 }:\1') + text.gsub!(/<sem:([a-z_]+)\s+depth=['"]many['"]>(\s*.+?\s*)<\/sem:\1>/,'\1:{ \2 }:\1') + text.gsub!(/<sem:([a-z_]+)>(\s*.+?\s*)<\/sem:\1>/,'\1:{ \2 }:\1') text.gsub!(/\s +/,' ') text.strip! #text.gsub!(/<header>(.+?)<\/header/,"@#{x.name}: \\1\n\n") @@ -126,7 +131,7 @@ module SiSU_sst_from_xml sax end def dom - raise "#{__FILE}::#{__LINE__} xml dom representation to sst not yet implemented (experimental simple xml representations sax and node to sst are in place)." + raise "#{__FILE__}::#{__LINE__} xml dom representation to sst not yet implemented (experimental simple xml representations sax and node to sst are in place)." end def xml_to_sisu unless @opt.files.empty? diff --git a/lib/sisu/v0/sst_identify_markup.rb b/lib/sisu/v0/sst_identify_markup.rb index 0f60b916..a9eb4d32 100644 --- a/lib/sisu/v0/sst_identify_markup.rb +++ b/lib/sisu/v0/sst_identify_markup.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU @@ -113,7 +114,7 @@ WOK or cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ @declared_markup=$1 end - @flat_65,@flag_57,@flag_38=false,false,false + @flat_66,@flag_57,@flag_38=false,false,false cont.each_with_index do |y,i| if y =~/^(?:0\{?~links?|@links?:)\s/ \ and f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])/ @@ -129,16 +130,16 @@ WOK end end if @flag_38 - if @flag_65 \ + if @flag_66 \ or y =~/[a-z+][:;]\{.+?\}[:;][a-z+]/ - version='0.65' - markup=Markup_inform.new(version,'0.65' + oldlinks,@declared_markup,@declared_type) - @flag_65=true + version='0.66' + markup=Markup_inform.new(version,'0.66' + oldlinks,@declared_markup,@declared_type) + @flag_66=true break end end end - unless @flag_65 + unless @flag_66 cont.each_with_index do |y,i| if y =~/^(?:0\{?~links?|@links?:)\s/ \ and f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])/ @@ -244,6 +245,14 @@ WOK def initialize(opt) @opt=opt end + def sisu_0_66 + <<WOK + SiSU 0.66 same as previous, adds semantic tags + /[:;]\{.+?\}[:;][a-z+]/ + e.g. :{ Ralph last;{Amissah};last }:author + +WOK + end def sisu_0_65 <<WOK SiSU 0.65 same as previous, adds semantic tags @@ -366,7 +375,9 @@ WOK tell=if @opt.mod.inspect =~/--query/ tell=case @opt.mod.inspect when /history/ - "#{sisu_0_65}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}\n#{sisu_0_37}\n#{sisu_0_16}\n#{sisu_0_1}" + "#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}\n#{sisu_0_37}\n#{sisu_0_16}\n#{sisu_0_1}" + when /0.66/ + "#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}" when /0.65/ "#{sisu_0_65}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}" when /0.57/ diff --git a/lib/sisu/v0/sst_to_s_xml_dom.rb b/lib/sisu/v0/sst_to_s_xml_dom.rb index a1c81532..f9c190bf 100644 --- a/lib/sisu/v0/sst_to_s_xml_dom.rb +++ b/lib/sisu/v0/sst_to_s_xml_dom.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU @@ -161,7 +162,7 @@ module SiSU_simple_xml_model_dom para.gsub!(/~\{([*+]+)\s+(.+?)\}~/, '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') para.gsub!(/~\{(.+?)\}~/, - '<endnote><note>\2</note></endnote> ') + '<endnote><note>\1</note></endnote> ') end def xml_head(meta) txt=meta.text @@ -356,7 +357,7 @@ WOK (0..6).each { |x| @cont[x]=@level[x]=false } (4..6).each { |x| @xml_contents_close[x]='' } data.each do |para| - para=SiSU_sem::Tags.new(para).rm.all + #para=SiSU_sem::Tags.new(para,@md).rm.all wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 para=tidywords(wordlist).join(' ').strip para.gsub!(/<[-~]#>/,'') @@ -546,10 +547,19 @@ WOK include SiSU_Env def initialize(data,md) @data,@md=data,md + @trans=SiSU_XML_munge::Trans.new(@md) end def xml @sisu=[] @data.each do |para| + if para !~/^\s*(?:%+ |<:code>)/ + if @md.sem_tag and para =~/[:;]\{|\}[:;]/ + para=@trans.xml_semantic_tags(para) + end + if para =~/[:;]\{|\}[:;]/ + para=SiSU_sem::Tags.new(para,@md).rm.all + end + end para.gsub!(/\/\{(.+?)\}\//,'<italic>\1</italic>') para.gsub!(/\*\{(.+?)\}\*/,'<bold>\1</bold>') para.gsub!(/!\{(.+?)\}!/,'<bold>\1</bold>') diff --git a/lib/sisu/v0/sst_to_s_xml_node.rb b/lib/sisu/v0/sst_to_s_xml_node.rb index b6d7c9b2..a2656e3e 100644 --- a/lib/sisu/v0/sst_to_s_xml_node.rb +++ b/lib/sisu/v0/sst_to_s_xml_node.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU @@ -399,7 +400,6 @@ WOK @data=@data.join.split("\n\n") @data=SiSU_document_structure::Code.new(@md,@data).code @data.each do |para| - para=SiSU_sem::Tags.new(para).rm.all data << SiSU_document_structure::Structure.new(@md,para).structure end data=Syntax::Markup.new(@md,data).songsheet @@ -416,6 +416,15 @@ WOK obj.each do |o| para=o.txt unless o.txt =~/^%% / #comments are lost, consider if para + if para !~/^\s*(?:%+ |<:code>)/ + if @md.sem_tag and para =~/[:;]\{|\}[:;]/ + para=@trans.xml_semantic_tags(para) + end + if para =~/[:;]\{|\}[:;]/ + para=SiSU_sem::Tags.new(para,@md).rm.all + end + end + para=SiSU_sem::Tags.new(para,@md).rm.all para=@trans.markup_light(para) @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 if para =~/\A(?:@|0~)(\S+?):?\s+(.+?)\Z/m # for headers diff --git a/lib/sisu/v0/sst_to_s_xml_sax.rb b/lib/sisu/v0/sst_to_s_xml_sax.rb index 5e4eb5ea..4625779d 100644 --- a/lib/sisu/v0/sst_to_s_xml_sax.rb +++ b/lib/sisu/v0/sst_to_s_xml_sax.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU @@ -262,7 +263,14 @@ WOK data << SiSU_document_structure::Structure.new(@md,para).structure end data.each do |para| - para=SiSU_sem::Tags.new(para).rm.all + if para !~/^\s*(?:%+ |<:code>)/ + if @md.sem_tag and para =~/[:;]\{|\}[:;]/ + para=@trans.xml_semantic_tags(para) + end + if para =~/[:;]\{|\}[:;]/ + para=SiSU_sem::Tags.new(para,@md).rm.all + end + end para=@trans.markup_light(para) @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 if para =~/\A(?:@|0~)(\S+?):?\s+(.+?)\Z/m # for headers diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index fb3daefe..9cf14507 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/termsheet.rb b/lib/sisu/v0/termsheet.rb index 2a50eb4f..688ce3d6 100644 --- a/lib/sisu/v0/termsheet.rb +++ b/lib/sisu/v0/termsheet.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/texinfo.rb b/lib/sisu/v0/texinfo.rb index b6133ed7..2b10c04c 100644 --- a/lib/sisu/v0/texinfo.rb +++ b/lib/sisu/v0/texinfo.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/texinfo_format.rb b/lib/sisu/v0/texinfo_format.rb index 6564460a..5bcdf04d 100644 --- a/lib/sisu/v0/texinfo_format.rb +++ b/lib/sisu/v0/texinfo_format.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index f11e456d..5b8e020f 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index ba84f323..03bdd184 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/update.rb b/lib/sisu/v0/update.rb index 9f14a7e1..abb3736c 100644 --- a/lib/sisu/v0/update.rb +++ b/lib/sisu/v0/update.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/urls.rb b/lib/sisu/v0/urls.rb index c6e8d325..1d401f12 100644 --- a/lib/sisu/v0/urls.rb +++ b/lib/sisu/v0/urls.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/webrick.rb b/lib/sisu/v0/webrick.rb index 2b3110d0..5432a81d 100644 --- a/lib/sisu/v0/webrick.rb +++ b/lib/sisu/v0/webrick.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/wikispeak.rb b/lib/sisu/v0/wikispeak.rb index ec74afce..8ac3b351 100644 --- a/lib/sisu/v0/wikispeak.rb +++ b/lib/sisu/v0/wikispeak.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/xhtml.rb b/lib/sisu/v0/xhtml.rb index 6d808266..fa022db1 100644 --- a/lib/sisu/v0/xhtml.rb +++ b/lib/sisu/v0/xhtml.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb index e17958dd..9a88c09c 100644 --- a/lib/sisu/v0/xml.rb +++ b/lib/sisu/v0/xml.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/xml_dom.rb b/lib/sisu/v0/xml_dom.rb index 020393c1..a25afdc8 100644 --- a/lib/sisu/v0/xml_dom.rb +++ b/lib/sisu/v0/xml_dom.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/xml_fictionbook.rb b/lib/sisu/v0/xml_fictionbook.rb index cf47d16a..9e9a42f9 100644 --- a/lib/sisu/v0/xml_fictionbook.rb +++ b/lib/sisu/v0/xml_fictionbook.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/xml_format.rb b/lib/sisu/v0/xml_format.rb index cac39981..5558bd80 100644 --- a/lib/sisu/v0/xml_format.rb +++ b/lib/sisu/v0/xml_format.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/xml_md_oai_pmh_dc.rb b/lib/sisu/v0/xml_md_oai_pmh_dc.rb index 870eee5f..f4b0a53f 100644 --- a/lib/sisu/v0/xml_md_oai_pmh_dc.rb +++ b/lib/sisu/v0/xml_md_oai_pmh_dc.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/xml_scaffold.rb b/lib/sisu/v0/xml_scaffold.rb index 7d43e3ef..ae8a0cc0 100644 --- a/lib/sisu/v0/xml_scaffold.rb +++ b/lib/sisu/v0/xml_scaffold.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/xml_tables.rb b/lib/sisu/v0/xml_tables.rb index be8c1dd1..1e08f3eb 100644 --- a/lib/sisu/v0/xml_tables.rb +++ b/lib/sisu/v0/xml_tables.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v0/zap.rb b/lib/sisu/v0/zap.rb index 6b1805c1..268f3c40 100644 --- a/lib/sisu/v0/zap.rb +++ b/lib/sisu/v0/zap.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU |