Skip to content

Commit

Permalink
Handle non-letter character when generating function landing pages
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmach committed Mar 16, 2021
1 parent 30521cd commit 9ed96fe
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/ex_doc/formatter/html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,17 @@ defmodule ExDoc.Formatter.HTML do
module_node.docs
|> Enum.group_by(&{&1.type, &1.name})
|> Enum.each(fn {{type, name}, nodes} ->
content = Templates.module_entry_page(module_node, type, name, nodes, nodes_map, config)
filename = "#{module_node.id}-#{type}-#{name}.html"
File.write!("#{config.output}/#{filename}", content)
name =
name
|> Atom.to_string()
|> String.replace("?", "-question-mark")
|> String.replace("!", "-exclamation-mark")

if name =~ ~r/[a-z_-]/i do
content = Templates.module_entry_page(module_node, type, name, nodes, nodes_map, config)
filename = "#{module_node.id}-#{type}-#{name}.html"
File.write!("#{config.output}/#{filename}", content)
end
end)
end

Expand Down

0 comments on commit 9ed96fe

Please sign in to comment.