feat(download): rename Raw tab to Download and add HTML/RTF/PDF page export - #579
Merged
Conversation
…export (#578) The Raw tab is now the Download tab (?tab=raw kept as a legacy alias) and offers the page's content as downloadable documents next to the existing RDF links: HTML, RTF (opens in Word and LibreOffice), and PDF. - New export package: format-neutral DocumentModel built from the page's view displays (mirroring the QueryResult* rendering conventions), with HTML, hand-rolled RTF, and openhtmltopdf-based PDF writers; served by DownloadDocPage at /download-doc. - View-display resolution for downloads is now AbstractResourceWithProfile.fetchViewDisplaysSync(), reusing the page logic (ref-scoped query, preset-supplied views, own-classes matching); the previous duplicated copy in DownloadRdfPage had drifted and dropped class-targeted and preset views, which also fixes the RDF download. - Query fetching shared via ViewDataFetcher; buildQueryRef gained ViewList's context/root_np auto-fill. - Monochrome Noto Emoji (OFL) bundled as PDF fallback font so emoji in view titles render as glyphs instead of '#'; fonts are excluded from Maven resource filtering, which corrupts binaries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #578.
The Raw tab is now the Download tab (
?tab=rawkept as a legacy alias) and offers the page's content as downloadable documents next to the existing RDF links: HTML, RTF (opens in Word and LibreOffice, covering the Word/ODF ask without heavy dependencies), and PDF.What's in here
exportpackage: a format-neutralDocumentModel(sections, paragraphs, tables, lists) built byDocumentModelBuilderfrom the page's view displays, mirroring theQueryResult*rendering conventions (_labelfallbacks,_noheader, multi-value columns, action-mapping/source columns dropped, header views as headings, query-form views skipped). IRIs link to the IRI itself so documents carry resolvable links.HtmlWriter(no dependency), hand-rolledRtfWriter(no dependency), andPdfWritervia the only new dependency,io.github.openhtmltopdf:openhtmltopdf-pdfbox(with a strip-and-retry fallback for ill-formed embedded paragraph HTML).DownloadDocPageat/download-doc(type,id,context,format=pdf|rtf|html); HTML serves inline, RTF/PDF as attachments.DownloadRdfLinksrenamed toDownloadLinkswith a "Document formats" section above the RDF sections.AbstractResourceWithProfile.fetchViewDisplaysSync(), reusing the page-rendering logic (ref-scoped query for spaces, preset-supplied views, own-classes matching). The previously duplicated copy inDownloadRdfPagehad drifted and silently dropped class-targeted and preset views — this also fixes the existing RDF download. Query fetching moved toViewDataFetcher;buildQueryRefgained ViewList'scontext/root_npauto-fill.#;fonts/**excluded from Maven resource filtering, which corrupts binaries.Testing
?tab=rawalias, all three formats on space/user/part pages (PDF inspected visually and via pdftotext, RTF round-tripped through LibreOffice), export sections match the Content tab exactly, RDF links unchanged.Notes
.docx/.odtwriters can be added on the sameDocumentModelif RTF proves insufficient.🤖 Generated with Claude Code