This commit is contained in:
@@ -250,7 +250,6 @@ function closeImage(scan: Scan, at: number, inner: readonly Piece[], definition:
|
||||
return success(null)
|
||||
}
|
||||
|
||||
// spec/flavour.md: the description's plain-text content, where a break of either kind reads as a space.
|
||||
function imageAlt(inner: readonly Piece[]): string {
|
||||
return resolveNodes(inner)
|
||||
.map((node) => (node.type === 'hardBreak' ? ' ' : (node.text ?? '')))
|
||||
@@ -268,10 +267,16 @@ function resolveNodes(pieces: readonly Piece[]): AdfNode[] {
|
||||
|
||||
// Only `imageAlt` reaches the image arm: everywhere else an image amid other content is refused first.
|
||||
function pieceNodes(piece: Piece): AdfNode[] {
|
||||
if (piece.kind === 'nodes') return piece.nodes
|
||||
if (piece.kind === 'open') return bracketNodes(piece)
|
||||
if (piece.kind === 'image') return piece.alt === '' ? [] : [{ text: piece.alt, type: 'text' }]
|
||||
return []
|
||||
switch (piece.kind) {
|
||||
case 'image':
|
||||
return piece.alt === '' ? [] : [{ text: piece.alt, type: 'text' }]
|
||||
case 'nodes':
|
||||
return piece.nodes
|
||||
case 'open':
|
||||
return bracketNodes(piece)
|
||||
case 'run':
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
function delimiterRuns(pieces: readonly Piece[]): Run[] {
|
||||
|
||||
Reference in New Issue
Block a user