-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: only save inlined magic when in a container (#814)
Updates some recent changes so we only save magic blocks to a single line format if they are in a container node.
- Loading branch information
1 parent
48b7ecd
commit 227f12b
Showing
10 changed files
with
209 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
34 changes: 32 additions & 2 deletions
34
__tests__/flavored-compilers/__snapshots__/tables.test.js.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,41 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`table compiler converts to magic block syntax if there are breaks 1`] = ` | ||
"[block:parameters]{\\"data\\":{\\"h-0\\":\\"th 1\\",\\"h-1\\":\\"th 2\\",\\"0-0\\":\\"cell 1 \\\\nextra line\\",\\"0-1\\":\\"cell 2\\"},\\"cols\\":2,\\"rows\\":1,\\"align\\":[\\"center\\",\\"center\\"]}[/block] | ||
"[block:parameters] | ||
{ | ||
\\"data\\": { | ||
\\"h-0\\": \\"th 1\\", | ||
\\"h-1\\": \\"th 2\\", | ||
\\"0-0\\": \\"cell 1 \\\\nextra line\\", | ||
\\"0-1\\": \\"cell 2\\" | ||
}, | ||
\\"cols\\": 2, | ||
\\"rows\\": 1, | ||
\\"align\\": [ | ||
\\"center\\", | ||
\\"center\\" | ||
] | ||
} | ||
[/block] | ||
" | ||
`; | ||
|
||
exports[`table compiler saves to magic block syntax if there are breaks 1`] = ` | ||
"[block:parameters]{\\"data\\":{\\"h-0\\":\\"th 1\\",\\"h-1\\":\\"th 2\\",\\"0-0\\":\\"cell 1 \\\\nextra line\\",\\"0-1\\":\\"cell 2\\"},\\"cols\\":2,\\"rows\\":1,\\"align\\":[\\"center\\",\\"center\\"]}[/block] | ||
"[block:parameters] | ||
{ | ||
\\"data\\": { | ||
\\"h-0\\": \\"th 1\\", | ||
\\"h-1\\": \\"th 2\\", | ||
\\"0-0\\": \\"cell 1 \\\\nextra line\\", | ||
\\"0-1\\": \\"cell 2\\" | ||
}, | ||
\\"cols\\": 2, | ||
\\"rows\\": 1, | ||
\\"align\\": [ | ||
\\"center\\", | ||
\\"center\\" | ||
] | ||
} | ||
[/block] | ||
" | ||
`; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
const magicBlock = (type, data) => `[block:${type}]${JSON.stringify(data)}[/block]`; | ||
const magicBlock = (type, data, parent) => { | ||
return parent.type === 'root' | ||
? `[block:${type}]\n${JSON.stringify(data, null, 2)}\n[/block]\n` | ||
: `[block:${type}]${JSON.stringify(data)}[/block]`; | ||
}; | ||
|
||
export default magicBlock; |
This file contains 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