solidity-docgen
Advanced tools
Comparing version 0.5.8-1 to 0.5.8-2
# Changelog | ||
## 0.5.8 | ||
- Fixed issues with ignored newlines in solc >= 0.6.9. | ||
This may change the output slightly for all users of solc >= 0.6. This | ||
shouldn't be an issue if the output format is Markdown. | ||
## 0.5.7 | ||
@@ -4,0 +11,0 @@ |
@@ -46,3 +46,3 @@ "use strict"; | ||
sources: sources, | ||
settings: Object.assign(Object.assign({}, solcSettings), { outputSelection: exports.outputSelection }), | ||
settings: { ...solcSettings, outputSelection: exports.outputSelection }, | ||
}; | ||
@@ -97,16 +97,21 @@ const solcOutput = solc.compile(solcInput); | ||
const reader = new ASTReader(input, solcOutput); | ||
if (semver_1.default.satisfies(this.solc.version(), '>=0.6')) { | ||
const adaptDocumentation = (node) => { | ||
var _a; | ||
if ((_a = node.documentation) === null || _a === void 0 ? void 0 : _a.text) { | ||
node.documentation = cleanUpDocstring(reader.read(node.documentation)); | ||
} | ||
}; | ||
for (const source of Object.values(solcOutput.sources)) { | ||
for (const fileNode of source.ast.nodes) { | ||
adaptDocumentation(fileNode); | ||
if (fileNode.nodeType === 'ContractDefinition') { | ||
for (const contractNode of fileNode.nodes) { | ||
adaptDocumentation(contractNode); | ||
} | ||
const adaptDocumentation = (node) => { | ||
var _a; | ||
if (typeof node.documentation === 'string') { | ||
// fix solc buggy parsing of doc comments | ||
// reverse engineered from solc behavior... | ||
node.documentation = node.documentation | ||
.replace(/\n\n?^[ \t]*(?:\*|\/\/\/)/mg, '\n\n') | ||
.replace(/^[ \t]?/mg, ''); | ||
} | ||
else if ((_a = node.documentation) === null || _a === void 0 ? void 0 : _a.text) { | ||
node.documentation = cleanUpDocstring(reader.read(node.documentation)); | ||
} | ||
}; | ||
for (const source of Object.values(solcOutput.sources)) { | ||
for (const fileNode of source.ast.nodes) { | ||
adaptDocumentation(fileNode); | ||
if (fileNode.nodeType === 'ContractDefinition') { | ||
for (const contractNode of fileNode.nodes) { | ||
adaptDocumentation(contractNode); | ||
} | ||
@@ -113,0 +118,0 @@ } |
@@ -285,6 +285,3 @@ "use strict"; | ||
const res = {}; | ||
// fix solc buggy parsing of doc comments | ||
// reverse engineered from solc behavior... | ||
const raw = doc.replace(/\n\n?^[ \t]*(?:\*|\/\/\/)/mg, '\n\n').replace(/^[ \t]*/mg, ''); | ||
const tagMatches = execall(/^(?:@(\w+) )?((?:(?!^@\w+ )[^])*)/m, raw); | ||
const tagMatches = execall(/^(?:@(\w+) )?((?:(?!^@\w+ )[^])*)/m, doc); | ||
for (const [, tag, content] of tagMatches) { | ||
@@ -291,0 +288,0 @@ if (tag === 'dev') { |
{ | ||
"name": "solidity-docgen", | ||
"version": "0.5.8-1", | ||
"version": "0.5.8-2", | ||
"description": "Solidity API documentation automatic generator.", | ||
@@ -5,0 +5,0 @@ "repository": "github:OpenZeppelin/solidity-docgen", |
@@ -28,1 +28,9 @@ # `solidity-docgen` | ||
[NatSpec]: https://solidity.readthedocs.io/en/develop/natspec-format.html | ||
### Solidity 0.7 | ||
The built in compiler remains solc 0.6, but users who want to use the newer compiler version can do so by installing the desired solc version and using the flag `--solc-module`. Here's an example using npm aliases: | ||
``` | ||
npm install -D solc-0.7@npm:solc@^0.7.0 | ||
npx solidity-docgen --solc-module solc-0.7 | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
138980
82
1921
35