Skip to content

Commit d0ea964

Browse files
committed
epub fixes, closes #2087
1 parent 4f7580a commit d0ea964

File tree

9 files changed

+23
-35
lines changed

9 files changed

+23
-35
lines changed

assets/js/tooltips/tooltips.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import tooltipBodyTemplate from '../handlebars/templates/tooltip-body.handlebars
66
const TOOLTIP_HTML = '<div class="tooltip"><div class="tooltip-body"></div></div>'
77

88
// Elements that can activate the tooltip.
9-
const TOOLTIP_ACTIVATORS_SELECTOR = '.content a:not([data-no-tooltip])'
9+
const TOOLTIP_ACTIVATORS_SELECTOR = '.content a:not([data-no-tooltip=""])'
1010
// Tooltip root element.
1111
const TOOLTIP_SELECTOR = '.tooltip'
1212
// Tooltip content element.

formatters/html/dist/html-NL4GMUWY.js formatters/html/dist/html-6VTPNSGQ.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ex_doc/formatter/epub/templates.ex

-8
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,6 @@ defmodule ExDoc.Formatter.EPUB.Templates do
9999
trim: true
100100
)
101101

102-
EEx.function_from_file(
103-
:defp,
104-
:nav_item_template,
105-
Path.expand("templates/nav_item_template.eex", __DIR__),
106-
[:name, :nodes],
107-
trim: true
108-
)
109-
110102
EEx.function_from_file(
111103
:defp,
112104
:nav_grouped_item_template,

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

-9
This file was deleted.

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

+15-10
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@
22
<h1>Table of contents</h1>
33
<nav epub:type="toc">
44
<ol>
5-
<%= nav_grouped_item_template config.extras %>
5+
<%= nav_grouped_item_template config.extras %>
66

7-
<%= unless Enum.empty?(nodes.modules) do %>
7+
<%= if nodes.modules != [] do %>
88
<li>
9-
<ol>
10-
<li><span>Modules</span>
11-
<ol>
12-
<%= nav_grouped_item_template nodes.modules %>
13-
</ol>
14-
</li>
15-
</ol>
9+
<span>Modules</span>
10+
<ol><%= nav_grouped_item_template nodes.modules %></ol>
1611
</li>
1712
<% end %>
18-
<%= nav_item_template "Mix Tasks", nodes.tasks %>
13+
14+
<%= if nodes.tasks != [] do %>
15+
<li>
16+
<span>Mix Tasks</span>
17+
<ol>
18+
<%= for node <- nodes.tasks do %>
19+
<li><a href="<%= URI.encode node.id %>.xhtml"><%=h node.title %></a></li>
20+
<% end %>
21+
</ol>
22+
</li>
23+
<% end %>
1924
</ol>
2025
</nav>
2126
<%= before_closing_body_tag(config, :epub) %>

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<span id="<%=enc "#{default_name}/#{default_arity}" %>"></span>
44
<% end %>
55
<div class="detail-header">
6-
<a href="#<%=enc node.id %>" class="detail-link" data-no-tooltip aria-label="Link to this <%= pretty_type(node) %>">
6+
<a href="#<%=enc node.id %>" class="detail-link" data-no-tooltip="" aria-label="Link to this <%= pretty_type(node) %>">
77
<i class="ri-link-m" aria-hidden="true"></i>
88
</a>
99
<div class="heading-with-actions">

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<%= for node <- nodes do %>
66
<div class="summary-row">
77
<div class="summary-signature">
8-
<a href="#<%=enc node.id %>" data-no-tooltip translate="no"><%=h node.signature %></a>
8+
<a href="#<%=enc node.id %>" data-no-tooltip="" translate="no"><%=h node.signature %></a>
99
<%= if deprecated = node.deprecated do %>
1010
<span class="deprecated" title="<%= h(deprecated) %>">deprecated</span>
1111
<% end %>

test/ex_doc/formatter/epub/templates_test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ defmodule ExDoc.Formatter.EPUB.TemplatesTest do
145145
content = get_module_page([CompiledWithDocs])
146146

147147
assert content =~
148-
~r{<div class="summary-signature">\s*<a href="#example_1/0" data-no-tooltip translate="no">}
148+
~r{<div class="summary-signature">\s*<a href="#example_1/0" data-no-tooltip="" translate="no">}
149149
end
150150

151151
test "contains links to summary sections when those exist" do

test/ex_doc/formatter/html/templates_test.exs

+3-3
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ defmodule ExDoc.Formatter.HTML.TemplatesTest do
478478
assert content =~ ~s{example(foo, bar \\\\ Baz)}
479479

480480
assert content =~
481-
~r{<a href="#example/2" class="detail-link" data-no-tooltip aria-label="Link to this function">\s*<i class="ri-link-m" aria-hidden="true"></i>\s*</a>}ms
481+
~r{<a href="#example/2" class="detail-link" data-no-tooltip="" aria-label="Link to this function">\s*<i class="ri-link-m" aria-hidden="true"></i>\s*</a>}ms
482482
end
483483

484484
test "outputs function groups", context do
@@ -519,7 +519,7 @@ defmodule ExDoc.Formatter.HTML.TemplatesTest do
519519
~S[<a href="TypesAndSpecs.Sub.html#t:t/0">TypesAndSpecs.Sub.t</a>(), ] <>
520520
~S[<a href="#t:opaque/0">opaque</a>(), :ok | :error}]
521521

522-
assert content =~ ~s[<a href="#t:public/1" data-no-tooltip translate="no">public(t)</a>]
522+
assert content =~ ~s[<a href="#t:public/1" data-no-tooltip="" translate="no">public(t)</a>]
523523
refute content =~ ~s[<a href="#t:private/0">private</a>]
524524
assert content =~ public_html
525525
refute content =~ ~s[<strong>private\(t\)]
@@ -538,7 +538,7 @@ defmodule ExDoc.Formatter.HTML.TemplatesTest do
538538
content = get_module_page([CompiledWithDocs], context)
539539

540540
assert content =~
541-
~r{<div class="summary-signature">\s*<a href="#example_1/0" data-no-tooltip translate="no">}
541+
~r{<div class="summary-signature">\s*<a href="#example_1/0" data-no-tooltip="" translate="no">}
542542
end
543543

544544
test "contains links to summary sections when those exist", context do

0 commit comments

Comments
 (0)