Skip to content

Commit d2e4341

Browse files
committed
aside quote datasource support
both will be collected into quote.json in your datasource output. Usage: > This is a profound thought. > -- Albert Einstein <aside> The key insight is that simplicity beats complexity. </aside>
1 parent c26199c commit d2e4341

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/com/potomushto/statik/processors/HtmlPostProcessor.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class HtmlPostProcessor(
2525
val doc = Jsoup.parse(html)
2626

2727
wrapBlockquotesWithAttribution(doc)
28+
tagAsidesForCollection(doc)
2829
applyFootnoteDisplayPreference(doc)
29-
// Future transformations can be added here
3030

3131
return doc.body().html()
3232
}
@@ -53,6 +53,18 @@ class HtmlPostProcessor(
5353
}
5454
}
5555

56+
/**
57+
* Tag <aside> elements with data-collect="quote" for unified collection
58+
* with attributed blockquotes in the datasource system.
59+
*/
60+
private fun tagAsidesForCollection(doc: Document) {
61+
doc.select("aside").forEach { aside ->
62+
if (!aside.hasAttr("data-collect")) {
63+
aside.attr("data-collect", "quote")
64+
}
65+
}
66+
}
67+
5668
private fun applyFootnoteDisplayPreference(doc: Document) {
5769
if (footnotesConfig.display != FootnoteDisplay.HOVER) {
5870
return

src/com/potomushto/statik/processors/MarkdownProcessor.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,11 @@ class BlockQuoteAttributionNodeRenderer(val options: com.vladsch.flexmark.util.d
162162
html.line()
163163

164164
if (hasAttribution) {
165-
// Add data-author attribute for datasource collection
166-
html.withAttr().attr("data-author", attribution!!).tag("blockquote")
165+
// Add data-author and data-collect attributes for datasource collection
166+
html.withAttr()
167+
.attr("data-author", attribution!!)
168+
.attr("data-collect", "quote")
169+
.tag("blockquote")
167170
} else {
168171
html.tag("blockquote")
169172
}

0 commit comments

Comments
 (0)