From 427c8b2969fef30a403a55adfc32b449d78d7fe9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:11:52 -0400 Subject: v3: texpdf, XeTeX language settings (setmainlanguage setotherlanguage) * get from directory or filename if header @make: :language: not set --- data/doc/sisu/CHANGELOG_v3 | 3 +++ lib/sisu/v3/texpdf.rb | 2 +- lib/sisu/v3/texpdf_format.rb | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index db069a13..e873047e 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -25,6 +25,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.14.orig.tar.gz * param, cleanup setting of auto endnotes + * texpdf, XeTeX language settings ((setmainlanguage setotherlanguage) from + directory or filename) if @make: :language: header not set + * xmls (sax, dom, xhtml) use of xml tidy, correct output file location * urls, --concordance diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 522480fd..22269fc2 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -183,7 +183,7 @@ module SiSU_TeX 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) + mkdir_p(@md.file.output_path.pdf.dir) unless FileTest.directory?(@md.file.output_path.pdf.dir) if FileTest.file?(portrait_pdf) cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}") rm(portrait_pdf) diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index d7942121..cd63cd4e 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -636,10 +636,20 @@ module SiSU_TeX_Pdf end def tex_head_lang #babel 18n lang_char_arr=@md.i18n - mainlang_char=lang_char_arr.slice(0) + mainlang_char=if @md.i18n == Array \ + and @md.i18n.length > 0 + lang_char_arr.slice(0) + else @md.opt.lng + end mainlang=@lang.list[mainlang_char][:xlp] - otherlang=[] - lang_char_arr.slice(1..9).each { |ch| otherlang << @lang.list[ch][:xlp] } + otherlang=if mainlang != 'english' + [ @lang.list['en'][:xlp] ] + else [] + end + if lang_char_arr.length > 0 + lang_char_arr.slice(1..9).each { |ch| otherlang << @lang.list[ch][:xlp] } + otherlang.uniq! + end otherlang=otherlang.join(',') { mainlang: mainlang, otherlang: otherlang } end -- cgit v1.2.3