Skip to content

Commit 9ed96fe

Browse files
committed
Handle non-letter character when generating function landing pages
1 parent 30521cd commit 9ed96fe

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/ex_doc/formatter/html.ex

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,17 @@ defmodule ExDoc.Formatter.HTML do
477477
module_node.docs
478478
|> Enum.group_by(&{&1.type, &1.name})
479479
|> Enum.each(fn {{type, name}, nodes} ->
480-
content = Templates.module_entry_page(module_node, type, name, nodes, nodes_map, config)
481-
filename = "#{module_node.id}-#{type}-#{name}.html"
482-
File.write!("#{config.output}/#{filename}", content)
480+
name =
481+
name
482+
|> Atom.to_string()
483+
|> String.replace("?", "-question-mark")
484+
|> String.replace("!", "-exclamation-mark")
485+
486+
if name =~ ~r/[a-z_-]/i do
487+
content = Templates.module_entry_page(module_node, type, name, nodes, nodes_map, config)
488+
filename = "#{module_node.id}-#{type}-#{name}.html"
489+
File.write!("#{config.output}/#{filename}", content)
490+
end
483491
end)
484492
end
485493

0 commit comments

Comments
 (0)