Fixed parser to add proper newlines in multi-line values
Example: Key: Value1 Value2 Value3 Before: "Value1Value2\nValue" After: "Value1\nValue2\nValue"
This commit is contained in:
parent
061306e09e
commit
c944e1ba91
1 changed files with 8 additions and 3 deletions
|
|
@ -34,7 +34,8 @@ module DebImporter
|
|||
end # open
|
||||
end # def initialize
|
||||
|
||||
# Get package information from translation (i18n) files
|
||||
# Get package information from translation (i18n) files.
|
||||
# Returns an enumerator of packages.
|
||||
def i18n(component, language)
|
||||
url = "#{@dist_url}/#{component}/i18n/Translation-en"
|
||||
file = find_and_open_compressed_url(url)
|
||||
|
|
@ -96,12 +97,16 @@ module DebImporter
|
|||
when /^(.+): (.+)/ # "Key: Value"
|
||||
fields[name.to_sym]=value unless value.empty?
|
||||
name,value=$1,$2
|
||||
when /^(.+):\s*/ # "Key:" (start of multi-line entry)
|
||||
when /^(.+):$/ # "Key:" (start of multi-line entry without value in line)
|
||||
fields[name.to_sym]=value unless value.empty?
|
||||
name=$1
|
||||
value=''
|
||||
when /^\s+(.+)/ # " Indented multi-line value"
|
||||
value << $1+"\n"
|
||||
# Add a newline for multi-line entries ("Key: Value\n Foo\n Bar")
|
||||
unless value.empty?
|
||||
value << "\n"
|
||||
end
|
||||
value << $1
|
||||
when /^\s+$/ # Empty line
|
||||
break
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue