mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-18 22:25:44 +01:00
Answer prose round 1: 0 🔴, 5 🟡 (0 misread); split the decision paragraph, move the Invalid ADF Macro evidence to the carry entry, and fix the comment and test names
This commit is contained in:
+11
-9
@@ -1453,9 +1453,11 @@ alt text.
|
||||
|
||||
Wiki markup has no spelling for some nodes and marks, a layout among them. The lossless wiki
|
||||
writer wraps each such node's ADF JSON in Jira's own `{adf}` macro: `{adf:display=block}` for a
|
||||
block node, `{adf:display=inline}` for an inline node or each node of a marked run. The round-trip holds, and
|
||||
Jira still renders the document. The lossy wiki writer ships beside it for consumers who want wiki
|
||||
markup alone: it drops the form of what wiki markup cannot spell and keeps its content.
|
||||
block node, `{adf:display=inline}` for an inline node or each node of a marked run. A
|
||||
`{adf:display=inline}` holding an array shows "Invalid ADF Macro", where one holding a node renders
|
||||
it. The round-trip holds, and Jira still renders the document. The lossy wiki writer ships beside
|
||||
it for consumers who want wiki markup alone: it drops the form of what wiki markup cannot spell and
|
||||
keeps its content.
|
||||
|
||||
Confirmed 2026-11-16 on a live Jira Cloud site: a description holding `{adf:display=block}` around
|
||||
a `table` node's JSON rendered a table, and `{adf:display=inline}` around a `status` node's JSON
|
||||
@@ -1510,12 +1512,12 @@ the nearest-looking panel type, not `info`, and a backslash before `:` stays tex
|
||||
Checked again 2026-11-17 for the lossless writer's backslashes and inline carries. Jira drops the
|
||||
backslash before `(`, `)`, `?`, `!`, `#`, `[`, `]`, `{`, `}`, `*`, `+`, `-`, `^`, `_` and `~`, and
|
||||
keeps it as text before `:`, `;`, `.`, `,`, a letter, a digit and another backslash. So a backslash
|
||||
before a smiley's `(`, or its closing `)`, stops it (`:\)` reads as the text `:)`), while `:D`, `:P`,
|
||||
a `:` or `;` ending a node inside a line, and the `h` of `h1.` and the `b` of `bq.` at a line's start
|
||||
ride the carry. An escaped `|` still ends a table cell, so a text holding `|` rides the carry there;
|
||||
`|`, `\\`, `\"` and `\n` inside a carry's JSON survive in a cell and in a paragraph. A
|
||||
`{adf:display=inline}` holding an array shows "Invalid ADF Macro", where one holding a node renders
|
||||
it, so a run of nodes is one macro per node.
|
||||
before a smiley's `(`, or its closing `)`, stops it (`:\)` reads as the text `:)`). No backslash
|
||||
stops `:D`, `:P`, a `:` or `;` ending a node inside a line, or the `h` of `h1.` and the `b` of `bq.`
|
||||
at a line's start, so a text holding one rides the carry.
|
||||
|
||||
An escaped `|` still ends a table cell, so a text holding `|` rides the carry there. `|`, `\\`,
|
||||
`\"` and a newline inside a carry's JSON survive in a cell and in a paragraph.
|
||||
|
||||
## A plain wiki spelling stands for the attributes Jira's editor writes, and any other attribute rides the carry
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ test('escapes a character wiki markup would read as markup where it stands', ()
|
||||
assert.equal(line('a :( b ;) c'), 'a :\\( b ;\\) c')
|
||||
})
|
||||
|
||||
test('carries a text no backslash stops a smiley or a line-start word in', () => {
|
||||
test('carries a text whose smiley or line-start word no backslash stops', () => {
|
||||
const carried = (value: string): string => inline(`{"text":${JSON.stringify(value)},"type":"text"}`)
|
||||
assert.equal(line('h1. not a heading'), carried('h1. not a heading'))
|
||||
assert.equal(line('Bq. not a quote'), carried('Bq. not a quote'))
|
||||
@@ -330,7 +330,7 @@ test('escapes a smiley the node edge cuts, unless the line ends there', () => {
|
||||
assert.equal(line('a ('), 'a (')
|
||||
})
|
||||
|
||||
test('carries a text holding a pipe in a table cell, where a backslash would end the cell', () => {
|
||||
test('carries a text holding a pipe in a table cell, where an escaped pipe still ends the cell', () => {
|
||||
assert.equal(wiki(table(plainTable, [cell('tableCell', text('a|b')), cell('tableCell', text('c'))])), `|${inline('{"text":"a|b","type":"text"}')}|c|`)
|
||||
assert.equal(wiki(table(plainTable, [cell('tableCell', text('x', { attrs: { href: 'https://example.com' }, type: 'link' }), text('|'))])), `|[x|https://example.com]${inline('{"text":"|","type":"text"}')}|`)
|
||||
assert.equal(wiki(table(plainTable, [cell('tableHeader', text('a|b'))])), `||${inline('{"text":"a|b","type":"text"}')}||`)
|
||||
|
||||
@@ -35,7 +35,7 @@ function escapes(character: string, characters: readonly string[], index: number
|
||||
return character === '!' && after !== 'space'
|
||||
}
|
||||
|
||||
// A smiley reads wherever no letter or digit follows it; one the node's edge cuts may close in the next node's spelling. `undefined` where a smiley reads that no backslash stops: Jira keeps one before `:`, `;` and a letter, so only a `(` or a closing `)` takes it.
|
||||
// A smiley reads wherever no letter or digit follows it; one the node's edge cuts may close in the next node's spelling. Returns the indexes to put a backslash before: only a `(` or a closing `)` takes one, since Jira keeps a backslash before `:`, `;` and a letter. `undefined` where a smiley reads that no such backslash stops.
|
||||
function smileyStops(characters: readonly string[], end: Side): Set<number> | undefined {
|
||||
const stops = new Set<number>()
|
||||
for (const [index, character] of characters.entries()) {
|
||||
|
||||
Reference in New Issue
Block a user