From 3f912866187fd5bdaf2a6428aad074044e1e2060 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 28 Aug 2013 18:19:02 -0400 Subject: v5: dal, grouped text with fontface spanning newlines, partial solution, test * merge into v4 after testing --- data/doc/sisu/CHANGELOG_v5 | 4 +++- lib/sisu/v5/dal_syntax.rb | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index b43e6e70..e7a27cc6 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -37,7 +37,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.14.orig.tar.xz * vim syntax, sisu.vim, fix typo * ocn (object numbering) on, off, text block using "--~#" "---#" "--+#" -* dal, text blocks, tuning +* dal + * grouped text with fontface spanning newlines, partial solution, test + * text blocks, tuning * pdf (latex) tables, bugfix diff --git a/lib/sisu/v5/dal_syntax.rb b/lib/sisu/v5/dal_syntax.rb index 7852ab85..f6d01d22 100644 --- a/lib/sisu/v5/dal_syntax.rb +++ b/lib/sisu/v5/dal_syntax.rb @@ -308,16 +308,41 @@ module SiSU_DAL_Syntax end dob end + def fontface_lines(dob,leader) + while (dob.obj =~/#{Mx[:br_nl]}/ \ + and dob.obj =~/(?:#{leader})([*!\/_#])\{(.+?)\}\1/m) \ + and $2 =~/#{Mx[:br_nl]}/ + dob=if dob.obj =~/#{Mx[:br_nl]}/ \ + and dob.obj =~/(#{leader})([*!\/_#])\{(.+?)\}\2/m + lead,fce,txt=$1,$2,$3 + dob=if txt =~/#{Mx[:br_nl]}/ + lead_break=if dob.obj =~/^#{Mx[:br_nl]}/ + dob.obj=dob.obj.sub(/^#{Mx[:br_nl]}/,'') + Mx[:br_nl] + else '' + end + txt="#{lead_break}#{fce}\{" + txt.split(Mx[:br_nl]).join("\}#{fce}#{Mx[:br_nl]}#{fce}\{") + "\}#{fce}" + dob.obj=dob.obj.sub(/(?:^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)([*!\/_#])\{.+?\}\1/m,"#{lead}#{txt}") + dob + else dob + end + end + dob + end + dob + end def fontface(dob) - dob.obj=dob.obj.gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)\*\{(.+?)\}\*/m, + leader=/^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>/ + dob=fontface_lines(dob,leader) + dob.obj=dob.obj.gsub(/(#{leader})\*\{(.+?)\}\*/m, "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis - gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)!\{(.+?)\}!/m, + gsub(/(#{leader})!\{(.+?)\}!/m, "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold - gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\(|\>)\/\{(.+?)\}\//m, + gsub(/(#{leader})\/\{(.+?)\}\//m, "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics - gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)_\{(.+?)\}_/m, + gsub(/(#{leader})_\{(.+?)\}_/m, "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore - gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)#\{(.+?)\}#/m, + gsub(/(#{leader})#\{(.+?)\}#/m, "\\1#{Mx[:fa_monospace_o]}\\2#{Mx[:fa_monospace_c]}"). #monospace gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}]|\(|\>)\"\{(.+?)\}\"/m, "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). #cite /blockquote? -- cgit v1.2.3