diff options
author | Ralph Amissah <ralph@amissah.com> | 2013-09-21 00:57:26 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2013-09-21 00:57:26 -0400 |
commit | 1f3f3a745f89dc0d7d85edb12e5b95940e8872dd (patch) | |
tree | d55b7ab58ac6f19c8a26939ad9e0da41ebf99748 | |
parent | debian/changelog (4.2.3-2) (diff) | |
parent | Rakefile to assist in placing sisu markup under po4a management (sisu_manual) (diff) |
Merge tag 'sisu_4.2.4' into debian/sid
SiSU 4.2.4
-rw-r--r-- | data/doc/sisu/CHANGELOG_v4 | 31 | ||||
-rw-r--r-- | data/doc/sisu/CHANGELOG_v5 | 27 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/Rakefile | 404 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn.yml | 2 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn_monolingual.yml | 137 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft.yml | 2 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft_monolingual.yml | 137 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_lng.yml | 2 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu.ssm (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu.ssm) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_commands.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_config.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_config.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_content_directories.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_content_directories.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_css.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_css.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_description.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_description.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_download.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_download.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_examples.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_examples.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_faq.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_faq.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_filetypes.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_filetypes.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_help.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_help.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_help_sources.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_help_sources.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_homepages.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_homepages.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_how.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_how.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_howto.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_howto.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_installation.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_installation.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_interesting_to_whom.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_interesting_to_whom.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_introduction.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_introduction.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_manual.ssm (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_manual.ssm) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_markup.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_markup.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_markup_syntax_history.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_markup_syntax_history.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_output_overview.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_output_overview.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_postgresql.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_postgresql.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_quickstart.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_quickstart.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_remote.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_remote.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_search.ssm (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_search.ssm) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_search_cgi.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_search_cgi.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_search_intro.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_search_intro.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_short_feature_summary.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_short_feature_summary.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_sql.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_sql.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_sqlite.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_sqlite.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_synopsis.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_synopsis.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_syntax_highlighting.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_syntax_highlighting.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_webrick.sst (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_webrick.sst) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/en/sisu_work_needed_and_wishlist.ssi (renamed from data/doc/sisu/markup-samples/sisu_manual/sisu_work_needed_and_wishlist.ssi) | 0 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/sisu_manual/translation_languages | 1 | ||||
-rw-r--r-- | data/sisu/v4/v/version.yml | 6 | ||||
-rw-r--r-- | data/sisu/v5/v/version.yml | 6 | ||||
-rw-r--r-- | lib/sisu/v4/constants.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v4/dal_doc_str.rb | 54 | ||||
-rw-r--r-- | lib/sisu/v4/dal_idx.rb | 101 | ||||
-rw-r--r-- | lib/sisu/v4/dal_syntax.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v4/db_import.rb | 30 | ||||
-rw-r--r-- | lib/sisu/v4/hub.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v4/i18n.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v4/options.rb | 11 | ||||
-rw-r--r-- | lib/sisu/v4/param_make.rb | 24 | ||||
-rw-r--r-- | lib/sisu/v4/sysenv.rb | 51 | ||||
-rw-r--r-- | lib/sisu/v4/texpdf_format.rb | 48 | ||||
-rw-r--r-- | lib/sisu/v4/utils.rb | 1 | ||||
-rw-r--r-- | lib/sisu/v5/constants.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v5/dal_syntax.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v5/hub.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v5/i18n.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v5/options.rb | 11 | ||||
-rw-r--r-- | lib/sisu/v5/param_make.rb | 24 | ||||
-rw-r--r-- | lib/sisu/v5/sysenv.rb | 51 | ||||
-rw-r--r-- | lib/sisu/v5/texpdf_format.rb | 48 | ||||
-rw-r--r-- | lib/sisu/v5/utils.rb | 1 |
67 files changed, 1095 insertions, 147 deletions
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index 1992e796..1e28e882 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -23,6 +23,37 @@ v2 branch is removed; it is available in sisu =< 3.3.2 %% Reverse Chronological: +%% 4.2.4.orig.tar.xz (2013-09-21:37/6) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.4 +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.4-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_4.2.4.orig.tar.xz + sisu_4.2.4.orig.tar.xz + sisu_4.2.4-1.dsc + +* i18n CJK: zh ja ko, add languages Chinese, Japanese, Korean + * texpdf, has large texlive xetex dependencies (Korean untested) + * [concordance, untouched does nothing cjk, decide whether to disable] + +* sisu_manual, (in markup-samples) move to en/ sub-dir (permitting translations) + * use of language sub-dir for source sisu markup suited to permitting + translation management by po4a + * sisurc.yml minor + * Rakefile to help place sisu markup in a source language directory under po4a + management + +* Rakefile to assist in placing sisu markup under po4a management (sisu_manual) + * Provided as an example with sisu_manual + * fairly generic, but potentially dangerous, can be used to place sisu markup + source translations under po4a management, but user needs to know what this + is, (and how to set it up, hence sisu_manual as an example (despite the lack + of translations)) as can clobber/destroy files that are not managed by po4a. + +* dal, objects, store book index as hash (simplify downstream processing), and + associated downstream processing change from v5 + * db, book index, convert hash back to string + +* minor cleaning + %% 4.2.3.orig.tar.xz (2013-09-07:35/6) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.3 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.3-1 diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 341b06ef..9614e6c3 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -23,6 +23,33 @@ v2 branch is removed; it is available in sisu =< 3.3.2 %% Reverse Chronological: +%% 5.0.17.orig.tar.xz (2013-09-21:37/6) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.17 +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.17-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.17.orig.tar.xz + sisu_5.0.17.orig.tar.xz + sisu_5.0.17-1.dsc + +* i18n CJK: zh ja ko, add languages Chinese, Japanese, Korean + * texpdf, has large texlive xetex dependencies (Korean untested) + * [concordance, untouched does nothing cjk, decide whether to disable] + +* sisu_manual, (in markup-samples) move to en/ sub-dir (permitting translations) + * use of language sub-dir for source sisu markup suited to permitting + translation management by po4a + * sisurc.yml minor + * Rakefile to help place sisu markup in a source language directory under po4a + management + +* Rakefile to assist in placing sisu markup under po4a management (sisu_manual) + * Provided as an example with sisu_manual + * fairly generic, but potentially dangerous, can be used to place sisu markup + source translations under po4a management, but user needs to know what this + is, (and how to set it up, hence sisu_manual as an example (despite the lack + of translations)) as can clobber/destroy files that are not managed by po4a. + +* minor cleaning + %% 5.0.16.orig.tar.xz (2013-09-07:35/6) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.16 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.16-1 diff --git a/data/doc/sisu/markup-samples/sisu_manual/Rakefile b/data/doc/sisu/markup-samples/sisu_manual/Rakefile new file mode 100644 index 00000000..1d9b5414 --- /dev/null +++ b/data/doc/sisu/markup-samples/sisu_manual/Rakefile @@ -0,0 +1,404 @@ +#!/usr/bin/env ruby +raise 'Please, use ruby1.9.3 or later.' if RUBY_VERSION < '1.9.3' +=begin + Common Rakefile, Rantfile to place sisu markup translation under + po4a management softlink Rakefile and Rantfile to this file + + * Homepage: <http://www.jus.uio.no/sisu/SiSU> + <http://sisudoc.org> + * Download: <http://www.jus.uio.no/sisu/download> + + Copyright (C) 2013 Ralph Amissah + + * License: LGPL - GNU Lesser General Public License + [same license as Rant provided within the Rant package] + + * Ralph Amissah <ralph@amissah.com> + Ralph Amissah <ralph.amissah@gmail.com> + + Rake is a Ruby build program by Jim Weirich + * Rake may be downloaded and installed from: + <http://rake.rubyforge.org/> + + Rant is a Ruby build program by Stefan Lang + * Rant may be downloaded and installed from: + <http://make.rubyforge.org/> + + Notes on use: + rake -T + [if rant is preferred and installed] + rant -T +=end +require 'find' +require 'fileutils' +#require 'ftools' +require 'rbconfig.rb' +#include RbConfig +require 'yaml' +include FileUtils +def project_details + def name + 'SiSU translations under po4a management' + end + def name_warning + <<-WOK +#{name} + +WARNING all sisu markup files (.ssm, .sst, .ssi) in languages other than #{language.source} +are managed by po4a, through translations of the source language to other languages. + +#{language.info_on_selection} + WOK + end + def rake_project + "Rakefile for placing #{name}" + end + self +end +def query + def answer?(ask) + resp='redo' + print ask + %{ ['yes', 'no' or 'quit']: } + resp=File.new('/dev/tty').gets.strip + if resp == 'yes'; true + elsif resp == 'no'; false + elsif resp =~/^quit|exit$/; exit + else + puts %{[please type: 'yes', 'no' or 'quit']} + answer?(ask) + end + end + self +end +def notice + def warn_and_proceed? + %{WARNING: This Software is used entirely at your own risk. + PROCEED?} + end + def default(selection=nil) + ans= if selection + case selection + when selection.is_a?(String) + <<-WOK + #{project_details.rake_project} + Information on alternative actions is available using: "rake help" or "rake -T" + Default action selected - "#{selection} #{project_details.name}" + #{warn_and_proceed?} + WOK + when :make + <<-WOK + #{project_details.rake_project} + Information on alternative actions is available using: "rake help" or "rake -T" + #{selection.upcase} selected - #{selection} #{project_details.name} + WARNING: this action assumes (and places) this project is under po4a + (translation) management. It will create the sub-directories: + #{language.translations_available_str} + & file: #{filename.po4a_cfg} + in the current directory: + #{Dir.pwd} + It will populate the sub-directories with translation files created from + the pot and po files found under the corresponding language sub-directories, + (under #{dir.pot}/ & #{dir.po}/). (OVERWRITING any existing translated + .ssm .sst .ssi files in language subdirectories that are not under po4a + management). + #{warn_and_proceed?} + WOK + when :clean + <<-WOK + #{project_details.rake_project} + Information on alternative actions is available using: "rake help" or "rake -T" + #{selection.upcase} selected - #{selection} #{project_details.name} + #{warn_and_proceed?} + WOK + when :distclean + <<-WOK + #{project_details.rake_project} + Information on alternative actions is available using: "rake help" or "rake -T" + #{selection.upcase} selected - #{selection} #{project_details.name} + WARNING: this action assumes (and places) this project is under po4a + (translation) management. It will remove the sub-directories: + #{language.translations_available_str} + & file: #{filename.po4a_cfg} + in the current directory: + #{Dir.pwd} + Note: these sub-directories & the config file #{filename.po4a_cfg} + should be auto-generated from pot and po files if this project translation + is under po4a management. + This query is to give you the chance to make sure you know what you are doing. + #{warn_and_proceed?} + WOK + when :rebuild + <<-WOK + #{project_details.rake_project} + Information on alternative actions is available using: "rake help" or "rake -T" + #{selection.upcase} selected - #{selection} #{project_details.name} + WARNING: this action assumes (and places) this project is under po4a + (translation) management. It will destroy/clobber and then create again the + sub-directories: + #{language.translations_available_str} + populating them with translation files created from the pot and po files + found under the corresponding language sub-directories in (#{dir.pot}/ + & #{dir.po}/). + It will also generate the file: #{filename.po4a_cfg} + These actions will be taken in the current directory: + #{Dir.pwd} + This query is to give you the chance to make sure you know what you are doing. + #{warn_and_proceed?} + WOK + else + <<-WOK + #{project_details.rake_project} + Information on alternative actions is available using: "rake help" or "rake -T" + Default action selected - "#{selection} #{project_details.name}" + #{warn_and_proceed?} + WOK + end + else + <<-WOK + #{project_details.rake_project} + Information on alternative actions is available using: "rake help" or "rake -T" + Default action selected - "install and to setup #{project_details.name}" + #{warn_and_proceed?} + WOK + end + resp=query.answer?(ans) + exit unless resp + end + def project_help + puts <<-WOK +#{project_details.name} +#{project_details.rake_project} + +This rake file is to assist with having sisu markup files under po4a +translation management. It assumes that the source language files are placed +under the sub-directory identifying the source language set, which is currently +#{language.source} +The files there are used to make the source translation file in the directory #{dir.pot}/ +Which is then used to create files for translation under the directory #{dir.po}/ +in sub-directories bearing the translation languages ISO code. + +The current language translation selection is: #{translations_selected_str} +The languages selected are located in the file: #{filename.languages} + +sisu available language list: #{sisu_available_str} + +For a more detailed and up to date task list use: + + rake -T + + WOK + end + self +end +def tasks + system('rake -T') +end +def filename + def languages + 'translation_languages' + end + def po4a_cfg + 'po4a.cfg' + end + self +end +def dir + def pwd + Dir.pwd + end + def po4a_ + 'po4a/' # '' + end + def pot + po4a_ + 'pot' + end + def po + po4a_ + 'po' + end + self +end +def dir_mk(dir) + FileUtils::mkdir_p(dir) unless FileTest.directory?(dir) +end +def po4a_flags + def debug + '-d -v' + end + def normal + '' + end + def quiet + '-q' + end + self +end +def language + def source #source_language + 'en' + end + def translations_selected #translation_languages + IO.read(filename.languages, mode: 'r:utf-8').split(/\s+/) + end + def translations_available + translations_selected & sisu_available + end + def info_on_selection + if translations_selected != translations_available + <<-WOK +WARNING: language selections mismatch + +The current language translation selection appears to be: #{translations_selected_str} +Of which the following are valid (available) selections: #{translations_available_str} + +sisu available language list: #{sisu_available_str} + +the following will be used: #{translations_available_str} +The languages selected are located in the file: #{filename.languages} + WOK + else + <<-WOK +The current language translation selection is: #{translations_selected_str} +The languages selected are located in the file: #{filename.languages} + +sisu available language list: #{sisu_available_str} + WOK + end + end + def sisu_available + %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it ja ko la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi zh] + end + def translations_selected_str + language.translations_selected.join(' ') + end + def translations_available_str + language.translations_available.join(' ') + end + def sisu_available_str + language.sisu_available.join(' ') + end + self +end +def files_src + def ssm + Dir.glob("#{language.source}/*.ssm").sort + end + def sst + Dir.glob("#{language.source}/*.sst").sort + end + def ssi + Dir.glob("#{language.source}/*.ssi").sort + end + def all + Dir.glob("#{language.source}/*{.ssm,.sst,.ssi}").sort + end + self +end +def po4a_cfg_file + File.open("#{Dir.pwd}/#{filename.po4a_cfg}",'w') +end +def po4a + def configure #po4a_cfg + po4a_cfg_arr=[] + po4a_cfg_arr << "[po4a_langs] #{language.translations_available_str}" + po4a_cfg_arr << "[po4a_paths] #{dir.pot}/$master.pot $lang:#{dir.po}/$lang/$master.po" + files_src.ssm.each do |file_src| + file_src_fn=file_src.gsub(/#{language.source}\//,'') + po4a_cfg_arr << "[type: text] #{file_src} $lang:$lang/#{file_src_fn}" + end + files_src.sst.each do |file_src| + file_src_fn=file_src.gsub(/#{language.source}\//,'') + po4a_cfg_arr << "[type: text] #{file_src} $lang:$lang/#{file_src_fn}" + end + files_src.ssi.each do |file_src| + file_src_fn=file_src.gsub(/#{language.source}\//,'') + po4a_cfg_arr << "[type: text] #{file_src} $lang:$lang/#{file_src_fn}" + end + file=po4a_cfg_file + po4a_cfg_arr.each do |txt| + puts txt + file << txt << "\n" + end + file.close + system("po4a --keep 0 --no-backups --package-name sisu-manual #{po4a_flags.normal} #{filename.po4a_cfg}") + end + self +end +def project + dir_mk(dir.pot) + language.translations_available.each do |lang_dir| + dir_lang="#{Dir.pwd}/#{dir.po}/#{lang_dir}" + dir_mk(dir_lang) + end + po4a.configure +end +def clean + #rm -rf ../build + FileUtils.rm_f Dir.glob("#{dir.po}/*/*.po~") +end +def distclean + FileUtils::rm_f(filename.po4a_cfg) + FileUtils::rm_r(language.translations_available,:force => true) +end + +#% task lists +desc "runs make (see its description below)" +task :default => [:make] +desc "assist with having sisu markup files managed by po4a + create configuration files, and language directories and + populate them with po4a pot & po files for translation and + from those (as translated) create translated sisu markup + .ssm .sst & .ssi files in corresponding language sub-directories" +task :make => [:notice_make_,:build_] +desc "help" +task :help => [:project_help_,:tasks_] +desc "clean temporary files" +task :clean => [:notice_clean_,:clean_] +desc "removes auto-generated files under po4a management + including translated .ssm .sst & .ssi files, + that are created from po4a pot and po files" +task :distclean => [:notice_distclean_,:distclean_] +desc "runs 'distclean' and 'make' (see their descriptions above)" +task :rebuild => [:notice_rebuild_,:distclean_,:build_] +if File.directory?(dir.pot) \ +and File.directory?(dir.po) + #desc "" + task :clean! => [:clean_] + task :distclean! => [:distclean_] + task :rebuild! => [:distclean_,:build_] + task :make! => [:build_] +else + task :make! => [:build_] +end + +#% task actions +task :project_help_ do + notice.project_help +end +task :tasks_ do + tasks +end +task :build_ do + project +end +task :clean_ do + clean +end +task :distclean_ do + distclean +end +task :notice_default_ do + notice.default +end +task :notice_make_ do + notice.default(:make) +end +task :notice_clean_ do + notice.default(:clean) +end +task :notice_distclean_ do + notice.default(:distclean) +end +task :notice_rebuild_ do + notice.default(:rebuild) +end +__END__ diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn.yml b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn.yml index bf88977f..f12e3144 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn.yml +++ b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn.yml @@ -98,6 +98,8 @@ db: output_dir_structure_by: filename #% lingual: 'multi' | 'mono' (multi default) #lingual: mono +#% language_default: lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it ja ko la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi zh] ('en' default) +#language_default: 'en' permission_set: zap: true diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn_monolingual.yml b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn_monolingual.yml new file mode 100644 index 00000000..b3c49ca1 --- /dev/null +++ b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn_monolingual.yml @@ -0,0 +1,137 @@ +# Name: SiSU - Simple information Structuring Universe +# Author: ralph@amissah.com +# Description: Site wide environment defaults set here +# system environment info / resource configuration file, for sisu +# License: GPL v3 or later +# site environment configuration file +# this file should be configured and live in +# /etc/sisu #per environment settings, overridden by: +# ~/.sisu #per user settings, overridden by: +# ./_sisu #per local markup directory settings +#% #image source directory, main path and subdirectories +#image: +# path: 'sisu_working' +# public: '_sisu/image' +# #all: 'image' +#% presentation/web directory, main path and subdirectories (most subdirectories are created automatically based on markup directory name) +#webserv: +# url_root: 'http://www.your.url' #without dir stub +# path: '/var/www' #either (i) / [full path from root] or (ii) ~/ [home] or (iii) ./ [pwd] or (iv) will be made from home +# images: '_sisu/image' +# man: 'man' +# cgi: '/usr/local/lib/sisu-cgi' +# feed: 'feed' +# sqlite: 'sisu/sqlite' +# webrick_url: true +#show_output_on: 'filesystem' #for -v and -u url information, alternatives: 'filesystem','webserver','remote_webserver','local:8111','localhost','localhost:8080','webrick','path' +#show_output_on: 'local:8111' +#webserv_cgi: +# host: localhost +# base_path: ~ +# port: '8081' +# user: ~ +# file_links: webserv + +show_output_on: 'filesystem_url' +#texinfo display output +#texinfo: +# stub: 'texinfo' + +##% processing directories, main path and subdirectories (appended to $HOME), using defaults set in sysenv +#processing: +# path: 'sisu_processing' +# metaverse: 'metaverse' +# tune: 'tune' +# latex: 'tex' +# texinfo: 'texinfo' +# concord_max: 400000 + +#% flag - set (non-default) processing flag shortcuts -1, -2 etc. (here adding colour and verbosity as default) +flag: + color: true # making colour default -c is toggle, and will now toggle colour off +# default: '-NQdhewpotbxXyYv' # includes verbose; -m would in any event be run by default +# i: '-NQdhewpoty' # -m run by default +# ii: '-NQdhewpotbxXy' # -m run by default +# iii: '-NQdhewpotbxXyY' # -m run by default +# iv: '-NQhewpotbxXYDy --update' # -m run by default +# v: '-NQhewpotbxXYDyv --update' # includes verbose; -m run by default + +#% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal +default: + papersize: 'a4,letter' + #language: 'en' + #texpdf_font: 'Liberation Sans' # 'Liberation Sans' 'Liberation Serif' + #texpdf_font_mono: 'Liberation Mono' #'Inconsolata' + #text_wrap: 78 + #emphasis: 'bold' #make *{emphasis}* 'bold', 'italics' or 'underscore', default if not configured is 'bold' + #digest: 'sha' #sha is sha256, default is md5 + #language: 'English' + #emphasis: 'italics' + +#% settings used by ssh scp +#remote: +# - +# user: '[usrname]' +# host: '[remote.hostname]' +# path: '.' #no trailing slash eg 'sisu/www' +# - +# user: '[usrname]' +# host: '[remote.hostname]' +# path: '.' #no trailing slash eg 'sisu/www' + +#% webrick information +#webrick: +# port: '8081' + +#sql database info, postgresql and sqlite +db: + postgresql: + port: '5432' # '5432' + #host: # '[if not localhost, provide host tcp/ip address or domain name]'' + #user: # '[(if different from user) provide username]' + #password: # '[password if required]' +# sqlite: +# path: ~ # './sisu_sqlite.db' +# port: "**" + +#% output_dir_structure_by: language (language_and_filetype); filetype; or filename (original v1 & v2) +output_dir_structure_by: filename +#% lingual: 'multi' | 'mono' (multi default) +lingual: mono +#% language_default: lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it ja ko la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi zh] ('en' default) +#language_default: 'en' + +permission_set: + zap: true + css_modify: true + remote_base_site: true + +program_set: + rmagick: true +# wc: true +# editor: true +# postgresql: true +# sqlite: true +# tidy: true +# rexml: true +# pdflatex: true + +#program_select: +# editor: 'vim' +# pdf_viewer: 'evince' +# web_browser: 'iceweasel' +# console_web_browser: 'links2' #'elinks' #'w3m' #'lynx' #'links' +# odf_viewer: 'lowriter' #'oowriter' #'abiword' +# xml_viewer: 'xml-viewer' +# epub_viewer: 'ebook-viewer' #'calibre' #'fbreader' #'okular' +# info_viewer: 'pinfo -f' +# man: 'man' #'groff -man -Tascii' # 'nroff -man' + +#search: +# sisu: +# flag: true +## action: http://localhost:8081/cgi-bin/sisu_pgsql.cgi +# action: http://search.sisudoc.org +# db: sisu +# title: sample search form +#promo: sisu_search_libre, sisu_icon, sisu, open_society, fsf, ruby diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft.yml b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft.yml index 0963780c..71faa3e0 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft.yml +++ b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft.yml @@ -98,6 +98,8 @@ db: output_dir_structure_by: filetype #% lingual: 'multi' | 'mono' (multi default) #lingual: mono +#% language_default: lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it ja ko la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi zh] ('en' default) +#language_default: 'en' permission_set: zap: true diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft_monolingual.yml b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft_monolingual.yml new file mode 100644 index 00000000..adf144d5 --- /dev/null +++ b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft_monolingual.yml @@ -0,0 +1,137 @@ +# Name: SiSU - Simple information Structuring Universe +# Author: ralph@amissah.com +# Description: Site wide environment defaults set here +# system environment info / resource configuration file, for sisu +# License: GPL v3 or later +# site environment configuration file +# this file should be configured and live in +# /etc/sisu #per environment settings, overridden by: +# ~/.sisu #per user settings, overridden by: +# ./_sisu #per local markup directory settings +#% #image source directory, main path and subdirectories +#image: +# path: 'sisu_working' +# public: '_sisu/image' +# #all: 'image' +#% presentation/web directory, main path and subdirectories (most subdirectories are created automatically based on markup directory name) +#webserv: +# url_root: 'http://www.your.url' #without dir stub +# path: '/var/www' #either (i) / [full path from root] or (ii) ~/ [home] or (iii) ./ [pwd] or (iv) will be made from home +# images: '_sisu/image' +# man: 'man' +# cgi: '/usr/local/lib/sisu-cgi' +# feed: 'feed' +# sqlite: 'sisu/sqlite' +# webrick_url: true +#show_output_on: 'filesystem' #for -v and -u url information, alternatives: 'filesystem','webserver','remote_webserver','local:8111','localhost','localhost:8080','webrick','path' +#show_output_on: 'local:8111' +#webserv_cgi: +# host: localhost +# base_path: ~ +# port: '8081' +# user: ~ +# file_links: webserv + +show_output_on: 'filesystem_url' +#texinfo display output +#texinfo: +# stub: 'texinfo' + +##% processing directories, main path and subdirectories (appended to $HOME), using defaults set in sysenv +#processing: +# path: 'sisu_processing' +# metaverse: 'metaverse' +# tune: 'tune' +# latex: 'tex' +# texinfo: 'texinfo' +# concord_max: 400000 + +#% flag - set (non-default) processing flag shortcuts -1, -2 etc. (here adding colour and verbosity as default) +flag: + color: true # making colour default -c is toggle, and will now toggle colour off +# default: '-NQdhewpotbxXyYv' # includes verbose; -m would in any event be run by default +# i: '-NQdhewpoty' # -m run by default +# ii: '-NQdhewpotbxXy' # -m run by default +# iii: '-NQdhewpotbxXyY' # -m run by default +# iv: '-NQhewpotbxXYDy --update' # -m run by default +# v: '-NQhewpotbxXYDyv --update' # includes verbose; -m run by default + +#% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal +default: + papersize: 'a4,letter' + #language: 'en' + #texpdf_font: 'Liberation Sans' # 'Liberation Sans' 'Liberation Serif' + #texpdf_font_mono: 'Liberation Mono' #'Inconsolata' + #text_wrap: 78 + #emphasis: 'bold' #make *{emphasis}* 'bold', 'italics' or 'underscore', default if not configured is 'bold' + #digest: 'sha' #sha is sha256, default is md5 + #language: 'English' + #emphasis: 'italics' + +#% settings used by ssh scp +#remote: +# - +# user: '[usrname]' +# host: '[remote.hostname]' +# path: '.' #no trailing slash eg 'sisu/www' +# - +# user: '[usrname]' +# host: '[remote.hostname]' +# path: '.' #no trailing slash eg 'sisu/www' + +#% webrick information +#webrick: +# port: '8081' + +#sql database info, postgresql and sqlite +db: + postgresql: + port: '5432' # '5432' + #host: # '[if not localhost, provide host tcp/ip address or domain name]'' + #user: # '[(if different from user) provide username]' + #password: # '[password if required]' +# sqlite: +# path: ~ # './sisu_sqlite.db' +# port: "**" + +#% output_dir_structure_by: language (language_and_filetype); filetype; or filename (original v1 & v2) +output_dir_structure_by: filetype +#% lingual: 'multi' | 'mono' (multi default) +lingual: mono +#% language_default: lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it ja ko la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi zh] ('en' default) +#language_default: 'en' + +permission_set: + zap: true + css_modify: true + remote_base_site: true + +program_set: + rmagick: true +# wc: true +# editor: true +# postgresql: true +# sqlite: true +# tidy: true +# rexml: true +# pdflatex: true + +#program_select: +# editor: 'vim' +# pdf_viewer: 'evince' +# web_browser: 'iceweasel' +# console_web_browser: 'links2' #'elinks' #'w3m' #'lynx' #'links' +# odf_viewer: 'lowriter' #'oowriter' #'abiword' +# xml_viewer: 'xml-viewer' +# epub_viewer: 'ebook-viewer' #'calibre' #'fbreader' #'okular' +# info_viewer: 'pinfo -f' +# man: 'man' #'groff -man -Tascii' # 'nroff -man' + +#search: +# sisu: +# flag: true +## action: http://localhost:8081/cgi-bin/sisu_pgsql.cgi +# action: http://search.sisudoc.org +# db: sisu +# title: sample search form +#promo: sisu_search_libre, sisu_icon, sisu, open_society, fsf, ruby diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_lng.yml b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_lng.yml index c9da8898..ca1cf424 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_lng.yml +++ b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_lng.yml @@ -96,6 +96,8 @@ db: #% output_dir_structure_by: language (language_and_filetype); filetype; or filename (original v1 & v2) output_dir_structure_by: language +#% language_default: lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it ja ko la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi zh] ('en' default) +#language_default: 'en' permission_set: zap: true diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu.ssm b/data/doc/sisu/markup-samples/sisu_manual/en/sisu.ssm index 79703fef..79703fef 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu.ssm +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu.ssm diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_commands.sst index 8e8926ad..8e8926ad 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_commands.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_config.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_config.ssi index 3c29f995..3c29f995 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_config.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_config.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_content_directories.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_content_directories.ssi index 182b176d..182b176d 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_content_directories.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_content_directories.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_css.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_css.ssi index 7ffc654b..7ffc654b 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_css.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_css.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_description.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_description.sst index 9f8fdcd8..9f8fdcd8 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_description.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_description.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_download.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_download.ssi index 96c97985..96c97985 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_download.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_download.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_examples.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_examples.ssi index cf9df9d5..cf9df9d5 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_examples.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_examples.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_faq.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_faq.sst index 966cea5f..966cea5f 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_faq.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_faq.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_filetypes.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_filetypes.sst index d36acac0..d36acac0 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_filetypes.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_filetypes.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_help.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_help.sst index 69535085..69535085 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_help.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_help.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_help_sources.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_help_sources.sst index bee5ed78..bee5ed78 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_help_sources.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_help_sources.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_homepages.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_homepages.ssi index 3d8d95d5..3d8d95d5 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_homepages.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_homepages.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_how.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_how.ssi index 3372bcd4..3372bcd4 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_how.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_how.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_howto.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_howto.sst index 4a23bdfe..4a23bdfe 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_howto.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_howto.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_installation.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_installation.ssi index f908bb6e..f908bb6e 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_installation.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_installation.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_interesting_to_whom.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_interesting_to_whom.ssi index 750c46ea..750c46ea 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_interesting_to_whom.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_interesting_to_whom.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_introduction.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_introduction.sst index 8978ace6..8978ace6 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_introduction.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_introduction.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_manual.ssm b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_manual.ssm index 90e8a323..90e8a323 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_manual.ssm +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_manual.ssm diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_markup.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_markup.sst index 92b7f430..92b7f430 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_markup.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_markup.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_markup_syntax_history.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_markup_syntax_history.sst index c6da0a14..c6da0a14 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_markup_syntax_history.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_markup_syntax_history.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_output_overview.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_output_overview.sst index 332f4aae..332f4aae 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_output_overview.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_output_overview.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_postgresql.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_postgresql.sst index 574e307c..574e307c 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_postgresql.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_postgresql.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_quickstart.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_quickstart.sst index ae95f528..ae95f528 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_quickstart.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_quickstart.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_remote.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_remote.sst index 959fbcf6..959fbcf6 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_remote.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_remote.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_search.ssm b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_search.ssm index 9c40a8bf..9c40a8bf 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_search.ssm +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_search.ssm diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_search_cgi.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_search_cgi.ssi index 03eef9ff..03eef9ff 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_search_cgi.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_search_cgi.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_search_intro.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_search_intro.ssi index d5da379f..d5da379f 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_search_intro.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_search_intro.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_short_feature_summary.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_short_feature_summary.ssi index 294644af..294644af 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_short_feature_summary.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_short_feature_summary.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_sql.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_sql.ssi index 6e54275b..6e54275b 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_sql.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_sql.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_sqlite.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_sqlite.sst index a73ae16c..a73ae16c 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_sqlite.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_sqlite.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_synopsis.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_synopsis.ssi index 98e5d4f3..98e5d4f3 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_synopsis.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_synopsis.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_syntax_highlighting.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_syntax_highlighting.sst index ef881aae..ef881aae 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_syntax_highlighting.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_syntax_highlighting.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_webrick.sst b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_webrick.sst index 6e56e53a..6e56e53a 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_webrick.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_webrick.sst diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_work_needed_and_wishlist.ssi b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_work_needed_and_wishlist.ssi index 20e774ac..20e774ac 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_work_needed_and_wishlist.ssi +++ b/data/doc/sisu/markup-samples/sisu_manual/en/sisu_work_needed_and_wishlist.ssi diff --git a/data/doc/sisu/markup-samples/sisu_manual/translation_languages b/data/doc/sisu/markup-samples/sisu_manual/translation_languages new file mode 100644 index 00000000..d84a94e8 --- /dev/null +++ b/data/doc/sisu/markup-samples/sisu_manual/translation_languages @@ -0,0 +1 @@ +de fr es ja ru zh diff --git a/data/sisu/v4/v/version.yml b/data/sisu/v4/v/version.yml index b83fabbf..be124c73 100644 --- a/data/sisu/v4/v/version.yml +++ b/data/sisu/v4/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 4.2.3 -:date_stamp: 2013w35/6 -:date: "2013-09-07" +:version: 4.2.4 +:date_stamp: 2013w37/6 +:date: "2013-09-21" :project: SiSU diff --git a/data/sisu/v5/v/version.yml b/data/sisu/v5/v/version.yml index 9d60a3ac..2cbf765e 100644 --- a/data/sisu/v5/v/version.yml +++ b/data/sisu/v5/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 5.0.16 -:date_stamp: 2013w35/6 -:date: "2013-09-07" +:version: 5.0.17 +:date_stamp: 2013w37/6 +:date: "2013-09-21" :project: SiSU diff --git a/lib/sisu/v4/constants.rb b/lib/sisu/v4/constants.rb index 28bb2f49..962b1ca4 100644 --- a/lib/sisu/v4/constants.rb +++ b/lib/sisu/v4/constants.rb @@ -209,7 +209,7 @@ Px={ po_subscript_o: ',{', po_subscript_c: '},', po_hilite_o: '*{', po_hilite_c: '}*', po_monospace_o: '#{', po_monospace_c: '}#', - lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi], + lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it ja ko la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi zh], lv1: '*', lv2: '=', lv3: '=', diff --git a/lib/sisu/v4/dal_doc_str.rb b/lib/sisu/v4/dal_doc_str.rb index 2a3e6b83..e4a0be2b 100644 --- a/lib/sisu/v4/dal_doc_str.rb +++ b/lib/sisu/v4/dal_doc_str.rb @@ -168,6 +168,55 @@ module SiSU_DAL_DocumentStructureExtract end [str,tags] end + def rgx_idx_ocn_seg + @rgx_idx_ocn_seg=/(.+?)\s*[+](\d+)/ + end + def construct_idx_array_and_hash(idxraw) + idx_array_raw=idxraw.scan(/[^;]+/) + idx_hash,idx_array,idx_lst={},[],[] + idx_array_raw.each do |idx| + idx_lst=case idx + when /\S+?\s*:/ + idx_couplet_tmp=[] + idx_couplet=idx.scan(/\s*[^:]+\s*/) + if idx_couplet[1] =~/[|]/ + idx_couplet_tmp << idx_couplet[0] << idx_couplet[1].scan(/\s*[^|]+\s*/) + else + idx_couplet_tmp << idx_couplet[0] << [idx_couplet[1]] + end + idx_couplet=idx_couplet_tmp + else [idx] + end + term_nodes=[] + idx_lst.each do |term_node| + case term_node + when String + term_node=term_node[0].chr.capitalize + term_node[1,term_node.length] + term_node=(term_node =~/.+?[+]\d+/) \ + ? term_node + : (term_node + '+0') + term_nodes << term_node + use,plus=rgx_idx_ocn_seg.match(term_node)[1,2] + @use=use.strip + idx_hash[@use]={ sub: [], plus: plus } unless idx_hash[@use] and defined? idx_hash[@use] + when Array + subterm_nodes=[] + term_node.each do |subterm_node| + subterm_node=(subterm_node =~/.+?[+]\d+/) \ + ? subterm_node + : (subterm_node + '+0') + subterm_nodes << subterm_node + sub,sub_plus=rgx_idx_ocn_seg.match(subterm_node)[1,2] + idx_hash[@use]={ sub: [], plus: 0 } unless idx_hash[@use] and defined? idx_hash[@use] + idx_hash[@use][:sub] << {sub.strip => { plus: sub_plus }} + end + term_nodes << subterm_nodes + end + end + idx_array << term_nodes + end + { hash: idx_hash, array: idx_array } + end def identify_parts tuned_file=[] @tuned_block,@tuned_code=[],[] @@ -205,9 +254,10 @@ module SiSU_DAL_DocumentStructureExtract idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1 m=m.split(/\n/).join(' '). gsub(/\s+([|:;])\s+/,'\1'). - gsub(/\s+([+])\s+/,'\1') + gsub(/\s+([+]\d+)\s+/,'\1') t_o=t_o.gsub(/\n=\{.+\}\s*$\Z/m,'') - m + idx_array_and_hash=construct_idx_array_and_hash(m) + idx_array_and_hash[:hash] else nil end end diff --git a/lib/sisu/v4/dal_idx.rb b/lib/sisu/v4/dal_idx.rb index 96486858..5fbfe5df 100644 --- a/lib/sisu/v4/dal_idx.rb +++ b/lib/sisu/v4/dal_idx.rb @@ -84,13 +84,11 @@ module SiSU_DAL_BookIndex @seg=dob.name end if defined? dob.idx \ - and dob.idx.is_a?(String) \ - and not dob.idx.empty? - idx_array << "#{dob.idx}~#{dob.ocn}~#{@seg}" + and dob.idx.is_a?(Hash) + idx_array << {idx: dob.idx, ocn: dob.ocn, seg: @seg } end tuned_file << dob if dob end - idx_array=construct_idx_array(idx_array) if idx_array.length > 0 if idx_array.length > 0 the_idx=construct_book_index(idx_array) sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx=nil,nil,nil,nil @@ -101,61 +99,28 @@ module SiSU_DAL_BookIndex end [tuned_file,sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx] end - def construct_idx_array(idx_array) - idx_lst=[] - idx_array.each do |idx| - idx_list,ocn,seg=@rgx_idx_ocn_seg.match(idx)[1..3] - idx_lst <<=if idx_list =~/;/ - g=idx_list.scan(/[^;]+/) - idxl=[] - g.each do |i| - i=i.strip - idxl << { rough_idx: i, ocn: ocn, seg: seg } - end - idxl - else { rough_idx: idx_list, ocn: ocn, seg: seg } - end - end - idx_lst=idx_lst.flatten - end def construct_book_index(idx_array) the_idx={} idx_array.each do |idx| - if idx[:rough_idx] =~/[|]/ \ - && idx[:rough_idx] !~/[:]/ - if @md.opt.cmd =~/[MVv]/ - p 'book index error? --> ' + idx[:rough_idx] - end - else - idx_lst=idx[:rough_idx].scan(/[^|:]+/) - idx_lst[0]=idx_lst[0].strip - if idx_lst[0] =~/.+?\+\d+/ - use=/(.+?)\+(?:\d+)/.match(idx_lst[0])[1] - else use=idx_lst[0] - end - use=use[0].chr.capitalize + use[1,use.length] - the_idx[use]={} unless the_idx[use] and defined? the_idx[use] - idx_lst.each do |i| - i=i.strip - i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/ - x=if idx_lst.length==1 or idx_lst[0].gsub(/\+\d+/,'')==i - the_idx[use]['term_node_lev1']=[] unless the_idx[use]['term_node_lev1'] and defined? the_idx[use]['term_node_lev1'] - x=if r - the_idx[use]['term_node_lev1'] << { ocn: idx[:ocn], range: "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", seg: idx[:seg] } - "#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}" - else - the_idx[use]['term_node_lev1'] << { ocn: idx[:ocn], seg: idx[:seg] } - "#{i} #{idx[:ocn]}" - end - else - the_idx[use]['term_node_lev2']={} unless the_idx[use]['term_node_lev2'] and defined? the_idx[use]['term_node_lev2'] - the_idx[use]['term_node_lev2'][i]=[] unless the_idx[use]['term_node_lev2'][i] and defined? the_idx[use]['term_node_lev2'][i] - x=if r - the_idx[use]['term_node_lev2'][i] << { ocn: idx[:ocn], range: "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", seg: idx[:seg] } - "#{idx_lst[0]}:#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}" - else - the_idx[use]['term_node_lev2'][i] << { ocn: idx[:ocn], seg: idx[:seg] } - "#{idx_lst[0]}:#{i} #{idx[:ocn]}" + idx[:idx].each_pair do |term,term_info| + location=(term_info[:plus].to_i > 0) \ + ? (%{#{idx[:ocn]}-#{idx[:ocn].to_i + term_info[:plus].to_i}}) + : idx[:ocn].to_s + the_idx[term]={} unless the_idx[term] and defined? the_idx[term] + the_idx[term]['node_0_terms']=[] unless the_idx[term]['node_0_terms'] and defined? the_idx[term]['node_0_terms'] + the_idx[term]['node_0_terms'] << { ocn: idx[:ocn], range: location, seg: idx[:seg] } + if term_info[:sub].is_a?(Array) \ + and term_info[:sub].length > 0 + term_info[:sub].each do |y| + y.each_pair do |subterm,subterm_info| + location=(subterm_info[:plus].to_i > 0) \ + ? (%{#{idx[:ocn]}-#{idx[:ocn].to_i + subterm_info[:plus].to_i}}) + : idx[:ocn].to_s + the_idx[term]={} unless the_idx[term] and defined? the_idx[term] + the_idx[term]['node_0_terms']=[] unless the_idx[term]['node_0_terms'] and defined? the_idx[term]['node_0_terms'] + the_idx[term]['node_1_subterms']={} unless the_idx[term]['node_1_subterms'] and defined? the_idx[term]['node_1_subterms'] + the_idx[term]['node_1_subterms'][subterm]=[] unless the_idx[term]['node_1_subterms'][subterm] and defined? the_idx[term]['node_1_subterms'][subterm] + the_idx[term]['node_1_subterms'][subterm] << { ocn: idx[:ocn], range: location, seg: idx[:seg] } end end end @@ -230,8 +195,8 @@ module SiSU_DAL_BookIndex p 'array error? -->' print x elsif x.is_a?(Hash) - if x['term_node_lev1'].is_a?(Array) - x['term_node_lev1'].each do |a| + if x['node_0_terms'].is_a?(Array) + x['node_0_terms'].each do |a| if a[:range] idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{a[:ocn]}#{Mx[:rel_c]}, } idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } @@ -250,11 +215,9 @@ module SiSU_DAL_BookIndex idx[:html][@q]=idx[:html][@q] + '</p>' idx[:xhtml][@r]=idx[:xhtml][@r] + '</p>' end - if x['term_node_lev2'] - m=x['term_node_lev2'] - m=m.sort - m.each do |k,y| - if k !~/term_node_lev1/ + if x['node_1_subterms'] + x['node_1_subterms'].sort.each do |k,y| + if k !~/node_0_terms/ idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{k}, } idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{k}, } idx[:html][@q]=idx[:html][@q] + %{\n<p class="book_index_lev2">#{k}, } @@ -298,8 +261,8 @@ module SiSU_DAL_BookIndex p 'array error? -->' print x elsif x.is_a?(Hash) - if x['term_node_lev1'].is_a?(Array) - x['term_node_lev1'].each do |a| + if x['node_0_terms'].is_a?(Array) + x['node_0_terms'].each do |a| if a[:range] print a[:range] + ', ' elsif a[:ocn] @@ -308,11 +271,9 @@ module SiSU_DAL_BookIndex end end end - if x['term_node_lev2'] - m=x['term_node_lev2'] - m=m.sort - m.each do |k,y| - if k !~/term_node_lev1/ + if x['node_1_subterms'] + x['node_1_subterms'].sort.each do |k,y| + if k !~/node_0_terms/ print "\n\t" + k + ', ' y.each do |z| if z[:range] diff --git a/lib/sisu/v4/dal_syntax.rb b/lib/sisu/v4/dal_syntax.rb index c49f41f7..0f57307e 100644 --- a/lib/sisu/v4/dal_syntax.rb +++ b/lib/sisu/v4/dal_syntax.rb @@ -332,7 +332,7 @@ module SiSU_DAL_Syntax dob end def fontface(dob) - leader=/^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>/ + leader=/^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|[、。]|\>/ dob=fontface_lines(dob,leader) dob.obj=dob.obj.gsub(/(#{leader})\*\{(.+?)\}\*/m, "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis diff --git a/lib/sisu/v4/db_import.rb b/lib/sisu/v4/db_import.rb index 240efd67..0384795a 100644 --- a/lib/sisu/v4/db_import.rb +++ b/lib/sisu/v4/db_import.rb @@ -209,6 +209,26 @@ module SiSU_DbImport end def pf_db_import_transaction_close end + def book_idx_hash_to_str(book_idx) + book_idx=book_idx ? book_idx : '' + book_idx_str,book_subidx_part='','' + if not book_idx.empty? + book_idx_str='' + book_idx.each_pair do |k0,v0| + book_idx_str << %{#{k0}+#{v0[:plus]}} + book_subidx_part='' + if v0[:sub].length > 0 + v0[:sub].each do |subterms| + subterms.each_pair do |k1,v1| + book_subidx_part << %{\n #{k1}+#{v1[:plus]} | } + end + end + book_idx_str=book_idx_str + ':' + book_subidx_part + end + end + end + book_idx_str + end def db_import_metadata #% import documents - populate database print %{ #{@cX.grey}import documents dbi_unit #{@cX.off} } if @opt.cmd =~/vVM/ @tp={} @@ -285,7 +305,7 @@ module SiSU_DbImport plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text(plaintext) - book_idx=data.idx ? data.idx : '' + book_idx=book_idx_hash_to_str(data.idx) @col[:book_idx]=clean_searchable_text(book_idx) if @en[0] then @en_a,@en_z=@en[0].first,@en[0].last end @@ -321,7 +341,7 @@ module SiSU_DbImport plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text(plaintext) - book_idx=data.idx ? data.idx : '' + book_idx=book_idx_hash_to_str(data.idx) @col[:book_idx]=clean_searchable_text(book_idx) @en_a,@en_z=@en[0].first,@en[0].last if @en[0] @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0] @@ -353,7 +373,7 @@ module SiSU_DbImport plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text(plaintext) - book_idx=data.idx ? data.idx : '' + book_idx=book_idx_hash_to_str(data.idx) @col[:book_idx]=clean_searchable_text(book_idx) @en_a,@en_z=@en[0].first,@en[0].last if @en[0] @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0] @@ -383,7 +403,7 @@ module SiSU_DbImport plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text(plaintext) - book_idx=data.idx ? data.idx : '' + book_idx=book_idx_hash_to_str(data.idx) @col[:book_idx]=clean_searchable_text(book_idx) @en_a,@en_z=@en[0].first,@en[0].last if @en[0] @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0] @@ -441,7 +461,7 @@ module SiSU_DbImport plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text(plaintext) - book_idx=data.idx ? data.idx : '' + book_idx=book_idx_hash_to_str(data.idx) @col[:book_idx]=clean_searchable_text(book_idx) t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint) @tuple_array << t.tuple diff --git a/lib/sisu/v4/hub.rb b/lib/sisu/v4/hub.rb index 5f80e795..ebe9ccf4 100644 --- a/lib/sisu/v4/hub.rb +++ b/lib/sisu/v4/hub.rb @@ -75,9 +75,9 @@ module SiSU class HubMaster def initialize(argv) pwd_the=Dir.pwd - begin #% select what to do - opt=SiSU_Commandline::Options.new(argv) - SiSU::Processing.new(opt).actions + begin #% select what to do (set options & start processing (files selected if any)) + opt=SiSU_Commandline::Options.new(argv) # command line selection of what to do, files & operations set + SiSU::Processing.new(opt).actions # do it rescue cmd=(opt ? opt.cmd : '') SiSU_Screen::Ansi.new(cmd,$!,$@).rescue do diff --git a/lib/sisu/v4/i18n.rb b/lib/sisu/v4/i18n.rb index 3bccc1fc..7480e15f 100644 --- a/lib/sisu/v4/i18n.rb +++ b/lib/sisu/v4/i18n.rb @@ -91,6 +91,8 @@ module SiSU_i18n ia: { c: 'ia', n: 'Interlingua', t: 'Interlingua', xlp: 'interlingua' }, is: { c: 'is', n: 'Icelandic', t: 'Icelandic', xlp: 'icelandic' }, it: { c: 'it', n: 'Italian', t: 'Italiano', xlp: 'italian' }, + ja: { c: 'ja', n: 'Japanese', t: '日本語 (Nihongo)', xlp: 'japanese' }, + ko: { c: 'ko', n: 'Korean', t: 'Korean', xlp: 'korean' }, la: { c: 'la', n: 'Latin', t: 'Latin', xlp: 'latin' }, lo: { c: 'lo', n: 'Lao', t: 'Lao', xlp: 'lao' }, lt: { c: 'lt', n: 'Lithuanian', t: 'Lithuanian', xlp: 'lithuanian' }, @@ -122,6 +124,7 @@ module SiSU_i18n ur: { c: 'ur', n: 'Urdu', t: 'Urdu', xlp: 'urdu' }, us: { c: 'en', n: 'English (American)',t: 'English', xlp: 'english' }, vi: { c: 'vi', n: 'Vietnamese', t: 'Vietnamese', xlp: 'vietnamese' }, + zh: { c: 'zh', n: 'Chinese', t: '中文', xlp: 'chinese' }, en: { c: 'en', n: 'English', t: 'English', xlp: 'english' }, xx: { c: 'xx', n: 'Default', t: 'English', xlp: 'english' }, } @@ -154,6 +157,8 @@ module SiSU_i18n 'ia' => table[:ia], 'is' => table[:is], 'it' => table[:it], + 'ja' => table[:ja], + 'ko' => table[:ko], 'la' => table[:la], 'lo' => table[:lo], 'lt' => table[:lt], @@ -185,6 +190,7 @@ module SiSU_i18n 'ur' => table[:ur], 'us' => table[:en], 'vi' => table[:vi], + 'zh' => table[:zh], 'en' => table[:en], 'xx' => table[:en] } diff --git a/lib/sisu/v4/options.rb b/lib/sisu/v4/options.rb index 9d6821ac..54ef7ccc 100644 --- a/lib/sisu/v4/options.rb +++ b/lib/sisu/v4/options.rb @@ -66,14 +66,12 @@ module SiSU_Commandline require_relative 'param_make' # param_make.rb @@sisu_call_origin_path=nil class HeaderCommon - def initialize(make_instruct_array) - @make_instruct_array=make_instruct_array - end def sisu_document_make_instructions @pagenew=@pagebreak=@pageline=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@num_top=@i18n=@man_section=@emphasis_set_to=@bold_match_list=@italics_match_list=@substitution_match_list=@footer_links=@home_button_links=@links=nil + make_instruct_array=SiSU_Env::GetInit.new.sisu_document_make.makefile_read @makeset=false - if @make_instruct_array - @make_instruct_array.each do |para| #% scan document + if make_instruct_array + make_instruct_array.each do |para| #% scan document if para =~/^(?:@make:|@links:)[+-]?\s/ case para when /^@make:(.+)/m #% header processing - make @@ -153,8 +151,7 @@ module SiSU_Commandline @base_stub=@base_path.gsub(u,'\1') @a=sisu_glob_rules(a) @a.freeze - make_instruct_array=SiSU_Env::GetInit.new.sisu_document_make.makefile_read - @make_instructions=HeaderCommon.new(make_instruct_array).sisu_document_make_instructions + @make_instructions=HeaderCommon.new.sisu_document_make_instructions @make_instructions_pod=nil init end diff --git a/lib/sisu/v4/param_make.rb b/lib/sisu/v4/param_make.rb index 616ef77d..32576fb8 100644 --- a/lib/sisu/v4/param_make.rb +++ b/lib/sisu/v4/param_make.rb @@ -360,6 +360,30 @@ module SiSU_Param_Make ? @h['texpdf_font_mono'] : @env.font.texpdf.mono end + def cjk + @h['texpdf_font_cjk'] \ + && (@h['texpdf_font_cjk']=~/\S{3,}/) \ + ? @h['texpdf_font_cjk'] + : @env.font.texpdf.cjk + end + def cjk_zh + @h['texpdf_font_cjk_zh'] \ + && (@h['texpdf_font_cjk_zh']=~/\S{3,}/) \ + ? @h['texpdf_font_cjk_zh'] + : @env.font.texpdf.cjk_zh + end + def cjk_ja + @h['texpdf_font_cjk_ja'] \ + && (@h['texpdf_font_cjk_ja']=~/\S{3,}/) \ + ? @h['texpdf_font_cjk_ja'] + : @env.font.texpdf.cjk_ja + end + def cjk_ko + @h['texpdf_font_cjk_ko'] \ + && (@h['texpdf_font_cjk_ko']=~/\S{3,}/) \ + ? @h['texpdf_font_cjk_ko'] + : @env.font.texpdf.cjk_ko + end self end def promo diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index cfbbc0c1..b13d5a88 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -281,7 +281,7 @@ module SiSU_Env @@tx ||=SiSU_Viz::TeX.new end def rc_path_options - @rc_path=[ + [ "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_version_dir}", "#{$sisu_document_markup_directory_base_fixed_path}/.sisu", "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_version_dir}", @@ -297,14 +297,12 @@ module SiSU_Env S_CONF[:header_make] end def makefile - #if @markup_dir_changed_ - rc_path_options.each do |v| - if FileTest.exist?("#{v}/#{makefile_name}") - @sisu_make_path=v - break - end + rc_path_options.each do |v| + if FileTest.exist?("#{v}/#{makefile_name}") + @sisu_make_path=v + break end - #end + end @sisu_make_file_path=@sisu_make_path \ ? "#{@sisu_make_path}/#{makefile_name}" : nil @@ -552,7 +550,6 @@ module SiSU_Env n =n + '.' + @fn[:t] x << { f: "#{@fn[:m]}.#{@fn[:t]}", l: lng_base, n: n } end - #x << { f: "#{@fns}", l: lng_base } langs.each do |l| lng=SiSU_Env::StandardiseLanguage.new(l) if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") @@ -617,16 +614,10 @@ module SiSU_Env @m=@m.uniq end def filename(code,name,suffix) - #d=SiSU_Env::InfoEnv.new(@fns) - #fnl=d.i18n.lang_filename(code) "#{name}#{suffix}" - #if code - # "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}" - #else "#{name}#{suffix}" - #end end def lang(code) - @fn={ + { html: filename(code,'','.html'), book_index: filename(code,'book_index','.html'), concordance: filename(code,'concordance','.html'), @@ -671,7 +662,6 @@ module SiSU_Env book_idx_epub: filename(code,'book_index','.xhtml'), epub_concord: filename(code,'concordance','.xhtml'), } - @fn end end class SystemCall @@ -1790,6 +1780,9 @@ WOK end def font def texpdf + # you may wish to check selected font against available fonts: + # fc-list :outline -f "%{family}\n" + # fc-list :lang=ja def main (defined? @rc['default']['texpdf_font']) \ && (@rc['default']['texpdf_font']=~/\S{3,}/) \ @@ -1814,6 +1807,30 @@ WOK ? @rc['default']['texpdf_font_mono'] : 'Liberation Mono' end + def cjk + (defined? @rc['default']['texpdf_font_cjk']) \ + && (@rc['default']['texpdf_font_cjk']=~/\S{3,}/) \ + ? @rc['default']['texpdf_font_cjk'] + : 'IPAGothic' # 'IPAGothic' # 'IPAMincho' # 'TakaoMincho' # 'VL Gothic' + end + def cjk_zh + (defined? @rc['default']['texpdf_font_cjk_zh']) \ + && (@rc['default']['texpdf_font_cjk_zh']=~/\S{3,}/) \ + ? @rc['default']['texpdf_font_cjk_zh'] + : 'IPAGothic' + end + def cjk_ja + (defined? @rc['default']['texpdf_font_cjk_ja']) \ + && (@rc['default']['texpdf_font_cjk_ja']=~/\S{3,}/) \ + ? @rc['default']['texpdf_font_cjk_ja'] + : 'IPAGothic' + end + def cjk_ko + (defined? @rc['default']['texpdf_font_cjk_ko']) \ + && (@rc['default']['texpdf_font_cjk_ko']=~/\S{3,}/) \ + ? @rc['default']['texpdf_font_cjk_ko'] + : 'IPAGothic' + end self end self diff --git a/lib/sisu/v4/texpdf_format.rb b/lib/sisu/v4/texpdf_format.rb index b010bb08..d87a457e 100644 --- a/lib/sisu/v4/texpdf_format.rb +++ b/lib/sisu/v4/texpdf_format.rb @@ -794,11 +794,52 @@ module SiSU_TeX_Pdf @md.make.texpdf_font.mono else @env.font.texpdf.mono end - # you may wish to check selected font against avaiable fonts: + texpdf_font_cjk=if @md.opt.lng =~/zh/ \ + and defined? @md.make.texpdf_font.cjk_zh \ + and not @md.make.texpdf_font.cjk_zh.nil? \ + and @md.make.texpdf_font.cjk_zh=~/\S{3,}/ + @md.make.texpdf_font.cjk_zh + elsif @md.opt.lng =~/ja/ \ + and defined? @md.make.texpdf_font.cjk_ja \ + and not @md.make.texpdf_font.cjk_ja.nil? \ + and @md.make.texpdf_font.cjk_ja=~/\S{3,}/ + @md.make.texpdf_font.cjk_ja + elsif @md.opt.lng =~/ko/ \ + and defined? @md.make.texpdf_font.cjk_ko \ + and not @md.make.texpdf_font.cjk_ko.nil? \ + and @md.make.texpdf_font.cjk_ko=~/\S{3,}/ + @md.make.texpdf_font.cjk_ko + elsif @md.opt.lng =~/(?:zh|ja|ko)/ \ + and defined? @md.make.texpdf_font.cjk \ + and not @md.make.texpdf_font.cjk.nil? \ + and @md.make.texpdf_font.cjk=~/\S{3,}/ + @md.make.texpdf_font.cjk + else + case @md.opt.lng + when /zh/; @env.font.texpdf.cjk_zh + when /ja/; @env.font.texpdf.cjk_ja + when /ko/; @env.font.texpdf.cjk_ko + else @env.font.texpdf.cjk + end + end + # you may wish to check selected font against available fonts: # fc-list :outline -f "%{family}\n" + # fc-list :lang=ja case @tex2pdf when /xe/ - <<-WOK + if @md.opt.lng =~/(?:zh|ja|ko)/ + <<-WOK +\\usepackage{ucs, fontspec, xltxtra, xunicode, xeCJK} +\\setmainCJKlanguage{#{tex_head_lang[:mainlang]}} +\\setCJKmainfont{#{texpdf_font_cjk}} +\\XeTeXlinebreaklocale "#{tex_head_lang[:mainlang]}" +\\XeTeXlinebreakskip = 0pt plus 1pt +\\setotherlanguage{#{tex_head_lang[:otherlang]}} +\\setmainfont{#{texpdf_font}} +\\setmonofont[Scale=0.85]{#{texpdf_font_mono}} + WOK + else + <<-WOK \\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode} \\setmainlanguage{#{tex_head_lang[:mainlang]}} \\setotherlanguage{#{tex_head_lang[:otherlang]}} @@ -806,7 +847,8 @@ module SiSU_TeX_Pdf \\setmonofont[Scale=0.85]{#{texpdf_font_mono}} % \\setsansfont{#{texpdf_font_sans}} % \\setromanfont{#{texpdf_font_serif}} - WOK + WOK + end when /pdf/ if @md.file_encoding =~ /iso-?8859/i #% iso8859 <<-WOK diff --git a/lib/sisu/v4/utils.rb b/lib/sisu/v4/utils.rb index b120cc01..d18e2180 100644 --- a/lib/sisu/v4/utils.rb +++ b/lib/sisu/v4/utils.rb @@ -151,6 +151,7 @@ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark({ m: %{ }}) if t_o=~/^```/m SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark(%{ code: #{@@flag['code']}, open --> "#{t_o}" }) \ if t_o=~/^```/m +SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark("open -->") SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark("open -->",:green) SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:green,"open -->") SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark("open -->") diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index bc98ca99..78655871 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -209,7 +209,7 @@ Px={ po_subscript_o: ',{', po_subscript_c: '},', po_hilite_o: '*{', po_hilite_c: '}*', po_monospace_o: '#{', po_monospace_c: '}#', - lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi], + lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it ja ko la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi zh], lv1: '*', lv2: '=', lv3: '=', diff --git a/lib/sisu/v5/dal_syntax.rb b/lib/sisu/v5/dal_syntax.rb index f6d01d22..1e1d8542 100644 --- a/lib/sisu/v5/dal_syntax.rb +++ b/lib/sisu/v5/dal_syntax.rb @@ -332,7 +332,7 @@ module SiSU_DAL_Syntax dob end def fontface(dob) - leader=/^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>/ + leader=/^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|[、。]|\>/ dob=fontface_lines(dob,leader) dob.obj=dob.obj.gsub(/(#{leader})\*\{(.+?)\}\*/m, "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index 08ad7b58..fcbaa67a 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -75,9 +75,9 @@ module SiSU class HubMaster def initialize(argv) pwd_the=Dir.pwd - begin #% select what to do - opt=SiSU_Commandline::Options.new(argv) - SiSU::Processing.new(opt).actions + begin #% select what to do (set options & start processing (files selected if any)) + opt=SiSU_Commandline::Options.new(argv) # command line selection of what to do, files & operations set + SiSU::Processing.new(opt).actions # do it rescue cmd=(opt ? opt.cmd : '') SiSU_Screen::Ansi.new(cmd,$!,$@).rescue do diff --git a/lib/sisu/v5/i18n.rb b/lib/sisu/v5/i18n.rb index b635af15..cfd02244 100644 --- a/lib/sisu/v5/i18n.rb +++ b/lib/sisu/v5/i18n.rb @@ -91,6 +91,8 @@ module SiSU_i18n ia: { c: 'ia', n: 'Interlingua', t: 'Interlingua', xlp: 'interlingua' }, is: { c: 'is', n: 'Icelandic', t: 'Icelandic', xlp: 'icelandic' }, it: { c: 'it', n: 'Italian', t: 'Italiano', xlp: 'italian' }, + ja: { c: 'ja', n: 'Japanese', t: '日本語 (Nihongo)', xlp: 'japanese' }, + ko: { c: 'ko', n: 'Korean', t: 'Korean', xlp: 'korean' }, la: { c: 'la', n: 'Latin', t: 'Latin', xlp: 'latin' }, lo: { c: 'lo', n: 'Lao', t: 'Lao', xlp: 'lao' }, lt: { c: 'lt', n: 'Lithuanian', t: 'Lithuanian', xlp: 'lithuanian' }, @@ -122,6 +124,7 @@ module SiSU_i18n ur: { c: 'ur', n: 'Urdu', t: 'Urdu', xlp: 'urdu' }, us: { c: 'en', n: 'English (American)',t: 'English', xlp: 'english' }, vi: { c: 'vi', n: 'Vietnamese', t: 'Vietnamese', xlp: 'vietnamese' }, + zh: { c: 'zh', n: 'Chinese', t: '中文', xlp: 'chinese' }, en: { c: 'en', n: 'English', t: 'English', xlp: 'english' }, xx: { c: 'xx', n: 'Default', t: 'English', xlp: 'english' }, } @@ -154,6 +157,8 @@ module SiSU_i18n 'ia' => table[:ia], 'is' => table[:is], 'it' => table[:it], + 'ja' => table[:ja], + 'ko' => table[:ko], 'la' => table[:la], 'lo' => table[:lo], 'lt' => table[:lt], @@ -185,6 +190,7 @@ module SiSU_i18n 'ur' => table[:ur], 'us' => table[:en], 'vi' => table[:vi], + 'zh' => table[:zh], 'en' => table[:en], 'xx' => table[:en] } diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index 031258af..422762d1 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -66,14 +66,12 @@ module SiSU_Commandline require_relative 'param_make' # param_make.rb @@sisu_call_origin_path=nil class HeaderCommon - def initialize(make_instruct_array) - @make_instruct_array=make_instruct_array - end def sisu_document_make_instructions @pagenew=@pagebreak=@pageline=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@num_top=@i18n=@man_section=@emphasis_set_to=@bold_match_list=@italics_match_list=@substitution_match_list=@footer_links=@home_button_links=@links=nil + make_instruct_array=SiSU_Env::GetInit.new.sisu_document_make.makefile_read @makeset=false - if @make_instruct_array - @make_instruct_array.each do |para| #% scan document + if make_instruct_array + make_instruct_array.each do |para| #% scan document if para =~/^(?:@make:|@links:)[+-]?\s/ case para when /^@make:(.+)/m #% header processing - make @@ -153,8 +151,7 @@ module SiSU_Commandline @base_stub=@base_path.gsub(u,'\1') @a=sisu_glob_rules(a) @a.freeze - make_instruct_array=SiSU_Env::GetInit.new.sisu_document_make.makefile_read - @make_instructions=HeaderCommon.new(make_instruct_array).sisu_document_make_instructions + @make_instructions=HeaderCommon.new.sisu_document_make_instructions @make_instructions_pod=nil init end diff --git a/lib/sisu/v5/param_make.rb b/lib/sisu/v5/param_make.rb index ba89c7b3..ec538ccb 100644 --- a/lib/sisu/v5/param_make.rb +++ b/lib/sisu/v5/param_make.rb @@ -360,6 +360,30 @@ module SiSU_Param_Make ? @h['texpdf_font_mono'] : @env.font.texpdf.mono end + def cjk + @h['texpdf_font_cjk'] \ + && (@h['texpdf_font_cjk']=~/\S{3,}/) \ + ? @h['texpdf_font_cjk'] + : @env.font.texpdf.cjk + end + def cjk_zh + @h['texpdf_font_cjk_zh'] \ + && (@h['texpdf_font_cjk_zh']=~/\S{3,}/) \ + ? @h['texpdf_font_cjk_zh'] + : @env.font.texpdf.cjk_zh + end + def cjk_ja + @h['texpdf_font_cjk_ja'] \ + && (@h['texpdf_font_cjk_ja']=~/\S{3,}/) \ + ? @h['texpdf_font_cjk_ja'] + : @env.font.texpdf.cjk_ja + end + def cjk_ko + @h['texpdf_font_cjk_ko'] \ + && (@h['texpdf_font_cjk_ko']=~/\S{3,}/) \ + ? @h['texpdf_font_cjk_ko'] + : @env.font.texpdf.cjk_ko + end self end def promo diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 3092532b..0616abb7 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -281,7 +281,7 @@ module SiSU_Env @@tx ||=SiSU_Viz::TeX.new end def rc_path_options - @rc_path=[ + [ "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_version_dir}", "#{$sisu_document_markup_directory_base_fixed_path}/.sisu", "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_version_dir}", @@ -297,14 +297,12 @@ module SiSU_Env S_CONF[:header_make] end def makefile - #if @markup_dir_changed_ - rc_path_options.each do |v| - if FileTest.exist?("#{v}/#{makefile_name}") - @sisu_make_path=v - break - end + rc_path_options.each do |v| + if FileTest.exist?("#{v}/#{makefile_name}") + @sisu_make_path=v + break end - #end + end @sisu_make_file_path=@sisu_make_path \ ? "#{@sisu_make_path}/#{makefile_name}" : nil @@ -552,7 +550,6 @@ module SiSU_Env n =n + '.' + @fn[:t] x << { f: "#{@fn[:m]}.#{@fn[:t]}", l: lng_base, n: n } end - #x << { f: "#{@fns}", l: lng_base } langs.each do |l| lng=SiSU_Env::StandardiseLanguage.new(l) if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") @@ -617,16 +614,10 @@ module SiSU_Env @m=@m.uniq end def filename(code,name,suffix) - #d=SiSU_Env::InfoEnv.new(@fns) - #fnl=d.i18n.lang_filename(code) "#{name}#{suffix}" - #if code - # "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}" - #else "#{name}#{suffix}" - #end end def lang(code) - @fn={ + { html: filename(code,'','.html'), book_index: filename(code,'book_index','.html'), concordance: filename(code,'concordance','.html'), @@ -671,7 +662,6 @@ module SiSU_Env book_idx_epub: filename(code,'book_index','.xhtml'), epub_concord: filename(code,'concordance','.xhtml'), } - @fn end end class SystemCall @@ -1790,6 +1780,9 @@ WOK end def font def texpdf + # you may wish to check selected font against available fonts: + # fc-list :outline -f "%{family}\n" + # fc-list :lang=ja def main (defined? @rc['default']['texpdf_font']) \ && (@rc['default']['texpdf_font']=~/\S{3,}/) \ @@ -1814,6 +1807,30 @@ WOK ? @rc['default']['texpdf_font_mono'] : 'Liberation Mono' end + def cjk + (defined? @rc['default']['texpdf_font_cjk']) \ + && (@rc['default']['texpdf_font_cjk']=~/\S{3,}/) \ + ? @rc['default']['texpdf_font_cjk'] + : 'IPAGothic' # 'IPAGothic' # 'IPAMincho' # 'TakaoMincho' # 'VL Gothic' + end + def cjk_zh + (defined? @rc['default']['texpdf_font_cjk_zh']) \ + && (@rc['default']['texpdf_font_cjk_zh']=~/\S{3,}/) \ + ? @rc['default']['texpdf_font_cjk_zh'] + : 'IPAGothic' + end + def cjk_ja + (defined? @rc['default']['texpdf_font_cjk_ja']) \ + && (@rc['default']['texpdf_font_cjk_ja']=~/\S{3,}/) \ + ? @rc['default']['texpdf_font_cjk_ja'] + : 'IPAGothic' + end + def cjk_ko + (defined? @rc['default']['texpdf_font_cjk_ko']) \ + && (@rc['default']['texpdf_font_cjk_ko']=~/\S{3,}/) \ + ? @rc['default']['texpdf_font_cjk_ko'] + : 'IPAGothic' + end self end self diff --git a/lib/sisu/v5/texpdf_format.rb b/lib/sisu/v5/texpdf_format.rb index 172dfa56..5ed6ca75 100644 --- a/lib/sisu/v5/texpdf_format.rb +++ b/lib/sisu/v5/texpdf_format.rb @@ -794,11 +794,52 @@ module SiSU_TeX_Pdf @md.make.texpdf_font.mono else @env.font.texpdf.mono end - # you may wish to check selected font against avaiable fonts: + texpdf_font_cjk=if @md.opt.lng =~/zh/ \ + and defined? @md.make.texpdf_font.cjk_zh \ + and not @md.make.texpdf_font.cjk_zh.nil? \ + and @md.make.texpdf_font.cjk_zh=~/\S{3,}/ + @md.make.texpdf_font.cjk_zh + elsif @md.opt.lng =~/ja/ \ + and defined? @md.make.texpdf_font.cjk_ja \ + and not @md.make.texpdf_font.cjk_ja.nil? \ + and @md.make.texpdf_font.cjk_ja=~/\S{3,}/ + @md.make.texpdf_font.cjk_ja + elsif @md.opt.lng =~/ko/ \ + and defined? @md.make.texpdf_font.cjk_ko \ + and not @md.make.texpdf_font.cjk_ko.nil? \ + and @md.make.texpdf_font.cjk_ko=~/\S{3,}/ + @md.make.texpdf_font.cjk_ko + elsif @md.opt.lng =~/(?:zh|ja|ko)/ \ + and defined? @md.make.texpdf_font.cjk \ + and not @md.make.texpdf_font.cjk.nil? \ + and @md.make.texpdf_font.cjk=~/\S{3,}/ + @md.make.texpdf_font.cjk + else + case @md.opt.lng + when /zh/; @env.font.texpdf.cjk_zh + when /ja/; @env.font.texpdf.cjk_ja + when /ko/; @env.font.texpdf.cjk_ko + else @env.font.texpdf.cjk + end + end + # you may wish to check selected font against available fonts: # fc-list :outline -f "%{family}\n" + # fc-list :lang=ja case @tex2pdf when /xe/ - <<-WOK + if @md.opt.lng =~/(?:zh|ja|ko)/ + <<-WOK +\\usepackage{ucs, fontspec, xltxtra, xunicode, xeCJK} +\\setmainCJKlanguage{#{tex_head_lang[:mainlang]}} +\\setCJKmainfont{#{texpdf_font_cjk}} +\\XeTeXlinebreaklocale "#{tex_head_lang[:mainlang]}" +\\XeTeXlinebreakskip = 0pt plus 1pt +\\setotherlanguage{#{tex_head_lang[:otherlang]}} +\\setmainfont{#{texpdf_font}} +\\setmonofont[Scale=0.85]{#{texpdf_font_mono}} + WOK + else + <<-WOK \\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode} \\setmainlanguage{#{tex_head_lang[:mainlang]}} \\setotherlanguage{#{tex_head_lang[:otherlang]}} @@ -806,7 +847,8 @@ module SiSU_TeX_Pdf \\setmonofont[Scale=0.85]{#{texpdf_font_mono}} % \\setsansfont{#{texpdf_font_sans}} % \\setromanfont{#{texpdf_font_serif}} - WOK + WOK + end when /pdf/ if @md.file_encoding =~ /iso-?8859/i #% iso8859 <<-WOK diff --git a/lib/sisu/v5/utils.rb b/lib/sisu/v5/utils.rb index 8ebc3647..52ca22d0 100644 --- a/lib/sisu/v5/utils.rb +++ b/lib/sisu/v5/utils.rb @@ -151,6 +151,7 @@ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark({ m: %{ }}) if t_o=~/^```/m SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark(%{ code: #{@@flag['code']}, open --> "#{t_o}" }) \ if t_o=~/^```/m +SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark("open -->") SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark("open -->",:green) SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:green,"open -->") SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark("open -->") |