From d756e90690f3a395b52c60843015ba2b8e89df2a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 5 Sep 2013 23:40:49 -0400 Subject: v4: dal, grouped text with fontface spanning newlines, partial solution * merged from v5 --- data/doc/sisu/CHANGELOG_v4 | 3 +++ lib/sisu/v4/dal_syntax.rb | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index 82f82751..f41bafaa 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -30,6 +30,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.2.2.orig.tar.xz sisu_4.2.2.orig.tar.xz sisu_4.2.2-1.dsc +* dal, grouped text with fontface spanning newlines, partial solution, merge + from 5.0.14 + %% 4.2.1.orig.tar.xz (2013-08-28:34/3) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.1 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.1-1 diff --git a/lib/sisu/v4/dal_syntax.rb b/lib/sisu/v4/dal_syntax.rb index eb23fd22..c49f41f7 100644 --- a/lib/sisu/v4/dal_syntax.rb +++ b/lib/sisu/v4/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