diff options
author | Jeff King <peff@peff.net> | 2022-10-05 20:37:39 +0300 |
---|---|---|
committer | Jeff King <peff@peff.net> | 2022-10-05 20:37:39 +0300 |
commit | b6e2701de7559860af72596469e073f8920414ab (patch) | |
tree | 0b31dcffc7b604c43f8980f1b0f02fcffe0ffb40 | |
parent | 45b48fa53fc346f8812ecf70db6baa74b13ba08b (diff) |
index_doc(): loosen match of "git-cmd(1)" on manpages
In v2.38.0, we now have a manpage for scalar, which doesn't start with
"git". As a result, our regex to find the section number fails, and the
whole manpage is aborted.
Let's loosen this regex to match any alphanumeric command name, plus
dashes. That's enough for the current code base. It's conceivable we
might introduce more characters, but you get a nice big exception
if we do.
-rw-r--r-- | lib/tasks/index.rake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/tasks/index.rake b/lib/tasks/index.rake index dc47a9ce..c5c933fe 100644 --- a/lib/tasks/index.rake +++ b/lib/tasks/index.rake @@ -200,7 +200,7 @@ def index_doc(filter_tags, doc_list, get_content) links = cmd_list[category].map do |cmd, attr| if cmd_file = tag_files.detect { |ent| ent.first == "Documentation/#{cmd}.txt" } content = get_content.call(cmd_file.second) - section = content.match(/^git.*\(([1-9])\)/)[1] + section = content.match(/^[a-z0-9-]+\(([1-9])\)/)[1] if match = content.match(/NAME\n----\n\S+ - (.*)$/) "linkgit:#{cmd}[#{section}]::\n\t#{attr == 'deprecated' ? '(deprecated) ' : ''}#{match[1]}\n" end |