Skip to content

Commit 522edca

Browse files
committed
Add current url to navheader as data attribute
1 parent 5230f6d commit 522edca

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

resources/asciidoctor/lib/chunker/extension.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def convert_inline_anchor(node)
7575
yield
7676
end
7777

78-
def add_nav(doc)
79-
nav = Nav.new doc
78+
def add_nav(doc, section)
79+
nav = Nav.new doc, section
8080
doc.blocks.insert 0, nav.header
8181
doc.blocks.append nav.footer
8282
end

resources/asciidoctor/lib/chunker/nav.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ class Nav
1010

1111
attr_reader :header, :footer
1212

13-
def initialize(doc)
14-
body = nav_body doc
13+
def initialize(doc, section)
14+
body = nav_body doc, section
1515
@header = Asciidoctor::Block.new(doc, :pass, source: <<~HTML)
16-
<div class="navheader">
16+
<div class="navheader" data-current-url="#{section.id}.html">
1717
#{body}
1818
</div>
1919
HTML

0 commit comments

Comments
 (0)