From 05e9def44b36b93fac538488f75834b9f3342771 Mon Sep 17 00:00:00 2001 From: Adam Monsen Date: Thu, 23 May 2024 13:47:57 -0700 Subject: add id attribute support to sidebar (#480) Fixes "Fragment identifier is not defined." error when trying to deep-link a sidebar. For example: ``` ERROR(RSC-012): foo.epub/EPUB/_chapter.xhtml(LINE,COLUMN): Fragment identifier is not defined. ``` --- lib/asciidoctor-epub3/converter.rb | 3 ++- spec/xref_spec.rb | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/asciidoctor-epub3/converter.rb b/lib/asciidoctor-epub3/converter.rb index b227afd..8786adf 100644 --- a/lib/asciidoctor-epub3/converter.rb +++ b/lib/asciidoctor-epub3/converter.rb @@ -735,6 +735,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) { end def convert_sidebar(node) + id_attribute = node.id ? %( id="#{node.id}") : '' classes = ['sidebar'] if node.title? classes << 'titled' @@ -747,7 +748,7 @@ document.addEventListener('DOMContentLoaded', function(event, reader) { title_attr = title_el = '' end - %(