asciidoctor-rhrev 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -210,10 +210,7 @@ function generateInitialReleaseHtml(doc) {
|
|
|
210
210
|
|
|
211
211
|
const columnWidths = String(doc.getAttribute('rhrev-table-column-width') || '30,70').split(',').map(w => w.trim())
|
|
212
212
|
const sectionLabel = doc.getAttribute('rhrev-localization-location') || 'Section'
|
|
213
|
-
|
|
214
|
-
const versionLabel = doc.getAttribute('version-label') || 'Revision'
|
|
215
|
-
const revnumber = doc.getAttribute('revnumber') || '1.0'
|
|
216
|
-
|
|
213
|
+
|
|
217
214
|
// Build table with frame/grid classes
|
|
218
215
|
const frame = doc.getAttribute('rhrev-table-frame') || 'all'
|
|
219
216
|
const grid = doc.getAttribute('rhrev-table-grid') || 'all'
|
|
@@ -250,13 +247,9 @@ function generateInitialReleaseHtml(doc) {
|
|
|
250
247
|
html.push('</tr>')
|
|
251
248
|
}
|
|
252
249
|
|
|
253
|
-
html.push('<tr class="rhrev-header">')
|
|
254
|
-
html.push(`<th class="tableblock halign-left valign-top">${sectionLabel}</th>`)
|
|
255
|
-
html.push(`<th class="tableblock halign-left valign-top"><strong>${majorChangesText} ${versionLabel} ${revnumber}</strong></th>`)
|
|
256
|
-
html.push('</tr>')
|
|
257
250
|
html.push('<tr>')
|
|
258
|
-
html.push(
|
|
259
|
-
html.push(`<td>${initialText}</td>`)
|
|
251
|
+
html.push(`<th class="tableblock halign-left valign-top">${sectionLabel}</th>`)
|
|
252
|
+
html.push(`<td class="tableblock halign-left valign-top">${initialText}</td>`)
|
|
260
253
|
html.push('</tr>')
|
|
261
254
|
html.push('</tbody>')
|
|
262
255
|
html.push('</table>')
|
|
@@ -497,6 +490,46 @@ module.exports.register = function (registry, context = {}) {
|
|
|
497
490
|
})
|
|
498
491
|
})
|
|
499
492
|
|
|
493
|
+
// Tag blocks carrying the current revision attribute with the rhrev-changed
|
|
494
|
+
// role so the site stylesheet can draw an HTML change bar (right-side border).
|
|
495
|
+
// Enabled by rhrev-change-bars, mirroring the PDF backend; color/width/offset
|
|
496
|
+
// overrides are emitted as CSS custom properties. Side is always right in HTML.
|
|
497
|
+
registry.treeProcessor(function () {
|
|
498
|
+
const self = this
|
|
499
|
+
|
|
500
|
+
self.process(function (doc) {
|
|
501
|
+
if (!doc.hasAttribute('rhrev-change-bars')) return doc
|
|
502
|
+
const revnumber = doc.getAttribute('revnumber')
|
|
503
|
+
if (!revnumber) return doc
|
|
504
|
+
const prefix = doc.getAttribute('revhistoryprefix') || 'rhrev'
|
|
505
|
+
const changeAttr = prefix + String(revnumber).replace(/\./g, '-')
|
|
506
|
+
const contexts = ['section', 'floating_title', 'example', 'listing', 'table', 'image']
|
|
507
|
+
|
|
508
|
+
let tagged = false
|
|
509
|
+
doc.findBy((b) => contexts.includes(b.getContext())).forEach((block) => {
|
|
510
|
+
const attrs = block.getAttributes()
|
|
511
|
+
if (!attrs || attrs[changeAttr] === undefined) return
|
|
512
|
+
const role = attrs.role ? attrs.role + ' rhrev-changed' : 'rhrev-changed'
|
|
513
|
+
block.setAttribute('role', role)
|
|
514
|
+
tagged = true
|
|
515
|
+
})
|
|
516
|
+
if (!tagged) return doc
|
|
517
|
+
|
|
518
|
+
const overrides = []
|
|
519
|
+
const color = doc.getAttribute('rhrev-change-bars-color')
|
|
520
|
+
if (color) overrides.push(`--rhrev-change-bar-color: #${String(color).replace(/^#/, '')};`)
|
|
521
|
+
const width = doc.getAttribute('rhrev-change-bars-width')
|
|
522
|
+
if (width) overrides.push(`--rhrev-change-bar-width: ${width}px;`)
|
|
523
|
+
const offset = doc.getAttribute('rhrev-change-bars-offset')
|
|
524
|
+
if (offset) overrides.push(`--rhrev-change-bar-offset: ${offset}px;`)
|
|
525
|
+
if (overrides.length) {
|
|
526
|
+
const style = self.createBlock(doc, 'pass', `<style>:root { ${overrides.join(' ')} }</style>`)
|
|
527
|
+
doc.getBlocks().unshift(style)
|
|
528
|
+
}
|
|
529
|
+
return doc
|
|
530
|
+
})
|
|
531
|
+
})
|
|
532
|
+
|
|
500
533
|
// Register treeprocessor for auto-injection
|
|
501
534
|
registry.treeProcessor(function () {
|
|
502
535
|
const self = this
|
package/package.json
CHANGED