diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sisu/v2/db_sqltxt.rb | 19 | 
1 files changed, 17 insertions, 2 deletions
| diff --git a/lib/sisu/v2/db_sqltxt.rb b/lib/sisu/v2/db_sqltxt.rb index f120b95f..68e9ef8a 100644 --- a/lib/sisu/v2/db_sqltxt.rb +++ b/lib/sisu/v2/db_sqltxt.rb @@ -62,6 +62,7 @@ module SiSU_DB_text    class Prepare      def special_character_escape(str)        str.gsub!(/'/,"''") #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'") +      str.gsub!(/(\\)/m,'\1\1') #ok but with warnings, double backslash on sqlite #str.gsub!(/[\\]/m,'\\x5C') #ok but with warnings, but not for sqlite #str.gsub!(/(\\)/m,'\1') #ok for sqlite not for pgsql        str.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"<br />\n")        str.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check        str.gsub!(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/,'[image: \1] \2') @@ -76,8 +77,22 @@ module SiSU_DB_text          s.gsub!(/^(?:group|poem|code)\{/,''); s.gsub!(/^\}(?:group|poem|code)/,'')          s.gsub!(/\A(?:@\S+:\s+.+)\Z/m,'')          if s =~/^:A~/ -          s.gsub!(/@author/,@md.creator.author) -          s.gsub!(/@title/,@md.title.full) +          if defined? @md.creator \ +          and defined? @md.creator.author \ +          and not @md.creator.author.empty? +            s.gsub!(/@author/,@md.creator.author) +          else +            tell=SiSU_Screen::Ansi.new('v','WARNING Document Author information missing; provide @creator: :author:') +            tell.warn +          end +          if defined? @md.title \ +          and defined? @md.title.full \ +          and not @md.title.full.empty? +            s.gsub!(/@title/,@md.title.full) +          else +            tell=SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:') +            tell.warn +          end          end          s.gsub!(/^(?:_[1-9]\*?|_\*)\s+/,'')          s.gsub!(/^(?:[1-9]\~(\S+)?)\s+/,'') | 
