From f7bad422ac9a564e08ea3b25f43822eecce8faf2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 17 May 2011 23:00:31 -0400 Subject: v3: sysenv, rsync, get rid of annoying nag to terminal (-v reporting Dir.pwd) * prevent attempt to change directory unless different directory requested --- lib/sisu/v3/sysenv.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 5a59ebf8..127e4181 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -774,7 +774,7 @@ module SiSU_Env #? system("scp -Cr #{@input} #{@output}") \ #: (puts "\tWARN: #{program} not found" ) end - def rsync(action='',chdir='.') + def rsync(action='',chdir=nil) program='rsync' if program_found?(program) vb=if @cmd =~/q/; 'q' @@ -783,11 +783,17 @@ module SiSU_Env end msg='' msg=" && echo 'OK: #{@input} -> #{@output}'" unless @cmd =~/q/ - puts "rsync -az#{vb} #{action} #{@input} #{@output}" if @cmd =~/[vVM]/ + puts "rsync -az#{vb} #{action} #{@input} #{@output}" if @cmd =~/[vVM]/ + dir_change,dir_return='','' + if chdir \ + && chdir != Dir.pwd + dir_change="cd #{chdir}" + dir_return='cd -' + end system(" - cd #{chdir} + #{dir_change} rsync -az#{vb} #{action} #{@input} #{@output} #{msg} - cd - + #{dir_return} ") else puts "\tWARN: #{program} not found" end @@ -3818,7 +3824,7 @@ WOK "#{output_path.base.url}/po4a/#{@md.fnb}/pot" end def rcp - p "#{output_path.base.dir}/po4a/#{@md.fnb}/pot" + #p "#{output_path.base.dir}/po4a/#{@md.fnb}/pot" end self end -- cgit v1.2.3 From c11ed8c181b56dbf2a3130c651e8e1ae46f1617e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 May 2011 17:09:19 -0400 Subject: v3: i18n, added language translation table column to hash/table * changelog, version dates touched as well --- lib/sisu/v3/i18n.rb | 118 ++++++++++++++++++++++++++-------------------------- 1 file changed, 59 insertions(+), 59 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/i18n.rb b/lib/sisu/v3/i18n.rb index 1001b6fb..85030697 100644 --- a/lib/sisu/v3/i18n.rb +++ b/lib/sisu/v3/i18n.rb @@ -62,65 +62,65 @@ module SiSU_i18n def language def table @@language_table ||= { - am: { c: 'am', n: 'Amharic', xlp: 'amharic'}, - bg: { c: 'bg', n: 'Bulgarian', xlp: 'bulgarian'}, - bn: { c: 'bn', n: 'Bengali', xlp: 'bengali'}, - br: { c: 'br', n: 'Breton', xlp: 'breton'}, - ca: { c: 'ca', n: 'Catalan', xlp: 'catalan'}, - cs: { c: 'cs', n: 'Czech', xlp: 'czech'}, - cy: { c: 'cy', n: 'Welsh', xlp: 'welsh'}, - da: { c: 'da', n: 'Danish', xlp: 'danish'}, - de: { c: 'de', n: 'German', xlp: 'german'}, - el: { c: 'el', n: 'Greek', xlp: 'greek'}, - en: { c: 'en', n: 'English', xlp: 'english'}, - eo: { c: 'eo', n: 'Esperanto', xlp: 'esperanto'}, - es: { c: 'es', n: 'Spanish', xlp: 'spanish'}, - et: { c: 'et', n: 'Estonian', xlp: 'estonian'}, - eu: { c: 'eu', n: 'Basque', xlp: 'basque'}, - fi: { c: 'fi', n: 'Finnish', xlp: 'finnish'}, - fr: { c: 'fr', n: 'French', xlp: 'french'}, - ga: { c: 'ga', n: 'Irish', xlp: 'irish'}, - gl: { c: 'gl', n: 'Galician', xlp: 'galician'}, - he: { c: 'he', n: 'Hebrew', xlp: 'hebrew'}, - hi: { c: 'hi', n: 'Hindi', xlp: 'hindi'}, - hr: { c: 'hr', n: 'Croatian', xlp: 'croatian'}, - hy: { c: 'hy', n: 'Armenian', xlp: 'armenian'}, - ia: { c: 'ia', n: 'Interlingua', xlp: 'interlingua'}, - is: { c: 'is', n: 'Icelandic', xlp: 'icelandic'}, - it: { c: 'it', n: 'Italian', xlp: 'italian'}, - la: { c: 'la', n: 'Latin', xlp: 'latin'}, - lo: { c: 'lo', n: 'Lao', xlp: 'lao'}, - lt: { c: 'lt', n: 'Lithuanian', xlp: 'lithuanian'}, - lv: { c: 'lv', n: 'Latvian', xlp: 'latvian'}, - ml: { c: 'ml', n: 'Malayalam', xlp: 'malayalam'}, - mr: { c: 'mr', n: 'Marathi', xlp: 'marathi'}, - nl: { c: 'nl', n: 'Dutch', xlp: 'dutch'}, - no: { c: 'no', n: 'Norwegian', xlp: 'norsk'}, - nn: { c: 'nn', n: 'Norwegian Nynorsk', xlp: 'nynorsk'}, - oc: { c: 'oc', n: 'Occitan', xlp: 'occitan'}, - pl: { c: 'pl', n: 'Polish', xlp: 'polish'}, - pt: { c: 'pt', n: 'Portuguese', xlp: 'portuges'}, - pt_BR: { c: 'pt_BR', n: 'Portuguese Brazil', xlp: 'brazilian'}, - ro: { c: 'ro', n: 'Romanian', xlp: 'romanian'}, - ru: { c: 'ru', n: 'Russian', xlp: 'russian'}, - sa: { c: 'sa', n: 'Sanskrit', xlp: 'sanskrit'}, - se: { c: 'se', n: 'Sami', xlp: 'samin'}, - sk: { c: 'sk', n: 'Slovak', xlp: 'slovak'}, - sl: { c: 'sl', n: 'Slovenian', xlp: 'slovenian'}, - sq: { c: 'sq', n: 'Albanian', xlp: 'albanian'}, - sr: { c: 'sr', n: 'Serbian', xlp: 'serbian'}, - sv: { c: 'sv', n: 'Swedish', xlp: 'swedish'}, - ta: { c: 'ta', n: 'Tamil', xlp: 'tamil'}, - te: { c: 'te', n: 'Telugu', xlp: 'telugu'}, - th: { c: 'th', n: 'Thai', xlp: 'thai'}, - tk: { c: 'tk', n: 'Turkmen', xlp: 'turkmen'}, - tr: { c: 'tr', n: 'Turkish', xlp: 'turkish'}, - uk: { c: 'uk', n: 'Ukranian', xlp: 'ukrainian'}, - ur: { c: 'ur', n: 'Urdu', xlp: 'urdu'}, - us: { c: 'en', n: 'English (American)',xlp: 'english'}, - vi: { c: 'vi', n: 'Vietnamese', xlp: 'vietnamese'}, - en: { c: 'en', n: 'English', xlp: 'english'}, - xx: { c: 'xx', n: 'Default', xlp: 'english'}, + am: { c: 'am', n: 'Amharic', t: 'Amharic', xlp: 'amharic' }, + bg: { c: 'bg', n: 'Bulgarian', t: 'Български (Bəlgarski)', xlp: 'bulgarian' }, + bn: { c: 'bn', n: 'Bengali', t: 'Bengali', xlp: 'bengali' }, + br: { c: 'br', n: 'Breton', t: 'Breton', xlp: 'breton' }, + ca: { c: 'ca', n: 'Catalan', t: 'catalan', xlp: 'catalan' }, + cs: { c: 'cs', n: 'Czech', t: 'česky', xlp: 'czech' }, + cy: { c: 'cy', n: 'Welsh', t: 'Welsh', xlp: 'welsh' }, + da: { c: 'da', n: 'Danish', t: 'dansk', xlp: 'danish' }, + de: { c: 'de', n: 'German', t: 'Deutsch', xlp: 'german' }, + el: { c: 'el', n: 'Greek', t: 'Ελληνικά (Ellinika)', xlp: 'greek' }, + en: { c: 'en', n: 'English', t: 'English', xlp: 'english' }, + eo: { c: 'eo', n: 'Esperanto', t: 'Esperanto', xlp: 'esperanto' }, + es: { c: 'es', n: 'Spanish', t: 'español', xlp: 'spanish' }, + et: { c: 'et', n: 'Estonian', t: 'Estonian', xlp: 'estonian' }, + eu: { c: 'eu', n: 'Basque', t: 'basque', xlp: 'basque' }, + fi: { c: 'fi', n: 'Finnish', t: 'suomi', xlp: 'finnish' }, + fr: { c: 'fr', n: 'French', t: 'français', xlp: 'french' }, + ga: { c: 'ga', n: 'Irish', t: 'Irish', xlp: 'irish' }, + gl: { c: 'gl', n: 'Galician', t: 'Galician', xlp: 'galician' }, + he: { c: 'he', n: 'Hebrew', t: 'Hebrew', xlp: 'hebrew' }, + hi: { c: 'hi', n: 'Hindi', t: 'Hindi', xlp: 'hindi' }, + hr: { c: 'hr', n: 'Croatian', t: 'Croatian', xlp: 'croatian' }, + hy: { c: 'hy', n: 'Armenian', t: 'Armenian', xlp: 'armenian' }, + 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' }, + 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' }, + lv: { c: 'lv', n: 'Latvian', t: 'Latvian', xlp: 'latvian' }, + ml: { c: 'ml', n: 'Malayalam', t: 'Malayalam', xlp: 'malayalam' }, + mr: { c: 'mr', n: 'Marathi', t: 'Marathi', xlp: 'marathi' }, + nl: { c: 'nl', n: 'Dutch', t: 'Nederlands', xlp: 'dutch' }, + no: { c: 'no', n: 'Norwegian', t: 'norsk', xlp: 'norsk' }, + nn: { c: 'nn', n: 'Norwegian Nynorsk', t: 'nynorsk', xlp: 'nynorsk' }, + oc: { c: 'oc', n: 'Occitan', t: 'Occitan', xlp: 'occitan' }, + pl: { c: 'pl', n: 'Polish', t: 'polski', xlp: 'polish' }, + pt: { c: 'pt', n: 'Portuguese', t: 'Português', xlp: 'portuges' }, + pt_BR: { c: 'pt_BR', n: 'Portuguese Brazil', t: 'Brazilian Português', xlp: 'brazilian' }, + ro: { c: 'ro', n: 'Romanian', t: 'română', xlp: 'romanian' }, + ru: { c: 'ru', n: 'Russian', t: 'Русский (Russkij)', xlp: 'russian' }, + sa: { c: 'sa', n: 'Sanskrit', t: 'Sanskrit', xlp: 'sanskrit' }, + se: { c: 'se', n: 'Sami', t: 'Samin', xlp: 'samin' }, + sk: { c: 'sk', n: 'Slovak', t: 'slovensky', xlp: 'slovak' }, + sl: { c: 'sl', n: 'Slovenian', t: 'Slovenian', xlp: 'slovenian' }, + sq: { c: 'sq', n: 'Albanian', t: 'Albanian', xlp: 'albanian' }, + sr: { c: 'sr', n: 'Serbian', t: 'Serbian', xlp: 'serbian' }, + sv: { c: 'sv', n: 'Swedish', t: 'svenska', xlp: 'swedish' }, + ta: { c: 'ta', n: 'Tamil', t: 'Tamil', xlp: 'tamil' }, + te: { c: 'te', n: 'Telugu', t: 'Telugu', xlp: 'telugu' }, + th: { c: 'th', n: 'Thai', t: 'Thai', xlp: 'thai' }, + tk: { c: 'tk', n: 'Turkmen', t: 'Turkmen', xlp: 'turkmen' }, + tr: { c: 'tr', n: 'Turkish', t: 'Türkçe', xlp: 'turkish' }, + uk: { c: 'uk', n: 'Ukranian', t: 'українська (ukrajins\'ka)', xlp: 'ukrainian' }, + 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' }, + en: { c: 'en', n: 'English', t: 'English', xlp: 'english' }, + xx: { c: 'xx', n: 'Default', t: 'English', xlp: 'english' }, } end def list -- cgit v1.2.3 From 92fb4acea3904a368f644f7d6bcfcb9b41e313d3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 May 2011 17:18:12 -0400 Subject: v3: prog_text_translation, language class name fix; languge name matching * Portuguese language class name (missed 't') * language name matching ('Portuguese Brazil') * indentation --- lib/sisu/v3/prog_text_translation.rb | 410 ++++++++++++++++++----------------- 1 file changed, 209 insertions(+), 201 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/prog_text_translation.rb b/lib/sisu/v3/prog_text_translation.rb index e5a78e92..fca06e71 100644 --- a/lib/sisu/v3/prog_text_translation.rb +++ b/lib/sisu/v3/prog_text_translation.rb @@ -69,7 +69,8 @@ module SiSU_Translate when /German/i; German.new(md,doc_lang,trans_str) when /Italian/i; Italian.new(md,doc_lang,trans_str) when /Spanish/i; Spanish.new(md,doc_lang,trans_str) - when /Brazilian(?: Portuguese)?/i; Portuguese.new(md,doc_lang,trans_str) # tag depreciated, see iso 639-2 + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; + Portuguese.new(md,doc_lang,trans_str) # tag depreciated, see iso 639-2 when /Portuguese/i; Portuguese.new(md,doc_lang,trans_str) when /Swedish/i; Swedish.new(md,doc_lang,trans_str) when /Danish/i; Danish.new(md,doc_lang,trans_str) @@ -285,7 +286,8 @@ module SiSU_Translate when /German/i; 'Deutsch' when /Italian/i; 'Italiano' when /Spanish/i; 'español' - when /Brazilian(?: Portuguese)?/i; 'Brazilian Português' # tag depreciated, see iso 639-2 + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; + 'Brazilian Português' # tag depreciated, see iso 639-2 when /Portuguese/i; 'Português' when /Swedish/i; 'svenska' when /Danish/i; 'dansk' @@ -503,7 +505,8 @@ module SiSU_Translate when /German/i; 'German' when /Italian/i; 'Italian' when /Spanish/i; 'Spanish' - when /Brazilian(?: Portuguese)?/i; 'Brazilian Portuguese' # tag depreciated, see iso 639-2 + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; + 'Brazilian Portuguese' # tag depreciated, see iso 639-2 when /Portuguese/i; 'Portuguese' when /Swedish/i; 'Swedish' when /Danish/i; 'Danish' @@ -717,7 +720,8 @@ module SiSU_Translate when /German/i; 'Allemand' when /Italian/i; 'Italien' when /Spanish/i; 'Espagnol' - when /Brazilian(?: Portuguese)?/i; 'Portugais brésilien' # tag depreciated, see iso 639-2 + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; + 'Portugais brésilien' # tag depreciated, see iso 639-2 when /Portuguese/i; 'Portugais' when /Swedish/i; 'Suédois' when /Danish/i; 'Danois' @@ -928,7 +932,8 @@ module SiSU_Translate when /German/i; 'Deutsch' when /Italian/i; 'Italienisch' when /Spanish/i; 'Spanisch' - when /Brazilian(?: Portuguese)?/i; 'Brasilianisch-Portugiesisch' # tag depreciated, see iso 639-2 + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; + 'Brasilianisch-Portugiesisch' # tag depreciated, see iso 639-2 when /Portuguese/i; 'Portugiesisch' when /Swedish/i; 'Schwedisch' when /Danish/i; 'Dänisch' @@ -966,203 +971,204 @@ module SiSU_Translate def filetype_description description end - def metadata - 'metadatos' - end - def file_size - 'tamaño del fichero' - end - def full_title #dc - 'Título' - end - def title - 'Título' - end - def subtitle - 'Subtítulo' - end - def author #dc - 'Creador' - end - def contributor #dc - 'Contribuidor' - end - def translator - 'Traductor' - end - def illustrator - 'Ilustrador' - end - def publisher #dc - 'Editor' - end - def prepared_by - 'Preparado por' - end - def digitized_by - 'Digitalizado por' - end - def subject #dc - 'Asunto' - end - def description #dc (watch) - 'Descripción' - end - def abstract #dc - 'Resumen' - end - def type #dc - 'Tipo' - end - def rights #dc - 'Derechos' - end - def date #dc - 'Fecha' - end - def date_created #dc - 'Fecha de creación' - end - def date_issued #dc - 'Fecha de publicación' - end - def date_available #dc - 'Fecha de disponibilidad' - end - def date_modified #dc - 'Fecha de modificación' - end - def date_valid #dc - 'Fecha de valided' - end - def language #dc - 'Idioma' - end - def language_original - 'Lenguaje original' - end - def format #dc - 'Formato' - end - def identifier #dc - 'Identificador' - end - def source #dc - 'Fuente' - end - def relation #dc - 'Relación' - end - def coverage #dc - 'Cobertura' - end - def keywords - 'Palabras claves' - end - def comments - 'Comentarios' - end - def cls_loc - 'Clasificación Biblioteca del Congreso' - end - def cls_dewey - 'Clasificación Dewey' - end - def cls_oclc # fix - 'Classify OCLC number' + def metadata + 'metadatos' end - def cls_gutenberg - 'Clasificación Proyecto Gutenberg' - end - def cls_isbn - 'Clasificación ISBN' - end - def prefix_a - 'Prefijo (a)' - end - def prefix_b - 'Prefijo (b)' - end - def topic_register - 'Topics Registered' + def file_size + 'tamaño del fichero' end - def sourcefile - 'Fichero fuente' - end - def word_count - 'Número de palabras apróximado' - end - def sourcefile_digest - 'Resumen del fichero fuente' - end - def digest_md5 - 'Resumen del fichero fuente (md5)' - end - def digest_sha256 - 'Resumen del fichero fuente (sha256)' - end - def sc_number - 'Versión (RCS/CVS) del documento' - end - def sc_date - 'Versión (RCS/CVS) del documento' - end - def last_generated - 'Última generación (metaverse) del documento' - end - def sisu_version - 'Generado por' - end - def ruby_version - 'Versión de Ruby' - end - def suggested_links - 'enlaces sugeridos de metadatos' - end - def language_version_list - 'Document Language Versions, manifests' - end - def manifest_description - 'SiSU manifest of document filetypes and metadata' + def full_title #dc + 'Título' + end + def title + 'Título' + end + def subtitle + 'Subtítulo' + end + def author #dc + 'Creador' + end + def contributor #dc + 'Contribuidor' + end + def translator + 'Traductor' + end + def illustrator + 'Ilustrador' + end + def publisher #dc + 'Editor' + end + def prepared_by + 'Preparado por' + end + def digitized_by + 'Digitalizado por' + end + def subject #dc + 'Asunto' + end + def description #dc (watch) + 'Descripción' + end + def abstract #dc + 'Resumen' + end + def type #dc + 'Tipo' + end + def rights #dc + 'Derechos' + end + def date #dc + 'Fecha' + end + def date_created #dc + 'Fecha de creación' + end + def date_issued #dc + 'Fecha de publicación' + end + def date_available #dc + 'Fecha de disponibilidad' + end + def date_modified #dc + 'Fecha de modificación' + end + def date_valid #dc + 'Fecha de valided' + end + def language #dc + 'Idioma' end - def manifest_description_output - 'Manifiesto SiSU de salida generada' - end - def manifest_description_metadata - 'Manifiesto SiSU de metadatos de documento' - end - def language_list_translated - lang=case @trans_str - when /American/i; 'Inglés Americano' # tag depreciated, see iso 639-2 - when /English/i; 'Inglés' - when /French/i; 'Francés' - when /German/i; 'Alemán' - when /Italian/i; 'Italiano' - when /Spanish/i; 'Español' - when /Brazilian(?: Portuguese)?/i; 'Portugués de Brasil' # tag depreciated, see iso 639-2 - when /Portuguese/i; 'Portugués' - when /Swedish/i; 'Sueco' - when /Danish/i; 'Danés' - when /Finnish/i; 'Finés' - when /Norwegian/i; 'Noruego' - when /Icelandic/i; 'Islandés' - when /Dutch/i; 'Holandés' - when /Estonian/i; 'Estonio' - when /Hungarian/i; 'Húngaro' - when /Polish/i; 'Polaco' - when /Romanian/i; 'Rumano' - when /Russian/i; 'Ruso' - when /Greek/i; 'Griego' - when /Ukranian/i; 'Ucraniano' - when /Turkish/i; 'Turco' - when /Slovenian/i; 'Eslovaco' - when /Croatian/i; 'Croata' - when /Slovak(?:ian)?/i; 'Eslovaco' - when /Czech/i; 'Checo' - when /Bulgarian/i; 'Búlgaro' - else @trans_str + def language_original + 'Lenguaje original' + end + def format #dc + 'Formato' + end + def identifier #dc + 'Identificador' + end + def source #dc + 'Fuente' + end + def relation #dc + 'Relación' + end + def coverage #dc + 'Cobertura' + end + def keywords + 'Palabras claves' + end + def comments + 'Comentarios' + end + def cls_loc + 'Clasificación Biblioteca del Congreso' + end + def cls_dewey + 'Clasificación Dewey' + end + def cls_oclc # fix + 'Classify OCLC number' + end + def cls_gutenberg + 'Clasificación Proyecto Gutenberg' + end + def cls_isbn + 'Clasificación ISBN' + end + def prefix_a + 'Prefijo (a)' + end + def prefix_b + 'Prefijo (b)' + end + def topic_register + 'Topics Registered' end - end + def sourcefile + 'Fichero fuente' + end + def word_count + 'Número de palabras apróximado' + end + def sourcefile_digest + 'Resumen del fichero fuente' + end + def digest_md5 + 'Resumen del fichero fuente (md5)' + end + def digest_sha256 + 'Resumen del fichero fuente (sha256)' + end + def sc_number + 'Versión (RCS/CVS) del documento' + end + def sc_date + 'Versión (RCS/CVS) del documento' + end + def last_generated + 'Última generación (metaverse) del documento' + end + def sisu_version + 'Generado por' + end + def ruby_version + 'Versión de Ruby' + end + def suggested_links + 'enlaces sugeridos de metadatos' + end + def language_version_list + 'Document Language Versions, manifests' + end + def manifest_description + 'SiSU manifest of document filetypes and metadata' + end + def manifest_description_output + 'Manifiesto SiSU de salida generada' + end + def manifest_description_metadata + 'Manifiesto SiSU de metadatos de documento' + end + def language_list_translated + lang=case @trans_str + when /American/i; 'Inglés Americano' # tag depreciated, see iso 639-2 + when /English/i; 'Inglés' + when /French/i; 'Francés' + when /German/i; 'Alemán' + when /Italian/i; 'Italiano' + when /Spanish/i; 'Español' + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; + 'Portugués de Brasil' # tag depreciated, see iso 639-2 + when /Portuguese/i; 'Portugués' + when /Swedish/i; 'Sueco' + when /Danish/i; 'Danés' + when /Finnish/i; 'Finés' + when /Norwegian/i; 'Noruego' + when /Icelandic/i; 'Islandés' + when /Dutch/i; 'Holandés' + when /Estonian/i; 'Estonio' + when /Hungarian/i; 'Húngaro' + when /Polish/i; 'Polaco' + when /Romanian/i; 'Rumano' + when /Russian/i; 'Ruso' + when /Greek/i; 'Griego' + when /Ukranian/i; 'Ucraniano' + when /Turkish/i; 'Turco' + when /Slovenian/i; 'Eslovaco' + when /Croatian/i; 'Croata' + when /Slovak(?:ian)?/i; 'Eslovaco' + when /Czech/i; 'Checo' + when /Bulgarian/i; 'Búlgaro' + else @trans_str + end + end end class Italian def initialize(md,doc_lang,trans_str) @@ -1350,7 +1356,8 @@ module SiSU_Translate when /German/i; 'Tedesco' when /Italian/i; 'Italiano' when /Spanish/i; 'Spagnolo' - when /Brazilian(?: Portuguese)?/i; 'Portoguese (Brasile)' # tag depreciated, see iso 639-2 + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; + 'Portoguese (Brasile)' # tag depreciated, see iso 639-2 when /Portuguese/i; 'Portoguese' when /Swedish/i; 'Svedese' when /Danish/i; 'Danese' @@ -1561,7 +1568,8 @@ module SiSU_Translate when /German/i; 'Saksa' when /Italian/i; 'Italia' when /Spanish/i; 'Espanja' - when /Brazilian(?: Portuguese)?/i; 'Brasilian portugali' # tag depreciated, see iso 639-2 + when /Portuguese Brazil|Brazilian(?: Portuguese)?/i; + 'Brasilian portugali' # tag depreciated, see iso 639-2 when /Portuguese/i; 'Portugali' when /Swedish/i; 'Ruotsi' when /Danish/i; 'Tanska' @@ -1586,7 +1594,7 @@ module SiSU_Translate end end end - class Porguguese < English + class Portuguese < English end class Swedish < English end -- cgit v1.2.3 From a11485b8aa86780677c7a5ac415551e559e5961c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 May 2011 21:23:30 -0400 Subject: v3: param, html, epub, xml, simplify file-naming with language code * language code occurs in fixed location within file-name (could previously do so in 1 of 3 configured locations) --- lib/sisu/v3/concordance.rb | 12 ++++++------ lib/sisu/v3/epub.rb | 10 +++++----- lib/sisu/v3/epub_concordance.rb | 10 +++++----- lib/sisu/v3/epub_format.rb | 22 +++++++++++----------- lib/sisu/v3/epub_segments.rb | 4 ++-- lib/sisu/v3/html.rb | 10 +++++----- lib/sisu/v3/html_format.rb | 22 +++++++++++----------- lib/sisu/v3/html_minitoc.rb | 10 +++++----- lib/sisu/v3/html_segments.rb | 2 +- lib/sisu/v3/param.rb | 9 ++++++--- lib/sisu/v3/xml_format.rb | 22 +++++++++++----------- 11 files changed, 68 insertions(+), 65 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/concordance.rb b/lib/sisu/v3/concordance.rb index 72031419..91b63778 100644 --- a/lib/sisu/v3/concordance.rb +++ b/lib/sisu/v3/concordance.rb @@ -212,17 +212,17 @@ WOK end protected def location_scroll(wordlocation,show) - %{#{wordlocation}; } + %{#{wordlocation}; } end def location_seg(wordlocation,show) ##fix - @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}#\\2") unless wordlocation.nil? + @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:html]}#\\2") unless wordlocation.nil? case wordlocation when @rxp_t1 - %{[H]#{show}, } + %{[H]#{show}, } when @rxp_t2 - %{[H]#{show}, } + %{[H]#{show}, } when @rxp_t3 - %{[H]#{show}, } + %{[H]#{show}, } else %{#{show}, } end end @@ -337,7 +337,7 @@ WOK end credits=@vz.credits_sisu @file_concordance << %{\n} # footer - SiSU_Screen::Ansi.new(@opt.cmd,@md.fns,"#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").flow if @md.opt.cmd =~/[MV]/ + SiSU_Screen::Ansi.new(@md.opt.cmd,@md.fns,"#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").flow if @md.opt.cmd =~/[MV]/ end end end diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index 422c1e68..7293c601 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -310,7 +310,7 @@ module SiSU_EPUB title=if dob.obj !~/Document Information/; linkname else link='metadata' - %{#{linkname}} + %{#{linkname}} end toc={} txt_obj={ txt: title } @@ -395,13 +395,13 @@ module SiSU_EPUB linkname,ocn=dob.obj.strip,dob.ocn p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) if ocn if dob.ln==4 - seg_link=%{ + seg_link=%{ #{dob.obj} } @@seg_url=dob.name elsif dob.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ seg_link=dob.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, - %{} + + %{} + %{\\1 \\2 }) end p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) if ocn @@ -423,7 +423,7 @@ module SiSU_EPUB if ocn \ and ocn !~/#/ p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } @@ -444,7 +444,7 @@ module SiSU_EPUB if ocn \ and ocn !~/#/ p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb index 205f4f22..687155d2 100644 --- a/lib/sisu/v3/epub_concordance.rb +++ b/lib/sisu/v3/epub_concordance.rb @@ -185,18 +185,18 @@ WOK protected def location_scroll(wordlocation,show) @wordlocation=wordlocation - %{#{@wordlocation}; } + %{#{@wordlocation}; } end def location_seg(wordlocation,show) @wordlocation,@show=wordlocation,show - @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}#o\\2") unless wordlocation.nil? + @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}#o\\2") unless wordlocation.nil? case @wordlocation when @rxp_t1 - %{[H]#{@show}, } + %{[H]#{@show}, } when @rxp_t2 - %{[H]#{@show}, } + %{[H]#{@show}, } when @rxp_t3 - %{[H]#{@show}, } + %{[H]#{@show}, } else %{#{@show}, } end end diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 5af5c0b4..e75ad112 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1196,13 +1196,13 @@ WOK } end def seg_head_navigation_band - firstseg=%{ + firstseg=%{ #{@vz.epub_png_nav_nxt} } if @md.firstseg =~/\S+/ %{

