Commit 6391d404 authored by Michael Witrant's avatar Michael Witrant

fix language

parent fbc3f716
...@@ -48,14 +48,6 @@ European Fashion Council: !ruby/struct:Answer ...@@ -48,14 +48,6 @@ European Fashion Council: !ruby/struct:Answer
languages: languages:
- en - en
"": !ruby/struct:Answer
name: ""
files:
- https://circabc.europa.eu/d/d/workspace/SpacesStore/318e33ff-694a-4485-9755-dde97697d148/fast.pdf
annexes: []
languages:
- fast
Voez: !ruby/struct:Answer Voez: !ruby/struct:Answer
name: Voez name: Voez
files: files:
...@@ -338,7 +330,7 @@ Aepoc: !ruby/struct:Answer ...@@ -338,7 +330,7 @@ Aepoc: !ruby/struct:Answer
annexes: [] annexes: []
languages: languages:
- " en" - en
Rim: !ruby/struct:Answer Rim: !ruby/struct:Answer
name: Rim name: Rim
files: files:
...@@ -676,6 +668,14 @@ Faep: !ruby/struct:Answer ...@@ -676,6 +668,14 @@ Faep: !ruby/struct:Answer
languages: languages:
- en - en
Fast: !ruby/struct:Answer
name: Fast
files:
- https://circabc.europa.eu/d/d/workspace/SpacesStore/318e33ff-694a-4485-9755-dde97697d148/fast.pdf
annexes: []
languages: []
Danish Patent Agents Association: !ruby/struct:Answer Danish Patent Agents Association: !ruby/struct:Answer
name: Danish Patent Agents Association name: Danish Patent Agents Association
files: files:
......
...@@ -20,13 +20,23 @@ files.each do |type| ...@@ -20,13 +20,23 @@ files.each do |type|
name = CGI::unescape(name) name = CGI::unescape(name)
#name = Iconv.iconv("utf-8", "iso8859-15", name).first #name = Iconv.iconv("utf-8", "iso8859-15", name).first
names = name.split("_") names = name.split("_")
language = names.pop
language = names.last.dup
language.gsub!(/\s/, "")
if language.size == 2
names.pop
else
language = nil
end
annex = names.index { |part| part =~ /^annex/ } annex = names.index { |part| part =~ /^annex/ }
if annex if annex
names[annex..-1] = [] names[annex..-1] = []
end end
raise "no name on #{url}" if names.empty?
name = names.map(&:capitalize).join(" ") name = names.map(&:capitalize).join(" ")
#name = "#{name} (#{language})" #name = "#{name} (#{language})"
...@@ -36,8 +46,10 @@ files.each do |type| ...@@ -36,8 +46,10 @@ files.each do |type|
else else
answer.files << url answer.files << url
end end
answer.languages << language if language
answer.languages.uniq! answer.languages << language
answer.languages.uniq!
end
end end
answers.sort.each do |name, answer| answers.sort.each do |name, answer|
......
--- ---
Uk: !ruby/struct:Answer
name: Uk
files:
- https://circabc.europa.eu/d/d/workspace/SpacesStore/6436e9a1-1ba6-414e-af8c-d50fa3ac2c52/uk_governement.pdf
annexes: []
languages:
- governement
"": !ruby/struct:Answer
name: ""
files:
- https://circabc.europa.eu/d/d/workspace/SpacesStore/4edaf82a-d143-4a07-9880-e59529afc595/france.pdf
annexes: []
languages:
- france
Portugal: !ruby/struct:Answer Portugal: !ruby/struct:Answer
name: Portugal name: Portugal
files: files:
...@@ -105,6 +89,14 @@ Italy Office Of The Prime Minister: !ruby/struct:Answer ...@@ -105,6 +89,14 @@ Italy Office Of The Prime Minister: !ruby/struct:Answer
languages: languages:
- it - it
France: !ruby/struct:Answer
name: France
files:
- https://circabc.europa.eu/d/d/workspace/SpacesStore/4edaf82a-d143-4a07-9880-e59529afc595/france.pdf
annexes: []
languages: []
Finnish Commerce Federation: !ruby/struct:Answer Finnish Commerce Federation: !ruby/struct:Answer
name: Finnish Commerce Federation name: Finnish Commerce Federation
files: files:
...@@ -212,6 +204,14 @@ Czech Republic: !ruby/struct:Answer ...@@ -212,6 +204,14 @@ Czech Republic: !ruby/struct:Answer
languages: languages:
- en - en
Uk Governement: !ruby/struct:Answer
name: Uk Governement
files:
- https://circabc.europa.eu/d/d/workspace/SpacesStore/6436e9a1-1ba6-414e-af8c-d50fa3ac2c52/uk_governement.pdf
annexes: []
languages: []
Germany: !ruby/struct:Answer Germany: !ruby/struct:Answer
name: Germany name: Germany
files: files:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment