diff --git a/app/models/concerns/exportable.rb b/app/models/concerns/exportable.rb index 3b77d2ed..cf80fe12 100644 --- a/app/models/concerns/exportable.rb +++ b/app/models/concerns/exportable.rb @@ -39,12 +39,12 @@ def get_path(document_id, current_depth) end def html_filename(path) - Pathname.new(path) + path = Pathname.new(path) dir, base = path.split # use parameterize on basename to produce well-formed URLs base = Pathname.new(base.to_s.parameterize) path = dir.join(base) - path = "#{path.to_s}.html" + "#{path.to_s}.html" end def write_zip_entries(entries, path, zipfile, depth) @@ -64,7 +64,8 @@ def write_zip_entries(entries, path, zipfile, depth) end if not child.instance_of? DocumentFolder # create an html file for all non-folder items - zipfile_path = html_filename(zipfile_pth) + zipfile_path = html_filename(zipfile_path) + zipfile.get_output_stream(zipfile_path) { |html_outfile| html_outfile.write('
') html_outfile.write("") @@ -103,13 +104,15 @@ def write_zip_entries(entries, path, zipfile, depth) # add highlights to footer if child.highlight_map.present? - styles = [] + styles = ["li:target { border: 1px solid blue; }"] html_outfile.write("") html_outfile.write("") diff --git a/lib/storyblok_richtext/marks/highlight.rb b/lib/storyblok_richtext/marks/highlight.rb index 66b6d0dd..03ed4bae 100644 --- a/lib/storyblok_richtext/marks/highlight.rb +++ b/lib/storyblok_richtext/marks/highlight.rb @@ -13,6 +13,7 @@ def tag tag: 'a', attrs: { class: classname, + id: "highlight-#{highlight_uid}", href: "##{highlight_uid}", } }]