aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/dal_syntax.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2008-11-03 13:44:24 -0500
committerRalph Amissah <ralph@amissah.com>2008-11-03 13:44:24 -0500
commit9458eedd5d4c5b5ece6c258e96d4c37f3cf0cb7b (patch)
tree6dd4b035c24f6f86d0e23b348a4d16c52026fd86 /lib/sisu/v0/dal_syntax.rb
parentsoftware libré, accent (diff)
dal and param various changes (some affecting other files)
dal, minor changes including related to bold line instruction and, variable name change affecting other files param, header tag for document index, create site index of documents use, add info on document content, harvest info provided from document set for metadata to create site index of documents (similar sub-sytax to book index) also variable name others variable name change, made earlier in dal and param
Diffstat (limited to 'lib/sisu/v0/dal_syntax.rb')
-rw-r--r--lib/sisu/v0/dal_syntax.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb
index cbcd42f9..84ddef92 100644
--- a/lib/sisu/v0/dal_syntax.rb
+++ b/lib/sisu/v0/dal_syntax.rb
@@ -76,6 +76,7 @@ module SiSU_Syntax
tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)}
tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?}
bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)}
+ ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)}
@line_scan_ital=if defined? @md.make_italic[:str] \
and defined? @vz.markup_make_italic[:str]
/#@http_m|#{bold_line}|#@manmkp_ital#{tail_m_ital}|(?:#{@md.make_italic[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/
@@ -150,11 +151,19 @@ module SiSU_Syntax
line
end
def embolden(given)
+ given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})http:\/\/\S+.*?)(<br>)/,"#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2")
+ given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})http:\/\/\S+.*)/,"#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}")
given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)(<br>)/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
given.gsub!(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
end
+ def italicise(given)
+ given.gsub!(/^\/_\s*(.+?)(<br>)/,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2")
+ given.gsub!(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2")
+ given.gsub!(/^\/_\s*(.+?)\s*([~-]#)$/,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2")
+ given.gsub!(/^\/_\s+(.*)?\s*$/,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
+ end
def wordlist_bold(line)
line=line.dup
if (defined? @md.make_bold[:str] \
@@ -177,6 +186,7 @@ module SiSU_Syntax
end
else
if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
+ elsif w =~/^\/_\s+/; italicise(w)
end
end
line_array << w
@@ -189,6 +199,9 @@ module SiSU_Syntax
and line =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/
embolden(line)
end
+ if line =~ /\/_\s+/
+ italicise(line)
+ end
end
line
end
@@ -227,7 +240,7 @@ module SiSU_Syntax
word=line.scan(/\S+|\n/) unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit
if word
word.each do |w| # _ - / # | : ! ^ ~
- unless w =~/^#{Mx[:lv_o]}[0-9]:\S*?#{Mx[:lv_c]}|~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table/
+ unless w =~/^#{Mx[:lv_o]}[0-9]:\S*?#{Mx[:lv_c]}|~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|http:\/\/\S+/
w.gsub!(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
#w.gsub!(/~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}")
end