vortex_client 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/vortex_client.rb +19 -1
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
data/lib/vortex_client.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  require 'net/dav'
2
3
  require 'vortex_client/string_utils'
3
4
  require 'highline/import'
@@ -141,6 +142,23 @@ module Vortex
141
142
  end
142
143
  end
143
144
 
145
+ def escape_html(str)
146
+ new_str = str.gsub("
","") #remove line break
147
+ new_str = new_str.gsub("\"",""") #swaps " to html-encoding
148
+ new_str = new_str.gsub("'","'") #swaps ' to html-encoding
149
+ new_str = new_str.gsub("<","&lt;")
150
+ new_str = new_str.gsub(">","&gt;")
151
+ new_str = new_str.gsub(/'/, "\"") # Fnutter gir "not valid xml error"
152
+ new_str = new_str.gsub("&nbsp;", " ") # &nbsp; gir også "not valid xml error"
153
+ new_str = new_str.gsub("–", "-") # Tankestrek til minustegn
154
+ new_str = new_str.gsub("’","&#39;") # Fnutt
155
+ new_str = new_str.gsub("‘","&#39;") # Fnutt
156
+ new_str = new_str.gsub("“","&#39;") # Fnutt
157
+ new_str = new_str.gsub("”","&#39;") # Fnutt
158
+ new_str = new_str.gsub("”","&#39;") # Norske gåseøyne til fnutt
159
+ return new_str
160
+ end
161
+
144
162
  def properties
145
163
  props = '<v:resourceType xmlns:v="vrtx">article</v:resourceType>' +
146
164
  '<v:xhtml10-type xmlns:v="vrtx">article</v:xhtml10-type>' +
@@ -177,7 +195,7 @@ module Vortex
177
195
  props += '<owner xmlns="vrtx">' + owner + '</owner>'
178
196
  end
179
197
  if(introduction and introduction != "")
180
- props += '<introduction xmlns="vrtx">' + introduction + '</introduction>'
198
+ props += '<introduction xmlns="vrtx">' + escape_html(introduction) + '</introduction>'
181
199
  end
182
200
  if(author and author != "")
183
201
  props += '<v:authors xmlns:v="vrtx">' +
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 1
9
- version: 0.5.1
8
+ - 2
9
+ version: 0.5.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Thomas Flemming