mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-20 20:00:33 +03:00
feat(preset-html5): list type attribute support (#18)
now you can use [list=1] or [list=A] to produce <ol type="A"></ol> lists
This commit is contained in:
committed by
GitHub
parent
c4f78c1230
commit
847c55e836
@@ -125,8 +125,10 @@ export default {
|
|||||||
content: node.content,
|
content: node.content,
|
||||||
}),
|
}),
|
||||||
list: node => ({
|
list: node => ({
|
||||||
tag: 'ul',
|
tag: getUniqAttr(node.attrs) ? 'ol' : 'ul',
|
||||||
attrs: {},
|
attrs: getUniqAttr(node.attrs) ? {
|
||||||
|
type: getUniqAttr(node.attrs),
|
||||||
|
} : {},
|
||||||
content: asListItems(node.content),
|
content: asListItems(node.content),
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -99,6 +99,20 @@ describe('@bbob/preset-html5', () => {
|
|||||||
expect(parse(input)).toBe(result);
|
expect(parse(input)).toBe(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('[list=1][/list]', () => {
|
||||||
|
const input = `[list=1][/list]`;
|
||||||
|
const result = `<ol type="1"></ol>`;
|
||||||
|
|
||||||
|
expect(parse(input)).toBe(result);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('[list=A][/list]', () => {
|
||||||
|
const input = `[list=A][/list]`;
|
||||||
|
const result = `<ol type="A"></ol>`;
|
||||||
|
|
||||||
|
expect(parse(input)).toBe(result);
|
||||||
|
});
|
||||||
|
|
||||||
test(`[table][/table]`, () => {
|
test(`[table][/table]`, () => {
|
||||||
const input = `[table][tr][td]table 1[/td][td]table 2[/td][/tr][tr][td]table 3[/td][td]table 4[/td][/tr][/table]`;
|
const input = `[table][tr][td]table 1[/td][td]table 2[/td][/tr][tr][td]table 3[/td][td]table 4[/td][/tr][/table]`;
|
||||||
const result = `<table><tr><td>table 1</td><td>table 2</td></tr><tr><td>table 3</td><td>table 4</td></tr></table>`;
|
const result = `<table><tr><td>table 1</td><td>table 2</td></tr><tr><td>table 3</td><td>table 4</td></tr></table>`;
|
||||||
|
|||||||
Reference in New Issue
Block a user