summaryrefslogtreecommitdiffhomepage
path: root/scan.rb
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2023-05-09 12:58:33 -0400
committerrealtradam <[email protected]>2023-05-09 12:58:33 -0400
commit0edab992ab6ee804c223e30ae9347b3072a750be (patch)
tree310feb32cfad556f736af63cf978cc37b06cb821 /scan.rb
parenta4314fafa69cacaa247277b7da8a647c34c4ede3 (diff)
downloadRodeoKit-0edab992ab6ee804c223e30ae9347b3072a750be.tar.gz
RodeoKit-0edab992ab6ee804c223e30ae9347b3072a750be.zip
add some documentation generation
Diffstat (limited to 'scan.rb')
-rw-r--r--scan.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/scan.rb b/scan.rb
new file mode 100644
index 0000000..75c7959
--- /dev/null
+++ b/scan.rb
@@ -0,0 +1,44 @@
+require "rexml/document"
+
+class CodeModule
+ attr_accessor :title, :color, :files, :code
+
+ def initialize(title:, files:, color:)
+ self.title = title
+ self.color = color
+ self.files = files
+ self.code = ""
+ end
+end
+
+code_modules = [
+ CodeModule.new(title: "Core", files: ['rodeo_8h.xml', 'common_8h.xml'], color: "stone"),
+ CodeModule.new(title: "Audio", files: ['audio_8h.xml'], color: "blue"),
+ CodeModule.new(title: "Input", files: ['input_8h.xml'], color: "red"),
+ CodeModule.new(title: "Log", files: ['log_8h.xml'], color: "yellow"),
+]
+code_modules.each_with_index do |mod, index|
+ mod.files.each do |file|
+ file = File.new("doxygen/xml/#{file}")
+ doc = REXML::Document.new file
+ root = doc.root
+
+ defines = root.get_elements('//sectiondef').filter { |attr| attr.attributes['kind'] == "func" }
+
+ defines.each do |func|
+ func.get_elements('//definition').each_with_index do |defi, i|
+ mod.code += "#{defi.text}#{func.get_elements('//argsstring')[i].text};\n"
+ end
+ end
+ end
+ File.write("./docs/#{index}#{mod.title.downcase}.html",
+ "---
+title: #{mod.title}
+id: #{mod.title.downcase}
+color: #{mod.color}
+---
+{% highlight c %}
+#{mod.code}
+{% endhighlight %}
+")
+end