New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ebnf2railroad

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ebnf2railroad - npm Package Compare versions

Comparing version 1.12.0 to 1.13.0

src/build-ascii-diagram.js

10

CHANGELOG.md

@@ -9,2 +9,12 @@ # Changelog

## [1.13.0] - 2020-10-24
### Added
- Support for markdown output, by using a `.md` extension on the target filename
### Fixes
- Only remove optional around repetition if repetition is zero or more
## [1.12.0] - 2020-10-10

@@ -11,0 +21,0 @@

9

package.json
{
"name": "ebnf2railroad",
"version": "1.12.0",
"version": "1.13.0",
"description": "EBNF to Railroad diagram",

@@ -34,4 +34,6 @@ "keywords": [

"commander": "^2.19.0",
"prettier": "^1.14.3",
"railroad-diagrams": "https://github.com/tabatkins/railroad-diagrams#c7730b8fab6cb0fd55fc3c3b0a81ce355fdbf963",
"showdown": "^1.0.0"
"showdown": "^1.0.0",
"utf-railroad": "^1.0.1"
},

@@ -44,4 +46,3 @@ "devDependencies": {

"jison": "^0.4.18",
"mocha": "^8.0.0",
"prettier": "^1.14.3"
"mocha": "^8.0.0"
},

@@ -48,0 +49,0 @@ "resolutions": {

@@ -35,3 +35,3 @@ # EBNF 2 RailRoad

Converts an ISO/IEC 14977 EBNF file to a HTML file with SVG railroad diagrams
Converts an ISO/IEC 14977 EBNF file to a HTML/Markdown file with SVG railroad diagrams

@@ -107,4 +107,6 @@ Options:

- All railroad diagrams are generated through:
- All SVG railroad diagrams are generated through:
https://github.com/tabatkins/railroad-diagrams
- All UTF railroad diagrams are generated through:
https://github.com/matthijsgroen/utf-railroad
- The EBNF parser is generated by http://zaa.ch/jison/

@@ -111,0 +113,0 @@ - All markdown is parsed with http://showdownjs.com/

@@ -5,7 +5,10 @@ const { NodeTypes } = require("../ebnf-transform");

[NodeTypes.Optional]: current => {
if (current.optional.repetition || current.optional.optional) {
if (current.optional.optional) {
return current.optional;
}
if (current.optional.repetition && current.optional.skippable) {
return current.optional;
}
return current;
}
};

@@ -6,3 +6,9 @@ const program = require("commander");

const { parseEbnf } = require("./main");
const { createDocumentation, validateEbnf } = require("./report-builder");
const {
createDocumentation: createHtmlDocumentation
} = require("./html-report-builder");
const {
createDocumentation: createMarkdownDocumentation
} = require("./markdown-report-builder");
const { validateEbnf } = require("./validate");
const { version } = require("../package.json");

@@ -19,3 +25,3 @@ const { productionToEBNF } = require("./ebnf-builder");

.description(
"Converts an ISO/IEC 14977 EBNF file to a HTML file with SVG railroad diagrams"
"Converts an ISO/IEC 14977 EBNF file to a HTML/Markdown file with SVG railroad diagrams"
)

@@ -110,4 +116,5 @@ .option("-o, --target [target]", "output the file to target destination.")

}
if (targetFilename) {
const report = createDocumentation(ast, {
const markdown = targetFilename.endsWith(".md");
if (targetFilename && !markdown) {
const report = createHtmlDocumentation(ast, {
title: documentTitle,

@@ -123,2 +130,14 @@ optimizeDiagrams,

}
if (targetFilename && markdown) {
const report = createMarkdownDocumentation(ast, {
title: documentTitle,
optimizeDiagrams,
optimizeText,
textFormatting,
overviewDiagram,
diagramWrap
});
await writeFile(targetFilename, report, "utf8");
output(`📜 Document created at ${targetFilename}`);
}
warnings.length > 0 && program.validate && process.exit(2);

@@ -125,0 +144,0 @@ } catch (e) {

const { parse } = require("./ebnf-parser");
const { createDocumentation, documentStyle } = require("./html-report-builder");
const {
createDocumentation,
documentStyle,
validateEbnf
} = require("./report-builder");
createDocumentation: createMarkdownDocumentation
} = require("./markdown-report-builder");
const { validateEbnf } = require("./validate");
const { version } = require("../package.json");

@@ -36,2 +36,3 @@ const {

createDocumentation,
createMarkdownDocumentation,
documentStyle,

@@ -38,0 +39,0 @@ validateEbnf,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc