aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-08-28 18:19:02 -0400
committerRalph Amissah <ralph@amissah.com>2013-08-28 18:19:03 -0400
commit3f912866187fd5bdaf2a6428aad074044e1e2060 (patch)
treee678f0ef0ababa9d8f24b4c9cea074980997f0c0
parentv4 v5: dal, text blocks, tuning (diff)
v5: dal, grouped text with fontface spanning newlines, partial solution, testsisu_4.2.1
* merge into v4 after testing
-rw-r--r--data/doc/sisu/CHANGELOG_v54
-rw-r--r--lib/sisu/v5/dal_syntax.rb35
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]}]|[\(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). #cite /blockquote?