ebnf2railroad
Advanced tools
Comparing version 1.8.2 to 1.9.0
@@ -7,2 +7,6 @@ # Changelog | ||
## [1.9.0] - 2019-01-22 | ||
### Fixed | ||
- Improved detection for recursion and roots | ||
## [1.8.2] - 2019-01-21 | ||
@@ -9,0 +13,0 @@ ### Changed |
{ | ||
"name": "ebnf2railroad", | ||
"version": "1.8.2", | ||
"version": "1.9.0", | ||
"description": "EBNF to Railroad diagram", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -220,5 +220,5 @@ const { | ||
`<li${ | ||
metadata[tocNode.name].root | ||
(metadata[tocNode.name] || {}).root | ||
? ' class="root-node"' | ||
: metadata[tocNode.name].common | ||
: (metadata[tocNode.name] || {}).common | ||
? ' class="common-node"' | ||
@@ -230,3 +230,3 @@ : "" | ||
${ | ||
metadata[tocNode.name].recursive | ||
(metadata[tocNode.name] || {}).recursive | ||
? '<dfn title="recursive">♺</dfn>' | ||
@@ -287,8 +287,10 @@ : "" | ||
const alphabetical = createAlphabeticalToc(ast); | ||
const rootItems = alphabetical.filter(item => metadata[item.name].root); | ||
const isRoot = item => (metadata[item.name] || {}).root; | ||
const isCommon = item => (metadata[item.name] || {}).common; | ||
const rootItems = alphabetical.filter(item => isRoot(item)); | ||
const commonItems = alphabetical.filter( | ||
item => !metadata[item.name].root && metadata[item.name].common | ||
item => !isRoot(item) && isCommon(item) | ||
); | ||
const otherItems = alphabetical.filter( | ||
item => !metadata[item.name].root && !metadata[item.name].common | ||
item => !isRoot(item) && !isCommon(item) | ||
); | ||
@@ -295,0 +297,0 @@ const hierarchicalToc = createTocStructure(structuralToc, metadata); |
@@ -76,8 +76,8 @@ const { | ||
.filter((root, index, list) => { | ||
const childIndex = Math.min( | ||
flatList(root.children || []) | ||
.filter(node => node !== root.name) | ||
.map(node => list.map(p => p.name).indexOf(node)) | ||
.filter(e => e !== -1) | ||
); | ||
const indices = flatList(root.children || []) | ||
.filter(node => node !== root.name) | ||
.map(node => list.map(p => p.name).indexOf(node)) | ||
.filter(e => e !== -1); | ||
const childIndex = Math.min(...indices); | ||
return index < childIndex; | ||
@@ -84,0 +84,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87495
2308