mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-30 07:53:45 -04:00
Added script to output all level guides for a campaign
This commit is contained in:
parent
c0609dafd5
commit
803abafa99
1 changed files with 17 additions and 0 deletions
17
scripts/mongodb/queries/level-guides.js
Normal file
17
scripts/mongodb/queries/level-guides.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Finds all level guides for a particular campaign.
|
||||||
|
|
||||||
|
var campaignSlug = 'intro';
|
||||||
|
var campaign = db.campaigns.findOne({slug: campaignSlug});
|
||||||
|
var levelOriginals = Object.keys(campaign.levels);
|
||||||
|
levelOriginals.forEach(function(original) {
|
||||||
|
var level = db.levels.findOne({original: ObjectId(original), slug: {$exists: true}});
|
||||||
|
//print("found level", level);
|
||||||
|
(level.documentation.specificArticles || []).forEach(function(doc) {
|
||||||
|
if (doc.name != 'Overview') return;
|
||||||
|
var exclusionRegex = new RegExp("```(clojure|lua|coffeescript|io)\n[^`]+```\n?", 'gm');
|
||||||
|
var body = doc.body.replace(exclusionRegex, '');
|
||||||
|
body = body.replace(/```python/g, '**Python**:\n```python');
|
||||||
|
body = body.replace(/```javascript/g, '**JavaScript**:\n```javascript');
|
||||||
|
print("\n\n## " + level.name + " Overview:\n\n" + body);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue