diff options
Diffstat (limited to 'lib/sisu/v3dv/shared_xml.rb')
-rw-r--r-- | lib/sisu/v3dv/shared_xml.rb | 683 |
1 files changed, 344 insertions, 339 deletions
diff --git a/lib/sisu/v3dv/shared_xml.rb b/lib/sisu/v3dv/shared_xml.rb index 78611ccc..dbaed6d8 100644 --- a/lib/sisu/v3dv/shared_xml.rb +++ b/lib/sisu/v3dv/shared_xml.rb @@ -116,399 +116,404 @@ module SiSU_XML_Munge if str #¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûü #¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷ - str.gsub!(/</um,'<') # '<' # < - str.gsub!(/>/um,'>') # '>' # > - str.gsub!(/¢/um,'¢') # '¢' # ¢ - str.gsub!(/£/um,'£') # '£' # £ - str.gsub!(/¥/um,'¥') # '¥' # ¥ - str.gsub!(/§/um,'§') # '§' # § - str.gsub!(/©/um,'©') # '©' # © - str.gsub!(/ª/um,'ª') # 'ª' # ª - str.gsub!(/«/um,'«') # '«' # « - str.gsub!(/®/um,'®') # '®' # ® - str.gsub!(/°/um,'°') # '°' # ° - str.gsub!(/±/um,'±') # '±' # ± - str.gsub!(/²/um,'²') # '²' # ² - str.gsub!(/³/um,'³') # '³' # ³ - str.gsub!(/µ/um,'µ') # 'µ' # µ - str.gsub!(/¶/um,'¶') # '¶' # ¶ - str.gsub!(/¹/um,'¹') # '¹' # ¹ - str.gsub!(/º/um,'º') # 'º' # º - str.gsub!(/»/um,'»') # '»' # » - str.gsub!(/¼/um,'¼') # '¼' # ¼ - str.gsub!(/½/um,'½') # '½' # ½ - str.gsub!(/¾/um,'¾') # '¾' # ¾ - str.gsub!(/×/um,'×') # '×' # × - str.gsub!(/÷/um,'÷') # '÷' # ÷ - str.gsub!(/¿/um,'¿') # '¿' # ¿ - str.gsub!(/À/um,'À') # 'À' # À - str.gsub!(/Á/um,'Á') # 'Á' # Á - str.gsub!(/Â/um,'Â') # 'Â' #  - str.gsub!(/Ã/um,'Ã') # 'Ã' # à - str.gsub!(/Ä/um,'Ä') # 'Ä' # Ä - str.gsub!(/Å/um,'Å') # 'Å' # Å - str.gsub!(/Æ/um,'Æ') # 'Æ' # Æ - str.gsub!(/Ç/um,'Ç') # 'Ç' # Ç - str.gsub!(/È/um,'È') # 'È' # È - str.gsub!(/É/um,'É') # 'É' # É - str.gsub!(/Ê/um,'Ê') # 'Ê' # Ê - str.gsub!(/Ë/um,'Ë') # 'Ë' # Ë - str.gsub!(/Ì/um,'Ì') # 'Ì' # Ì - str.gsub!(/Í/um,'Í') # 'Í' # Í - str.gsub!(/Î/um,'Î') # 'Î' # Î - str.gsub!(/Ï/um,'Ï') # 'Ï' # Ï - str.gsub!(/Ð/um,'Ð') # 'Ð' # Ð - str.gsub!(/Ñ/um,'Ñ') # 'Ñ' # Ñ - str.gsub!(/Ò/um,'Ò') # 'Ò' # Ò - str.gsub!(/Ó/um,'Ó') # 'Ó' # Ó - str.gsub!(/Ô/um,'Ô') # 'Ô' # Ô - str.gsub!(/Õ/um,'Õ') # 'Õ' # Õ - str.gsub!(/Ö/um,'Ö') # 'Ö' # Ö - str.gsub!(/Ø/um,'Ø') # 'Ø' # Ø - str.gsub!(/Ù/um,'Ù') # 'Ù' # Ù - str.gsub!(/Ú/um,'Ú') # 'Ú' # Ú - str.gsub!(/Û/um,'Û') # 'Û' # Û - str.gsub!(/Ü/um,'Ü') # 'Ü' # Ü - str.gsub!(/Ý/um,'Ý') # 'Ý' # Ý - str.gsub!(/Þ/um,'Þ') # 'Þ' # Þ - str.gsub!(/ß/um,'ß') # 'ß' # ß - str.gsub!(/à/um,'à') # 'à' # à - str.gsub!(/á/um,'á') # 'á' # á - str.gsub!(/â/um,'â') # 'â' # â - str.gsub!(/ã/um,'ã') # 'ã' # ã - str.gsub!(/ä/um,'ä') # 'ä' # ä - str.gsub!(/å/um,'å') # 'å' # å - str.gsub!(/æ/um,'æ') # 'æ' # æ - str.gsub!(/ç/um,'ç') # 'ç' # ç - str.gsub!(/è/um,'è') # 'è' # è - str.gsub!(/é/um,'é') # '´' # é - str.gsub!(/ê/um,'ê') # 'ˆ' # ê - str.gsub!(/ë/um,'ë') # 'ë' # ë - str.gsub!(/ì/um,'ì') # 'ì' # ì - str.gsub!(/í/um,'í') # '´' # í - str.gsub!(/î/um,'î') # 'î' # î - str.gsub!(/ï/um,'ï') # 'ï' # ï - str.gsub!(/ð/um,'ð') # 'ð' # ð - str.gsub!(/ñ/um,'ñ') # 'ñ' # ñ - str.gsub!(/ò/um,'ò') # 'ò' # ò - str.gsub!(/ó/um,'ó') # 'ó' # ó - str.gsub!(/ô/um,'ô') # 'ô' # ô - str.gsub!(/õ/um,'õ') # 'õ' # õ - str.gsub!(/ö/um,'ö') # 'ö' # ö - str.gsub!(/ø/um,'ø') # 'ø' # ø - str.gsub!(/ù/um,'ú') # 'ù' # ú - str.gsub!(/ú/um,'û') # 'ú' # û - str.gsub!(/û/um,'ü') # 'û' # ü - str.gsub!(/ü/um,'ý') # 'ü' # ý - str.gsub!(/þ/um,'þ') # 'þ' # þ - str.gsub!(/ÿ/um,'ÿ') # 'ÿ' # ÿ - str.gsub!(/‘/um,'‘') # '‘' # ‘ - str.gsub!(/’/um,'’') # '’' # ’ - str.gsub!(/“/um,'“') # “ # “ - str.gsub!(/”/um,'”') # ” # ” - str.gsub!(/–/um,'–') # – # – - str.gsub!(/—/um,'—') # — # — - str.gsub!(/∝/um,'∝') # ∝ # ∝ - str.gsub!(/∞/um,'∞') # ∞ # ∞ - str.gsub!(/™/um,'™') # ™ # ™ - str.gsub!(/✠/um,'✠') # ✗ # ✠ - str.gsub!(/ /um,' ') # space identify - str.gsub!(/ /um,' ') # space identify + str=str.gsub(/</um,'<'). # '<' # < + gsub(/>/um,'>'). # '>' # > + gsub(/¢/um,'¢'). # '¢' # ¢ + gsub(/£/um,'£'). # '£' # £ + gsub(/¥/um,'¥'). # '¥' # ¥ + gsub(/§/um,'§'). # '§' # § + gsub(/©/um,'©'). # '©' # © + gsub(/ª/um,'ª'). # 'ª' # ª + gsub(/«/um,'«'). # '«' # « + gsub(/®/um,'®'). # '®' # ® + gsub(/°/um,'°'). # '°' # ° + gsub(/±/um,'±'). # '±' # ± + gsub(/²/um,'²'). # '²' # ² + gsub(/³/um,'³'). # '³' # ³ + gsub(/µ/um,'µ'). # 'µ' # µ + gsub(/¶/um,'¶'). # '¶' # ¶ + gsub(/¹/um,'¹'). # '¹' # ¹ + gsub(/º/um,'º'). # 'º' # º + gsub(/»/um,'»'). # '»' # » + gsub(/¼/um,'¼'). # '¼' # ¼ + gsub(/½/um,'½'). # '½' # ½ + gsub(/¾/um,'¾'). # '¾' # ¾ + gsub(/×/um,'×'). # '×' # × + gsub(/÷/um,'÷'). # '÷' # ÷ + gsub(/¿/um,'¿'). # '¿' # ¿ + gsub(/À/um,'À'). # 'À' # À + gsub(/Á/um,'Á'). # 'Á' # Á + gsub(/Â/um,'Â'). # 'Â' #  + gsub(/Ã/um,'Ã'). # 'Ã' # à + gsub(/Ä/um,'Ä'). # 'Ä' # Ä + gsub(/Å/um,'Å'). # 'Å' # Å + gsub(/Æ/um,'Æ'). # 'Æ' # Æ + gsub(/Ç/um,'Ç'). # 'Ç' # Ç + gsub(/È/um,'È'). # 'È' # È + gsub(/É/um,'É'). # 'É' # É + gsub(/Ê/um,'Ê'). # 'Ê' # Ê + gsub(/Ë/um,'Ë'). # 'Ë' # Ë + gsub(/Ì/um,'Ì'). # 'Ì' # Ì + gsub(/Í/um,'Í'). # 'Í' # Í + gsub(/Î/um,'Î'). # 'Î' # Î + gsub(/Ï/um,'Ï'). # 'Ï' # Ï + gsub(/Ð/um,'Ð'). # 'Ð' # Ð + gsub(/Ñ/um,'Ñ'). # 'Ñ' # Ñ + gsub(/Ò/um,'Ò'). # 'Ò' # Ò + gsub(/Ó/um,'Ó'). # 'Ó' # Ó + gsub(/Ô/um,'Ô'). # 'Ô' # Ô + gsub(/Õ/um,'Õ'). # 'Õ' # Õ + gsub(/Ö/um,'Ö'). # 'Ö' # Ö + gsub(/Ø/um,'Ø'). # 'Ø' # Ø + gsub(/Ù/um,'Ù'). # 'Ù' # Ù + gsub(/Ú/um,'Ú'). # 'Ú' # Ú + gsub(/Û/um,'Û'). # 'Û' # Û + gsub(/Ü/um,'Ü'). # 'Ü' # Ü + gsub(/Ý/um,'Ý'). # 'Ý' # Ý + gsub(/Þ/um,'Þ'). # 'Þ' # Þ + gsub(/ß/um,'ß'). # 'ß' # ß + gsub(/à/um,'à'). # 'à' # à + gsub(/á/um,'á'). # 'á' # á + gsub(/â/um,'â'). # 'â' # â + gsub(/ã/um,'ã'). # 'ã' # ã + gsub(/ä/um,'ä'). # 'ä' # ä + gsub(/å/um,'å'). # 'å' # å + gsub(/æ/um,'æ'). # 'æ' # æ + gsub(/ç/um,'ç'). # 'ç' # ç + gsub(/è/um,'è'). # 'è' # è + gsub(/é/um,'é'). # '´' # é + gsub(/ê/um,'ê'). # 'ˆ' # ê + gsub(/ë/um,'ë'). # 'ë' # ë + gsub(/ì/um,'ì'). # 'ì' # ì + gsub(/í/um,'í'). # '´' # í + gsub(/î/um,'î'). # 'î' # î + gsub(/ï/um,'ï'). # 'ï' # ï + gsub(/ð/um,'ð'). # 'ð' # ð + gsub(/ñ/um,'ñ'). # 'ñ' # ñ + gsub(/ò/um,'ò'). # 'ò' # ò + gsub(/ó/um,'ó'). # 'ó' # ó + gsub(/ô/um,'ô'). # 'ô' # ô + gsub(/õ/um,'õ'). # 'õ' # õ + gsub(/ö/um,'ö'). # 'ö' # ö + gsub(/ø/um,'ø'). # 'ø' # ø + gsub(/ù/um,'ú'). # 'ù' # ú + gsub(/ú/um,'û'). # 'ú' # û + gsub(/û/um,'ü'). # 'û' # ü + gsub(/ü/um,'ý'). # 'ü' # ý + gsub(/þ/um,'þ'). # 'þ' # þ + gsub(/ÿ/um,'ÿ'). # 'ÿ' # ÿ + gsub(/‘/um,'‘'). # '‘' # ‘ + gsub(/’/um,'’'). # '’' # ’ + gsub(/“/um,'“'). # “ # “ + gsub(/”/um,'”'). # ” # ” + gsub(/–/um,'–'). # – # – + gsub(/—/um,'—'). # — # — + gsub(/∝/um,'∝'). # ∝ # ∝ + gsub(/∞/um,'∞'). # ∞ # ∞ + gsub(/™/um,'™'). # ™ # ™ + gsub(/✠/um,'✠'). # ✗ # ✠ + gsub(/ /um,' '). # space identify + gsub(/ /um,' ') # space identify end dob=if defined? dob.obj dob.obj=str dob - elsif dob.class==String; dob + elsif dob.class==String + str end dob end end def html(dob='') if @sys.locale =~/utf-?8/i # instead ucs for utf8 # String#encode Iñtërnâtiônàlizætiøn - dob.obj.gsub!(/ /u,' ') # space identify - dob.obj.gsub!(/ /u,' ') # space identify + dob.obj=dob.obj.gsub(/ /u,' '). # space identify + gsub(/ /u,' ') # space identify else - dob.obj.gsub!(/¢/u,'¢') # ¢ - dob.obj.gsub!(/£/u,'£') # £ - dob.obj.gsub!(/¥/u,'¥') # ¥ - dob.obj.gsub!(/§/u,'§') # § - dob.obj.gsub!(/©/u,'©') # © - dob.obj.gsub!(/ª/u,'ª') # ª - dob.obj.gsub!(/«/u,'«') # « - dob.obj.gsub!(/®/u,'®') # ® - dob.obj.gsub!(/°/u,'°') # ° - dob.obj.gsub!(/±/u,'±') # ± - dob.obj.gsub!(/²/u,'²') # ² - dob.obj.gsub!(/³/u,'³') # ³ - dob.obj.gsub!(/µ/u,'µ') # µ - dob.obj.gsub!(/¶/u,'¶') # ¶ - dob.obj.gsub!(/¹/u,'¹') # ¹ - dob.obj.gsub!(/º/u,'º') # º - dob.obj.gsub!(/»/u,'»') # » - dob.obj.gsub!(/¼/u,'¼') # ¼ - dob.obj.gsub!(/½/u,'½') # ½ - dob.obj.gsub!(/¾/u,'¾') # ¾ - dob.obj.gsub!(/×/u,'×') # × - dob.obj.gsub!(/÷/u,'÷') # ÷ - dob.obj.gsub!(/¿/u,'¿') # ¿ - dob.obj.gsub!(/À/u,'À') # À - dob.obj.gsub!(/Á/u,'Á') # Á - dob.obj.gsub!(/Â/u,'Â') #  - dob.obj.gsub!(/Ã/u,'Ã') # à - dob.obj.gsub!(/Ä/u,'Ä') # Ä - dob.obj.gsub!(/Å/u,'Å') # Å - dob.obj.gsub!(/Æ/u,'Æ') # Æ - dob.obj.gsub!(/Ç/u,'Ç') # Ç - dob.obj.gsub!(/È/u,'È') # È - dob.obj.gsub!(/É/u,'É') # É - dob.obj.gsub!(/Ê/u,'Ê') # Ê - dob.obj.gsub!(/Ë/u,'Ë') # Ë - dob.obj.gsub!(/Ì/u,'Ì') # Ì - dob.obj.gsub!(/Í/u,'Í') # Í - dob.obj.gsub!(/Î/u,'Î') # Î - dob.obj.gsub!(/Ï/u,'Ï') # Ï - dob.obj.gsub!(/Ð/u,'Ð') # Ð - dob.obj.gsub!(/Ñ/u,'Ñ') # Ñ - dob.obj.gsub!(/Ò/u,'Ò') # Ò - dob.obj.gsub!(/Ó/u,'Ó') # Ó - dob.obj.gsub!(/Ô/u,'Ô') # Ô - dob.obj.gsub!(/Õ/u,'Õ') # Õ - dob.obj.gsub!(/Ö/u,'Ö') # Ö - dob.obj.gsub!(/Ø/u,'Ø') # Ø - dob.obj.gsub!(/Ù/u,'Ù') # Ù - dob.obj.gsub!(/Ú/u,'Ú') # Ú - dob.obj.gsub!(/Û/u,'Û') # Û - dob.obj.gsub!(/Ü/u,'Ü') # Ü - dob.obj.gsub!(/Ý/u,'Ý') # Ý - dob.obj.gsub!(/Þ/u,'Þ') # Þ - dob.obj.gsub!(/ß/u,'ß') # ß - dob.obj.gsub!(/à/u,'à') # à - dob.obj.gsub!(/á/u,'á') # á - dob.obj.gsub!(/â/u,'â') # â - dob.obj.gsub!(/ã/u,'ã') # ã - dob.obj.gsub!(/ä/u,'ä') # ä - dob.obj.gsub!(/å/u,'å') # å - dob.obj.gsub!(/æ/u,'æ') # æ - dob.obj.gsub!(/ç/u,'ç') # ç - dob.obj.gsub!(/è/u,'è') # è - dob.obj.gsub!(/é/u,'´') # é - dob.obj.gsub!(/ê/u,'ˆ') # ê - dob.obj.gsub!(/ë/u,'ë') # ë - dob.obj.gsub!(/ì/u,'ì') # ì - dob.obj.gsub!(/í/u,'´') # í - dob.obj.gsub!(/î/u,'î') # î - dob.obj.gsub!(/ï/u,'ï') # ï - dob.obj.gsub!(/ð/u,'ð') # ð - dob.obj.gsub!(/ñ/u,'ñ') # ñ - dob.obj.gsub!(/ò/u,'ò') # ò - dob.obj.gsub!(/ó/u,'ó') # ó - dob.obj.gsub!(/ô/u,'ô') # ô - dob.obj.gsub!(/õ/u,'õ') # õ - dob.obj.gsub!(/ö/u,'ö') # ö - dob.obj.gsub!(/ø/u,'ø') # ø - dob.obj.gsub!(/ù/u,'ù') # ú - dob.obj.gsub!(/ú/u,'ú') # û - dob.obj.gsub!(/û/u,'û') # ü - dob.obj.gsub!(/ü/u,'ü') # ý - dob.obj.gsub!(/þ/u,'þ') # þ - dob.obj.gsub!(/ÿ/u,'ÿ') # ÿ - dob.obj.gsub!(/‘/u,'&#lsquo;') # ‘ # ‘ - dob.obj.gsub!(/’/u,'&#rsquo;') # ’ # ’ - dob.obj.gsub!(/“/u,'“') # “ # “ - dob.obj.gsub!(/”/u,'”') # ” # ” - dob.obj.gsub!(/–/u,'–') # – # – - dob.obj.gsub!(/—/u,'—') # — # — - dob.obj.gsub!(/∝/u,'∝') # ∝ # ∝ - dob.obj.gsub!(/∞/u,'∞') # ∞ # ∞ - dob.obj.gsub!(/™/u,'™') # ™ # ™ - dob.obj.gsub!(/✠/u,'✠') # ✠ - #par.obja.gsub!(/✠/u '†') # † # † incorrect replacement † - dob.obj.gsub!(/ /u,' ') # space identify - dob.obj.gsub!(/ /u,' ') # space identify + dob.obj=dob.obj.gsub(/¢/u,'¢'). # ¢ + gsub(/£/u,'£'). # £ + gsub(/¥/u,'¥'). # ¥ + gsub(/§/u,'§'). # § + gsub(/©/u,'©'). # © + gsub(/ª/u,'ª'). # ª + gsub(/«/u,'«'). # « + gsub(/®/u,'®'). # ® + gsub(/°/u,'°'). # ° + gsub(/±/u,'±'). # ± + gsub(/²/u,'²'). # ² + gsub(/³/u,'³'). # ³ + gsub(/µ/u,'µ'). # µ + gsub(/¶/u,'¶'). # ¶ + gsub(/¹/u,'¹'). # ¹ + gsub(/º/u,'º'). # º + gsub(/»/u,'»'). # » + gsub(/¼/u,'¼'). # ¼ + gsub(/½/u,'½'). # ½ + gsub(/¾/u,'¾'). # ¾ + gsub(/×/u,'×'). # × + gsub(/÷/u,'÷'). # ÷ + gsub(/¿/u,'¿'). # ¿ + gsub(/À/u,'À'). # À + gsub(/Á/u,'Á'). # Á + gsub(/Â/u,'Â'). #  + gsub(/Ã/u,'Ã'). # à + gsub(/Ä/u,'Ä'). # Ä + gsub(/Å/u,'Å'). # Å + gsub(/Æ/u,'Æ'). # Æ + gsub(/Ç/u,'Ç'). # Ç + gsub(/È/u,'È'). # È + gsub(/É/u,'É'). # É + gsub(/Ê/u,'Ê'). # Ê + gsub(/Ë/u,'Ë'). # Ë + gsub(/Ì/u,'Ì'). # Ì + gsub(/Í/u,'Í'). # Í + gsub(/Î/u,'Î'). # Î + gsub(/Ï/u,'Ï'). # Ï + gsub(/Ð/u,'Ð'). # Ð + gsub(/Ñ/u,'Ñ'). # Ñ + gsub(/Ò/u,'Ò'). # Ò + gsub(/Ó/u,'Ó'). # Ó + gsub(/Ô/u,'Ô'). # Ô + gsub(/Õ/u,'Õ'). # Õ + gsub(/Ö/u,'Ö'). # Ö + gsub(/Ø/u,'Ø'). # Ø + gsub(/Ù/u,'Ù'). # Ù + gsub(/Ú/u,'Ú'). # Ú + gsub(/Û/u,'Û'). # Û + gsub(/Ü/u,'Ü'). # Ü + gsub(/Ý/u,'Ý'). # Ý + gsub(/Þ/u,'Þ'). # Þ + gsub(/ß/u,'ß'). # ß + gsub(/à/u,'à'). # à + gsub(/á/u,'á'). # á + gsub(/â/u,'â'). # â + gsub(/ã/u,'ã'). # ã + gsub(/ä/u,'ä'). # ä + gsub(/å/u,'å'). # å + gsub(/æ/u,'æ'). # æ + gsub(/ç/u,'ç'). # ç + gsub(/è/u,'è'). # è + gsub(/é/u,'´'). # é + gsub(/ê/u,'ˆ'). # ê + gsub(/ë/u,'ë'). # ë + gsub(/ì/u,'ì'). # ì + gsub(/í/u,'´'). # í + gsub(/î/u,'î'). # î + gsub(/ï/u,'ï'). # ï + gsub(/ð/u,'ð'). # ð + gsub(/ñ/u,'ñ'). # ñ + gsub(/ò/u,'ò'). # ò + gsub(/ó/u,'ó'). # ó + gsub(/ô/u,'ô'). # ô + gsub(/õ/u,'õ'). # õ + gsub(/ö/u,'ö'). # ö + gsub(/ø/u,'ø'). # ø + gsub(/ù/u,'ù'). # ú + gsub(/ú/u,'ú'). # û + gsub(/û/u,'û'). # ü + gsub(/ü/u,'ü'). # ý + gsub(/þ/u,'þ'). # þ + gsub(/ÿ/u,'ÿ'). # ÿ + gsub(/‘/u,'&#lsquo;'). # ‘ # ‘ + gsub(/’/u,'&#rsquo;'). # ’ # ’ + gsub(/“/u,'“'). # “ # “ + gsub(/”/u,'”'). # ” # ” + gsub(/–/u,'–'). # – # – + gsub(/—/u,'—'). # — # — + gsub(/∝/u,'∝'). # ∝ # ∝ + gsub(/∞/u,'∞'). # ∞ # ∞ + gsub(/™/u,'™'). # ™ # ™ + gsub(/✠/u,'✠'). # ✠ + #gsub(/✠/u '†'). # † # † incorrect replacement † + gsub(/ /u,' '). # space identify + gsub(/ /u,' ') # space identify end end self end def tidywords(wordlist) + wordlist_new=[] wordlist.each do |x| #imperfect solution will not catch all possible cases - x.gsub!(/&/,'&') unless x =~/&\S+;/ - x.gsub!(/&([A-Z])/,'&\1') + x=x.gsub(/&/,'&') unless x =~/&\S+;/ + x=x.gsub(/&([A-Z])/,'&\1') + wordlist_new << x end + wordlist_new end def markup(dob='') wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 dob.obj=tidywords(wordlist).join(' ').strip unless dob.is=='table' - dob.obj.gsub!(/#{Mx[:br_line]}/u,'<br />') - dob.obj.gsub!(/#{Mx[:br_paragraph]}/u,'<br />') - dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') - end - dob.obj.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'') - dob.obj.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;') - dob.obj.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+)<\s+/,'\1< '); dob.obj.gsub!(/\s+>(\s+|$)/,' >\1') - #dob.obj.gsub!(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphasis_c]}/,'<em>\1</em>') #reinstate - dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/m,'<b>\1</b>') - dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,'<i>\1</i>') - dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') - dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>') - dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>') - dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>') - dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>') - dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') - dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>') - dob.obj.gsub!(/<:pb>\s*/,'') #Fix - dob.obj.gsub!(/<+[-~]#>+/,'') + dob.obj=dob.obj.gsub(/#{Mx[:br_line]}/u,'<br />'). + gsub(/#{Mx[:br_paragraph]}/u,'<br />'). + gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') + end + dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,''). + gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). + gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;'). + gsub(/(^|#{Mx[:gl_c]}|\s+)<\s+/,'\1< ').gsub(/\s+>(\s+|$)/,' >\1'). + #gsub(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphasis_c]}/,'<em>\1</em>'). #reinstate + gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/m,'<b>\1</b>'). + gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,'<i>\1</i>'). + gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). + gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>'). + gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>'). + gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>'). + gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>'). + gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>'). + gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). + gsub(/<:pb>\s*/,''). #Fix + gsub(/<+[-~]#>+/,'') if dob.is !~/^code/ #embeds a red-bullet image --> - dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') - dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') - dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') - dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') - dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table' - dob.obj.gsub!(/#{Mx[:br_page]}\s*/,'') - dob.obj.gsub!(/#{Mx[:br_page_new]}\s*/,'') - dob.obj.gsub!(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,''); dob.obj.gsub!(/<[-~]#>/,'') - dob.obj.gsub!(/href="#{Xx[:segment]}/m,'href="') - dob.obj.gsub!(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\.\.\/\S+?)#{Mx[:rel_c]}/, - '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>') - dob.obj.gsub!(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/, - '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="../\2">\1</link>') - dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/, - '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="#\2">\1</link>') - dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}) - dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}) - dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/, - %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}) - dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}image/, - %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}) - dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>') #watch, compare html_tune - dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\1">\\1</link>#{@brace_url.xml_close}}) - dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, - '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>') #escaped urls not linked, deal with later + dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). + gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). + gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). + gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') + dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table' + dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*/,''). + gsub(/#{Mx[:br_page_new]}\s*/,''). + gsub(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,''). + gsub(/<[-~]#>/,''). + gsub(/href="#{Xx[:segment]}/m,'href="'). + gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\.\.\/\S+?)#{Mx[:rel_c]}/, + '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>'). + gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/, + '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="../\2">\1</link>'). + gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/, + '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="#\2">\1</link>'). + gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, + %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}). + gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, + %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}). + gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/, + %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}). + gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}image/, + %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}). + gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, + '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>'). #watch, compare html_tune + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, + %{#{@brace_url.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\1">\\1</link>#{@brace_url.xml_close}}). + gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, + '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>') #escaped urls not linked, deal with later else - dob.obj.gsub!(/</m,'<'); dob.obj.gsub!(/>/m,'>') + dob.obj=dob.obj.gsub(/</m,'<').gsub(/>/m,'>') end if dob.of=='block' - dob.obj.gsub!(/#{Mx[:gl_bullet]}/,'● ') + dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ') end - dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) - dob.obj.gsub!(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}") - dob.obj.gsub!(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}") - dob.obj.gsub!(/ |#{Mx[:nbsp]}/m,' ') + dob.obj=dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + gsub(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}"). + gsub(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}"). + gsub(/ |#{Mx[:nbsp]}/m,' ') dob end def markup_light(dob='') - dob.obj.gsub!(/\/\{(.+?)\}\//,'<i>\1</i>') - dob.obj.gsub!(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>') - dob.obj.gsub!(/_\{(.+?)\}_/,'<u>\1</u>') - dob.obj.gsub!(/-\{(.+?)\}-/,'<del>\1</del>') - dob.obj.gsub!(/<br(\s*\/)?>/,'<br />') - dob.obj.gsub!(/<:pb>\s*/,'') - dob.obj.gsub!(/<[-~]#>/,'') - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& ') #sort - dob.obj.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax - dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, - "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>") - dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ') + dob.obj=dob.obj.gsub(/\/\{(.+?)\}\//,'<i>\1</i>'). + gsub(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>'). + gsub(/_\{(.+?)\}_/,'<u>\1</u>'). + gsub(/-\{(.+?)\}-/,'<del>\1</del>'). + gsub(/<br(\s*\/)?>/,'<br />'). + gsub(/<:pb>\s*/,''). + gsub(/<[-~]#>/,''). + gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& '). #sort + gsub(/&([^;]{1,5})/,'&\1'). #sort, rough estimate, revisit #WATCH found in node not sax + gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, + "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>"). + gsub(/ |#{Mx[:nbsp]}/,' ') wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 dob.obj=tidywords(wordlist).join(' ').strip dob end def markup_fictionbook(dob='') - dob.obj.gsub!(/~\{([\d*+]+).+?\}~/,'[\1]') - dob.obj.gsub!(/\/\{(.+?)\}\//,'<i>\1</i>') - dob.obj.gsub!(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>') - dob.obj.gsub!(/_\{(.+?)\}_/,'<u>\1</u>') - dob.obj.gsub!(/-\{(.+?)\}-/,'<del>\1</del>') - dob.obj.gsub!(/<br(?:\s*\/)?>/,'<br />') - dob.obj.gsub!(/<:pb>\s*/,'') - dob.obj.gsub!(/<[-~]#>/,'') - #temporary --> - dob.obj.gsub!(/<:\S+?>/,'') - #<-- temporary - dob.obj.gsub!(/<[-~]#>/,'') - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& ') #sort - dob.obj.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax - dob.obj.gsub!(/(#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, - "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>") - dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ') + dob.obj.gsub(/~\{([\d*+]+).+?\}~/,'[\1]'). + gsub(/\/\{(.+?)\}\//,'<i>\1</i>'). + gsub(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>'). + gsub(/_\{(.+?)\}_/,'<u>\1</u>'). + gsub(/-\{(.+?)\}-/,'<del>\1</del>'). + gsub(/<br(?:\s*\/)?>/,'<br />'). + gsub(/<:pb>\s*/,''). + gsub(/<[-~]#>/,''). + #temporary --> + gsub(/<:\S+?>/,''). + #<-- temporary + gsub(/<[-~]#>/,''). + gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& '). #sort + gsub(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax + gsub(/(#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, + "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>"). + gsub(/ |#{Mx[:nbsp]}/,' ') wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 dob.obj=tidywords(wordlist).join(' ').strip dob end def markup_group(dob='') - dob.obj.gsub!(/</,'<'); dob.obj.gsub!(/>/,'>') - dob.obj.gsub!(/<:?br(?:\s+\/)?>/,'<br />') - dob.obj.gsub!(/<(link xmlns:xlink=".+?")>/,'<\1>') - dob.obj.gsub!(/<(\/link)>/,'<\1>') - dob.obj.gsub!(/<(\/?en)>/,'<\1>') + dob.obj=dob.obj.gsub(/</,'<').gsub(/>/,'>'). + gsub(/<:?br(?:\s+\/)?>/,'<br />'). + gsub(/<(link xmlns:xlink=".+?")>/,'<\1>'). + gsub(/<(\/link)>/,'<\1>'). + gsub(/<(\/?en)>/,'<\1>') dob end def markup_block(dob='') - dob.obj.gsub!(/</,'<'); dob.obj.gsub!(/>/,'>') - dob.obj.gsub!(/<:?br(?:\s+\/)?>/,'<br />') - dob.obj.gsub!(/<(link xmlns:xlink=".+?")>/,'<\1>') - dob.obj.gsub!(/<(\/link)>/,'<\1>') - dob.obj.gsub!(/<(\/?en)>/,'<\1>') + dob.obj=dob.obj.gsub(/</,'<').gsub(/>/,'>'). + gsub(/<:?br(?:\s+\/)?>/,'<br />'). + gsub(/<(link xmlns:xlink=".+?")>/,'<\1>'). + gsub(/<(\/link)>/,'<\1>'). + gsub(/<(\/?en)>/,'<\1>') dob end def xml_sem_block_paired(matched) # colon depth: many, recurs - matched.gsub!(/\b(au):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:au]} depth="many">\\2</sem:#{@ab[:au]}>}) - matched.gsub!(/\b(vol):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:vol]} depth="many">\\2</sem:#{@ab[:vol]}>}) - matched.gsub!(/\b(pub):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:pub]} depth="many">\\2</sem:#{@ab[:pub]}>}) - matched.gsub!(/\b(ref):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ref]} depth="many">\\2</sem:#{@ab[:ref]}>}) - matched.gsub!(/\b(desc):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:desc]} depth="many">\\2</sem:#{@ab[:desc]}>}) - matched.gsub!(/\b(conv):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:conv]} depth="many">\\2</sem:#{@ab[:conv]}>}) - matched.gsub!(/\b(ct):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ct]} depth="many">\\2</sem:#{@ab[:ct]}>}) - matched.gsub!(/\b(cty):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:cty]} depth="many">\\2</sem:#{@ab[:cty]}>}) - matched.gsub!(/\b(org):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:org]} depth="many">\\2</sem:#{@ab[:org]}>}) - matched.gsub!(/\b(dt):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:dt]} depth="many">\\2</sem:#{@ab[:dt]}>}) - matched.gsub!(/\b(n):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:n]} depth="many">\\2</sem:#{@ab[:n]}>}) - matched.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m,'<sem:\1 depth="many">\2</sem:\1>') + matched=matched.gsub(/\b(au):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:au]} depth="many">\\2</sem:#{@ab[:au]}>}). + gsub(/\b(vol):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:vol]} depth="many">\\2</sem:#{@ab[:vol]}>}). + gsub(/\b(pub):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:pub]} depth="many">\\2</sem:#{@ab[:pub]}>}). + gsub(/\b(ref):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ref]} depth="many">\\2</sem:#{@ab[:ref]}>}). + gsub(/\b(desc):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:desc]} depth="many">\\2</sem:#{@ab[:desc]}>}). + gsub(/\b(conv):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:conv]} depth="many">\\2</sem:#{@ab[:conv]}>}). + gsub(/\b(ct):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ct]} depth="many">\\2</sem:#{@ab[:ct]}>}). + gsub(/\b(cty):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:cty]} depth="many">\\2</sem:#{@ab[:cty]}>}). + gsub(/\b(org):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:org]} depth="many">\\2</sem:#{@ab[:org]}>}). + gsub(/\b(dt):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:dt]} depth="many">\\2</sem:#{@ab[:dt]}>}). + gsub(/\b(n):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:n]} depth="many">\\2</sem:#{@ab[:n]}>}). + gsub(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m,'<sem:\1 depth="many">\2</sem:\1>') end def xml_semantic_tags(dob) if @md.sem_tag dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) } dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) } dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) } - dob.obj.gsub!(/:\{(.+?)\}:au\b/m, %{<sem:#{@ab[:au]} depth="one">\\1</sem:#{@ab[:au]}>}) - dob.obj.gsub!(/:\{(.+?)\}:n\b/m, %{<sem:#{@ab[:n]} depth="one">\\1</sem:#{@ab[:n]}>}) - dob.obj.gsub!(/:\{(.+?)\}:ti\b/m, %{<sem:#{@ab[:ti]} depth="one">\\1</sem:#{@ab[:ti]}>}) - dob.obj.gsub!(/:\{(.+?)\}:ref\b/m, %{<sem:#{@ab[:ref]} depth="one">\\1</sem:#{@ab[:ref]}>}) - dob.obj.gsub!(/:\{(.+?)\}:desc\b/m, %{<sem:#{@ab[:desc]} depth="one">\\1</sem:#{@ab[:desc]}>}) - dob.obj.gsub!(/:\{(.+?)\}:cty\b/m, %{<sem:#{@ab[:cty]} depth="one">\\1</sem:#{@ab[:cty]}>}) - dob.obj.gsub!(/:\{(.+?)\}:org\b/m, %{<sem:#{@ab[:org]} depth="one">\\1</sem:#{@ab[:org]}>}) - dob.obj.gsub!(/:\{(.+?)\}:([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="one">\1</sem:\2>') - dob.obj.gsub!(/;\{([^}]+(?![;]))\};ti\b/m, %{<sem:#{@ab[:ti]} depth="zero">\\1</sem:#{@ab[:ti]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};qt\b/m, %{<sem:#{@ab[:qt]} depth="zero">\\1</sem:#{@ab[:qt]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};ref\b/m, %{<sem:#{@ab[:ref]} depth="zero">\\1</sem:#{@ab[:ref]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};ed\b/m, %{<sem:#{@ab[:ed]} depth="zero">\\1</sem:#{@ab[:ed]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};v\b/m, %{<sem:#{@ab[:v]} depth="zero">\\1</sem:#{@ab[:v]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};desc\b/m, %{<sem:#{@ab[:desc]} depth="zero">\\1</sem:#{@ab[:desc]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};def\b/m, %{<sem:#{@ab[:def]} depth="zero">\\1</sem:#{@ab[:def]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};trans\b/m, %{<sem:#{@ab[:trans]} depth="zero">\\1</sem:#{@ab[:trans]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};y\b/m, %{<sem:#{@ab[:y]} depth="zero">\\1</sem:#{@ab[:y]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};ab\b/m, %{<sem:#{@ab[:ab]} depth="zero">\\1</sem:#{@ab[:ab]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};pg\b/m, %{<sem:#{@ab[:pg]} depth="zero">\\1</sem:#{@ab[:pg]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};fn?\b/m, %{<sem:#{@ab[:fn]} depth="zero">\\1</sem:#{@ab[:fn]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};mn?\b/m, %{<sem:#{@ab[:mn]} depth="zero">\\1</sem:#{@ab[:mn]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};ln?\b/m, %{<sem:#{@ab[:ln]} depth="zero">\\1</sem:#{@ab[:ln]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};in\b/m, %{<sem:#{@ab[:in]} depth="zero">\\1</sem:#{@ab[:in]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};uni\b/m, %{<sem:#{@ab[:uni]} depth="zero">\\1</sem:#{@ab[:uni]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};fac\b/m, %{<sem:#{@ab[:fac]} depth="zero">\\1</sem:#{@ab[:fac]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};inst\b/m, %{<sem:#{@ab[:inst]} depth="zero">\\1</sem:#{@ab[:inst]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};dept\b/m, %{<sem:#{@ab[:dpt]} depth="zero">\\1</sem:#{@ab[:dept]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};org\b/m, %{<sem:#{@ab[:org]} depth="zero">\\1</sem:#{@ab[:org]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};com?\b/m, %{<sem:#{@ab[:com]} depth="zero">\\1</sem:#{@ab[:com]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};cty\b/m, %{<sem:#{@ab[:cty]} depth="zero">\\1</sem:#{@ab[:cty]}>}) - dob.obj.gsub!(/;\{([^}]+(?![;]))\};([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="zero">\1</sem:\2>') + dob.obj=dob.obj.gsub(/:\{(.+?)\}:au\b/m, %{<sem:#{@ab[:au]} depth="one">\\1</sem:#{@ab[:au]}>}). + gsub(/:\{(.+?)\}:n\b/m, %{<sem:#{@ab[:n]} depth="one">\\1</sem:#{@ab[:n]}>}). + gsub(/:\{(.+?)\}:ti\b/m, %{<sem:#{@ab[:ti]} depth="one">\\1</sem:#{@ab[:ti]}>}). + gsub(/:\{(.+?)\}:ref\b/m, %{<sem:#{@ab[:ref]} depth="one">\\1</sem:#{@ab[:ref]}>}). + gsub(/:\{(.+?)\}:desc\b/m, %{<sem:#{@ab[:desc]} depth="one">\\1</sem:#{@ab[:desc]}>}). + gsub(/:\{(.+?)\}:cty\b/m, %{<sem:#{@ab[:cty]} depth="one">\\1</sem:#{@ab[:cty]}>}). + gsub(/:\{(.+?)\}:org\b/m, %{<sem:#{@ab[:org]} depth="one">\\1</sem:#{@ab[:org]}>}). + gsub(/:\{(.+?)\}:([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="one">\1</sem:\2>'). + gsub(/;\{([^}]+(?![;]))\};ti\b/m, %{<sem:#{@ab[:ti]} depth="zero">\\1</sem:#{@ab[:ti]}>}). + gsub(/;\{([^}]+(?![;]))\};qt\b/m, %{<sem:#{@ab[:qt]} depth="zero">\\1</sem:#{@ab[:qt]}>}). + gsub(/;\{([^}]+(?![;]))\};ref\b/m, %{<sem:#{@ab[:ref]} depth="zero">\\1</sem:#{@ab[:ref]}>}). + gsub(/;\{([^}]+(?![;]))\};ed\b/m, %{<sem:#{@ab[:ed]} depth="zero">\\1</sem:#{@ab[:ed]}>}). + gsub(/;\{([^}]+(?![;]))\};v\b/m, %{<sem:#{@ab[:v]} depth="zero">\\1</sem:#{@ab[:v]}>}). + gsub(/;\{([^}]+(?![;]))\};desc\b/m, %{<sem:#{@ab[:desc]} depth="zero">\\1</sem:#{@ab[:desc]}>}). + gsub(/;\{([^}]+(?![;]))\};def\b/m, %{<sem:#{@ab[:def]} depth="zero">\\1</sem:#{@ab[:def]}>}). + gsub(/;\{([^}]+(?![;]))\};trans\b/m, %{<sem:#{@ab[:trans]} depth="zero">\\1</sem:#{@ab[:trans]}>}). + gsub(/;\{([^}]+(?![;]))\};y\b/m, %{<sem:#{@ab[:y]} depth="zero">\\1</sem:#{@ab[:y]}>}). + gsub(/;\{([^}]+(?![;]))\};ab\b/m, %{<sem:#{@ab[:ab]} depth="zero">\\1</sem:#{@ab[:ab]}>}). + gsub(/;\{([^}]+(?![;]))\};pg\b/m, %{<sem:#{@ab[:pg]} depth="zero">\\1</sem:#{@ab[:pg]}>}). + gsub(/;\{([^}]+(?![;]))\};fn?\b/m, %{<sem:#{@ab[:fn]} depth="zero">\\1</sem:#{@ab[:fn]}>}). + gsub(/;\{([^}]+(?![;]))\};mn?\b/m, %{<sem:#{@ab[:mn]} depth="zero">\\1</sem:#{@ab[:mn]}>}). + gsub(/;\{([^}]+(?![;]))\};ln?\b/m, %{<sem:#{@ab[:ln]} depth="zero">\\1</sem:#{@ab[:ln]}>}). + gsub(/;\{([^}]+(?![;]))\};in\b/m, %{<sem:#{@ab[:in]} depth="zero">\\1</sem:#{@ab[:in]}>}). + gsub(/;\{([^}]+(?![;]))\};uni\b/m, %{<sem:#{@ab[:uni]} depth="zero">\\1</sem:#{@ab[:uni]}>}). + gsub(/;\{([^}]+(?![;]))\};fac\b/m, %{<sem:#{@ab[:fac]} depth="zero">\\1</sem:#{@ab[:fac]}>}). + gsub(/;\{([^}]+(?![;]))\};inst\b/m, %{<sem:#{@ab[:inst]} depth="zero">\\1</sem:#{@ab[:inst]}>}). + gsub(/;\{([^}]+(?![;]))\};dept\b/m, %{<sem:#{@ab[:dpt]} depth="zero">\\1</sem:#{@ab[:dept]}>}). + gsub(/;\{([^}]+(?![;]))\};org\b/m, %{<sem:#{@ab[:org]} depth="zero">\\1</sem:#{@ab[:org]}>}). + gsub(/;\{([^}]+(?![;]))\};com?\b/m, %{<sem:#{@ab[:com]} depth="zero">\\1</sem:#{@ab[:com]}>}). + gsub(/;\{([^}]+(?![;]))\};cty\b/m, %{<sem:#{@ab[:cty]} depth="zero">\\1</sem:#{@ab[:cty]}>}). + gsub(/;\{([^}]+(?![;]))\};([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="zero">\1</sem:\2>') end dob end @@ -647,7 +652,7 @@ module SiSU_XML_Tags #Format def meta_content_clean(content='') content unless content.nil? - content.tr!('"',"'") + content=content.tr('"',"'") content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content) end content |