diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-07-01 00:49:09 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-07-01 00:49:50 -0400 |
commit | 60411adb8256b06545ea6db3cd2b4d2e7f58d03a (patch) | |
tree | 2bd80d57cec276a497473cf52780f62aae7da028 /lib | |
parent | v5 v6: ao, (param), book index, strip white spaces around terms (diff) |
v5 v6: ao, quote block, insert text indent markup (book index markup unchanged)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v5/ao_misc_arrange.rb | 9 | ||||
-rw-r--r-- | lib/sisu/v6/ao_misc_arrange.rb | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/sisu/v5/ao_misc_arrange.rb b/lib/sisu/v5/ao_misc_arrange.rb index a053f37e..09842fcc 100644 --- a/lib/sisu/v5/ao_misc_arrange.rb +++ b/lib/sisu/v5/ao_misc_arrange.rb @@ -66,7 +66,7 @@ module SiSU_AO_MiscArrangeText @md,@data=md,data end def conditional_headings(para) - para=para.gsub(/^(:?A~)\s*$/,'\1~ @title @author'). #conditional header + para=para.gsub(/^(:?A~)\s*$/,'\1~ @title @author'). #conditional header gsub(/^((?:[1-9]|:?[A-D])~\S*)\s*$/, '\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 if para =~/^@\S+?:/ @@ -130,7 +130,12 @@ module SiSU_AO_MiscArrangeText para << '`:quote_open`' text=text.gsub(/```[ ]+quote/m,'') end - text=text.gsub(/(?:\n|\A)([^`=\n]+)/m,'_1 \1') #not a perfect match for book index \n={ + text=if text =~/(?:\n|\A)=\{.+?\}/m #exclude book index from indent markup + txt,bkidx,tail=/(.+?)((?:\n|\A)=\{.+?\}$)(.*)/m.match(text).captures + txt=txt.gsub(/(?:\n|\A)([^`\n]+)/m,'_1 \1') + txt + bkidx + tail + else text.gsub(/(?:\n|\A)([^`\n]+)/m,'_1 \1') + end para << text.gsub(/```/m,'') if text =~/```/m @flag=:quote_close diff --git a/lib/sisu/v6/ao_misc_arrange.rb b/lib/sisu/v6/ao_misc_arrange.rb index 387c14ca..8adebfd5 100644 --- a/lib/sisu/v6/ao_misc_arrange.rb +++ b/lib/sisu/v6/ao_misc_arrange.rb @@ -66,7 +66,7 @@ module SiSU_AO_MiscArrangeText @md,@data=md,data end def conditional_headings(para) - para=para.gsub(/^(:?A~)\s*$/,'\1~ @title @author'). #conditional header + para=para.gsub(/^(:?A~)\s*$/,'\1~ @title @author'). #conditional header gsub(/^((?:[1-9]|:?[A-D])~\S*)\s*$/, '\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 if para =~/^@\S+?:/ @@ -130,7 +130,12 @@ module SiSU_AO_MiscArrangeText para << '`:quote_open`' text=text.gsub(/```[ ]+quote/m,'') end - text=text.gsub(/(?:\n|\A)([^`=\n]+)/m,'_1 \1') #not a perfect match for book index \n={ + text=if text =~/(?:\n|\A)=\{.+?\}/m #exclude book index from indent markup + txt,bkidx,tail=/(.+?)((?:\n|\A)=\{.+?\}$)(.*)/m.match(text).captures + txt=txt.gsub(/(?:\n|\A)([^`\n]+)/m,'_1 \1') + txt + bkidx + tail + else text.gsub(/(?:\n|\A)([^`\n]+)/m,'_1 \1') + end para << text.gsub(/```/m,'') if text =~/```/m @flag=:quote_close |