forked from aragon/osx-plugin-template-hardhat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
98 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
= The title here | ||
|
||
This is for testing purposes. | ||
|
||
== Core | ||
|
||
{{TokenVoting}} | ||
|
||
{{MajorityVotingBase}} | ||
|
||
{{TokenVotingSetup}} | ||
|
||
{{VotingPowerCondition}} | ||
|
||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env node | ||
|
||
const path = require('path'); | ||
const glob = require('glob'); | ||
const startCase = require('lodash.startcase'); | ||
|
||
const baseDir = process.argv[2]; | ||
|
||
const files = glob | ||
.sync(baseDir + '/**/*.adoc') | ||
.map(f => path.relative(baseDir, f)); | ||
|
||
console.log('.API'); | ||
|
||
function getPageTitle(directory) { | ||
switch (directory) { | ||
case 'metatx': | ||
return 'Meta Transactions'; | ||
case 'common': | ||
return 'Common (Tokens)'; | ||
default: | ||
return startCase(directory); | ||
} | ||
} | ||
|
||
const links = files.map(file => { | ||
const doc = file.replace(baseDir, ''); | ||
const title = path.parse(file).name; | ||
|
||
return { | ||
xref: `* xref:${doc}[${getPageTitle(title)}]`, | ||
title, | ||
}; | ||
}); | ||
|
||
// Case-insensitive sort based on titles (so 'token/ERC20' gets sorted as 'erc20') | ||
const sortedLinks = links.sort(function (a, b) { | ||
return a.title | ||
.toLowerCase() | ||
.localeCompare(b.title.toLowerCase(), undefined, {numeric: true}); | ||
}); | ||
|
||
for (const link of sortedLinks) { | ||
console.log(link.xref); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
# shopt -s globstar | ||
|
||
OUTDIR="$(node -p 'require("./docs/config.js").outputDir')" | ||
|
||
if [ ! -d node_modules ]; then | ||
npm ci | ||
fi | ||
|
||
rm -rf "$OUTDIR" | ||
|
||
hardhat docgen | ||
|
||
# copy examples and adjust imports | ||
# examples_source_dir="contracts/mocks/docs" | ||
# examples_target_dir="docs/modules/api/examples" | ||
|
||
# for f in "$examples_source_dir"/**/*.sol; do | ||
# name="${f/#"$examples_source_dir/"/}" | ||
# mkdir -p "$examples_target_dir/$(dirname "$name")" | ||
# sed -Ee '/^import/s|"(\.\./)+|"@openzeppelin/contracts/|' "$f" > "$examples_target_dir/$name" | ||
# done | ||
|
||
echo $OUTDIR | ||
|
||
node scripts/gen-nav.js "$OUTDIR" > "$OUTDIR/../nav.adoc" |
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