lib/pdd.rb in pdd-0.4.1 vs lib/pdd.rb in pdd-0.5
- old
+ new
@@ -74,12 +74,12 @@
sources = sources.exclude(p)
PDD.log.info "excluding #{p}"
end unless @opts[:exclude].nil?
sanitize(
Nokogiri::XML::Builder.new do |xml|
- xml << '<?xml-stylesheet type="text/xsl" href="puzzles.xsl"?>'
- xml.puzzles(version: PDD::VERSION, date: Time.now.utc.iso8601) do
+ xml << "<?xml-stylesheet type='text/xsl' href='#{xsl}'?>"
+ xml.puzzles(attrs) do
sources.fetch.each do |source|
source.puzzles.each do |puzzle|
PDD.log.info "puzzle #{puzzle.props[:ticket]}:" \
"#{puzzle.props[:estimate]}/#{puzzle.props[:role]}" \
" at #{puzzle.props[:file]}"
@@ -90,9 +90,26 @@
end.to_xml
)
end
private
+
+ def attrs
+ {
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
+ 'xsi:noNamespaceSchemaLocation' => "#{host}/xsd/#{PDD::VERSION}.xsd",
+ 'version' => PDD::VERSION,
+ 'date' => Time.now.utc.iso8601
+ }
+ end
+
+ def host
+ 'http://pdd.teamed.io'
+ end
+
+ def xsl
+ "#{host}/xsl/#{PDD::VERSION}.xsl"
+ end
def render(puzzle, xml)
props = puzzle.props
xml.puzzle do
props.map do |k, v|