Double separators for chapter anchors

This commit is contained in:
Alex Kotov 2024-10-18 16:09:41 +04:00
parent 0f83fbc6de
commit 10d7696e40
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 6 additions and 6 deletions

View file

@ -11,7 +11,7 @@
"title": "Chapter 2", "title": "Chapter 2",
"chapters": [ "chapters": [
{ {
"slug": "2-nested", "slug": "2--nested",
"title": "Chapter 2.1", "title": "Chapter 2.1",
"chapters": [ "chapters": [

View file

@ -63,19 +63,19 @@ The Rty
</div> </div>
</div> </div>
</div> </div>
<h2 id="chapter-1-юникод">Chapter 1</h2> <h2 id="chapter--1-юникод">Chapter 1</h2>
<p> <p>
<span> <span>
Chapter 1 paragraph text Chapter 1 paragraph text
</span> </span>
</p> </p>
<h2 id="chapter-2">Chapter 2</h2> <h2 id="chapter--2">Chapter 2</h2>
<p> <p>
<span> <span>
Chapter 2 paragraph text Chapter 2 paragraph text
</span> </span>
</p> </p>
<h3 id="chapter-2-nested">Chapter 2.1</h3> <h3 id="chapter--2--nested">Chapter 2.1</h3>
<p> <p>
<span> <span>
Chapter 2.1 paragraph text Chapter 2.1 paragraph text

View file

@ -66,11 +66,11 @@ module Repubmark
def anchor def anchor
if parent.instance_of?(self.class) && @level > 2 if parent.instance_of?(self.class) && @level > 2
"#{parent.anchor}-#@slug" "#{parent.anchor}--#@slug"
elsif anchor_prefix.empty? elsif anchor_prefix.empty?
@slug @slug
else else
"#{anchor_prefix}-#@slug" "#{anchor_prefix}--#@slug"
end.freeze end.freeze
end end