From 439a0b77a8bdfba6ad85218c1db8ead9c17c69f9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 1 Mar 2008 16:33:41 +0000 Subject: extend semantic shorthand --- lib/sisu/v0/shared_xml.rb | 110 +++++++++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 45 deletions(-) diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index abc6cc1a..c93eff5b 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -161,35 +161,46 @@ module SiSU_XML_munge @dp=SiSU_Env::Info_env.new.digest.pattern @url_brace=SiSU_Viz::Skin.new.url_decoration if @md.sem_tag + #@ab ||=SiSU_Viz::Skin.new.semantic_tags.default @ab ||=semantic_tags.default end end def semantic_tags def default { - :pub => 'publication', - :ref => 'reference', - :desc => 'description', - :conv => 'convention', - :vol => 'volume', - :pg => 'page', - :ct => 'cite', - :cty => 'city', - :org => 'organization', - :d => 'date', - :t => 'title', - :a => 'author', - :n => 'name', - :fn => 'firstname', - :f => 'firstname', - :mn => 'middlename', - :m => 'middlename', - :ln => 'lastname', - :l => 'lastname', - :i => 'initials', - :q => 'quote', - :y => 'year', - :ab => 'abreviation', + :pub => 'publication', + :conv => 'convention', + :vol => 'volume', + :pg => 'page', + :cty => 'city', + :org => 'organization', + :uni => 'university', + :dept => 'department', + :fac => 'faculty', + :inst => 'institute', + :co => 'company', + :com => 'company', + :conv => 'convention', + :dt => 'date', + :y => 'year', + :m => 'month', + :d => 'day', + :ti => 'title', + :au => 'author', + :ed => 'editor', #editor? + :v => 'version', #edition + :n => 'name', + :fn => 'firstname', + :mn => 'middlename', + :ln => 'lastname', + :in => 'initials', + :qt => 'quote', + :ct => 'cite', + :ref => 'reference', + :ab => 'abreviation', + :def => 'define', + :desc => 'description', + :trans => 'translate', } end self @@ -460,7 +471,7 @@ module SiSU_XML_munge para end def xml_sem_block_paired(matched) # colon depth: many, recurs - matched.gsub!(/\b(a):\{(.+?)\}:\1\b/m, %{\\2}) # sem : + matched.gsub!(/\b(au):\{(.+?)\}:\1\b/m, %{\\2}) # sem : matched.gsub!(/\b(vol):\{(.+?)\}:\1\b/m, %{\\2}) # sem : matched.gsub!(/\b(pub):\{(.+?)\}:\1\b/m, %{\\2}) # sem : matched.gsub!(/\b(ref):\{(.+?)\}:\1\b/m, %{\\2}) # sem : @@ -469,7 +480,7 @@ module SiSU_XML_munge matched.gsub!(/\b(ct):\{(.+?)\}:\1\b/m, %{\\2}) # sem : matched.gsub!(/\b(cty):\{(.+?)\}:\1\b/m, %{\\2}) # sem : matched.gsub!(/\b(org):\{(.+?)\}:\1\b/m, %{\\2}) # sem : - matched.gsub!(/\b(d):\{(.+?)\}:\1\b/m, %{\\2}) # sem : + matched.gsub!(/\b(dt):\{(.+?)\}:\1\b/m, %{\\2}) # sem : matched.gsub!(/\b(n):\{(.+?)\}:\1\b/m, %{\\2}) # sem : matched.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m,'\2') # sem : end @@ -479,28 +490,37 @@ module SiSU_XML_munge para.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) } # sem : para.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) } # sem : #colon one / single / flat / shallow - para.gsub!(/:\{(.+?)\}:a\b/m, %{\\1}) # sem : - para.gsub!(/:\{(.+?)\}:n\b/m, %{\\1}) # sem : - para.gsub!(/:\{(.+?)\}:t\b/m, %{\\1}) # sem : - para.gsub!(/:\{(.+?)\}:ref\b/m, %{\\1}) # sem : - para.gsub!(/:\{(.+?)\}:desc\b/m, %{\\1}) # sem : - para.gsub!(/:\{(.+?)\}:cty\b/m, %{\\1}) # sem : - para.gsub!(/:\{(.+?)\}:org\b/m, %{\\1}) # sem : + para.gsub!(/:\{(.+?)\}:au\b/m, %{\\1}) # sem : + para.gsub!(/:\{(.+?)\}:n\b/m, %{\\1}) # sem : + para.gsub!(/:\{(.+?)\}:ti\b/m, %{\\1}) # sem : + para.gsub!(/:\{(.+?)\}:ref\b/m, %{\\1}) # sem : + para.gsub!(/:\{(.+?)\}:desc\b/m, %{\\1}) # sem : + para.gsub!(/:\{(.+?)\}:cty\b/m, %{\\1}) # sem : + para.gsub!(/:\{(.+?)\}:org\b/m, %{\\1}) # sem : para.gsub!(/:\{(.+?)\}:([a-z]+(?:[_:.][a-z]+)*)/m,'\1') # sem : #semicolon zero / none - para.gsub!(/;\{([^}]+(?![;]))\};t\b/m, %{\\1}) # sem ; - para.gsub!(/;\{([^}]+(?![;]))\};q\b/m, %{\\1}) # sem ; - para.gsub!(/;\{([^}]+(?![;]))\};ref\b/m, %{\\1}) # sem ; - para.gsub!(/;\{([^}]+(?![;]))\};desc\b/m,%{\\1}) # sem ; - para.gsub!(/;\{([^}]+(?![;]))\};y\b/m, %{\\1}) # sem ; - para.gsub!(/;\{([^}]+(?![;]))\};ab\b/m, %{\\1}) # sem ; - para.gsub!(/;\{([^}]+(?![;]))\};pg\b/m, %{\\1}) # sem ; - para.gsub!(/;\{([^}]+(?![;]))\};fn?\b/m, %{\\1}) # sem ; - para.gsub!(/;\{([^}]+(?![;]))\};mn?\b/m, %{\\1}) # sem ; - para.gsub!(/;\{([^}]+(?![;]))\};ln?\b/m, %{\\1}) # sem ; - para.gsub!(/;\{([^}]+(?![;]))\};i\b/m, %{\\1}) # sem ; - para.gsub!(/;\{([^}]+(?![;]))\};org\b/m, %{\\1}) # sem ; - para.gsub!(/;\{([^}]+(?![;]))\};cty\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};ti\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};qt\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};ref\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};ed\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};v\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};desc\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};def\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};trans\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};y\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};ab\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};pg\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};fn?\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};mn?\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};ln?\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};in\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};uni\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};fac\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};inst\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};dept\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};org\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};com?\b/m, %{\\1}) # sem ; + para.gsub!(/;\{([^}]+(?![;]))\};cty\b/m, %{\\1}) # sem ; para.gsub!(/;\{([^}]+(?![;]))\};([a-z]+(?:[_:.][a-z]+)*)/m,'\1') # sem ; end para -- cgit v1.2.3