Skip to content

Commit

Permalink
Fixed dump_ay_addons.rb helper script
Browse files Browse the repository at this point in the history
- the <addon> tag was missing
- fixed indentation
- XML escape the values
  • Loading branch information
lslezak committed Mar 25, 2019
1 parent 38dd37f commit 7cf29ed
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions devel/dump_ay_addons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,27 @@

require_relative "yaml_workaround"

INDENT_WIDTH = 4
INDENT_WIDTH = 2

# convert addon data to an XML document snippet
def dump_addon(a)
prefix = " " * INDENT_WIDTH
prefix = " " * INDENT_WIDTH * 2
prefix_outer = " " * INDENT_WIDTH

ret = prefix + "<!-- #{a.name} -->\n"
ret = prefix_outer + "<addon>\n"

ret += prefix + "<!-- #{a.name} -->\n"

ret += prefix + "<!-- Depends on: #{a.depends_on.name} -->\n" if a.depends_on

ret += prefix + "<name>#{a.identifier}</name>\n" +
prefix + "<version>#{a.version}</version>\n" +
prefix + "<arch>#{a.arch}</arch>\n"
ret += prefix + "<name>#{a.identifier.encode(:xml => :text)}</name>\n" +
prefix + "<version>#{a.version.encode(:xml => :text)}</version>\n" +
prefix + "<arch>#{a.arch.encode(:xml => :text)}</arch>\n"

ret += prefix + "<reg_code>REG_CODE_REQUIRED</reg_code>\n" unless a.free

ret += prefix_outer + "</addon>\n"

ret
end

Expand Down

0 comments on commit 7cf29ed

Please sign in to comment.