mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- start hacking on a doc generator
This commit is contained in:
parent
cb11e9ec5c
commit
ad9f40b7d3
1 changed files with 31 additions and 0 deletions
31
docgen.rb
Normal file
31
docgen.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
class LogStashConfigDocGenerator
|
||||
COMMENT_RE = /^ *#(.*)/
|
||||
RULES = {
|
||||
COMMENT_RE => lambda { |m| add_comment(m[1]) },
|
||||
/^ *config .*/ => lambda { |m| add_config(m[0]) },
|
||||
}
|
||||
|
||||
def parse(string)
|
||||
buffer = ""
|
||||
string.split("\n").each do |line|
|
||||
|
||||
if line =~ COMMENT_RE
|
||||
# nothing
|
||||
else
|
||||
# Join extended lines
|
||||
if line =~ /(, *$)|(\\$)/
|
||||
buffer += line.gsub(/\\$/, "")
|
||||
next
|
||||
end
|
||||
end
|
||||
|
||||
p line
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
gen = LogStashConfigDocGenerator.new
|
||||
gen.parse(File.new(ARGV[0]).read)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue