Skip to content

Commit

Permalink
Fix function entry page name check, closes #1344
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmach committed Mar 19, 2021
1 parent 3a40edd commit da6c25c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ex_doc/formatter/html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ defmodule ExDoc.Formatter.HTML do
|> String.replace("?", "-question-mark")
|> String.replace("!", "-exclamation-mark")

if name =~ ~r/[a-z_-]/i do
if name =~ ~r/^[a-z0-9_-]+$/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)
Expand Down

2 comments on commit da6c25c

@josevalim
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test where we validate something like def unquote(:"foo/bar")() do doesn't generate a page? :)

@wojtekmach
Copy link
Member Author

@wojtekmach wojtekmach commented on da6c25c Mar 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 7735cd5

Please sign in to comment.