#{firstseg}

} end def seg_head_navigation_band_bottom - firstseg=%{ + firstseg=%{ #{@vz.epub_png_nav_nxt} } if @md.firstseg =~/\S+/ %{

#{firstseg}

} @@ -1335,17 +1335,17 @@ WOK def dot_control_pre_next %{
- + #{@vz.png_nav_dot_pre} - + #{@vz.png_nav_dot_toc} - + #{@vz.png_nav_dot_nxt} #{@vz.table_close}} @@ -1353,12 +1353,12 @@ WOK def dot_control_pre %{ @@ -1370,15 +1370,15 @@ WOK end def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' - toc=%{ + toc=%{ #{@vz.epub_png_nav_toc} } - pre=%{ + pre=%{ #{@vz.epub_png_nav_pre} } if f_pre==true - nxt=%{ + nxt=%{ #{@vz.epub_png_nav_nxt} } if f_nxt==true @@ -1861,7 +1861,7 @@ WOK fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info %{

- #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}#{@endnote_part_b} + #{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}#{@endnote_part_b}

} end diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index a21a64a7..ed8c8d39 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -231,7 +231,7 @@ WOK and dob.ln==4 if tracking != 0 Seg.new(@md).tail - segfilename="#{dir_epub_cont}/#{@md.fnl[:pre]}#{@@seg_name_xhtml[tracking-1]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" + segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" output_epub_cont_seg=File.new(segfilename,'w') if @@seg_name_xhtml[tracking-1] if dob.is=='heading' \ or @@seg_name_xhtml[tracking-1] !~/endnotes|book_index|metadata/ @@ -252,7 +252,7 @@ WOK heading_art(dob) head(dob) if @@seg_name_xhtml[tracking]=='sisu_manifest' # this is for manifest, includes navigation bug - segfilename="#{dir_epub_cont}/#{@md.fnl[:pre]}#{@@seg_name_xhtml[tracking]}#{@md.fnl[:mid]}#{Sfx[:epub_xhtml]}#{@md.fnl[:post]}" + segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" output_epub_cont_seg=File.new(segfilename,'w') Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'sisu_manifest').output Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb index 8d10b7da..b569653f 100644 --- a/lib/sisu/v3/html.rb +++ b/lib/sisu/v3/html.rb @@ -322,7 +322,7 @@ WOK title=if dob.obj !~/Metadata/; linkname else link='metadata' - %{#{linkname}} + %{#{linkname}} end toc={} txt_obj={ txt: title } @@ -409,13 +409,13 @@ WOK linkname,ocn=dob.obj.strip,dob.ocn p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn if dob.ln ==4 - seg_link=%{ + seg_link=%{ #{dob.obj} } @@seg_url=dob.name elsif dob.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ seg_link=dob.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, - %{\\1 \\2 }) end p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn @@ -451,7 +451,7 @@ WOK if ocn \ and ocn !~/#/ p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } @@ -472,7 +472,7 @@ WOK if ocn \ and ocn !~/#/ p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v3/html_format.rb b/lib/sisu/v3/html_format.rb index a4a05293..e89b5c43 100644 --- a/lib/sisu/v3/html_format.rb +++ b/lib/sisu/v3/html_format.rb @@ -299,7 +299,7 @@ WOK

} end def seg_head_navigation_band(type='') - firstseg=%{ + firstseg=%{ #{@vz.png_nav_nxt} } if @md.firstseg =~/\S+/ %{

- + #{@vz.png_nav_dot_pre} - + #{@vz.png_nav_dot_toc}
@@ -318,7 +318,7 @@ WOK if type=~/pdf/ @tocband_segtoc=make_scroll_seg_pdf end - firstseg=%{ + firstseg=%{ #{@vz.png_nav_nxt} } if @md.firstseg =~/\S+/ %{
@@ -646,9 +646,9 @@ WOK def title_banner(title,subtitle,creator) end def dot_control_pre_next - pre="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" - up="#{@md.fnl[:pre]}#{@toc}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" - nxt="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" + pre="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:html]}" + up="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" + nxt="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" if nxt=~/sisu_manifest\.html/ @file=SiSU_Env::SiSU_file.new(@md) if @md if @file.output_dir_structure.by_language_code? \ @@ -674,8 +674,8 @@ WOK #{@vz.table_close}} end def dot_control_pre - pre="#{@md.fnl[:pre]}#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" - up="#{@md.fnl[:pre]}#{@toc}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" + pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}" + up="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" nxt="#{@md.fn[:toc]}" %{
} pre=%{} if f_pre==true nxt=%{} if f_nxt==true @@ -1281,7 +1281,7 @@ WOK fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info %{

- #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}#{@endnote_part_b} + #{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:html]}#{@endnote_part_b}

} end diff --git a/lib/sisu/v3/html_minitoc.rb b/lib/sisu/v3/html_minitoc.rb index 7390ee7c..3a4f8fc5 100644 --- a/lib/sisu/v3/html_minitoc.rb +++ b/lib/sisu/v3/html_minitoc.rb @@ -115,7 +115,7 @@ title=unless txt.obj =~/Document Information/; txt.obj else link='metadata' - %{#{txt.obj}} + %{#{txt.obj}} end toc={} txt_obj={ txt: title } @@ -148,13 +148,13 @@ txt=@data unless txt =~/~metadata/ if txt.ln ==4 - seg_link=%{ + seg_link=%{ #{txt.obj} } @@seg_url=txt.name elsif txt.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ seg_link=txt.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, - %{\\1 \\2 }) end txt_obj={ txt: seg_link } @@ -170,7 +170,7 @@ txt.obj.gsub!(@pat_strip_heading_name,'\1') end toc={} - lnk_n_txt=%{ + lnk_n_txt=%{ #{txt.obj} } txt_obj={ txt: lnk_n_txt } @@ -185,7 +185,7 @@ txt.obj.gsub!(@pat_strip_heading_name,'\1') end toc={} - lnk_n_txt=%{ + lnk_n_txt=%{ #{txt.obj} } txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v3/html_segments.rb b/lib/sisu/v3/html_segments.rb index fb9b01cb..ccd48407 100644 --- a/lib/sisu/v3/html_segments.rb +++ b/lib/sisu/v3/html_segments.rb @@ -237,7 +237,7 @@ module SiSU_HTML_seg mkdir_p(@file.output_path.html_seg.dir) if File.writable?("#{@file.output_path.base.dir}/.") end Seg.new(@md).tail - segfilename="#{@file.output_path.html_seg.dir}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking-1]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" + segfilename="#{@file.output_path.html_seg.dir}/#{@@seg_name_html[tracking-1]}#{@md.lang_code_insert}#{Sfx[:html]}" output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] minitoc=(@env.html_minitoc?) \ ? @minitoc \ diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 5d93523e..5d35bf3d 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -905,9 +905,9 @@ module SiSU_Param @doc={ lv: [] } @doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','','' @@publisher='SiSU scribe' - attr_accessor :make,:env,:path,:file,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:links,: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,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:en,:notes,: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,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy + attr_accessor :make,:env,:path,:file,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:links,: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,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:lang_code_insert,:en,:notes,: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,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy def initialize(fns_array,opt) - @env=@path,@file=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@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_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@links=@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=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@en=@notes=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=nil + @env=@path,@file=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@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_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@links=@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=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@lang_code_insert=@en=@notes=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=nil @data,@path,@fns,@opt=fns_array,opt.pth,opt.fns,opt #@data used as data @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=false,false,false,false,false,false,false @seg_autoname_safe=true @@ -918,6 +918,9 @@ module SiSU_Param @flv,@lang,@seg_names,@tags,@tag_array,@tag_a,@ec[:image],@ec[:audio],@ec[:multimedia]=Array.new(9){[]} @authors,@topic_register_array,@papersize_array=[],[],[] @lvs=[nil,0,0,0,0,0,0] + @lang_code_insert=(@opt.dir_structure_by =~/language/) \ + ? '' \ + : ".#{@opt.lng}" @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/ @rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg @@ -1318,7 +1321,7 @@ module SiSU_Param @language[:code]=fn_set_lang[:c] @language[:name]=fn_set_lang[:n] end - @fnl=@env.i18n.lang_filename(fn_set_lang[:n]) + @fnl=@env.i18n.lang_filename(fn_set_lang[:c]) #fix # @flv.each do |l| # lang=SiSU_Env::Standardise_language.new.file_to_language(l) diff --git a/lib/sisu/v3/xml_format.rb b/lib/sisu/v3/xml_format.rb index a3539f60..58b3f880 100644 --- a/lib/sisu/v3/xml_format.rb +++ b/lib/sisu/v3/xml_format.rb @@ -537,7 +537,7 @@ WOK if type=~/pdf/ @tocband_segtoc=make_scroll_seg_pdf end - firstseg=%{ + firstseg=%{ #{@vz.png_nav_nxt} } if @md.firstseg =~/\S+/ %{
@@ -697,17 +697,17 @@ WOK def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' toc=%{ - + #{@vz.png_nav_toc} - + #{@vz.png_nav_pre} - + #{@vz.png_nav_nxt}
@@ -556,7 +556,7 @@ WOK if type=~/pdf/ @tocband_segtoc=make_scroll_seg_pdf end - firstseg=%{ + firstseg=%{ #{@vz.png_nav_nxt} } if @md.firstseg =~/\S+/ %{
@@ -891,17 +891,17 @@ WOK def dot_control_pre_next %{
- + #{@vz.png_nav_dot_pre} - + #{@vz.png_nav_dot_toc} - + #{@vz.png_nav_dot_nxt} #{@vz.table_close}} @@ -909,12 +909,12 @@ WOK def dot_control_pre %{ @@ -927,17 +927,17 @@ WOK def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' toc=%{} pre=%{} if f_pre==true nxt=%{} if f_nxt==true @@ -1479,7 +1479,7 @@ WOK fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info # Sfx[:html] or Sfx[:xhtml] ? %{

- #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}#{@endnote_part_b} + #{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:html]}#{@endnote_part_b}

} end -- cgit v1.2.3 From eebc0d4f7af96cb387955cc25c0059f2e9dd63d3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 May 2011 21:42:51 -0400 Subject: v3: manifest, sysenv, "available outputs" relative paths; available languages * relative paths to "available outputs" (for each dir structure), fix * show language versions published (needs 2 runs for manifest, polls output as to whether manifest exists) --- lib/sisu/v3/manifest.rb | 434 +++++++++++++++++++++++++++--------------------- lib/sisu/v3/sysenv.rb | 408 +++++++++++++++++++++++++++++++-------------- 2 files changed, 529 insertions(+), 313 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index 90f8df55..0c6d5460 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -67,6 +67,7 @@ module SiSU_Manifest include SiSU_HTML_Format require_relative 'param' # param.rb include SiSU_Param + require_relative 'i18n' # i18n.rb include SiSU_Viz class Source def initialize(opt) @@ -101,11 +102,11 @@ module SiSU_Manifest def initialize(md) @manifest={ txt: [], html: [] } @md,@fns=md,md.fns -# @file=SiSU_Env::SiSU_file.new(@md) @env=SiSU_Env::Info_env.new(@md.fns) @fnb=@md.fnb @base_url="#{@env.url.root}/#{@fnb}" - @base_path=@md.file.output_path.manifest.dir + @f=SiSU_Env::SiSU_file.new(@md) + @base_path=@f.output_path.manifest.dir @@dg ||=SiSU_Env::Info_env.new.digest.type @dg=@@dg l=SiSU_Env::Standardise_language.new(@md.opt.lng).language @@ -114,26 +115,26 @@ module SiSU_Manifest @brace_url=SiSU_Viz::Skin.new.url_decoration end def output - manifest=@md.file.write_file.manifest + manifest=@f.write_file.manifest @manifest[:html].each do |x| - x.gsub!(Xx[:html_relative2],@md.file.path_rel_links.html_scroll_2) - x.gsub!(Xx[:html_relative1],@md.file.path_rel_links.html_scroll_1) + x.gsub!(Xx[:html_relative2],@f.path_rel_links.html_scroll_2) + x.gsub!(Xx[:html_relative1],@f.path_rel_links.html_scroll_1) manifest << x end end - def summarize(id,file,pth='',url='',img='● ') + def summarize(id,file,pth='',rel='',url='',img='● ') size=(File.size("#{pth}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] << "#{file} #{id} #{kb}\n" - @manifest[:html] << %{\n} + @manifest[:html] << %{\n} end - def summarize_html_seg(id,file,pth='',url='',img='● ') + def summarize_html_seg(id,file,pth='',rel='',url='',img='● ') size=(File.size("#{pth}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] << "#{file} #{id} #{kb}\n" - @manifest[:html] << %{\n} + @manifest[:html] << %{\n} end - def summarize_sources(id,file,pth,url) + def summarize_sources(id,file,pth,rel,url) sys=SiSU_Env::System_call.new dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{pth}/#{file}") else sys.md5("#{pth}/#{file}") @@ -142,25 +143,62 @@ module SiSU_Manifest size=(File.size("#{pth}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] << "#{file} #{id} #{kb}\n" - @manifest[:html] << %{\n} if kb and kb =~/\d+/ end + def published_manifests? + @f=SiSU_Env::SiSU_file.new(@md) #.base_filename + @m=[] + url=@f.output_path.base.url + manifests={} + mp,mn,mt,mr=nil,nil,nil,nil + ln=SiSU_i18n::Languages.new.list + Px[:lng_lst].each do |lc| + if @env.output_dir_structure.by_language_code? + mp="#{@f.output_path.base.dir}/#{lc}/manifest" + mn="#{@md.fnb}.html" + mt="#{mp}/#{mn}" + mr="../../#{lc}/manifest/#{mn}" + mu="#{url}/#{lc}/manifest/#{mn}" + elsif @env.output_dir_structure.by_filetype? + mp="#{@f.output_path.base.dir}/manifest" + mn="#{@md.fnb}.#{lc}.html" + mt="#{mp}/#{mn}" + mr=mn + mu="#{url}/manifest/#{mn}" + else + mp="#{@f.output_path.base.dir}/#{@md.fnb}" + mn="sisu_manifest.#{lc}.html" + mt="#{mp}/#{mn}" + mr=mn + mu="#{url}/#{mn}" + end + if FileTest.directory?(mp) \ + && FileTest.file?(mt) + lng=ln[lc][:t] + manifests[lc]={ ln: lng, fn: mn, rel: mr } + @m << { mu: mu, l: lng, rel: mr } + end + end + manifests + @m.uniq! + @m + end def languages(id,file) - flv=@env.published_manifests?(@base_path) + flv=published_manifests? @manifest[:html] << %{\n} end def published_languages(id,file) - flv=@env.published_manifests?(@base_path) + flv=published_manifests? flv.each do |l| - lang=SiSU_Translate::Source.new(@md,@language,l[:n]).language_list - @manifest[:txt] << "#{l[:m]} #{lang}\n" - @manifest[:html] << %{\n} + @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n" + @manifest[:html] << %{\n} end end def metadata(id,info) @@ -175,173 +213,191 @@ module SiSU_Manifest @manifest[:html] << %{\n} end def output_tests - if FileTest.file?(@md.file.place_file.html_segtoc.dir)==true - img=%{TOC linked } - pth=@md.file.output_path.html_seg.dir - url=@md.file.output_path.html_seg.url - id,file='HTML, table of contents (for segmented text)',@md.file.base_filename.html_segtoc - summarize_html_seg(id,file,pth,url,img) - end - if FileTest.file?(@md.file.place_file.html_scroll.dir)==true - img=%{Full Text } - pth=@md.file.output_path.html_scroll.dir - url=@md.file.output_path.html_scroll.url - id,file='HTML, full length document',@md.file.base_filename.html_scroll - summarize(id,file,pth,url,img) - end - if FileTest.file?(@md.file.place_file.html_book_index.dir)==true - pth=@md.file.output_path.html_seg.dir - url=@md.file.output_path.html_seg.url - id,file='HTML, (book type) index',@md.file.base_filename.html_book_index - summarize(id,file,pth,url) - end - if FileTest.file?(@md.file.place_file.html_concordance.dir)==true - pth=@md.file.output_path.html_seg.dir - url=@md.file.output_path.html_seg.url - id,file='HTML, concordance file',@md.file.base_filename.html_concordance - summarize(id,file,pth,url) - end - if FileTest.file?(@md.file.place_file.epub.dir)==true - img=%{EPUB } - id,file='EPUB (Electronic Publication, e-book standard)',@md.file.base_filename.epub - pth=@md.file.output_path.epub.dir - url=@md.file.output_path.epub.url - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p_letter}")==true - img=%{PDF portrait } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)","#{@md.file.base_filename.pdf_p_letter}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l_letter}")==true - img=%{PDF landscape } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)","#{@md.file.base_filename.pdf_l_letter}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p_a4}")==true - img=%{PDF portrait } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, A4 size, portrait/vertical document (recommended for printing)","#{@md.file.base_filename.pdf_p_a4}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l_a4}")==true - img=%{PDF landscape } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)","#{@md.file.base_filename.pdf_l_a4}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p_a5}")==true - img=%{PDF portrait } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)","#{@md.file.base_filename.pdf_p_a5}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l_a5}")==true - img=%{PDF landscape } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)","#{@md.file.base_filename.pdf_l_a5}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p_b5}")==true - img=%{PDF portrait } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)","#{@md.file.base_filename.pdf_p_b5}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l_b5}")==true - img=%{PDF landscape } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)","#{@md.file.base_filename.pdf_l_b5}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p_legal}")==true - img=%{PDF portrait } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)","#{@md.file.base_filename.pdf_p_legal}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l_legal}")==true - img=%{PDF landscape } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)","#{@md.file.base_filename.pdf_l_legal}" - summarize(id,file,pth,url,img) - end - if FileTest.file?(@md.file.place_file.odt.dir)==true - img=%{ODF/ODT } - pth=@md.file.output_path.odt.dir - url=@md.file.output_path.odf.url - id,file='ODF:ODT (Open Document Format)',@md.file.base_filename.odt - summarize(id,file,pth,url,img) - end - if FileTest.file?(@md.file.place_file.xhtml.dir)==true - pth=@md.file.output_path.xhtml.dir - url=@md.file.output_path.xhtml.url - id,file='ODF:ODT (Open Document Format)',@md.file.base_filename.odt - id,file='XHTML',@md.file.base_filename.xhtml - summarize(id,file,pth,url) - end - if FileTest.file?(@md.file.place_file.xml_sax.dir)==true - pth=@md.file.output_path.xml_sax.dir - url=@md.file.output_path.xml_sax.url - id,file='XML SAX',@md.file.base_filename.xml_sax - summarize(id,file,pth,url) - end - if FileTest.file?(@md.file.place_file.xml_dom.dir)==true - pth=@md.file.output_path.xml_dom.dir - url=@md.file.output_path.xml_dom.url - id,file='XML DOM',@md.file.base_filename.xml_dom - summarize(id,file,pth,url) - end - if FileTest.file?(@md.file.place_file.txt.dir)==true + if FileTest.file?(@f.place_file.html_segtoc.dir)==true + img=%{TOC linked } + pth=@f.output_path.html_seg.dir + rel=@f.output_path.html_seg.rel_sm + url=@f.output_path.html_seg.url + id,file='HTML, table of contents (for segmented text)',@f.base_filename.html_segtoc + summarize_html_seg(id,file,pth,rel,url,img) + end + if FileTest.file?(@f.place_file.html_scroll.dir)==true + img=%{Full Text } + pth=@f.output_path.html_scroll.dir + rel=@f.output_path.html_scroll.rel_sm + url=@f.output_path.html_scroll.url + id,file='HTML, full length document',@f.base_filename.html_scroll + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?(@f.place_file.html_book_index.dir)==true + pth=@f.output_path.html_seg.dir + rel=@f.output_path.html_seg.rel_sm + url=@f.output_path.html_seg.url + id,file='HTML, (book type) index',@f.base_filename.html_book_index + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.html_concordance.dir)==true + pth=@f.output_path.html_seg.dir + rel=@f.output_path.html_seg.rel_sm + url=@f.output_path.html_seg.url + id,file='HTML, concordance file',@f.base_filename.html_concordance + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.epub.dir)==true + img=%{EPUB } + id,file='EPUB (Electronic Publication, e-book standard)',@f.base_filename.epub + pth=@f.output_path.epub.dir + rel=@f.output_path.epub.rel_sm + url=@f.output_path.epub.url + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_letter}")==true + img=%{PDF portrait } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_letter}" + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_letter}")==true + img=%{PDF landscape } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_letter}" + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a4}")==true + img=%{PDF portrait } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, A4 size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_a4}" + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a4}")==true + img=%{PDF landscape } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_a4}" + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a5}")==true + img=%{PDF portrait } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_a5}" + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a5}")==true + img=%{PDF landscape } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_a5}" + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_b5}")==true + img=%{PDF portrait } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_b5}" + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_b5}")==true + img=%{PDF landscape } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_b5}" + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_legal}")==true + img=%{PDF portrait } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_legal}" + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_legal}")==true + img=%{PDF landscape } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_legal}" + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?(@f.place_file.odt.dir)==true + img=%{ODF/ODT } + pth=@f.output_path.odt.dir + rel=@f.output_path.odt.rel_sm + url=@f.output_path.odf.url + id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?(@f.place_file.xhtml.dir)==true + pth=@f.output_path.xhtml.dir + rel=@f.output_path.xhtml.rel_sm + url=@f.output_path.xhtml.url + id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt + id,file='XHTML',@f.base_filename.xhtml + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_sax.dir)==true + pth=@f.output_path.xml_sax.dir + rel=@f.output_path.xml_sax.rel_sm + url=@f.output_path.xml_sax.url + id,file='XML SAX',@f.base_filename.xml_sax + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_dom.dir)==true + pth=@f.output_path.xml_dom.dir + rel=@f.output_path.xml_dom.rel_sm + url=@f.output_path.xml_dom.url + id,file='XML DOM',@f.base_filename.xml_dom + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.txt.dir)==true if @md.opt.cmd =~/a/; id='Plaintext (Unix (UTF-8) with footnotes)' elsif @md.opt.cmd =~/e/; id='Plaintext (Unix (UTF-8) with endnotes)' elsif @md.opt.cmd =~/A/; id='Plaintext (dos (UTF-8) with footnotes)' elsif @md.opt.cmd =~/E/; id='Plaintext (dos (UTF-8) with endnotes)' else id='Plaintext (UTF-8)' end - pth=@md.file.output_path.txt.dir - url=@md.file.output_path.txt.url - file=@md.file.base_filename.txt - summarize(id,file,pth,url) + pth=@f.output_path.txt.dir + rel=@f.output_path.txt.rel_sm + url=@f.output_path.txt.url + file=@f.base_filename.txt + summarize(id,file,pth,rel,url) end if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true id,file='LaTeX (portrait)',"#{@md.fns}.tex" - pth,url='','' - summarize(id,file,pth,url) + pth,rel,url='','','' + summarize(id,file,pth,rel,url) end if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true id,file='LaTeX (landscape)',"#{@md.fns}.landscape.tex" - pth,url='','' - summarize(id,file,pth,url) + pth,rel,url='','','' + summarize(id,file,pth,rel,url) end if FileTest.file?("#{@base_path}/#{@md.fn[:digest]}")==true id,file="Digest/DCC - Document Content Certificate (#{@dg})",@md.fn[:digest] pth=@base_path - url='' + rel,url='','' #pth='' - summarize(id,file,pth,url) + summarize(id,file,pth,rel,url) end end def published_versions - if FileTest.file?("#{@base_path}/sisu_manifest.html")==true - id,file='Markup (SiSU source)',@md.fns - languages(id,file) - end + id,file='Markup (SiSU source)',@md.fns + languages(id,file) end def language_versions - if FileTest.file?(@md.file.place_file.manifest.dir)==true + if FileTest.file?(@f.place_file.manifest.dir)==true id,file='Markup (SiSU source)',@md.fns published_languages(id,file) end @@ -349,31 +405,35 @@ module SiSU_Manifest def source_tests if @md.fns =~/\.ssm\.sst$/ #% decide whether to extract and include requested/required documents req=@md.fns - if FileTest.file?(@md.file.place_file.src.dir)==true - pth=@md.file.output_path.src.dir - url=@md.file.output_path.src.url - id,file='Markup Composite File (SiSU source)',@md.file.base_filename.src - summarize_sources(id,file,pth,url) + if FileTest.file?(@f.place_file.src.dir)==true + pth=@f.output_path.src.dir + rel=@f.output_path.src.rel_sm + url=@f.output_path.src.url + id,file='Markup Composite File (SiSU source)',@f.base_filename.src + summarize_sources(id,file,pth,rel,url) end else - if FileTest.file?(@md.file.place_file.src.dir)==true - pth=@md.file.output_path.src.dir - url=@md.file.output_path.src.url - id,file='Markup (SiSU source)',@md.file.base_filename.src - summarize_sources(id,file,pth,url) + if FileTest.file?(@f.place_file.src.dir)==true + pth=@f.output_path.src.dir + rel=@f.output_path.src.rel_sm + url=@f.output_path.src.url + id,file='Markup (SiSU source)',@f.base_filename.src + summarize_sources(id,file,pth,rel,url) end end - if FileTest.file?(@md.file.place_file.sisupod.dir)==true - pth=@md.file.output_path.sisupod.dir - url=@md.file.output_path.sisupod.url - id,file='SiSU doc (zip)',@md.file.base_filename.sisupod - summarize_sources(id,file,pth,url) + if FileTest.file?(@f.place_file.sisupod.dir)==true + pth=@f.output_path.sisupod.dir + rel=@f.output_path.sisupod.rel_sm + url=@f.output_path.sisupod.url + id,file='SiSU doc (zip)',@f.base_filename.sisupod + summarize_sources(id,file,pth,rel,url) end - if FileTest.file?(@md.file.place_file.pot.dir)==true - pth=@md.file.output_path.pot.dir - url=@md.file.output_path.pot.url - id,file='SiSU pot',@md.file.base_filename.pot - summarize_sources(id,file,pth,url) + if FileTest.file?(@f.place_file.pot.dir)==true + pth=@f.output_path.pot.dir + rel=@f.output_path.pot.rel_sm + url=@f.output_path.pot.url + id,file='SiSU pot',@f.base_filename.pot + summarize_sources(id,file,pth,rel,url) end end def metadata_tests @@ -659,8 +719,8 @@ SiSU manifest: #{@md.title.full} - - + + #{banner_table} @@ -669,8 +729,8 @@ WOK if @env.output_dir_structure.by_language_code? \ or @env.output_dir_structure.by_filetype? minitoc.gsub!(/ diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 127e4181..df86904b 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -445,6 +445,8 @@ module SiSU_Env 'language' elsif by_filetype? 'filetype' + elsif by_filename? + 'filename' else 'filename' end @@ -1442,6 +1444,81 @@ WOK end self end + def path_rel_links + def html_scroll_2 + if @env.output_dir_structure.by_language_code? + '../../' + elsif @env.output_dir_structure.by_filetype? + '../' + else + '../' + end + end + def html_seg_2 + if @env.output_dir_structure.by_language_code? + '../../../' + elsif @env.output_dir_structure.by_filetype? + '../../' + else + '../' + end + end + def html_scroll_1 + if @env.output_dir_structure.by_language_code? + '../' + elsif @env.output_dir_structure.by_filetype? + '../' + else + './' + end + end + def html_seg_1 + if @env.output_dir_structure.by_language_code? + '../../' + elsif @env.output_dir_structure.by_filetype? + '../../' + else + './' + end + end + def default_output_css + if @env.output_dir_structure.by_language_code? + '../../' + elsif @env.output_dir_structure.by_filetype? + '../' + else + '../' + end + end + def html_scroll_css + default_output_css + end + def xhtml_css + default_output_css + end + def xml_css + default_output_css + end + def html_seg_css + if @env.output_dir_structure.by_language_code? + '../../../' + elsif @env.output_dir_structure.by_filetype? + '../../' + else + '../' + end + end + def manifest_css + if @env.output_dir_structure.by_language_code? + '../../_sisu/css' + elsif @env.output_dir_structure.by_filetype? + '' + else + '../' + end + end + self + end def path #dir def home @sys.home @@ -3028,81 +3105,6 @@ WOK end self end - def path_rel_links - def html_scroll_2 - if @env.output_dir_structure.by_language_code? - '../../' - elsif @env.output_dir_structure.by_filetype? - '../' - else - '../' - end - end - def html_seg_2 - if @env.output_dir_structure.by_language_code? - '../../../' - elsif @env.output_dir_structure.by_filetype? - '../../' - else - '../../' - end - end - def html_scroll_1 - if @env.output_dir_structure.by_language_code? - '../' - elsif @env.output_dir_structure.by_filetype? - '../' - else - '/' - end - end - def html_seg_1 - if @env.output_dir_structure.by_language_code? - '../../' - elsif @env.output_dir_structure.by_filetype? - '../../' - else - '/' - end - end - def default_output_css - if @env.output_dir_structure.by_language_code? - '../../' - elsif @env.output_dir_structure.by_filetype? - '../' - else - '../' - end - end - def html_scroll_css - default_output_css - end - def xhtml_css - default_output_css - end - def xml_css - default_output_css - end - def html_seg_css - if @env.output_dir_structure.by_language_code? - '../../../' - elsif @env.output_dir_structure.by_filetype? - '../../' - else - '../' - end - end - def manifest_css - if @env.output_dir_structure.by_language_code? - '../../_sisu/css' - elsif @env.output_dir_structure.by_filetype? - '' - else - '../' - end - end - self - end def mkdir #check moved from SiSU_file, existing mkdir def processing def dal @@ -3432,110 +3434,117 @@ WOK end def base_filename def txt + ft='.txt' if @env.output_dir_structure.by_language_code? - @md.fnb + '.txt' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + @md.fn[:plain] + @md.fnb + @md.lang_code_insert + ft else - 'plain' + @md.fn[:plain] + 'plain' + @md.lang_code_insert + ft end end def html_scroll - #"#{@md.fnl[:pre]}scroll#{@md.fnl[:mid]}.html#{@md.fnl[:post]}" + ft='.html' if @env.output_dir_structure.by_language_code? - @md.fnb + '.html' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + @md.fn[:html] + @md.fnb + @md.lang_code_insert + ft else - 'scroll' + @md.fn[:html] + 'scroll' + @md.lang_code_insert + ft end end def html_seg_index - #"#{@md.fnl[:pre]}index#{@md.fnl[:mid]}.html#{@md.fnl[:post]}" + ft='.html' if @env.output_dir_structure.by_language_code? - 'toc.html' + 'toc' + ft else - 'index' + @md.fn[:html] + 'index' + @md.lang_code_insert + ft end end def html_segtoc - #"#{@md.fnl[:pre]}toc#{@md.fnl[:mid]}.html#{@md.fnl[:post]}" + ft='.html' if @env.output_dir_structure.by_language_code? - 'toc.html' + 'toc' + ft else - 'toc' + @md.fn[:html] + 'toc' + @md.lang_code_insert + ft end end def html_book_index + ft='.html' if @env.output_dir_structure.by_language_code? - 'book_index.html' + 'book_index' + ft else - 'book_index.' + @md.fn[:html] + 'book_index' + @md.lang_code_insert + ft end end def html_concordance + ft='.html' if @env.output_dir_structure.by_language_code? - 'concordance.html' + 'concordance' + ft else - 'concordance' + @md.fn[:html] + 'concordance' + @md.lang_code_insert + ft end end def xhtml + ft= '.xhtml' if @env.output_dir_structure.by_language_code? - @md.fnb + '.xhtml' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + '.' + @md.fn[:xhtml] + @md.fnb + @md.lang_code_insert + ft else - 'scroll.' + @md.fn[:xhtml] + 'scroll' + @md.lang_code_insert + ft end end def epub + ft='.epub' if @env.output_dir_structure.by_language_code? - @md.fnb + '.epub' + @md.fnb + ft else - @md.fnb + @md.fn[:epub] + @md.fnb + @md.lang_code_insert + ft end end def odt - #"#{@md.fnl[:pre]}#{@md.fnb}#{@md.fnl[:mid]}.odt#{@md.fnl[:post]}" + ft='.odt' if @env.output_dir_structure.by_language_code? - @md.fnb + '.odt' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + @md.fn[:odf] + @md.fnb + @md.lang_code_insert + ft else - 'opendocument' + @md.fn[:odf] + 'opendocument' + @md.lang_code_insert + ft end end def xml_sax + ft='.sax.xml' if @env.output_dir_structure.by_language_code? - @md.fnb + '.sax.xml' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + '.' + @md.fn[:sax] + @md.fnb + @md.lang_code_insert + ft else - 'scroll.' + @md.fn[:sax] + 'scroll' + @md.lang_code_insert + ft end end def xml_dom + ft='.dom.xml' if @env.output_dir_structure.by_language_code? - @md.fnb + '.dom.xml' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + '.' + @md.fn[:dom] + @md.fnb + @md.lang_code_insert + ft else - 'scroll.' + @md.fn[:dom] + 'scroll' + @md.lang_code_insert + ft end end def pdf_p if @env.output_dir_structure.by_language_code? \ or @env.output_dir_structure.by_filetype? @md.fnb + '.portrait.' - else 'portrait.' + else 'portrait' + @md.lang_code_insert + '.' end end def pdf_l if @env.output_dir_structure.by_language_code? \ or @env.output_dir_structure.by_filetype? @md.fnb + '.landscape.' - else 'landscape.' + else 'landscape' + @md.lang_code_insert + '.' end end def pdf_p_a4 @@ -3569,43 +3578,47 @@ WOK pdf_l + @md.fn[:pdf_l_legal] end def manpage + ft='.1' if @env.output_dir_structure.by_language_code? - @md.fnb + '.1' + @md.fnb + ft else - @md.fnb + '.' + @md.fn[:manpage] + @md.fnb + @md.lang_code_insert + ft end end def hash_digest + ft='.txt' if @env.output_dir_structure.by_language_code? - @md.fnb + '.hash_digest.txt' + @md.fnb + '.hash_digest' + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + '.' + @md.fn[:digest] + @md.fnb + @md.lang_code_insert + ft else - 'digest.' + @md.fn[:digest] + 'digest' + @md.lang_code_insert + ft end end def sitemap + ft='.xml' if @env.output_dir_structure.by_language_code? - @md.fnb + '.sitemap.xml' + @md.fnb + '.sitemap' + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + '.' + @md.fn[:sitemap] + @md.fnb + @md.lang_code_insert + ft else - 'sitemap.' + @md.fn[:sitemap] + 'sitemap' + @md.lang_code_insert + ft end end def manifest + ft='.html' if @env.output_dir_structure.by_language_code? - @md.fnb + '.manifest.html' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + '.' + @md.fn[:manifest] - else - 'sisu_' + @md.fn[:manifest] + @md.fnb + @md.lang_code_insert + ft + else #fix + 'sisu_manifest' + @md.lang_code_insert + ft end end def src @md.fns end - def po + def po #check (@fno.empty?) \ ? (@md.fn[:po]) \ : (@fno + '.po') @@ -3705,18 +3718,28 @@ WOK def rcp def abc if @env.output_dir_structure.by_language_code? - "#{output_path.stub.rcp}/#{@md.opt.lng}/#{ft}" + "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}" elsif @env.output_dir_structure.by_filetype? - "#{output_path.stub.rcp}/#{ft}" + "#{output_path.stub.rcp}/#{@ft}" else "#{output_path.stub.rcp}/#{@md.fnb}" end end def ab if @env.output_dir_structure.by_language_code? - "#{output_path.stub.rcp}/#{@md.opt.lng}/#{ft}" + "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}" else - "#{output_path.stub.rcp}/#{ft}" + "#{output_path.stub.rcp}/#{@ft}" + end + end + self + end + def rel_sm + def ab + if @env.output_dir_structure.by_language_code? \ + or @env.output_dir_structure.by_filetype? + '../' + @ft + else '.' end end self @@ -3724,6 +3747,21 @@ WOK self end def output_path + def web_base + def dir + @env.path.webserv + end + def url + #"#{@env.url.root}" + end + def rel + '.' + end + def rcp + '.' + end + self + end def stub def dir "#{@md.opt.f_pth[:pth_stub]}" @@ -3768,6 +3806,9 @@ WOK def rcp "#{output_path.base.rcp}/pod" end + def rel_sm + #"#{output_path.base.rel}/pod" + end self end def sisugit @@ -3805,6 +3846,18 @@ WOK def rcp set_path(ft).rcp.ab_src end + def rel_sm + if @env.output_dir_structure.by_language_code? + '' + #"#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}" + elsif @env.output_dir_structure.by_filetype? + '' + #"#{output_path.base.dir}/#{@ft}" + else + '' + #"#{output_path.base.dir}/#{@md.fnb}" + end + end self end def po @@ -3868,6 +3921,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def html_scroll @@ -3886,6 +3942,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def html_seg @@ -3904,6 +3963,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def html_concordance @@ -3926,6 +3988,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def xhtml @@ -3944,6 +4009,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def epub @@ -3962,6 +4030,9 @@ WOK def rcp set_path(ft).rcp.ab end + def rel_sm + set_path(ft).rel_sm.ab + end self end def odt @@ -3980,6 +4051,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def xml @@ -3998,6 +4072,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def xml_sax @@ -4024,6 +4101,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def hash_digest @@ -4042,6 +4122,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def manifest @@ -4078,6 +4161,15 @@ WOK def rcp set_path(ft).rcp.ab end + def rel_sm + if @env.output_dir_structure.by_language_code? + '' + elsif @env.output_dir_structure.by_filetype? + '' + else + '' + end + end self end def manpage @@ -4096,6 +4188,15 @@ WOK def rcp set_path(ft).rcp.ab end + def rel_sm + if @env.output_dir_structure.by_language_code? + '' + elsif @env.output_dir_structure.by_filetype? + '' + else + '' + end + end self end def sitemaps @@ -4131,6 +4232,61 @@ WOK end self end + #def cgi + #end + def css + @d='_sisu/css' + def dir + output_path.base.dir + '/' + @d + end + def url + output_path.base.url + '/' + @d + end + def rel + @d + #output_path.base.rel + '/' + @d + end + def rcp + output_path.stub.rcp + '/' + @d + end + self + end + def images + @d='_sisu/image' + def dir + output_path.base.dir + '/' + @d + end + def url + output_path.base.url + '/' + @d + end + def rel + @d + #output_path.base.rel + '/' + @d + end + def rcp + output_path.stub.rcp + '/' + @d + end + self + end + def images_external + @d='_sisu/image_external' + def dir + output_path.base.dir + '/' + @d + end + def url + output_path.base.url + '/' + @d + end + def rel + output_path.base.rel + '/' + @d + end + def rcp + output_path.base.rcp + '/' + @d + end + self + end + #def css + # #"#{@env.path.output}/#{@env.path.style}" + #end self end end -- cgit v1.2.3 From b5b64d1ebf203b04c5484020d02c354b18d30224 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 May 2011 21:50:23 -0400 Subject: v3: texpdf, filenames --- lib/sisu/v3/texpdf.rb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index ebd68d6d..eff07f19 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -149,6 +149,7 @@ module SiSU_TeX @@n_lpdf||=0 #change def initialize(md,env) @md,@env=md,env + @f=SiSU_Env::SiSU_file.new(@md).base_filename end def latex_do(texfilename,papersize) @texfilename=texfilename @@ -175,12 +176,12 @@ module SiSU_TeX portrait_pdf="#{pwd}/#{tex_fn_base}.pdf" landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf" case papersize - when /a4/; pdf_p=@md.file.base_filename.pdf_p_a4; pdf_l=@md.file.base_filename.pdf_l_a4 - when /a5/; pdf_p=@md.file.base_filename.pdf_p_a5; pdf_l=@md.file.base_filename.pdf_l_a5 - when /b5/; pdf_p=@md.file.base_filename.pdf_p_b5; pdf_l=@md.file.base_filename.pdf_l_b5 - when /letter/; pdf_p=@md.file.base_filename.pdf_p_letter; pdf_l=@md.file.base_filename.pdf_l_letter - when /legal/; pdf_p=@md.file.base_filename.pdf_p_legal; pdf_l=@md.file.base_filename.pdf_l_legal - else pdf_p=@md.file.base_filename.pdf_p_a4; pdf_l=@md.file.base_filename.pdf_l_a4 + when /a4/; pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 + when /a5/; pdf_p=@f.pdf_p_a5; pdf_l=@f.pdf_l_a5 + when /b5/; pdf_p=@f.pdf_p_b5; pdf_l=@f.pdf_l_b5 + when /letter/; pdf_p=@f.pdf_p_letter; pdf_l=@f.pdf_l_letter + when /legal/; pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal + else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 end Dir.mkdir(@md.file.output_path.pdf.dir) unless FileTest.directory?(@md.file.output_path.pdf.dir) if FileTest.file?(portrait_pdf) @@ -223,12 +224,12 @@ module SiSU_TeX end end case @md.papersize_array[0] #default pdf - when /a4/; pdf_p=@md.file.base_filename.pdf_p_a4; pdf_l=@md.file.base_filename.pdf_l_a4 - when /a5/; pdf_p=@md.file.base_filename.pdf_p_a5; pdf_l=@md.file.base_filename.pdf_l_a5 - when /b5/; pdf_p=@md.file.base_filename.pdf_p_b5; pdf_l=@md.file.base_filename.pdf_l_b5 - when /letter/; pdf_p=@md.file.base_filename.pdf_p_letter; pdf_l=@md.file.base_filename.pdf_l_letter - when /legal/; pdf_p=@md.file.base_filename.pdf_p_legal; pdf_l=@md.file.base_filename.pdf_l_legal - else pdf_p=@md.file.base_filename.pdf_p_a4; pdf_l=@md.file.base_filename.pdf_l_a4 + when /a4/; pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 + when /a5/; pdf_p=@f.pdf_p_a5; pdf_l=@f.pdf_l_a5 + when /b5/; pdf_p=@f.pdf_p_b5; pdf_l=@f.pdf_l_b5 + when /letter/; pdf_p=@f.pdf_p_letter; pdf_l=@f.pdf_l_letter + when /legal/; pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal + else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 end if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_p}") mklnk=if @md.file.output_dir_structure.by_language_code? \ -- cgit v1.2.3 From 154fd687b4b16eedbe1bf774b9ecdeab84c9694b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 May 2011 21:56:12 -0400 Subject: v3: html, close files; syslink index.html to toc.html * syslink will need revisit (will only "work" properly with by_language dir structure) --- lib/sisu/v3/html.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb index b569653f..d586c25d 100644 --- a/lib/sisu/v3/html.rb +++ b/lib/sisu/v3/html.rb @@ -628,6 +628,7 @@ WOK end end rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + ensure; @filename_html_scroll.close end end def segtoc @@ -645,6 +646,18 @@ WOK end end rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + ensure + @filename_html_segtoc.close + @filename_html_index.close + ## only works properly for directory_structure_by language, fix + unless FileTest.file?("#{@file.output_path.html.dir}/index.html") + pwd_set=Dir.pwd + Dir.chdir(@file.output_path.html.dir) + system(" + ln -s #{@file.base_filename.html_segtoc} index.html + ") + Dir.chdir(pwd_set) + end end end end -- cgit v1.2.3 From 3a07ef3ca212b8858454c84f5bfbf8473c8830e1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 May 2011 22:05:51 -0400 Subject: v3: options, include markup source "base" path * used to parse alternative markup source dir structures --- lib/sisu/v3/options.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index aabbd946..e57bf7fa 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -60,14 +60,17 @@ module SiSU_commandline require "pathname" require_relative 'sysenv' # sysenv.rb + @@base_path=nil class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what + attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what def initialize(a) @x=a - @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng='','','','','','','','','','' + @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@base_path='','','','','','','','','','','' @f_pths,@files,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::Info_env.new @dir_structure_by=SiSU_Env::Env_call.new.output_dir_structure.by? + @@base_path ||=Dir.pwd + @base_path=@@base_path r=Px[:lng_lst].join('|') r.gsub!(/\|en\|/,'|') @lang_regx=%r{(?:#{r})} -- cgit v1.2.3 From d6f18ae946f5a10346e426eba2a4e73e38b464fc Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 May 2011 22:22:35 -0400 Subject: v3: sysenv, rsync, embedded: rsync to remote host alt output structures, fix --- lib/sisu/v3/embedded.rb | 18 +- lib/sisu/v3/remote.rb | 12 +- lib/sisu/v3/sysenv.rb | 500 +++++++++++++++++++++++++----------------------- 3 files changed, 281 insertions(+), 249 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/embedded.rb b/lib/sisu/v3/embedded.rb index f6049cec..fad1fb29 100644 --- a/lib/sisu/v3/embedded.rb +++ b/lib/sisu/v3/embedded.rb @@ -70,6 +70,7 @@ module SiSU_Embedded @env=SiSU_Env::Info_env.new(@md.fns) @rhost=SiSU_Env::Info_remote.new(@opt).remote_host_base @base_src_dir=@opt.f_pth[:pth].sub(/\/#{@opt.f_pth[:lng]}$/,'') + @f=SiSU_Env::SiSU_file.new(@md) end def read songsheet @@ -85,18 +86,21 @@ module SiSU_Embedded end def images src="#{@base_src_dir}/_sisu/image" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + src_img='_sisu/image' + ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}" + img_dir="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" @rhost.each do |remote_conn| rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image" + remote_rel=remote_conn[:name] + '/' + @f.output_path.stub.rcp if @md.opt.cmd.inspect =~/[vVMR]/ \ and FileTest.directory?(src) - mkdir_p(ldest) unless FileTest.directory?(ldest) - src_ec="#{src}/" + @md.ec[:image].join(" #{src}/") + mkdir_p(img_dir) unless FileTest.directory?(img_dir) + src_ec=@f.place_file.images.rel + '/' + @md.ec[:image].join(" #{@f.output_path.images.rel}/") unless @opt.fns =~/\.-sst$/ - SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync - if @md.opt.cmd.inspect =~/R/ #rsync to remote image directory - SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync - end + SiSU_Env::System_call.new(src_ec,ldest,'q').rsync('--relative',@opt.base_path) + #if @md.opt.cmd.inspect =~/R/ #rsync to remote image directory + # SiSU_Env::System_call.new(src_ec,remote_rel,'q').rsync('--relative') + #end end end end diff --git a/lib/sisu/v3/remote.rb b/lib/sisu/v3/remote.rb index d3e4d653..5537d7b4 100644 --- a/lib/sisu/v3/remote.rb +++ b/lib/sisu/v3/remote.rb @@ -71,15 +71,15 @@ module SiSU_Remote end def rsync SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put).dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.rsync + @remote.rsync.document end def rsync_base SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync').dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.rsync_base + @remote.rsync.site_base end def rsync_base_sync SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync and sync').dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.rsync_base_sync + @remote.rsync.site_base_sync end def rsync_sitemaps SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement sitemaps ->','rsync').dark_grey_title_hi unless @opt.cmd =~/q/ @@ -91,15 +91,15 @@ module SiSU_Remote end def scp SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put).dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.scp + @remote.scp.document end def scp_base SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement of base site ->','excluding images').dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.scp_base + @remote.scp.site_base end def scp_base_all SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','complete').dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.scp_base_all + @remote.scp.site_base_all end end class Get diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index df86904b..a35a9eef 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -523,12 +523,13 @@ module SiSU_Env @m end def filename(code,name,suffix) - d=SiSU_Env::Info_env.new(@fns) - fnl=d.i18n.lang_filename(code) - if code - "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}" - else "#{name}#{suffix}" - end + #d=SiSU_Env::Info_env.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={ @@ -789,14 +790,14 @@ module SiSU_Env dir_change,dir_return='','' if chdir \ && chdir != Dir.pwd - dir_change="cd #{chdir}" - dir_return='cd -' + dir_change=Dir.chdir(chdir) + dir_return=Dir.pwd end + dir_change system(" - #{dir_change} rsync -az#{vb} #{action} #{@input} #{@output} #{msg} - #{dir_return} ") + dir_return else puts "\tWARN: #{program} not found" end end @@ -2458,7 +2459,7 @@ WOK end class File_map < Info_env attr_accessor :local_sisu_source - def initialize(opt='') #watch + def initialize(opt='') #watch / REVIEW super() @opt=opt #,opt.fns,opt.cmd @env=(@opt.fns && !(@opt.fns.empty?) \ @@ -2725,250 +2726,277 @@ WOK remote_host_base_general end def scp #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built - self.remote_host_base.each do |remote_conn| - local_gen=@source_path - remote_gen=case @opt.cmd - when /u/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u - when /[abhHNopwxXy]/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/." - else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - end - local_epub=@source_path_epub - local_src=@source_path_src - local_pod=@source_path_pod - remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/." - remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." - remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/." - src_txt=@opt.fnc - src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip') - if (local_gen =~/\S/ \ - and local_gen !~/\/\//) \ - and (remote_gen =~/\S/ \ - and remote_gen !~/\/\//) \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - System_call.new(local_gen,remote_gen).scp - if FileTest.file?("#{local_src}/#{src_txt}") - System_call.new("#{local_src}/#{src_txt}",remote_src).scp + def document + self.remote_host_base.each do |remote_conn| + local_gen=@source_path + remote_gen=case @opt.cmd + when /u/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u + when /[abhHNopwxXy]/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/." + else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." end - if FileTest.file?("#{local_pod}/#{src_pod}") - System_call.new("#{local_src}/#{src_pod}",remote_pod).scp + local_epub=@source_path_epub + local_src=@source_path_src + local_pod=@source_path_pod + remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/." + remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." + remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/." + src_txt=@opt.fnc + src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip') + if (local_gen =~/\S/ \ + and local_gen !~/\/\//) \ + and (remote_gen =~/\S/ \ + and remote_gen !~/\/\//) \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ + System_call.new(local_gen,remote_gen).scp + if FileTest.file?("#{local_src}/#{src_txt}") + System_call.new("#{local_src}/#{src_txt}",remote_src).scp + end + if FileTest.file?("#{local_pod}/#{src_pod}") + System_call.new("#{local_src}/#{src_pod}",remote_pod).scp + end + if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub") + System_call.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp + end + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "#{local_gen} -> #{remote_gen}" + if FileTest.file?("#{local_src}/#{src_doc}") + puts "#{local_src}/#{src_doc}* -> #{remote_src}" + end + if FileTest.file?("#{local_pod}/#{src_doc}.zip") + puts "#{local_pod}/#{src_doc}* -> #{remote_pod}" + end + else + puts 'suspect scp request, ignored' + puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" + puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end - if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub") - System_call.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp + end + end + def site_base #base site + self.remote_host_base.each do |remote_conn| + local=@source_path + remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + if defined? @rc['permission_set']['remote_base_site'] \ + and @rc['permission_set']['remote_base_site'] \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ + puts "begin scp_base: #{local} -> #{remote}" + System_call.new("#{local}/#{@env.path.style}/",remote).scp + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "begin scp_base: #{local} -> #{remote}" + puts "#{local}/#{@env.path.style}/ -> #{remote}" + else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "#{local_gen} -> #{remote_gen}" - if FileTest.file?("#{local_src}/#{src_doc}") - puts "#{local_src}/#{src_doc}* -> #{remote_src}" + end + end + def site_base_all #base site + self.remote_host_base.each do |remote_conn| + local=@source_path + remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + if defined? @rc['permission_set']['remote_base_site'] \ + and @rc['permission_set']['remote_base_site'] \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ + puts "begin scp_base_all: #{local} -> #{remote}" + System_call.new("#{local}/_sisu/image_sys/",remote).scp + System_call.new("#{local}/_sisu/image/",remote).scp + System_call.new("#{local}/#{@env.path.style}/",remote).scp + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "scp_base_all: #{local} -> #{remote}" + puts "#{local}/_sisu/image_sys/ -> #{remote}" + puts "#{local}/_sisu/image/ -> #{remote}" + puts "#{local}/#{@env.path.style}/ -> #{remote}" + else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end - if FileTest.file?("#{local_pod}/#{src_doc}.zip") - puts "#{local_pod}/#{src_doc}* -> #{remote_pod}" + end + end + self + end + def images_from_skin + skin=Info_skin.new(@md).select + skin_array=nil + skin_images_array=[] + if skin + skin_array=IO.readlines(skin,"\n") + skin_array.each do |l| + if l !~/^#/ + if l =~/([a-z0-9._-]+\.(?:png|jpg|gif))/i + skin_images_array << $1 + end end - else - puts 'suspect scp request, ignored' - puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" - puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end end + skin_images_array end def rsync - self.remote_host_base.each do |remote_conn| - local_gen=@source_path - local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" - local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" - remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - remote_images="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image/." - remote_images_external="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image_external/." - local_epub=@source_path_epub - local_src=@source_path_src - local_pod=@source_path_pod - remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/." - remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." - remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/." - src_txt=@opt.fnc - src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip') - if (local_gen =~/\S/ \ - and local_gen !~/\/\//) \ - and (remote_gen =~/\S/ \ - and remote_gen !~/\/\//) \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - delete_extra_files='--delete' # '--delete-after' - inp=[] - begin - local_dirs=%{-f"+ */" -f"- *" #{@md.file.output_path.base.dir}/*} - System_call.new(local_dirs,remote_gen,@opt.cmd).rsync - rescue - local_dirs=%{--include='*/' --exclude='*' @md.file.output_path.base.dir} - System_call.new(local_dirs,remote_gen,@opt.cmd).rsync - end - if @opt.cmd =~/h/ \ - && FileTest.file?(@md.file.place_file.html_scroll.dir) - inp << @md.file.output_path.html_seg.rel << @md.file.place_file.html_scroll.rel - end - if @opt.cmd =~/w/ \ - && FileTest.file?(@md.file.place_file.html_concordance.dir) - inp << @md.file.place_file.html_concordance.rel - end - if @opt.cmd =~/e/ \ - && FileTest.file?(@md.file.place_file.epub.dir) - inp << @md.file.place_file.epub.rel - end - if @opt.cmd =~/o/ \ - && FileTest.file?(@md.file.place_file.odt.dir) - inp << @md.file.place_file.odt.rel - end - if @opt.cmd =~/b/ \ - && FileTest.file?(@md.file.place_file.xhtml.dir) - inp << @md.file.place_file.xhtml.rel - end - if @opt.cmd =~/x/ \ - && FileTest.file?(@md.file.place_file.xml_sax.dir) - inp << @md.file.place_file.xml_sax.rel - end - if @opt.cmd =~/X/ \ - && FileTest.file?(@md.file.place_file.xml_dom.dir) - inp << @md.file.place_file.xml_dom.rel - end - if @opt.cmd =~/[at]/ \ - && FileTest.file?(@md.file.place_file.txt.dir) - inp << @md.file.place_file.txt.rel - end - if @opt.cmd =~/N/ \ - && FileTest.file?(@md.file.place_file.hash_digest.dir) - inp << @md.file.place_file.hash_digest.rel - end - if @opt.cmd =~/s/ \ - && FileTest.file?(@md.file.place_file.src.dir) - inp << @md.file.place_file.src.rel - end - if @opt.cmd =~/S/ \ - && FileTest.file?(@md.file.place_file.sisupod.dir) - inp << @md.file.place_file.sisupod.rel - end - if @opt.cmd =~/p/ - inp << @md.file.output_path.pdf.rel + '/' + @opt.fnb + '*' - end - if @opt.cmd =~/y/ \ - && FileTest.file?(@md.file.place_file.manifest.dir) - inp << @md.file.place_file.manifest.rel - end - if inp.length > 0 - local_gen=inp.join(' ') - remote_rel=remote_conn[:name] + '/' + @md.file.output_path.stub.rcp - remote_rel='/home/ralph/tst' - System_call.new(local_gen,remote_rel,@opt.cmd).rsync('--relative',@md.file.output_path.base.dir) - end - if FileTest.file?("#{local_src}/#{src_txt}") + @f=SiSU_Env::SiSU_file.new(@md) + def document + self.remote_host_base.each do |remote_conn| + local_gen=@source_path + local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" + remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote_rel=remote_conn[:name] + '/' + @f.output_path.stub.rcp + src_txt=@opt.fnc + if (local_gen =~/\S/ \ + and local_gen !~/\/\//) \ + and (remote_gen =~/\S/ \ + and remote_gen !~/\/\//) \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ # System_call.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync - if defined? @md.ec[:image] and not @md.ec[:image].empty? - images="#{local_gen_image}/" + @md.ec[:image].join(" #{local_gen_image}/") -# System_call.new(images,remote_images,@opt.cmd).rsync + delete_extra_files='--delete' # '--delete-after' + inp=[] + if @opt.cmd =~/h/ \ + && FileTest.file?(@f.place_file.html_scroll.dir) + inp << @f.output_path.html_seg.rel << @f.place_file.html_scroll.rel + end + if @opt.cmd =~/w/ \ + && FileTest.file?(@f.place_file.html_concordance.dir) + inp << @f.place_file.html_concordance.rel + end + if @opt.cmd =~/e/ \ + && FileTest.file?(@f.place_file.epub.dir) + inp << @f.place_file.epub.rel + end + if @opt.cmd =~/o/ \ + && FileTest.file?(@f.place_file.odt.dir) + inp << @f.place_file.odt.rel + end + if @opt.cmd =~/b/ \ + && FileTest.file?(@f.place_file.xhtml.dir) + inp << @f.place_file.xhtml.rel + end + if @opt.cmd =~/x/ \ + && FileTest.file?(@f.place_file.xml_sax.dir) + inp << @f.place_file.xml_sax.rel + end + if @opt.cmd =~/X/ \ + && FileTest.file?(@f.place_file.xml_dom.dir) + inp << @f.place_file.xml_dom.rel + end + if @opt.cmd =~/[at]/ \ + && FileTest.file?(@f.place_file.txt.dir) + inp << @f.place_file.txt.rel + end + if @opt.cmd =~/N/ \ + && FileTest.file?(@f.place_file.hash_digest.dir) + inp << @f.place_file.hash_digest.rel + end + if @opt.cmd =~/s/ \ + && FileTest.file?(@f.place_file.src.dir) + inp << @f.place_file.src.rel + end + if @opt.cmd =~/S/ \ + && FileTest.file?(@f.place_file.sisupod.dir) + inp << @f.place_file.sisupod.rel + end + if @opt.cmd =~/p/ + inp << @f.output_path.pdf.rel + '/' + @opt.fnb + '*' + end + if @opt.cmd =~/y/ \ + && FileTest.file?(@f.place_file.manifest.dir) + inp << @f.place_file.manifest.rel + end + local_gen=if inp.length > 0 + inp.join(' ') + else '' + end + local_css,images,images_external,images_system='','','','' + if @opt.cmd =~/[hwbxX]/ \ + and defined? @md.ec[:image] \ + and not @md.ec[:image].empty? + images=@f.place_file.images.rel + '/' + @md.ec[:image].join(" #{@f.output_path.images.rel}/") images_external="#{local_gen_image_external}/" + @md.ec[:image].join(" #{local_gen_image_external}/") -# System_call.new(images_external,remote_images_external,@opt.cmd).rsync end + images_gen=images=images_skin=images_system=local_css='' + if @opt.cmd =~/[yhwbxX]/ \ + and defined? @md.ec[:image] \ + and not @md.ec[:image].empty? + local_css=@f.output_path.css.rel + images_system='_sisu/image_sys' + if @f.output_path.images.rel.length > 0 + images_skin=@f.place_file.images.rel + '/' + images_from_skin.join(" #{@f.output_path.images.rel}/") + end + end + begin + ##create file structure without copying files?: + ##rsync -av -f"+ */" -f"- *" @f.output_path.base.dir remote:./path/. + #local_dirs=%{-f"+ */" -f"- *" #{@f.output_path.base.dir}/*} + #System_call.new(local_dirs,remote_gen,@opt.cmd).rsync + local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css + System_call.new(local,remote_rel,@opt.cmd).rsync('--relative',@f.output_path.base.dir) + rescue + p __LINE__.to_s + ':' + __FILE__ + local_dirs=%{--include='*/' --exclude='*' #{@f.output_path.base.dir}} + System_call.new(local_dirs,remote_gen,@opt.cmd).rsync + end + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "#{local_gen} -> #{remote_gen}" + if FileTest.file?("#{local_src}/#{src_doc}") \ + or FileTest.file?("#{local_src}/#{src_doc}.zip") + puts "#{local_src}/#{src_doc}* -> #{remote_src}" + end + else + puts 'suspect rsync request, ignored' + puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" + puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "#{local_gen} -> #{remote_gen}" - if FileTest.file?("#{local_src}/#{src_doc}") \ - or FileTest.file?("#{local_src}/#{src_doc}.zip") - puts "#{local_src}/#{src_doc}* -> #{remote_src}" - end - else - puts 'suspect rsync request, ignored' - puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" - puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - end - end - end - def scp_base #base site - self.remote_host_base.each do |remote_conn| - local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - if defined? @rc['permission_set']['remote_base_site'] \ - and @rc['permission_set']['remote_base_site'] \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - puts "begin scp_base: #{local} -> #{remote}" - System_call.new("#{local}/#{@env.path.style}/",remote).scp - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "begin scp_base: #{local} -> #{remote}" - puts "#{local}/#{@env.path.style}/ -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end end - end - def scp_base_all #base site - self.remote_host_base.each do |remote_conn| - local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - if defined? @rc['permission_set']['remote_base_site'] \ - and @rc['permission_set']['remote_base_site'] \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - puts "begin scp_base_all: #{local} -> #{remote}" - System_call.new("#{local}/_sisu/image_sys/",remote).scp - System_call.new("#{local}/_sisu/image/",remote).scp - System_call.new("#{local}/#{@env.path.style}/",remote).scp - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "scp_base_all: #{local} -> #{remote}" - puts "#{local}/_sisu/image_sys/ -> #{remote}" - puts "#{local}/_sisu/image/ -> #{remote}" - puts "#{local}/#{@env.path.style}/ -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - end - end - end - def rsync_base #base site - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu" - image_sys="#{@env.path.webserv}/_sisu/image_sys" - images="#{@env.path.webserv}/_sisu/image" - self.remote_host_base.each do |remote_conn| - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - remote_conf="#{remote_conn[:name]}/_sisu" - if defined? @rc['permission_set']['remote_base_site'] \ - and @rc['permission_set']['remote_base_site'] \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - System_call.new("#{image_sys}","#{remote_conf}").rsync - System_call.new("#{images}","#{remote_conf}").rsync - System_call.new("#{ldest}","#{remote}").rsync - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "rsync_base: #{local} -> #{remote}" - puts "#{local}/_sisu/image -> #{remote}" - puts "#{local}/_sisu/image_sys/ -> #{remote}" - puts "#{local}/#{@env.path.style}/ -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + def site_base #base site + ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu" + image_sys="#{@env.path.webserv}/_sisu/image_sys" + images="#{@env.path.webserv}/_sisu/image" + self.remote_host_base.each do |remote_conn| + remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote_conf="#{remote_conn[:name]}/_sisu" + if defined? @rc['permission_set']['remote_base_site'] \ + and @rc['permission_set']['remote_base_site'] \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ + System_call.new("#{image_sys}","#{remote_conf}").rsync + System_call.new("#{images}","#{remote_conf}").rsync + System_call.new("#{ldest}","#{remote}").rsync + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "rsync_base: #{local} -> #{remote}" + puts "#{local}/_sisu/image -> #{remote}" + puts "#{local}/_sisu/image_sys/ -> #{remote}" + puts "#{local}/#{@env.path.style}/ -> #{remote}" + else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + end end end - end - def rsync_base_sync #base site - self.remote_host_base.each do |remote_conn| - local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - if defined? @rc['permission_set']['remote_base_site'] \ - and @rc['permission_set']['remote_base_site'] \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - delete_extra_files='--delete' # '--delete-after' - puts "begin rsync_base_sync: #{local} -> #{remote}" - System_call.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files) - System_call.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files) - System_call.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files) - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "rsync_base_sync: #{local} -> #{remote}" - puts "#{local}/_sisu/image_sys/ -> #{remote}" - puts "#{local}/_sisu/image/ -> #{remote}" - puts "#{local}/#{@env.path.style}/ -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + def site_base_sync + self.remote_host_base.each do |remote_conn| + local=@source_path + remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + if defined? @rc['permission_set']['remote_base_site'] \ + and @rc['permission_set']['remote_base_site'] \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ + delete_extra_files='--delete' # '--delete-after' + puts "begin rsync_base_sync: #{local} -> #{remote}" + System_call.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files) + System_call.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files) + System_call.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files) + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "rsync_base_sync: #{local} -> #{remote}" + puts "#{local}/_sisu/image_sys/ -> #{remote}" + puts "#{local}/_sisu/image/ -> #{remote}" + puts "#{local}/#{@env.path.style}/ -> #{remote}" + else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + end end end + self end def rsync_sitemaps #sitemap directory self.remote_host_base.each do |remote_conn| -- cgit v1.2.3 From f18dfa735dddbbb3eacdf87e1ce9f9549824be00 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 May 2011 22:25:59 -0400 Subject: v3: defaults, fix path to homepage image (more fixes remain...) --- lib/sisu/v3/defaults.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/defaults.rb b/lib/sisu/v3/defaults.rb index 2079da47..0ef81402 100644 --- a/lib/sisu/v3/defaults.rb +++ b/lib/sisu/v3/defaults.rb @@ -1029,12 +1029,13 @@ module SiSU_Viz %{lateral hop} end def png_home - dir=SiSU_Env::Info_env.new #(@fns) - %{#{txt_home} -->} - end - def png_home_button #dir=SiSU_Env::Info_env.new #(@fns) %{#{txt_home} -->} + #%{#{txt_home} -->} + end + def png_home_button + rel=@dir.path_rel_links.html_scroll_2 + %{#{txt_home} -->} end def png_book %{Cameron May Books} -- cgit v1.2.3
- + #{@vz.png_nav_dot_pre} - + #{@vz.png_nav_dot_toc} - + #{@vz.png_nav_toc} - + #{@vz.png_nav_pre} - + #{@vz.png_nav_nxt}

#{img}#{id}

#{file}

#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}

#{kb}

#{img}#{id}

#{file}

#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}

#{kb}

#{img}#{id}

#{file}

#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}

#{kb}

#{img}#{id}

#{file}

#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}

#{kb}

#{id}

#{file}   #{dgst[1]}
#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}

#{kb}

+ @manifest[:html] << %{

#{id}

#{file}   #{dgst[1]}
#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}

#{kb}

#{lang}

#{lang}

#{@brace_url.xml_open}#{@base_url}/#{l[:m]}#{@brace_url.xml_close}

 

#{l[:l]}

#{l[:l]}

#{@brace_url.xml_open}#{l[:mu]}#{@brace_url.xml_close}

 

#{lnk}

  #{@brace_url.xml_open}#{static}#{@brace_url.xml_close}