diff options
Diffstat (limited to 'lib/4store.rb')
-rw-r--r-- | lib/4store.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/4store.rb b/lib/4store.rb index 6143bbe..3ed081d 100644 --- a/lib/4store.rb +++ b/lib/4store.rb @@ -84,7 +84,8 @@ module OpenTox turtle = RDF::N3::Writer.for(:turtle).buffer(:prefixes => prefixes) do |writer| rdf.each{|statement| writer << statement} end - turtle = "<html><body>" + turtle.gsub(%r{<(.*)>},'<<a href="\1">\1</a>>').gsub(/\n/,'<br/>') + "</body></html>" if mime_type =~ /html/ and !turtle.empty? + regex = Regexp.new '(https?:\/\/[\S]+)([>"])' + turtle = "<html><body>" + turtle.gsub( regex, '<a href="\1">\1</a>\2' ).gsub(/\n/,'<br/>') + "</body></html>" if mime_type =~ /html/ and !turtle.empty? turtle end else |