Skip to content

Commit 4d16463

Browse files
committed
fix rebasing, missing ids
1 parent be98b00 commit 4d16463

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

lib/ex_doc/formatter/epub/templates/module_template.eex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</section>
2323
<% end %>
2424

25-
<%= for group <- dbg(summary), key = text_to_id(group.title) do %>
25+
<%= for group <- summary, key = text_to_id(group.title) do %>
2626
<section id="<%= key %>" class="details-list">
2727
<h1 class="section-heading"><%=h to_string(group.title) %></h1>
2828
<%= if doc = group.doc do %>

lib/ex_doc/formatter/html/templates/module_template.eex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
</a>
5252
<span class="text"><%= group.title %></span>
5353
</h1>
54-
<%= if doc = group.rendered_doc do %>
54+
<%= if doc = group.doc do %>
5555
<div class="group-description" id="group-description-<%= key %>">
5656
<%= render_doc(doc) %>
5757
</div>

lib/ex_doc/retriever.ex

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,13 @@ defmodule ExDoc.Retriever do
322322

323323
doc_ast =
324324
case description do
325-
nil -> nil
326-
text -> doc_ast("text/markdown", %{"en" => text}, [])
325+
nil ->
326+
nil
327+
328+
text ->
329+
doc_ast = doc_ast("text/markdown", %{"en" => text}, [])
330+
sub_id = ExDoc.Utils.text_to_id(group.title)
331+
normalize_doc_ast(doc_ast, "group-#{sub_id}-")
327332
end
328333

329334
%ExDoc.DocGroupNode{

test/ex_doc/formatter/epub/templates_test.exs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,6 @@ defmodule ExDoc.Formatter.EPUB.TemplatesTest do
169169

170170
doc = LazyHTML.from_document(content)
171171

172-
IO.warn("remove file.write")
173-
File.write("/tmp/doc.html", LazyHTML.to_html(doc))
174-
175172
assert Enum.count(doc["div.group-description"]) == 1
176173
assert Enum.count(doc["#group-description-example-functions"]) == 1
177174
assert Enum.count(doc["#group-description-example-functions h3"]) == 1
@@ -180,7 +177,9 @@ defmodule ExDoc.Formatter.EPUB.TemplatesTest do
180177
assert Enum.count(doc["#example-functions .group-description a[href='#example/2']"]) == 1
181178
assert Enum.count(doc["#example-functions .group-description a[href='#flatten/1']"]) == 1
182179

183-
assert content =~ ~s[<span class="text">A section heading example</span>]
180+
assert content =~
181+
~s[<h3 id="group-example-functions-a-section-heading-example">A section heading example</h3>]
182+
184183
assert content =~ "<p>A content example.</p>"
185184
end
186185

0 commit comments

Comments
 (0)