-
Notifications
You must be signed in to change notification settings - Fork 45
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
1 parent
d03b4b4
commit cf25573
Showing
5 changed files
with
43 additions
and
5 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 |
---|---|---|
|
@@ -3,3 +3,4 @@ afwiki-latest-pages-articles.xml | |
node_modules | ||
dump.rdb | ||
.DS_STORE | ||
tmp.txt |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,37 @@ | ||
//first, run dumpster with {} piped to a text file | ||
// npm run watch > ./tmp.txt | ||
const sundayDriver = require('sunday-driver'); | ||
|
||
let templates = {} | ||
|
||
let obj = { | ||
file: './tmp.txt', | ||
splitter: '\n', | ||
each: (line, resume) => { | ||
if (line[0] === ':') { | ||
templates[line] = templates[line] || 0 | ||
templates[line] += 1 | ||
} | ||
resume() | ||
} | ||
} | ||
|
||
let p = sundayDriver(obj); | ||
p.then(() => { | ||
let keys = Object.keys(templates) | ||
keys = keys.sort((a, b) => { | ||
if (templates[a] > templates[b]) { | ||
return -1 | ||
} | ||
return 1 | ||
}) | ||
let show = keys.slice(0, 1000) | ||
show.forEach((key) => { | ||
let k = key.replace('\n', '') | ||
k = k.replace('::', '') | ||
k = k.replace(/^ +/, '') | ||
k = k.replace(/ /g, '_') | ||
let link = `* [${k}](https://en.wikipedia.org/wiki/Template:${k})` | ||
console.log(link + '\t - ' + templates[key]) | ||
}) | ||
}) |
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