aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v4')
-rw-r--r--lib/sisu/v4/dal_doc_str.rb3
-rw-r--r--lib/sisu/v4/dal_syntax.rb35
2 files changed, 33 insertions, 5 deletions
diff --git a/lib/sisu/v4/dal_doc_str.rb b/lib/sisu/v4/dal_doc_str.rb
index e7d9917b..2a3e6b83 100644
--- a/lib/sisu/v4/dal_doc_str.rb
+++ b/lib/sisu/v4/dal_doc_str.rb
@@ -203,6 +203,9 @@ module SiSU_DAL_DocumentStructureExtract
and @@flag[:table]==:off
unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1
+ m=m.split(/\n/).join(' ').
+ gsub(/\s+([|:;])\s+/,'\1').
+ gsub(/\s+([+])\s+/,'\1')
t_o=t_o.gsub(/\n=\{.+\}\s*$\Z/m,'')
m
else nil
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?