Skip to content
Browse files

fixed xml xi:include issues

  • Loading branch information...
1 parent 03e8169 commit 9aece7dfc1a7ccd3e2405845829a393abe542109 ilan committed
Showing with 9 additions and 0 deletions.
  1. +9 −0 tasks/documentation.thor
View
9 tasks/documentation.thor
@@ -62,6 +62,15 @@ class Docs < Thor
Dir.glob("#{xmlPath}/*.xml").each do |filepath| # each .xml file in directory
contentXml = File.open(filepath).read # read the xml content of the file
+
+ regex = /<xi:include href="(.+?)".+>/ # including xml xi:include tags
+ contentXml = contentXml.gsub regex do
+ icontentXml = File.open("#{xmlPath}/#{$1}").read
+ reg = /<\?xml.*\?>/
+ icontentXml = icontentXml.gsub reg , ''
+ icontentXml
+ end
+
contentObj = Crack::XML.parse(contentXml) # parse xml to a object
filename = filepath.split('/').last.gsub('.xml', '') # get the filename (-selector variation for example)
entryObj = {} # will hold entry details, written to file as json

0 comments on commit 9aece7d

Please sign in to comment.
Something went wrong with that request. Please try again.