diff options
Diffstat (limited to 'org/meta_abstraction.org')
-rw-r--r-- | org/meta_abstraction.org | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 27f83be..4acb481 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -2614,7 +2614,7 @@ auto _doc_header_and_make_substitutions_(L,CMM)( if (conf_make_meta.make.substitute) { foreach(substitution_pair; conf_make_meta.make.substitute) { line = line.replaceAll( - regex(substitution_pair[Substitute.match]), + regex("\b" ~ substitution_pair[Substitute.match]), substitution_pair[Substitute.markup] ); } @@ -2637,19 +2637,19 @@ auto _doc_header_and_make_substitutions_fontface_(L,CMM)( enum Substitute { match, markup, } if ( conf_make_meta.make.bold) { line = line.replaceAll( - regex(conf_make_meta.make.bold[Substitute.match]), + regex("\b" ~ conf_make_meta.make.bold[Substitute.match]), conf_make_meta.make.bold[Substitute.markup] ); } if (conf_make_meta.make.emphasis) { line = line.replaceAll( - regex(conf_make_meta.make.emphasis[Substitute.match]), + regex("\b" ~ conf_make_meta.make.emphasis[Substitute.match]), conf_make_meta.make.emphasis[Substitute.markup] ); } if (conf_make_meta.make.italics) { line = line.replaceAll( - regex(conf_make_meta.make.italics[Substitute.match]), + regex("\b" ~ conf_make_meta.make.italics[Substitute.match]), conf_make_meta.make.italics[Substitute.markup] ); } @@ -4747,7 +4747,7 @@ static struct ObjInlineMarkupMunge { } #+END_SRC -******* url links +******* url links including images #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d @@ -4812,6 +4812,47 @@ static struct ObjInlineMarkupMunge { } #+END_SRC +#+name: meta_emitters_obj_inline_markup_munge +#+BEGIN_SRC d + static auto images(Ot)(Ot obj_txt_in) { + debug(asserts) { + static assert(is(typeof(obj_txt_in) == string)); + } + static auto mng = InlineMarkup(); + obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono, (mng.mono ~ "{$1}" ~ mng.mono)); // figure + /+ url matched +/ + obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented + if (obj_txt_in.match(rgx.smid_image_generic)) { /+ images with and without links +/ + debug(images) { + writeln("Image: ", obj_txt_in); + } + if (obj_txt_in.match(rgx.smid_image_with_dimensions)) { + obj_txt_in = (obj_txt_in).replaceAll( + rgx.smid_image_with_dimensions, + ("$1" + ~ mkup.img ~ "$2,w$3h$4 " + ~ "$5") // ("$1{ $2 }$2$3") + ); + debug(images) { + writeln("IMAGE with size: ", obj_txt_in); // decide on representation + } + } else if (obj_txt_in.match(rgx.smid_image)) { + obj_txt_in = (obj_txt_in).replaceAll( + rgx.smid_image, + ("$1" + ~ mkup.img ~ "$2,w0h0 " + ~ "$3") // ("$1{ $2 }$2$3") + ); + debug(images) { + writeln("IMAGE: ", obj_txt_in); // decide on representation + } + } + } + obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono_box, ("#{$1}#")); // figure + return obj_txt_in; + } +#+END_SRC + ******* footnotes endnotes markup #+name: meta_emitters_obj_inline_markup_munge @@ -4909,6 +4950,10 @@ static struct ObjInlineMarkupMunge { rgx.inline_notes_curly_sp_plus, (mkup.en_a_o ~ "+" ~ " $1" ~ mkup.en_a_c) ); + /+ image matched +/ + if (obj_txt_in.match(rgx.smid_image_generic)) { + obj_txt_in = images(obj_txt_in); + } /+ url matched +/ if (obj_txt_in.match(rgx.smid_inline_url)) { urls = true; |