aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v2/constants.rb2
-rw-r--r--lib/sisu/v2/css.rb1
-rw-r--r--lib/sisu/v2/dal_syntax.rb83
-rw-r--r--lib/sisu/v2/odf_format.rb1
-rw-r--r--lib/sisu/v2/param.rb33
-rw-r--r--lib/sisu/v2/sysenv.rb14
-rw-r--r--lib/sisu/v2/texpdf_format.rb19
-rw-r--r--lib/sisu/v2/xhtml_table.rb2
-rw-r--r--lib/sisu/v2/xml_tables.rb8
9 files changed, 99 insertions, 64 deletions
diff --git a/lib/sisu/v2/constants.rb b/lib/sisu/v2/constants.rb
index 7fc3b056..9eec8370 100644
--- a/lib/sisu/v2/constants.rb
+++ b/lib/sisu/v2/constants.rb
@@ -110,7 +110,7 @@ Rx[:lv],Rx[:lv_1],Rx[:lv_2],Rx[:lv_3],Rx[:lv_4],Rx[:lv_5],Rx[:lv_6],Rx[:lv_7],Rx
Rx[:meta]=/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}/
Dx[:url_o]='‹'; Dx[:url_c]='›'
Dx[:url_o_xml]='<'; Dx[:url_c_xml]='>'
-Dx[:rel_o]='‹'; Dx[:rel_c]='›'
+Dx[:rel_o]='‹'; Dx[:rel_c]='›' # Dx[:rel_o]='「'; Dx[:rel_c]='」'
Tex[:backslash]="\\\\"
Tex[:backslash]="\\\\"
Tex[:tilde]='\\\\\\~'
diff --git a/lib/sisu/v2/css.rb b/lib/sisu/v2/css.rb
index e187d24a..f088c44e 100644
--- a/lib/sisu/v2/css.rb
+++ b/lib/sisu/v2/css.rb
@@ -329,6 +329,7 @@ WOK
right: 0px;
margin-left: 75%;
width: 20%;
+ background-color: #aaaaaa;
}
.norm, .bold, .verse, .group, .alt {
diff --git a/lib/sisu/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb
index 0b7c6541..5e04730f 100644
--- a/lib/sisu/v2/dal_syntax.rb
+++ b/lib/sisu/v2/dal_syntax.rb
@@ -234,9 +234,51 @@ module SiSU_Syntax
end
dob
end
+ def fontface(dob)
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)\*\{(.+?)\}\*/,
+ "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)!\{(.+?)\}!/,
+ "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\(|\>)\/\{(.+?)\}\//,
+ "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)_\{(.+?)\}_/,
+ "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,
+ "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote?
+ dob.obj.gsub!(/(^|[^\\])\^\{(.+?)\}\^/,
+ "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|\(|\>|\S)9\{(.+?)\}9/,
+ "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript
+ dob.obj.gsub!(/(^|[^\\]),\{(.+?)\},/,
+ "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,
+ "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,
+ "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,
+ "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,
+ "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #strikethrough - deleted text
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/,
+ "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #deleted text
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/,
+ "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasise single word, watch
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/,
+ "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([^a-zA-Z0-9]|[ ,.;:'"~$]|$)/,
+ "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3") #italics single word, watch
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_([.,!'")]?(?:\s|$))/,
+ "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}\\3") #underscore single word, watch (made more complicated by url decoration escape tag (_url))
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+)-([^{]\S+?)-( |$)/,
+ "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}\\3") #underscore single word, watch
+ dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,
+ "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added
+ dob
+ end
def bodymarkup(dob)
# << http://www.jus.uio.no/sisu/sisu_markup_table/markup >>
# See: data/sisu/sample/document_samples_sisu_markup/
+ ## fontface
# *{emphasis}* e{emphasis}e <strong>emphasis</strong>
# !{bold text}! b{bold}b <b>bold text</b>
# _{underline}_ u{underline}u <u>underline</u>
@@ -246,6 +288,7 @@ module SiSU_Syntax
# ,{subscript}, <sub>subscript</sub>
# +{inserted text}+ <ins>inserted text</ins>
# -{deleted text}- <del>deleted text</del>
+ #
# {url address}:url
# {image.png}imageurl
# {image.png}png
@@ -350,44 +393,7 @@ module SiSU_Syntax
%{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3})
end
dob.obj.gsub!(/<:?p([nb])>/,"#{Mx[:fa_o]}p\\1#{Mx[:fa_c]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)\*\{(.+?)\}\*/,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasis
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)!\{(.+?)\}!/,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\(|\>)\/\{(.+?)\}\//,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)_\{(.+?)\}_/,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,
- "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote?
- dob.obj.gsub!(/(^|[^\\])\^\{(.+?)\}\^/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|\(|\>|\S)9\{(.+?)\}9/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript
- dob.obj.gsub!(/(^|[^\\]),\{(.+?)\},/,
- "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,
- "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,
- "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,
- "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,
- "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #strikethrough - deleted text
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/,
- "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #deleted text
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/,
- "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasise single word, watch
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/,
- "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([^a-zA-Z0-9]|[ ,.;:'"~$]|$)/,
- "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3") #italics single word, watch
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_([.,!'")]?(?:\s|$))/,
- "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}\\3") #underscore single word, watch (made more complicated by url decoration escape tag (_url))
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+)-([^{]\S+?)-( |$)/,
- "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}\\3") #underscore single word, watch
- dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,
- "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added
+ dob=fontface(dob)
dob.obj.gsub!(/<[:e]\s+(.+?)!?>/,
"#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}") #not tested
dob.obj.gsub!(/^\s*_\*\s*/,
@@ -417,6 +423,7 @@ module SiSU_Syntax
dob.obj.gsub!(/\{\s*(.+?)\s*\}(image)/,
"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image
elsif dob.is=='table'
+ dob=fontface(dob)
elsif dob.is =='code' # /^<:code>/ #should be enough # underscore used as escape for angle brackets
dob.obj.gsub!(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: ')
dob.obj.gsub!(/([<>])/,'_\1')
diff --git a/lib/sisu/v2/odf_format.rb b/lib/sisu/v2/odf_format.rb
index f0163f81..384b46b7 100644
--- a/lib/sisu/v2/odf_format.rb
+++ b/lib/sisu/v2/odf_format.rb
@@ -147,6 +147,7 @@ module SiSU_ODF_format
'Table_20_Heading'
else 'P7'
end
+ str.gsub!(/^~$/,'') # tilde / empty cell
%{<table:table-cell office:value-type="string">#{@br}} +
%{<text:p text:style-name="#{txt_name_cell}">#{@br}} +
%{#{str}} +
diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb
index fbc4ccde..98478626 100644
--- a/lib/sisu/v2/param.rb
+++ b/lib/sisu/v2/param.rb
@@ -148,8 +148,8 @@ module SiSU_Param
end
end
class Md
- def initialize(str,opt)
- @s,@opt=str,opt
+ def initialize(str,opt,env)
+ @s,@opt,@env=str,opt,env
end
def validate_length(s,l,n)
#s=(s.length <= l) ? s : nil
@@ -668,6 +668,11 @@ module SiSU_Param
else nil
end
end
+ def texpdf_font
+ @h['texpdf_font'] && (@h['texpdf_font']=~/\S{3,}/) \
+ ? @h['texpdf_font'] \
+ : @env.font.texpdf
+ end
def skin
@h['skin']
end
@@ -868,8 +873,8 @@ module SiSU_Param
fns_array=@data.dup
skip unless fns_array # consider
@markup_version=SiSU_Markup_type::Markup_identify.new(fns_array,@opt).markup_version? #% determine markup version
- if fns_array[0] =~ /^(?:%\s+)?(?:SiSU\s+(?:master\s+)?[\d.]*|sisu-[\d.]+)$/ #check markup and markup version
- if fns_array[0] =~ /^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)[\d.]+$/ #check markup and markup version
+ if fns_array[0] =~ /^(?:%\s+)?(?:SiSU\s+(?:master\s+)?[\d.]*|sisu-[\d.]+)$/ #check markup and markup version
+ if fns_array[0] =~ /^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)(?:[0-9]+)?(?:\.[0-9]+)?(?:\.[0-9]+)?$/ #check markup and markup version
@markup_version_declared=fns_array[0].match(/^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)([\d.]+)$/)[1]
sm_a,sm_b,sm_c=fns_array[0].match(/^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?$/)[1..3]
sm_c ||=0
@@ -922,23 +927,23 @@ module SiSU_Param
case para
when /^@ocn:\s+(.+?)$/m; @ocn=$1 #% processing
when /^@title:(.+)/m #% metainfo DC
- @title=Md.new($1.strip,@opt).title
+ @title=Md.new($1.strip,@opt,@env).title
when /^@creator:(.+)/m #% metainfo DC
- @creator=Md.new($1.strip,@opt).creator
+ @creator=Md.new($1.strip,@opt,@env).creator
@authorship=@author=@creator.author
@authors=@creator.author_detail
when /^@classify:(.+)/m; classify=$1
- @classify=Md.new($1.strip,@opt).classify
+ @classify=Md.new($1.strip,@opt,@env).classify
when /^@publisher:\s+(.+)/m
- @publisher=Md.new($1.strip,@opt).current_publisher
+ @publisher=Md.new($1.strip,@opt,@env).current_publisher
when /^@original:(.+)/m
- @original=Md.new($1.strip,@opt).original
+ @original=Md.new($1.strip,@opt,@env).original
@source=@original.source
when /^@writing_focus[:.]nationality:\s+(.+?)$/; @writing_focus=$1 # e.g. Finland (where and article on Finnish law)
when /^@date:(.+)/m #% metainfo DC
- @date=Md.new($1.strip,@opt).date
+ @date=Md.new($1.strip,@opt,@env).date
when /^@rights:(.+)/m; #@rights=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC copyright, public domain, copyleft, creative commons, etc.
- @rights=Md.new($1.strip,@opt).rights
+ @rights=Md.new($1.strip,@opt,@env).rights
when /^@papersize:\s+(.+?)$/m #% metainfo DC
l=$1
if @mod.inspect !~/--papersize[=-]\S+/
@@ -946,7 +951,7 @@ module SiSU_Param
@papersize=l
end
when /^@make:(.+)/m #% metainfo DC
- @make=Md.new($1.strip,@opt).make
+ @make=Md.new($1.strip,@opt,@env).make
if defined? @make.breaks \
and @make.breaks[:page_new] #clearpage
@pagenew=@make.breaks[:page_new]
@@ -978,7 +983,7 @@ module SiSU_Param
@man_section=(defined? @make.manpage.section) ? @make.manpage.section : 1
end
when /^@links:\s+(.+?)\Z/m #% processing
- doc_links=Md.new($1.strip,@opt).links
+ doc_links=Md.new($1.strip,@opt,@env).links
count=1
@lnk=[]
doc_links.each do |doc_link|
@@ -989,7 +994,7 @@ module SiSU_Param
end
end
when /^@notes?:\s(.+)/ #% metainfo
- Md.new($1.strip,@opt).notes
+ Md.new($1.strip,@opt,@env).notes
when /^@base_program:\s+(.+?)$/; @base_program=$1 #% processing
end
@lv1 ||=/^1~/
diff --git a/lib/sisu/v2/sysenv.rb b/lib/sisu/v2/sysenv.rb
index 4daccbcd..8a9e38be 100644
--- a/lib/sisu/v2/sysenv.rb
+++ b/lib/sisu/v2/sysenv.rb
@@ -1265,6 +1265,14 @@ WOK
end
end
end
+ def font
+ def texpdf
+ (defined? @rc['default']['texpdf_font']) \
+ ? @rc['default']['texpdf_font'] \
+ : 'Liberation Sans' #'Liberation Sans' #'Liberation Serif'
+ end
+ self
+ end
def path #dir
def home
@sys.home
@@ -1329,9 +1337,9 @@ WOK
@yamlrc_dir
end
def man #check use
- if defined? @rc['webserv']['man']; "#{webserv}/#{@rc['webserv']['man']}"
- else defaults[:webserv_man]
- end
+ (defined? @rc['webserv']['man']) \
+ ? "#{webserv}/#{@rc['webserv']['man']}" \
+ : defaults[:webserv_man]
end
def webserv_path #testing, check need, remove
webserv
diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb
index b53864ec..e756aa03 100644
--- a/lib/sisu/v2/texpdf_format.rb
+++ b/lib/sisu/v2/texpdf_format.rb
@@ -107,6 +107,19 @@ module SiSU_TeX_Pdf
def ocn_display(dob)
"\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{dob.ocn}}\\end{tiny}}}" #ocn object citation numbering
end
+ def table_special_characters(r)
+ r.gsub!(/#{Mx[:tc_p]}|$/u,'&')
+ r.gsub!(/%/,'\%')
+ r.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}')
+ r.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}')
+ r.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}') # ulem
+ r.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''") # quote #CHECK
+ r.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}') # ulem
+ r.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}') # ulem
+ r.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$")
+ r.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$")
+ r
+ end
def longtable_landscape
end_table='\end{longtable}'
row_break='\\\\\\'
@@ -137,7 +150,7 @@ module SiSU_TeX_Pdf
rows[0].gsub!(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")
end
rows.each do |r|
- r.gsub!(/#{Mx[:tc_p]}|$/,'&')
+ r=table_special_characters(r)
r.gsub!(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/
if r=~/\<!f(.+?)!\>/ # not tested table footer if any
tablefoot=$1
@@ -180,7 +193,7 @@ module SiSU_TeX_Pdf
rows[0].gsub!(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")
end
rows.each do |r|
- r.gsub!(/#{Mx[:tc_p]}|$/u,'&')
+ r=table_special_characters(r)
r.gsub!(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/
if r=~/\<!f(.+?)!\>/ # not tested table footer if any
tablefoot=$1
@@ -635,6 +648,7 @@ module SiSU_TeX_Pdf
\\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode}
\\setmainlanguage{#{tex_head_lang}}
\\setotherlanguage{english}
+\\setmainfont{#{@md.make.texpdf_font}}
WOK
when /pdf/
if @md.file_encoding =~ /iso-?8859/i #% iso8859
@@ -941,6 +955,7 @@ WOK
para_array=[]
str=if word
word.each do |w| # _ - / # | : ! ^ ~
+ w.gsub!(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<'); w.gsub!(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>')
w.gsub!(/[\\]?~/,'<=tilde>')
w.gsub!(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,' \newline ') #watch
w.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') #126 usual
diff --git a/lib/sisu/v2/xhtml_table.rb b/lib/sisu/v2/xhtml_table.rb
index 2b0cb5e7..25db60c8 100644
--- a/lib/sisu/v2/xhtml_table.rb
+++ b/lib/sisu/v2/xhtml_table.rb
@@ -78,6 +78,8 @@ module SiSU_XHTML_table
table_row_with_columns=table_row.split(Mx[:tc_p])
trc,nc=[],0
table_row_with_columns.each do |c|
+ c.gsub!(/^~$/,'') # tilde / empty cell
+ c.gsub!(/<:br>/,'<br />')
trc <<= if table_obj.head_ and nr==0; %{<th width="#{table_obj.widths[nc]}%">#{c}</th>}
else %{<td width="#{table_obj.widths[nc]}%">#{c}</td>}
end
diff --git a/lib/sisu/v2/xml_tables.rb b/lib/sisu/v2/xml_tables.rb
index f5b2845c..71bcb37e 100644
--- a/lib/sisu/v2/xml_tables.rb
+++ b/lib/sisu/v2/xml_tables.rb
@@ -142,9 +142,7 @@ module SiSU_Tables
#{tablefoot}}
end
def table_row(inf,h=false)
- bold=if h; '<b>'
- else ''
- end
+ bold=h ? '<b>' : ''
%{
<tr>
<td width="#{inf}%" valign="top">#{bold}}
@@ -155,9 +153,7 @@ module SiSU_Tables
end
end
def table_row_close(h=false)
- bold_close=if h; '</b>'
- else ''
- end
+ bold_close=h ? '<b>' : ''
"#{bold_close}</td></tr>"
end
def table