diff options
author | Rob Kendrick (humdrum) <rjek@rjek.com> | 2012-09-12 11:34:59 +0100 |
---|---|---|
committer | Rob Kendrick (humdrum) <rjek@rjek.com> | 2012-09-12 11:34:59 +0100 |
commit | 85be999abc770c56700ca09d7e1d0cea4c58dd8b (patch) | |
tree | 925d93b0b047e2e6016a49cab7aab7dd7f6b861f | |
parent | 6606ebd28e30bf44096b29698c197f0444c17a70 (diff) | |
download | luxio-85be999abc770c56700ca09d7e1d0cea4c58dd8b.tar.gz |
Attempt to make docgen work with C, too
-rwxr-xr-x | docs/docgen.lua | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/docs/docgen.lua b/docs/docgen.lua index 1c48fca..1c7e73a 100755 --- a/docs/docgen.lua +++ b/docs/docgen.lua @@ -47,12 +47,18 @@ function to_anchor(s) return (s:gsub("[^a-zA-Z0-9]", "-")):lower() end -for i, v in ipairs { find_comments:match(source) } do - if v:match("^/**") then - local content = v:match "^/%*%*%s*(.*)%s*%*/$" - if content then - doc_comments[#doc_comments + 1] = - content:gsub("\n%s*%*%s+", "\n"):gsub("\n%s*%*%s+", "\n\n"):gsub("%\\t", "\t") +if arg[1] == "-l" then + for c in source:gmatch "\n%-%-%-([^\n]*)" do + doc_comments[#doc_comments + 1] = c + end +else + for i, v in ipairs { find_comments:match(source) } do + if v:match("^/**") then + local content = v:match "^/%*%*%s*(.*)%s*%*/$" + if content then + doc_comments[#doc_comments + 1] = + content:gsub("\n%s*%*%s+", "\n"):gsub("\n%s*%*%s+", "\n\n"):gsub("%\\t", "\t") + end end end end |