Skip to content

Commit

Permalink
Show programming language in HTML footer (#1560)
Browse files Browse the repository at this point in the history
  • Loading branch information
kianmeng authored Apr 23, 2022
1 parent d01098a commit 8b42650
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/ex_doc/formatter/html/templates/footer_template.eex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
<p>
Built using
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener" translate="no">ExDoc</a> (v<%= ExDoc.version() %>) for the
<a href="https://elixir-lang.org" title="Elixir" target="_blank" translate="no">Elixir programming language</a>
<%= if config.proglang == :erlang do %>
<a href="https://erlang.org" title="Erlang" target="_blank" translate="no">Erlang programming language</a>
<% else %>
<a href="https://elixir-lang.org" title="Elixir" target="_blank" translate="no">Elixir programming language</a>
<% end %>
</p>
</footer>
</div>
Expand Down
15 changes: 15 additions & 0 deletions test/ex_doc/formatter/html/templates_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,21 @@ defmodule ExDoc.Formatter.HTML.TemplatesTest do
refute content =~ ~r{<li><a id="tasks-list-link" href="#full-list">Mix Tasks</a></li>}
end

test "display built with footer by proglang option" do
content = Templates.footer_template(doc_config(proglang: :erlang), nil)

assert content =~
~r{<a href="https://erlang.org" title="Erlang" target="_blank" translate="no">Erlang programming language</a>}

content = Templates.footer_template(doc_config(proglang: :elixir), nil)

assert content =~
~r{<a href="https://elixir-lang.org" title="Elixir" target="_blank" translate="no">Elixir programming language</a>}

assert Templates.footer_template(doc_config(proglang: :elixir), nil) ==
Templates.footer_template(doc_config(), nil)
end

test "outputs listing for the given nodes" do
names = [CompiledWithDocs, CompiledWithDocs.Nested]
nodes = ExDoc.Retriever.docs_from_modules(names, doc_config())
Expand Down

0 comments on commit 8b42650

Please sign in to comment.