From e95bb1b1c6948fb44b0fe42a93c095ceb93658a4 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 20:40:21 -0700 Subject: [PATCH 001/141] Create publish-wiki.yml --- .github/workflows/publish-wiki.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/publish-wiki.yml diff --git a/.github/workflows/publish-wiki.yml b/.github/workflows/publish-wiki.yml new file mode 100644 index 00000000000..3f90b30a5a1 --- /dev/null +++ b/.github/workflows/publish-wiki.yml @@ -0,0 +1,22 @@ +name: Publish wiki +on: + push: + branches: [master] + paths: + - wiki/** + - .github/workflows/wiki.yml +concurrency: + group: wiki + cancel-in-progress: true +permissions: + contents: write +jobs: + publish-wiki: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: impresscms-dev/strip-markdown-extensions-from-links-action@v1.0.0 + with: + path: wiki + - uses: Andrew-Chen-Wang/github-wik-action@v4 + From 7f396ad9e1da6d6a45db013ff86dbe294a39410a Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 20:41:33 -0700 Subject: [PATCH 002/141] Create Home.md --- wiki/Home.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 wiki/Home.md diff --git a/wiki/Home.md b/wiki/Home.md new file mode 100644 index 00000000000..69ae3d9382c --- /dev/null +++ b/wiki/Home.md @@ -0,0 +1,72 @@ +![XMage logo](https://github.com/magefree/mage/blob/master/Mage.Client/src/main/resources/label-xmage.png) +# MAGE - Magic, Another Game Engine + +XMage allows you to play Magic against one or more online players or computer opponents! +It includes **full rules enforcement** for over **25,000** unique cards and more than 65,000 reprints from different editions. +Starting with Eventide, all regular sets have nearly all their cards implemented ([detailed overview](https://github.com/magefree/mage/wiki/Set-implementation-list)). + +You can visit the [XMage forum](http://www.slightlymagic.net/forum/viewforum.php?f=70) for more information. + +## Features +* Two player duel or a multiplayer free-for-all + * Up to 10 players! +* Supports all popular MTG formats + * EDH/Commander, Modern, Pauper, Pioneer, Legacy, Vintage and Standard +* Supports special formats + * Cube, Custom Cubes, Jumpstart, Super Standard, Historic Standard, Historic, Canadian Highlander, Richman Cube, Richman Draft, Custom Jumpstart, Freeform Commander + * Even supports draft logs! [(supported deck formats)](https://github.com/magefree/mage/wiki/Supported-deck-formats) +* Deck editor, with easy to use import/export + * Import from clipboard +* Simple AI computer opponent +* 2 supported tournament types with up to 16 players! (elimination or swiss) + * Booster- and Cubedraft tournaments (4-16) + * Sealed- and Cubedraft tournaments (2-16) + * Draft from e.g. Zendikar, Khans of Tarkir, Worldwake + * Cubedraft from e.g. Vintage Cube 2022, Legacy Cube 2020 + +There are public servers where you can play XMage against other players. You can also host your own server to play against the AI and/or your friends. +Local server supports a [special test mode](https://github.com/magefree/mage/wiki/Development-Testing-Tools) for testing combos and other game situations with pre-defined conditions. + +## Installation +* Install version 8 or later of the [Java Runtime Environment](http://java.com/en/). +* Download and install the [latest XMage release](http://xmage.today/). + +Look here for more [detailed instructions](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=13632). +Look here for the latest [release changes](https://github.com/magefree/mage/wiki/Release-changes) + +**If you just want to play, you can do that now without worrying about anything else on this page** + +## Server configuration +The server application can be run on your local computer, local or public network, cloud hosting and another environments. Look here for more details about [server configuration](https://github.com/magefree/mage/wiki/Server-configuration). You can find different examples below. + +#### Running local server +* If you want to play with AI opponent on your own computer then no needs in any settings -- just run it from the launcher and connect to `localhost` or `127.0.0.1`; +* Look [here](https://github.com/magefree/mage/issues/5597#issuecomment-465647095) for instructions to setup local server and play it with friends (computers with router/NAT); +* Look [here](https://www.reddit.com/r/XMage/comments/g97vcn/guide_to_hosting_a_private_server/) for instructions to setup Windows machine and play it with friends; +* Look [here](https://github.com/magefree/mage/issues/6381#issuecomment-632513840) for instructions to setup server without domain name and host file modification for users; +* Look [here](https://www.reddit.com/r/XMage/comments/ebz4fd/guide_xmage_as_a_service_on_ubuntu/) for instructions to setup server as a service in linux base systems like Ubuntu; + +#### Running public server +* Look [here](https://github.com/magefree/mage/issues/5305#issuecomment-419691369) for instructions to run cloud server with docker (like DigitalOcean); +* Look [here](https://www.slightlymagic.net/forum/viewtopic.php?f=70&t=15898) for instructions to run own server; +* Look [here](https://github.com/magefree/mage/issues/5388#issuecomment-429671118) for instructions to run admin panel to manage server's users and tables; +* Look [here](https://github.com/magefree/mage/issues/586#issuecomment-57984707) for recommended settings on big servers (with 50+ online users). + +## Developer + +If you are interested in developing XMage, here are some useful resources: +* [Project Overview](https://github.com/magefree/mage/wiki/Project-Overview) +* [Setting up your Development Environment](https://github.com/magefree/mage/wiki/Setting-up-your-Development-Environment) +* [Development Workflow](https://github.com/magefree/mage/wiki/Development-Workflow) +* [Development HOWTO Guides](https://github.com/magefree/mage/wiki/Development-HOWTO-Guides) +* [Developer Testing Tools](https://github.com/magefree/mage/wiki/Development-Testing-Tools) +* [Creating a new release](https://github.com/magefree/mage/wiki/Creating-a-new-release-for-xmage) +* [Mage Updater](https://github.com/magefree/mage/wiki/Mage-Updater) +* [Hosting an xMage server](https://github.com/magefree/mage/wiki/Hosting-an-XMage-server) + +### Developer Extra +* [List of cards that will not implemented on xmage (but you can try)](https://github.com/magefree/mage/wiki/List-of-cards-that-will-not-be-implemented-on-Xmage) or [use github to find it](https://github.com/magefree/mage/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22tracking+set%22+is%3Aopen+) +* [Double Faced Cards](https://github.com/magefree/mage/wiki/Double-Faced-Cards) +* [Parse spoilers web page to get card data in mtg-cards-data.txt file format](https://github.com/magefree/mage/wiki/Parse-mtgsalvation-spoiler-data) +* [Card Requests](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=4554) +* [Tournament Relevant Card Requests](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=14062) From 1a8605da1f997c5edcb718650f363e22c99ee678 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 20:43:13 -0700 Subject: [PATCH 003/141] Update publish-wiki.yml --- .github/workflows/publish-wiki.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-wiki.yml b/.github/workflows/publish-wiki.yml index 3f90b30a5a1..5b88701020e 100644 --- a/.github/workflows/publish-wiki.yml +++ b/.github/workflows/publish-wiki.yml @@ -18,5 +18,5 @@ jobs: - uses: impresscms-dev/strip-markdown-extensions-from-links-action@v1.0.0 with: path: wiki - - uses: Andrew-Chen-Wang/github-wik-action@v4 + - uses: Andrew-Chen-Wang/github-wiki-action@v4.2.0 From d5aef2b77517f55d5c7eb32509f1f16d02a771af Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 20:43:33 -0700 Subject: [PATCH 004/141] Update publish-wiki.yml --- .github/workflows/publish-wiki.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-wiki.yml b/.github/workflows/publish-wiki.yml index 5b88701020e..7d84447bed6 100644 --- a/.github/workflows/publish-wiki.yml +++ b/.github/workflows/publish-wiki.yml @@ -4,7 +4,7 @@ on: branches: [master] paths: - wiki/** - - .github/workflows/wiki.yml + - .github/workflows/publish-wiki.yml concurrency: group: wiki cancel-in-progress: true From 5942c2d3eba2a011249da6ffcdfad8309405b5eb Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 20:44:12 -0700 Subject: [PATCH 005/141] Update publish-wiki.yml --- .github/workflows/publish-wiki.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-wiki.yml b/.github/workflows/publish-wiki.yml index 7d84447bed6..7d67ffef727 100644 --- a/.github/workflows/publish-wiki.yml +++ b/.github/workflows/publish-wiki.yml @@ -14,7 +14,7 @@ jobs: publish-wiki: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - uses: impresscms-dev/strip-markdown-extensions-from-links-action@v1.0.0 with: path: wiki From a314de230f29728065acbf5796490038c7c63da3 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 21:35:25 -0700 Subject: [PATCH 006/141] Create update-set-implementation-lists.yml --- .../update-set-implementation-lists.yml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/update-set-implementation-lists.yml diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml new file mode 100644 index 00000000000..0057a8e84e1 --- /dev/null +++ b/.github/workflows/update-set-implementation-lists.yml @@ -0,0 +1,37 @@ +name: Update set implementation lists +on: + # push: + # branches: [master] + workflow_dispatch: +concurrency: + group: set-impl + cancel-in-progress: true +jobs: + update-set-impl-issues: + runs-on: ubuntu-latest + steps: + - name: Get issues + uses: actions-cool/issues-helper@v3.4.0 + id: setimplissues + with: + actions: 'find-issues' + labels: 'tracking set' + - uses: github/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - run: npm install mustache + - name: Update issues + uses: actions/github-script@v2.1.0 + id: updateissues + with: + script: | + const mustache = require('mustache') + const fs = require('fs') + + const issues = JSON.parse(${{ steps.setimplissues.outputs.issues }}) + console.log("Found list of existing issues:", issues) + + issues.forEach(issue => { + console.log(issue.title); + }) From bdb97c8437bfc5cdd72ab8d6cbfad1520e0fa9b7 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 21:38:52 -0700 Subject: [PATCH 007/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 0057a8e84e1..8a11d540b56 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -16,7 +16,7 @@ jobs: with: actions: 'find-issues' labels: 'tracking set' - - uses: github/checkout@v3 + # - uses: github/checkout@v3 - uses: actions/setup-node@v3 with: node-version: 16 From 86335d8b2c15cc495be12fe1083b0d55bca6e0be Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 21:42:46 -0700 Subject: [PATCH 008/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 8a11d540b56..5cca2776f4c 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -21,6 +21,7 @@ jobs: with: node-version: 16 - run: npm install mustache + shell: bash - name: Update issues uses: actions/github-script@v2.1.0 id: updateissues From 833664df12feb7cf03c00463b15ae11bea14a3d7 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 21:48:29 -0700 Subject: [PATCH 009/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 5cca2776f4c..41f93447d9f 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -10,13 +10,13 @@ jobs: update-set-impl-issues: runs-on: ubuntu-latest steps: + #- uses: github/checkout@v3 - name: Get issues uses: actions-cool/issues-helper@v3.4.0 id: setimplissues with: actions: 'find-issues' labels: 'tracking set' - # - uses: github/checkout@v3 - uses: actions/setup-node@v3 with: node-version: 16 From c2bade1afae6724f6c2b93b824e8e7c0ef311e8a Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 21:49:52 -0700 Subject: [PATCH 010/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 41f93447d9f..670b616b9e5 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -22,8 +22,7 @@ jobs: node-version: 16 - run: npm install mustache shell: bash - - name: Update issues - uses: actions/github-script@v2.1.0 + - uses: actions/github-script@v2.1.0 id: updateissues with: script: | From 0880f163ee1125270ed3fc4f5ca0245f3a44d2d8 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 21:53:07 -0700 Subject: [PATCH 011/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 670b616b9e5..c6d3143df4d 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -17,12 +17,14 @@ jobs: with: actions: 'find-issues' labels: 'tracking set' + - uses: actions/setup-node@v3 with: node-version: 16 - run: npm install mustache shell: bash - - uses: actions/github-script@v2.1.0 + + - uses: actions/github-script@v6.4.1 id: updateissues with: script: | From b7e75b190a0072f5b9561b3fe9b0d9c24f3138f7 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 21:54:21 -0700 Subject: [PATCH 012/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index c6d3143df4d..d396fbb9500 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -31,6 +31,8 @@ jobs: const mustache = require('mustache') const fs = require('fs') + console.log(${{ steps.setimplissues.outputs.issues }}) + const issues = JSON.parse(${{ steps.setimplissues.outputs.issues }}) console.log("Found list of existing issues:", issues) From f2359b354825ee62f3a24903f0395ec6fc2cdca2 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:03:15 -0700 Subject: [PATCH 013/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index d396fbb9500..fbcf3c964c7 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -31,9 +31,11 @@ jobs: const mustache = require('mustache') const fs = require('fs') - console.log(${{ steps.setimplissues.outputs.issues }}) - - const issues = JSON.parse(${{ steps.setimplissues.outputs.issues }}) + const issues = github.rest.issues({ + owner: context.repo.owner, + repo: context.repo.repo, + labels: 'tracking set' + }); console.log("Found list of existing issues:", issues) issues.forEach(issue => { From d555f46c44e869de7caac8d038b2439134f1d3ad Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:06:49 -0700 Subject: [PATCH 014/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index fbcf3c964c7..80ca6d45f93 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -31,7 +31,7 @@ jobs: const mustache = require('mustache') const fs = require('fs') - const issues = github.rest.issues({ + const issues = await github.rest.issues.listForRepo({ owner: context.repo.owner, repo: context.repo.repo, labels: 'tracking set' From 5c7733a3ce33af9be4c68e9ec3efe95c1c38c746 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:11:11 -0700 Subject: [PATCH 015/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 80ca6d45f93..334c68bfc56 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -31,13 +31,10 @@ jobs: const mustache = require('mustache') const fs = require('fs') - const issues = await github.rest.issues.listForRepo({ + const issues = await octokit.paginate(github.rest.issues.listForRepo, { owner: context.repo.owner, repo: context.repo.repo, labels: 'tracking set' }); - console.log("Found list of existing issues:", issues) - issues.forEach(issue => { - console.log(issue.title); - }) + console.log("Found list of existing issues:", issues) From b77f93bdea1c3f0f5e91ca7b2811cfb83c7c6947 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:12:01 -0700 Subject: [PATCH 016/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 334c68bfc56..348326bcb4e 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -31,7 +31,7 @@ jobs: const mustache = require('mustache') const fs = require('fs') - const issues = await octokit.paginate(github.rest.issues.listForRepo, { + const issues = await github.paginate(github.rest.issues.listForRepo, { owner: context.repo.owner, repo: context.repo.repo, labels: 'tracking set' From c6ad031c19f6b24a8d688610d51695a6409cbf7a Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:20:36 -0700 Subject: [PATCH 017/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 348326bcb4e..179afcb213d 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -31,10 +31,19 @@ jobs: const mustache = require('mustache') const fs = require('fs') + const setsData = fs.readFileSync(path.join('Utils', 'mtg-sets-data.txt'), 'utf8') + .split('\n') + .map(line => {line.split('|')[1], line.split('|')[0]}); + + console.log(setsData); + + const issues = await github.paginate(github.rest.issues.listForRepo, { owner: context.repo.owner, repo: context.repo.repo, labels: 'tracking set' }); - console.log("Found list of existing issues:", issues) + console.log("Found list of existing issues:", issues); + + From d619cf48b036e5f2fc588131129ef831ee4ccb64 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:21:44 -0700 Subject: [PATCH 018/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 179afcb213d..c7e4a18f4c8 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -29,6 +29,7 @@ jobs: with: script: | const mustache = require('mustache') + const path = require('path') const fs = require('fs') const setsData = fs.readFileSync(path.join('Utils', 'mtg-sets-data.txt'), 'utf8') From c8df72e7d3558c8e74645a4904b692ec299d26e1 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:25:25 -0700 Subject: [PATCH 019/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index c7e4a18f4c8..82a3c41b572 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -10,7 +10,7 @@ jobs: update-set-impl-issues: runs-on: ubuntu-latest steps: - #- uses: github/checkout@v3 + - uses: github/checkout@v3 - name: Get issues uses: actions-cool/issues-helper@v3.4.0 id: setimplissues From 38da0cee0d4252d52c6a623b355a3d5e4666e077 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:26:08 -0700 Subject: [PATCH 020/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 82a3c41b572..e713622aa32 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -10,7 +10,7 @@ jobs: update-set-impl-issues: runs-on: ubuntu-latest steps: - - uses: github/checkout@v3 + - uses: actions/checkout@v3 - name: Get issues uses: actions-cool/issues-helper@v3.4.0 id: setimplissues From fa92c5f1df0be04d01b6d267f7f73e636225d7e8 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:27:23 -0700 Subject: [PATCH 021/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index e713622aa32..912c2871a19 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -34,7 +34,7 @@ jobs: const setsData = fs.readFileSync(path.join('Utils', 'mtg-sets-data.txt'), 'utf8') .split('\n') - .map(line => {line.split('|')[1], line.split('|')[0]}); + .map(line => line.split('|')); console.log(setsData); From f601c89167ccb154f11fb0f98ad1386a6b32d392 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:30:02 -0700 Subject: [PATCH 022/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 912c2871a19..94b6a43ee10 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -34,7 +34,7 @@ jobs: const setsData = fs.readFileSync(path.join('Utils', 'mtg-sets-data.txt'), 'utf8') .split('\n') - .map(line => line.split('|')); + .map(line => {[line.split('|')[1]]: line.split('|')[0]); console.log(setsData); From e736c0f200048d4f49c00111e07e5f85ab20e15e Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:30:20 -0700 Subject: [PATCH 023/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 94b6a43ee10..a368987fb7c 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -34,7 +34,7 @@ jobs: const setsData = fs.readFileSync(path.join('Utils', 'mtg-sets-data.txt'), 'utf8') .split('\n') - .map(line => {[line.split('|')[1]]: line.split('|')[0]); + .map(line => {[line.split('|')[1]]: line.split('|')[0]}); console.log(setsData); From a719fe62a96f50167fec0f40c2a28ecad57c51d3 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:31:25 -0700 Subject: [PATCH 024/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index a368987fb7c..2eec7386aa5 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -34,7 +34,7 @@ jobs: const setsData = fs.readFileSync(path.join('Utils', 'mtg-sets-data.txt'), 'utf8') .split('\n') - .map(line => {[line.split('|')[1]]: line.split('|')[0]}); + .map(line => ({[line.split('|')[1]]: line.split('|')[0]})); console.log(setsData); From 6e7b74205fbeb973dc6b5cdf7e4f061eb5334f12 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:48:50 -0700 Subject: [PATCH 025/141] Update update-set-implementation-lists.yml --- .../update-set-implementation-lists.yml | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 2eec7386aa5..98453b6a959 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -34,17 +34,40 @@ jobs: const setsData = fs.readFileSync(path.join('Utils', 'mtg-sets-data.txt'), 'utf8') .split('\n') - .map(line => ({[line.split('|')[1]]: line.split('|')[0]})); - - console.log(setsData); - + .map(line => line.split('|')); + const cardsData = fs.readFileSync(path.join('Utils', 'mtg-cards-data.txt'), 'utf8') + .split('\n') + .map(line => line.split('|')); const issues = await github.paginate(github.rest.issues.listForRepo, { owner: context.repo.owner, repo: context.repo.repo, labels: 'tracking set' }); - console.log("Found list of existing issues:", issues); + const issuesToUpdate = []; + const issuesToCreate = []; + + setsData.forEach(set => { + let foundIssue = undefined; + issues.forEach(issue => { + if(issue && issue.title && issue.title.startsWith(set[1])) { + console.log(`Found tracking issue for ${set[0]} with issue number: ${issue.number}`); + foundIssue = issue; + break; + } + }); + if(foundIssue !== undefined) { + issuesToUpdate.push(foundIssue); + } else { + issuesToCreate.push({ + title: `${set[1]}: ${set[0]} Set Card Implementation Tracking`, + body: `Placeholder` + }); + } + }); + + console.log("Issues to update: ", issuesToUpdate); + console.log("Issues to create: ", issuesToCreate); From 88e687c72ba22d91c3b9db5c60715c69366fe6df Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 22:51:03 -0700 Subject: [PATCH 026/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 98453b6a959..c0471a1545e 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -51,12 +51,13 @@ jobs: setsData.forEach(set => { let foundIssue = undefined; - issues.forEach(issue => { + issues.every(issue => { if(issue && issue.title && issue.title.startsWith(set[1])) { console.log(`Found tracking issue for ${set[0]} with issue number: ${issue.number}`); foundIssue = issue; - break; + return false; } + return true; }); if(foundIssue !== undefined) { issuesToUpdate.push(foundIssue); From 7c2325fcc9f642becd76cc5375e0a284b4d723fb Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Fri, 23 Jun 2023 23:31:53 -0700 Subject: [PATCH 027/141] Create set-tracking-issue.md --- .github/templates/set-tracking-issue.md | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/templates/set-tracking-issue.md diff --git a/.github/templates/set-tracking-issue.md b/.github/templates/set-tracking-issue.md new file mode 100644 index 00000000000..19cef91631c --- /dev/null +++ b/.github/templates/set-tracking-issue.md @@ -0,0 +1,34 @@ +This checklist is here to help manage the implementation of {{setName}}. If a card is marked as being in progress then someone is working on it. + +If you're new to implementing cards then you likely don't have permission to check things off. This is totally fine! We still appreciate your contributions so just leave a comment to let us know that you're working on it. + +Don't worry about moving things from in progress to completed either, this issue is automatically updated by github actions, and don't worry about fixing text issues as those are usually handled when the set is done. + +[All Sets](https://github.com/magefree/mage/wiki/Set-implementation-list) + + +{{#hasUnimplementedCards}} +# Unimplemented Cards + +{#unimplementedCards}} +* [{{#pr}}*{{/pr}}{{^pr}} {{/pr}}] In progress -- [{{name}}]({{scryfall}}) +{{/unimplementedCards}} + +[Scryfall gallery of everything currently unimplemented]({{unimplementedScryfallLink}}) + +{{/hasUnimplementedCards}} +{{^hasUnimplementedCards}} +All cards are implemented +{{/hasUnimplementedCards}} + +# Implemented Cards +
+ + Click to expand + + {{#hasImplementedCards}} + {{#implementedCards}} + * [{{#pr}}*{{/pr}}{{^pr}} {{/pr}}] Done -- [{{name}}]({{scryfall}}) + {{/implementedCards}} + {{/hasImplementedCards}} +
From a11f00428e9d88960aa987024956632f5d92225c Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 00:21:37 -0700 Subject: [PATCH 028/141] Update update-set-implementation-lists.yml --- .../update-set-implementation-lists.yml | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index c0471a1545e..d8d50c055aa 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -32,12 +32,20 @@ jobs: const path = require('path') const fs = require('fs') + // https://stackoverflow.com/a/2970667 + function toCamelCase(str) { + return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word, index) { + return index === 0 ? word.toLowerCase() : word.toUpperCase(); + }).replace(/\s+/g, '') + } + const setsData = fs.readFileSync(path.join('Utils', 'mtg-sets-data.txt'), 'utf8') .split('\n') .map(line => line.split('|')); const cardsData = fs.readFileSync(path.join('Utils', 'mtg-cards-data.txt'), 'utf8') .split('\n') .map(line => line.split('|')); + const cardIssueTemplate = fs.readFileSync(path.join('.github', 'templates', 'set-tracking-issue.md'); const issues = await github.paginate(github.rest.issues.listForRepo, { owner: context.repo.owner, @@ -59,12 +67,48 @@ jobs: } return true; }); + + const cards = cardsData.filter(card => card[1] === set[0]); + const unimplemented = []; + const implemented = []; + + cards.forEach(cardData => { + const className = toCamelCase(cardData[0]); + const cleanCardName = cardData[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase(); + if (fs.existsSync(path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className}.java`)) { + implemented.push({ + pr: false, //TODO: check to see if there is a PR for this card + name: cardData[0], + scryfall: `https://scryfall.com/search?q=!"${cleanCardName}" e:${set[1]}` + }); + } else { + unimplemented.push({ + pr: true, //TODO: check to see if there is a PR for this card + name: cardData[0], + scryfall: `https://scryfall.com/search?q=!"${cleanCardName}" e:${set[1]}` + }); + } + }); + const cleanCards = cards.map(card => card[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase()); if(foundIssue !== undefined) { + foundIssue.body = mustache.render(cardIssueTemplate, { + hasUnimplementedCards: unimplemented.length > 0, + hasImplementedCards: implemented.length > 0, + unimplementedCards: unimplemented, + implementedCards: implemented, + unimplementedScryfallLink: `https://scryfall.com/search?q=!"${String.join('"OR!"', cleanCards)}"+e:${set[1]}` + }); issuesToUpdate.push(foundIssue); } else { issuesToCreate.push({ title: `${set[1]}: ${set[0]} Set Card Implementation Tracking`, - body: `Placeholder` + body: mustache.render(cardIssueTemplate, { + hasUnimplementedCards: unimplemented.length > 0, + hasImplementedCards: implemented.length > 0, + unimplementedCards: unimplemented, + implementedCards: implemented, + unimplementedScryfallLink: `https://scryfall.com/search?q=!"${String.join('"OR!"', cleanCards)}"+e:${set[1]}` + }); }); } }); From f213735138e31809ddf9dad265b4c693e4ec9ea8 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 00:23:51 -0700 Subject: [PATCH 029/141] Update update-set-implementation-lists.yml --- .../workflows/update-set-implementation-lists.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index d8d50c055aa..40c6d86fdb6 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -103,12 +103,12 @@ jobs: issuesToCreate.push({ title: `${set[1]}: ${set[0]} Set Card Implementation Tracking`, body: mustache.render(cardIssueTemplate, { - hasUnimplementedCards: unimplemented.length > 0, - hasImplementedCards: implemented.length > 0, - unimplementedCards: unimplemented, - implementedCards: implemented, - unimplementedScryfallLink: `https://scryfall.com/search?q=!"${String.join('"OR!"', cleanCards)}"+e:${set[1]}` - }); + hasUnimplementedCards: unimplemented.length > 0, + hasImplementedCards: implemented.length > 0, + unimplementedCards: unimplemented, + implementedCards: implemented, + unimplementedScryfallLink: `https://scryfall.com/search?q=!"${String.join('"OR!"', cleanCards)}"+e:${set[1]}` + }) }); } }); From ae416c8c8b8e5b963151752982c750ba3a6466ba Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 00:26:25 -0700 Subject: [PATCH 030/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 40c6d86fdb6..c6d2c0bdd10 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -45,7 +45,7 @@ jobs: const cardsData = fs.readFileSync(path.join('Utils', 'mtg-cards-data.txt'), 'utf8') .split('\n') .map(line => line.split('|')); - const cardIssueTemplate = fs.readFileSync(path.join('.github', 'templates', 'set-tracking-issue.md'); + const cardIssueTemplate = fs.readFileSync(path.join('.github', 'templates', 'set-tracking-issue.md')); const issues = await github.paginate(github.rest.issues.listForRepo, { owner: context.repo.owner, From 23af8d407e02800aa21fd7349bdf590b168b316e Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 00:28:58 -0700 Subject: [PATCH 031/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index c6d2c0bdd10..52511da6734 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -45,7 +45,7 @@ jobs: const cardsData = fs.readFileSync(path.join('Utils', 'mtg-cards-data.txt'), 'utf8') .split('\n') .map(line => line.split('|')); - const cardIssueTemplate = fs.readFileSync(path.join('.github', 'templates', 'set-tracking-issue.md')); + const cardIssueTemplate = fs.readFileSync(path.join('.github', 'templates', 'set-tracking-issue.md'), 'utf8'); const issues = await github.paginate(github.rest.issues.listForRepo, { owner: context.repo.owner, @@ -90,7 +90,7 @@ jobs: } }); const cleanCards = cards.map(card => card[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase()); - if(foundIssue !== undefined) { + if (foundIssue !== undefined) { foundIssue.body = mustache.render(cardIssueTemplate, { hasUnimplementedCards: unimplemented.length > 0, hasImplementedCards: implemented.length > 0, From be0c765e49483aa0fb6de9fd8802cf137cfd593a Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 00:30:35 -0700 Subject: [PATCH 032/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 52511da6734..6a36ed4cc00 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -75,7 +75,7 @@ jobs: cards.forEach(cardData => { const className = toCamelCase(cardData[0]); const cleanCardName = cardData[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase(); - if (fs.existsSync(path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className}.java`)) { + if (fs.existsSync(path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className}.java`))) { implemented.push({ pr: false, //TODO: check to see if there is a PR for this card name: cardData[0], From ca4ba90f4fc63ebd89f7ce221a577cec35b37dec Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 00:32:17 -0700 Subject: [PATCH 033/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 6a36ed4cc00..dff5824fc4f 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -96,7 +96,7 @@ jobs: hasImplementedCards: implemented.length > 0, unimplementedCards: unimplemented, implementedCards: implemented, - unimplementedScryfallLink: `https://scryfall.com/search?q=!"${String.join('"OR!"', cleanCards)}"+e:${set[1]}` + unimplementedScryfallLink: `https://scryfall.com/search?q=!"${cleanCards.join('"OR!"')}"+e:${set[1]}` }); issuesToUpdate.push(foundIssue); } else { @@ -107,7 +107,7 @@ jobs: hasImplementedCards: implemented.length > 0, unimplementedCards: unimplemented, implementedCards: implemented, - unimplementedScryfallLink: `https://scryfall.com/search?q=!"${String.join('"OR!"', cleanCards)}"+e:${set[1]}` + unimplementedScryfallLink: `https://scryfall.com/search?q=!"${cleanCards.join('"OR!"')}"+e:${set[1]}` }) }); } From b5c8b352509a5e812d333bc8c96e4205249c7b41 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 00:35:04 -0700 Subject: [PATCH 034/141] Update set-tracking-issue.md --- .github/templates/set-tracking-issue.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/templates/set-tracking-issue.md b/.github/templates/set-tracking-issue.md index 19cef91631c..2f1ec07d8bf 100644 --- a/.github/templates/set-tracking-issue.md +++ b/.github/templates/set-tracking-issue.md @@ -15,8 +15,8 @@ Don't worry about moving things from in progress to completed either, this issue {{/unimplementedCards}} [Scryfall gallery of everything currently unimplemented]({{unimplementedScryfallLink}}) - {{/hasUnimplementedCards}} + {{^hasUnimplementedCards}} All cards are implemented {{/hasUnimplementedCards}} From 625a6788075b2759f277a0fa3a41433482720bb3 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 00:38:14 -0700 Subject: [PATCH 035/141] Update set-tracking-issue.md --- .github/templates/set-tracking-issue.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/templates/set-tracking-issue.md b/.github/templates/set-tracking-issue.md index 2f1ec07d8bf..d3e0f6d6a64 100644 --- a/.github/templates/set-tracking-issue.md +++ b/.github/templates/set-tracking-issue.md @@ -10,7 +10,7 @@ Don't worry about moving things from in progress to completed either, this issue {{#hasUnimplementedCards}} # Unimplemented Cards -{#unimplementedCards}} +{{#unimplementedCards}} * [{{#pr}}*{{/pr}}{{^pr}} {{/pr}}] In progress -- [{{name}}]({{scryfall}}) {{/unimplementedCards}} From 0d7cb4359006a5a8566c4245213196893e7a3e71 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 00:42:09 -0700 Subject: [PATCH 036/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index dff5824fc4f..b8807a36d7a 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -75,13 +75,17 @@ jobs: cards.forEach(cardData => { const className = toCamelCase(cardData[0]); const cleanCardName = cardData[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase(); - if (fs.existsSync(path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className}.java`))) { + const cardPath = path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className}.java`); + console.log("Checking if file exists in: ",cardPath); + if (fs.existsSync(cardPath)) { + console.log("File found!"); implemented.push({ pr: false, //TODO: check to see if there is a PR for this card name: cardData[0], scryfall: `https://scryfall.com/search?q=!"${cleanCardName}" e:${set[1]}` }); } else { + console.log("File not found!"); unimplemented.push({ pr: true, //TODO: check to see if there is a PR for this card name: cardData[0], From ed00793fd524361261f4fe52af3d81d9f89181e6 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:00:11 -0700 Subject: [PATCH 037/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index b8807a36d7a..26395e7e8c4 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -73,9 +73,9 @@ jobs: const implemented = []; cards.forEach(cardData => { - const className = toCamelCase(cardData[0]); + const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus').replace(/[_]+/g, ' Blank')).replace(/[-+,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, ''); const cleanCardName = cardData[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase(); - const cardPath = path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className}.java`); + const cardPath = path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className.charAt(0).toUpperCase()+className.slice(1)}.java`); console.log("Checking if file exists in: ",cardPath); if (fs.existsSync(cardPath)) { console.log("File found!"); From 43914d58d73e06a385860a0d54e67959ad9975d6 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:02:16 -0700 Subject: [PATCH 038/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 26395e7e8c4..b6d237c9c2e 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -73,7 +73,7 @@ jobs: const implemented = []; cards.forEach(cardData => { - const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus').replace(/[_]+/g, ' Blank')).replace(/[-+,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, ''); + const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus ').replace(/[_]+/g, ' Blank ')).replace(/[-+,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, ''); const cleanCardName = cardData[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase(); const cardPath = path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className.charAt(0).toUpperCase()+className.slice(1)}.java`); console.log("Checking if file exists in: ",cardPath); From 834090afa537810bd2025c920fc03086bbbca3be Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:02:49 -0700 Subject: [PATCH 039/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index b6d237c9c2e..bff51bac6d7 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -76,16 +76,13 @@ jobs: const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus ').replace(/[_]+/g, ' Blank ')).replace(/[-+,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, ''); const cleanCardName = cardData[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase(); const cardPath = path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className.charAt(0).toUpperCase()+className.slice(1)}.java`); - console.log("Checking if file exists in: ",cardPath); if (fs.existsSync(cardPath)) { - console.log("File found!"); implemented.push({ pr: false, //TODO: check to see if there is a PR for this card name: cardData[0], scryfall: `https://scryfall.com/search?q=!"${cleanCardName}" e:${set[1]}` }); } else { - console.log("File not found!"); unimplemented.push({ pr: true, //TODO: check to see if there is a PR for this card name: cardData[0], From 709ae170db0ac27eb51d0c9b0f82750adfed4038 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:03:59 -0700 Subject: [PATCH 040/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index bff51bac6d7..59e999c832e 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -11,13 +11,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Get issues - uses: actions-cool/issues-helper@v3.4.0 - id: setimplissues - with: - actions: 'find-issues' - labels: 'tracking set' - - uses: actions/setup-node@v3 with: node-version: 16 From 8165bbc4f3942c858fe2d9a49745694cd3c153e2 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:07:01 -0700 Subject: [PATCH 041/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 59e999c832e..13aaa20747b 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -73,12 +73,14 @@ jobs: implemented.push({ pr: false, //TODO: check to see if there is a PR for this card name: cardData[0], + cleanName: cleanCardName, scryfall: `https://scryfall.com/search?q=!"${cleanCardName}" e:${set[1]}` }); } else { unimplemented.push({ pr: true, //TODO: check to see if there is a PR for this card name: cardData[0], + cleanName: cleanCardName, scryfall: `https://scryfall.com/search?q=!"${cleanCardName}" e:${set[1]}` }); } @@ -90,7 +92,7 @@ jobs: hasImplementedCards: implemented.length > 0, unimplementedCards: unimplemented, implementedCards: implemented, - unimplementedScryfallLink: `https://scryfall.com/search?q=!"${cleanCards.join('"OR!"')}"+e:${set[1]}` + unimplementedScryfallLink: `https://scryfall.com/search?q=!"${unimplemented.map(e => e.cleanName).join('"OR!"')}"+e:${set[1]}` }); issuesToUpdate.push(foundIssue); } else { @@ -101,7 +103,7 @@ jobs: hasImplementedCards: implemented.length > 0, unimplementedCards: unimplemented, implementedCards: implemented, - unimplementedScryfallLink: `https://scryfall.com/search?q=!"${cleanCards.join('"OR!"')}"+e:${set[1]}` + unimplementedScryfallLink: `https://scryfall.com/search?q=!"${unimplemented.map(e => e.cleanName).join('"OR!"')}"+e:${set[1]}` }) }); } From 12adf4d172b217caee0422278107e9d9451341ba Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:08:47 -0700 Subject: [PATCH 042/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 13aaa20747b..ed4d903dee7 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -74,14 +74,14 @@ jobs: pr: false, //TODO: check to see if there is a PR for this card name: cardData[0], cleanName: cleanCardName, - scryfall: `https://scryfall.com/search?q=!"${cleanCardName}" e:${set[1]}` + scryfall: `https://scryfall.com/search?q=!"${cleanCardName}"+e:${set[1]}` }); } else { unimplemented.push({ pr: true, //TODO: check to see if there is a PR for this card name: cardData[0], cleanName: cleanCardName, - scryfall: `https://scryfall.com/search?q=!"${cleanCardName}" e:${set[1]}` + scryfall: `https://scryfall.com/search?q=!"${cleanCardName}"+e:${set[1]}` }); } }); From 072462584424f639c2743f16d0e291497d6a8b8c Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:14:25 -0700 Subject: [PATCH 043/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index ed4d903dee7..c0528a9816f 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -25,6 +25,9 @@ jobs: const path = require('path') const fs = require('fs') + // Disable mustache html-escape + mustache.escape = identity; + // https://stackoverflow.com/a/2970667 function toCamelCase(str) { return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word, index) { From 7c6bbe34e6539ecf4c79e558447ae0ad44925795 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:15:32 -0700 Subject: [PATCH 044/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index c0528a9816f..1773b3c0bb9 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -26,7 +26,9 @@ jobs: const fs = require('fs') // Disable mustache html-escape - mustache.escape = identity; + mustache.escape = function(str) { + return str; + }; // https://stackoverflow.com/a/2970667 function toCamelCase(str) { From 9687cc8e58f224eac403cdca0f028ee71e280ff7 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:17:56 -0700 Subject: [PATCH 045/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 1773b3c0bb9..f48fa50b03c 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -76,14 +76,14 @@ jobs: const cardPath = path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className.charAt(0).toUpperCase()+className.slice(1)}.java`); if (fs.existsSync(cardPath)) { implemented.push({ - pr: false, //TODO: check to see if there is a PR for this card + pr: true, //TODO: check to see if there is a PR for this card name: cardData[0], cleanName: cleanCardName, scryfall: `https://scryfall.com/search?q=!"${cleanCardName}"+e:${set[1]}` }); } else { unimplemented.push({ - pr: true, //TODO: check to see if there is a PR for this card + pr: false, //TODO: check to see if there is a PR for this card name: cardData[0], cleanName: cleanCardName, scryfall: `https://scryfall.com/search?q=!"${cleanCardName}"+e:${set[1]}` From 0f6e185e695bd38e8258b94af88803af07fe9d07 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:21:51 -0700 Subject: [PATCH 046/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index f48fa50b03c..18021135b32 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -42,7 +42,8 @@ jobs: .map(line => line.split('|')); const cardsData = fs.readFileSync(path.join('Utils', 'mtg-cards-data.txt'), 'utf8') .split('\n') - .map(line => line.split('|')); + .map(line => line.split('|')) + .filter(card => !(card[0].toLowerCase() === "plains" || card[0].toLowerCase() === "swamp" || card[0].toLowerCase() === "island" || card[0].toLowerCase() === "mountain" || card[0].toLowerCase() === "forest"); const cardIssueTemplate = fs.readFileSync(path.join('.github', 'templates', 'set-tracking-issue.md'), 'utf8'); const issues = await github.paginate(github.rest.issues.listForRepo, { From ffc2556a38ef28edcd0d552444c37a9767e90d26 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:23:02 -0700 Subject: [PATCH 047/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 18021135b32..c9a3dba132a 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -43,7 +43,7 @@ jobs: const cardsData = fs.readFileSync(path.join('Utils', 'mtg-cards-data.txt'), 'utf8') .split('\n') .map(line => line.split('|')) - .filter(card => !(card[0].toLowerCase() === "plains" || card[0].toLowerCase() === "swamp" || card[0].toLowerCase() === "island" || card[0].toLowerCase() === "mountain" || card[0].toLowerCase() === "forest"); + .filter(card => !(card[0].toLowerCase() === "plains" || card[0].toLowerCase() === "swamp" || card[0].toLowerCase() === "island" || card[0].toLowerCase() === "mountain" || card[0].toLowerCase() === "forest")); const cardIssueTemplate = fs.readFileSync(path.join('.github', 'templates', 'set-tracking-issue.md'), 'utf8'); const issues = await github.paginate(github.rest.issues.listForRepo, { From 9932ba1bcb8e1e6df8fa6467930e74a4934407b6 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:29:33 -0700 Subject: [PATCH 048/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index c9a3dba132a..46aec532f33 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -75,6 +75,7 @@ jobs: const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus ').replace(/[_]+/g, ' Blank ')).replace(/[-+,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, ''); const cleanCardName = cardData[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase(); const cardPath = path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className.charAt(0).toUpperCase()+className.slice(1)}.java`); + if(cleanCardName === "ulamogscrusher") console.log(cardPath); if (fs.existsSync(cardPath)) { implemented.push({ pr: true, //TODO: check to see if there is a PR for this card From 19b06cf825ed379ec23f5a94eeda7e26ebd62b3e Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:31:18 -0700 Subject: [PATCH 049/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 46aec532f33..dc5ba394e93 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -72,7 +72,7 @@ jobs: const implemented = []; cards.forEach(cardData => { - const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus ').replace(/[_]+/g, ' Blank ')).replace(/[-+,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, ''); + const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus ').replace(/[_]+/g, ' Blank ').replace(/[-+,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '')); const cleanCardName = cardData[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase(); const cardPath = path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className.charAt(0).toUpperCase()+className.slice(1)}.java`); if(cleanCardName === "ulamogscrusher") console.log(cardPath); From 52483f7c7ff3baa88019c8059d740de2c0de4522 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:33:38 -0700 Subject: [PATCH 050/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index dc5ba394e93..c502d95f510 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -72,7 +72,7 @@ jobs: const implemented = []; cards.forEach(cardData => { - const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus ').replace(/[_]+/g, ' Blank ').replace(/[-+,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '')); + const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus ').replace(/[_]+/g, ' Blank ').replace(/[-+,'.!?`@#$%^&*()_=<>:";~\\|/]/g, '')); const cleanCardName = cardData[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase(); const cardPath = path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className.charAt(0).toUpperCase()+className.slice(1)}.java`); if(cleanCardName === "ulamogscrusher") console.log(cardPath); From 1eccc25684f8d71d410d5e4c1850d7f953508a39 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:37:56 -0700 Subject: [PATCH 051/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index c502d95f510..b8070b18f28 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -72,10 +72,10 @@ jobs: const implemented = []; cards.forEach(cardData => { - const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus ').replace(/[_]+/g, ' Blank ').replace(/[-+,'.!?`@#$%^&*()_=<>:";~\\|/]/g, '')); + const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus ').replace(/[_]+/g, ' Blank ').replace(/[']/g, '').replace(/[-+,.!?`@#$%^&*()_=<>:";~\\|/]/g, ' ')); const cleanCardName = cardData[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase(); const cardPath = path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className.charAt(0).toUpperCase()+className.slice(1)}.java`); - if(cleanCardName === "ulamogscrusher") console.log(cardPath); + if(cleanCardName === "willothewisp") console.log(cardPath); if (fs.existsSync(cardPath)) { implemented.push({ pr: true, //TODO: check to see if there is a PR for this card From a1e900108827930aca153f645e74362f990270ce Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:54:24 -0700 Subject: [PATCH 052/141] Update update-set-implementation-lists.yml --- .../update-set-implementation-lists.yml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index b8070b18f28..e19680f76ae 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -118,4 +118,42 @@ jobs: console.log("Issues to update: ", issuesToUpdate); console.log("Issues to create: ", issuesToCreate); + update-set-impl-wiki: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - run: npm install mustache + shell: bash + + - uses: actions/github-script@v6.4.1 + id: updateissues + with: + script: | + const mustache = require('mustache') + const path = require('path') + const fs = require('fs') + // Disable mustache html-escape + mustache.escape = function(str) { + return str; + }; + + const setImplementationTemplate = fs.readFileSync(path.join('.github', 'templates', 'set-tracking-wiki.md'), 'utf8'); + + const setsData = fs.readFileSync(path.join('Utils', 'mtg-sets-data.txt'), 'utf8') + .split('\n') + .map(line => line.split('|')); + + const issues = await github.paginate(github.rest.issues.listForRepo, { + owner: context.repo.owner, + repo: context.repo.repo, + labels: 'tracking set' + }); + console.log("Found list of existing issues:", issues); + + const content = mustache.render(setImplementationTemplate, {}); + + fs.writeFile(path.join('wiki', 'Set-implementation-list.md'), content); From 8be2c1b2566bcb7ccbd6a9c255d16618d82c5a99 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 01:57:04 -0700 Subject: [PATCH 053/141] Create set-tracking-wiki.md --- .github/templates/set-tracking-wiki.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/templates/set-tracking-wiki.md diff --git a/.github/templates/set-tracking-wiki.md b/.github/templates/set-tracking-wiki.md new file mode 100644 index 00000000000..d3c11882839 --- /dev/null +++ b/.github/templates/set-tracking-wiki.md @@ -0,0 +1,5 @@ +Set Name | # Cards | # Missing | +--- | --- | --- | +{{#sets}} +[{{name}}]({{issueLink}}) | {{total}} | {{missing}} +{{/sets}} From 20f25f174954c7fb0f623ac64c94f61849ee7ac5 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 02:08:12 -0700 Subject: [PATCH 054/141] Update update-set-implementation-lists.yml --- .../update-set-implementation-lists.yml | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index e19680f76ae..54d845451a5 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -75,7 +75,6 @@ jobs: const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus ').replace(/[_]+/g, ' Blank ').replace(/[']/g, '').replace(/[-+,.!?`@#$%^&*()_=<>:";~\\|/]/g, ' ')); const cleanCardName = cardData[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase(); const cardPath = path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className.charAt(0).toUpperCase()+className.slice(1)}.java`); - if(cleanCardName === "willothewisp") console.log(cardPath); if (fs.existsSync(cardPath)) { implemented.push({ pr: true, //TODO: check to see if there is a PR for this card @@ -146,13 +145,46 @@ jobs: const setsData = fs.readFileSync(path.join('Utils', 'mtg-sets-data.txt'), 'utf8') .split('\n') .map(line => line.split('|')); - + const cardsData = fs.readFileSync(path.join('Utils', 'mtg-cards-data.txt'), 'utf8') + .split('\n') + .map(line => line.split('|')) + .filter(card => !(card[0].toLowerCase() === "plains" || card[0].toLowerCase() === "swamp" || card[0].toLowerCase() === "island" || card[0].toLowerCase() === "mountain" || card[0].toLowerCase() === "forest")) + const issues = await github.paginate(github.rest.issues.listForRepo, { owner: context.repo.owner, repo: context.repo.repo, labels: 'tracking set' }); - console.log("Found list of existing issues:", issues); + + const sets = []; + setsData.forEach(set => { + let foundIssue = undefined; + issues.every(issue => { + if(issue && issue.title && issue.title.startsWith(set[1])) { + console.log(`Found tracking issue for ${set[0]} with issue number: ${issue.number}`); + foundIssue = issue; + return false; + } + return true; + }); + + const cards = cardsData.filter(card => card[1] === set[0]); + let implementedCount = 0; + cards.forEach(cardData => { + const className = toCamelCase(cardData[0].replace(/[+]/g, ' Plus ').replace(/[_]+/g, ' Blank ').replace(/[']/g, '').replace(/[-+,.!?`@#$%^&*()_=<>:";~\\|/]/g, ' ')); + const cleanCardName = cardData[0].replace(/[-,'.!?`@#$%^&*()_=<>:";~\\|/\s]/g, '').toLowerCase(); + const cardPath = path.join('Mage.Sets', 'src', 'mage', 'cards', className.substring(0, 1), `${className.charAt(0).toUpperCase()+className.slice(1)}.java`); + if (fs.existsSync(cardPath)) { + implementedCount++; + } + }); + sets.push({ + name: set[0], + issueLink: foundIssue === undefined ? "https://www.github.com/mage/magefree" : foundIssue.url, + total: cards.length, + missing: cards.length - implementedCount + }); + }); const content = mustache.render(setImplementationTemplate, {}); From 503d0e52ab67a29e37ff76f275cd0ab77364a0af Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 02:11:16 -0700 Subject: [PATCH 055/141] Update update-set-implementation-lists.yml --- .../update-set-implementation-lists.yml | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 54d845451a5..23ef2c12874 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -117,18 +117,8 @@ jobs: console.log("Issues to update: ", issuesToUpdate); console.log("Issues to create: ", issuesToCreate); - update-set-impl-wiki: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 16 - - run: npm install mustache - shell: bash - - uses: actions/github-script@v6.4.1 - id: updateissues + id: updatewiki with: script: | const mustache = require('mustache') @@ -140,6 +130,13 @@ jobs: return str; }; + // https://stackoverflow.com/a/2970667 + function toCamelCase(str) { + return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word, index) { + return index === 0 ? word.toLowerCase() : word.toUpperCase(); + }).replace(/\s+/g, '') + } + const setImplementationTemplate = fs.readFileSync(path.join('.github', 'templates', 'set-tracking-wiki.md'), 'utf8'); const setsData = fs.readFileSync(path.join('Utils', 'mtg-sets-data.txt'), 'utf8') @@ -186,6 +183,9 @@ jobs: }); }); - const content = mustache.render(setImplementationTemplate, {}); + const content = mustache.render(setImplementationTemplate, { + sets: sets + }); + + fs.writeFile(path.join('wiki', 'Set-implementation-list.md'), content); - fs.writeFile(path.join('wiki', 'Set-implementation-list.md'), content); From ac74eb4be6264ef6d342c3191eaaf7d632dd346f Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 02:14:42 -0700 Subject: [PATCH 056/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 23ef2c12874..542820651f5 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -187,5 +187,10 @@ jobs: sets: sets }); - fs.writeFile(path.join('wiki', 'Set-implementation-list.md'), content); + console.log(content); + try { + fs.writeFileSync(path.join('wiki', 'Set-implementation-list.md'), content); + } catch (err) { + console.error(err); + } From 4b2f16cfc3ce517a30fe533b700afd41d00680c0 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 02:16:34 -0700 Subject: [PATCH 057/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 542820651f5..7f4b92b4093 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -177,7 +177,7 @@ jobs: }); sets.push({ name: set[0], - issueLink: foundIssue === undefined ? "https://www.github.com/mage/magefree" : foundIssue.url, + issueLink: foundIssue === undefined ? "https://www.github.com/mage/magefree" : foundIssue.html_url, total: cards.length, missing: cards.length - implementedCount }); From 2ab2f380880650317a8b370218f2a0ca01378c7b Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 02:32:45 -0700 Subject: [PATCH 058/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 7f4b92b4093..5344bcb9792 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -194,3 +194,11 @@ jobs: } catch (err) { console.error(err); } + - name: commit + run: | + # Setup git config + + # Stage the Set-implementation-list.md file, commit, then push + git add ./wiki/Set-implementation-list.md + git commit -m Update Set-implementation-list.md + git push origin master From a47679af05a189f3914ae1a486396f7d774deaea Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 02:34:56 -0700 Subject: [PATCH 059/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 5344bcb9792..0d12c27e7f1 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -199,6 +199,6 @@ jobs: # Setup git config # Stage the Set-implementation-list.md file, commit, then push - git add ./wiki/Set-implementation-list.md + git add -A git commit -m Update Set-implementation-list.md - git push origin master + git push From 18accccebc934369aca836a2b3be8ed73c79e751 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 02:35:33 -0700 Subject: [PATCH 060/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 0d12c27e7f1..f400b66b204 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -7,7 +7,7 @@ concurrency: group: set-impl cancel-in-progress: true jobs: - update-set-impl-issues: + update-set-implementation: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 2001002677be21b6f6b666ff30f71b8d911ab7e7 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 02:41:28 -0700 Subject: [PATCH 061/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index f400b66b204..71fec0cd4e9 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -197,8 +197,9 @@ jobs: - name: commit run: | # Setup git config - + git config user.name github-actions + git config user.email github-actions@github.com # Stage the Set-implementation-list.md file, commit, then push - git add -A + git add . git commit -m Update Set-implementation-list.md git push From 246f5b7b12ff941fa347b2921188285610e876d4 Mon Sep 17 00:00:00 2001 From: ExpensiveKoala Date: Sat, 24 Jun 2023 02:42:37 -0700 Subject: [PATCH 062/141] Update update-set-implementation-lists.yml --- .github/workflows/update-set-implementation-lists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-set-implementation-lists.yml b/.github/workflows/update-set-implementation-lists.yml index 71fec0cd4e9..acff2a6bdb8 100644 --- a/.github/workflows/update-set-implementation-lists.yml +++ b/.github/workflows/update-set-implementation-lists.yml @@ -201,5 +201,5 @@ jobs: git config user.email github-actions@github.com # Stage the Set-implementation-list.md file, commit, then push git add . - git commit -m Update Set-implementation-list.md + git commit -m "Update Set-implementation-list.md" git push From 6d9845d3041585af8c81ed1bc577d024ec349214 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sat, 24 Jun 2023 09:47:29 +0000 Subject: [PATCH 063/141] Update Set-implementation-list.md --- node_modules/.bin/mustache | 1 + node_modules/.package-lock.json | 15 + node_modules/mustache/CHANGELOG.md | 618 ++++++++++++++ node_modules/mustache/LICENSE | 11 + node_modules/mustache/README.md | 621 ++++++++++++++ node_modules/mustache/bin/mustache | 150 ++++ node_modules/mustache/mustache.js | 772 ++++++++++++++++++ node_modules/mustache/mustache.min.js | 1 + node_modules/mustache/mustache.mjs | 764 +++++++++++++++++ node_modules/mustache/package.json | 67 ++ .../mustache/wrappers/dojo/mustache.js.post | 4 + .../mustache/wrappers/dojo/mustache.js.pre | 9 + .../mustache/wrappers/jquery/mustache.js.post | 13 + .../mustache/wrappers/jquery/mustache.js.pre | 9 + .../wrappers/mootools/mustache.js.post | 5 + .../wrappers/mootools/mustache.js.pre | 2 + .../wrappers/qooxdoo/mustache.js.post | 9 + .../mustache/wrappers/qooxdoo/mustache.js.pre | 172 ++++ .../mustache/wrappers/yui3/mustache.js.post | 4 + .../mustache/wrappers/yui3/mustache.js.pre | 1 + package-lock.json | 27 + package.json | 5 + wiki/Set-implementation-list.md | 269 ++++++ 23 files changed, 3549 insertions(+) create mode 120000 node_modules/.bin/mustache create mode 100644 node_modules/.package-lock.json create mode 100644 node_modules/mustache/CHANGELOG.md create mode 100644 node_modules/mustache/LICENSE create mode 100644 node_modules/mustache/README.md create mode 100755 node_modules/mustache/bin/mustache create mode 100644 node_modules/mustache/mustache.js create mode 100644 node_modules/mustache/mustache.min.js create mode 100644 node_modules/mustache/mustache.mjs create mode 100644 node_modules/mustache/package.json create mode 100644 node_modules/mustache/wrappers/dojo/mustache.js.post create mode 100644 node_modules/mustache/wrappers/dojo/mustache.js.pre create mode 100644 node_modules/mustache/wrappers/jquery/mustache.js.post create mode 100644 node_modules/mustache/wrappers/jquery/mustache.js.pre create mode 100644 node_modules/mustache/wrappers/mootools/mustache.js.post create mode 100644 node_modules/mustache/wrappers/mootools/mustache.js.pre create mode 100644 node_modules/mustache/wrappers/qooxdoo/mustache.js.post create mode 100644 node_modules/mustache/wrappers/qooxdoo/mustache.js.pre create mode 100644 node_modules/mustache/wrappers/yui3/mustache.js.post create mode 100644 node_modules/mustache/wrappers/yui3/mustache.js.pre create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 wiki/Set-implementation-list.md diff --git a/node_modules/.bin/mustache b/node_modules/.bin/mustache new file mode 120000 index 00000000000..f8b719754c7 --- /dev/null +++ b/node_modules/.bin/mustache @@ -0,0 +1 @@ +../mustache/bin/mustache \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 00000000000..2f3afedd4b2 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,15 @@ +{ + "name": "mage", + "lockfileVersion": 2, + "requires": true, + "packages": { + "node_modules/mustache": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", + "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", + "bin": { + "mustache": "bin/mustache" + } + } + } +} diff --git a/node_modules/mustache/CHANGELOG.md b/node_modules/mustache/CHANGELOG.md new file mode 100644 index 00000000000..b1f72d0a373 --- /dev/null +++ b/node_modules/mustache/CHANGELOG.md @@ -0,0 +1,618 @@ +# Change Log + +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](http://semver.org/). + +## [4.2.0] / 28 March 2021 + +### Added + +* [#773]: Add package.json `exports` field, by [@manzt]. + +## [4.1.0] / 6 December 2020 + +### Added + +* [#764]: `render()` now recognizes a config object argument, by [@pineapplemachine]. + +### Fixed + +* [#764]: Ask custom `escape` functions to escape all types of values (including `number`s), by [@pineapplemachine]. + +## [4.0.1] / 15 March 2020 + +### Fixed + + * [#739]: Fix custom delimiters in nested partials, by [@aielo]. + +## [4.0.0] / 16 January 2020 + +Majority of using projects don't have to worry by this being a new major version. + +**TLDR;** if your project manipulates `Writer.prototype.parse | Writer.cache` directly or uses `.to_html()`, you probably have to change that code. + +This release allows the internal template cache to be customised, either by disabling it completely +or provide a custom strategy deciding how the cache should behave when mustache.js parses templates. + +```js +const mustache = require('mustache'); + +// disable caching +Mustache.templateCache = undefined; + +// or use a built-in Map in modern environments +Mustache.templateCache = new Map(); +``` + +Projects that wanted to customise the caching behaviour in earlier versions of mustache.js were forced to +override internal method responsible for parsing templates; `Writer.prototype.parse`. In short, that was unfortunate +because there is more than caching happening in that method. + +We've improved that now by introducing a first class API that only affects template caching. + +The default template cache behaves as before and is still compatible with older JavaScript environments. +For those who wants to provide a custom more sopisiticated caching strategy, one can do that with an object that adheres to the following requirements: + +```ts +{ + set(cacheKey: string, value: string): void + get(cacheKey: string): string | undefined + clear(): void +} +``` + +### Added + +* [#731]: Allow template caching to be customised, by [@AndrewLeedham]. + +### Removed + +* [#735]: Remove `.to_html()`, by [@phillipj]. + +## [3.2.1] / 30 December 2019 + +### Fixed + + * [#733]: Allow the CLI to use JavaScript views when the project has ES6 modules enabled, by [@eobrain]. + +## [3.2.0] / 18 December 2019 + +### Added + +* [#728]: Expose ECMAScript Module in addition to UMD (CommonJS, AMD & global scope), by [@phillipj] and [@zekth]. + +### Using mustache.js as an ES module + +To stay backwards compatible with already using projects, the default exposed module format is still UMD. +That means projects using mustache.js as an CommonJS, AMD or global scope module, from npm or directly from github.com +can keep on doing that for now. + +For those projects who would rather want to use mustache.js as an ES module, the `mustache/mustache.mjs` file has to +be `import`ed directly. + +Below are some usage scenarios for different runtimes. + +#### Modern browser with ES module support + +```html + + +``` + +#### [Node.js](https://nodejs.org) (>= v13.2.0 or using --experimental-modules flag) + +```js +// index.mjs +import mustache from 'mustache/mustache.mjs' + +console.log(mustache.render('Hello {{name}}!', { name: 'Santa' })) +// Hello Santa! +``` + +ES Module support for Node.js will be improved in the future when [Conditional Exports](https://nodejs.org/api/esm.html#esm_conditional_exports) +is enabled by default rather than being behind an experimental flag. + +More info in [Node.js ECMAScript Modules docs](https://nodejs.org/api/esm.html). + +#### [Deno](https://deno.land/) + +```js +// index.ts +import mustache from 'https://unpkg.com/mustache@3.2.0/mustache.mjs' + +console.log(mustache.render('Hello {{name}}!', { name: 'Santa' })) +// Hello Santa! +``` + +## [3.1.0] / 13 September 2019 + +### Added + + * [#717]: Added support .js files as views in command line tool, by [@JEStaubach]. + +### Fixed + + * [#716]: Bugfix for indentation of inline partials, by [@yotammadem]. + +## [3.0.3] / 27 August 2019 + +### Added + + * [#713]: Add test cases for custom functions in partials, by [@wol-soft]. + +### Fixed + + * [#714]: Bugfix for wrong function output in partials with indentation, by [@phillipj]. + +## [3.0.2] / 21 August 2019 + +### Fixed + + * [#705]: Fix indentation of partials, by [@kevindew] and [@yotammadem]. + +### Dev + + * [#701]: Fix test failure for Node 10 and above, by [@andersk]. + * [#704]: Lint all test files just like the source files, by [@phillipj]. + * Start experimenting & comparing GitHub Actions vs Travis CI, by [@phillipj]. + +## [3.0.1] / 11 November 2018 + + * [#679]: Fix partials not rendering tokens when using custom tags, by [@stackchain]. + +## [3.0.0] / 16 September 2018 + +We are very happy to announce a new major version of mustache.js. We want to be very careful not to break projects +out in the wild, and adhering to [Semantic Versioning](http://semver.org/) we have therefore cut this new major version. + +The changes introduced will likely not require any actions for most using projects. The things to look out for that +might cause unexpected rendering results are described in the migration guide below. + +A big shout out and thanks to [@raymond-lam] for this release! Without his contributions with code and issue triaging, +this release would never have happened. + +### Major + +* [#618]: Allow rendering properties of primitive types that are not objects, by [@raymond-lam]. +* [#643]: `Writer.prototype.parse` to cache by tags in addition to template string, by [@raymond-lam]. +* [#664]: Fix `Writer.prototype.parse` cache, by [@seminaoki]. + +### Minor + +* [#673]: Add `tags` parameter to `Mustache.render()`, by [@raymond-lam]. + +### Migrating from mustache.js v2.x to v3.x + +#### Rendering properties of primitive types + +We have ensured properties of primitive types can be rendered at all times. That means `Array.length`, `String.length` +and similar. A corner case where this could cause unexpected output follows: + +View: +``` +{ + stooges: [ + { name: "Moe" }, + { name: "Larry" }, + { name: "Curly" } + ] +} +``` + +Template: +``` +{{#stooges}} + {{name}}: {{name.length}} characters +{{/stooges}} +``` + +Output with v3.0: +``` + Moe: 3 characters + Larry: 5 characters + Curly: 5 characters +``` + +Output with v2.x: +``` + Moe: characters + Larry: characters + Curly: characters +``` + +#### Caching for templates with custom delimiters + +We have improved the templates cache to ensure custom delimiters are taken into consideration for the cache. +This improvement might cause unexpected rendering behaviour for using projects actively using the custom delimiters functionality. + +Previously it was possible to use `Mustache.parse()` as a means to set global custom delimiters. If custom +delimiters were provided as an argument, it would affect all following calls to `Mustache.render()`. +Consider the following: + +```js +const template = "[[item.title]] [[item.value]]"; +mustache.parse(template, ["[[", "]]"]); + +console.log( + mustache.render(template, { + item: { + title: "TEST", + value: 1 + } + }) +); + +>> TEST 1 +``` + +The above illustrates the fact that `Mustache.parse()` made mustache.js cache the template without considering +the custom delimiters provided. This is no longer true. + +We no longer encourage using `Mustache.parse()` for this purpose, but have rather added a fourth argument to +`Mustache.render()` letting you provide custom delimiters when rendering. + +If you still need the pre-parse the template and use custom delimiters at the same time, ensure to provide +the custom delimiters as argument to `Mustache.render()` as well. + +## [2.3.2] / 17 August 2018 + +This release is made to revert changes introduced in [2.3.1] that caused unexpected behaviour for several users. + +### Minor + + * [#670]: Rollback template cache causing unexpected behaviour, by [@raymond-lam]. + +## [2.3.1] / 7 August 2018 + +### Minor + + * [#643]: `Writer.prototype.parse` to cache by tags in addition to template string, by [@raymond-lam]. + * [#664]: Fix `Writer.prototype.parse` cache, by [@seminaoki]. + +### Dev + + * [#666]: Install release tools with npm rather than pre-commit hook & `Rakefile`, by [@phillipj]. + * [#667], [#668]: Stabilize browser test suite, by [@phillipj]. + +### Docs + + * [#644]: Document global Mustache.escape overriding capacity, by [@paultopia]. + * [#657]: Correct `Mustache.parse()` return type documentation, by [@bbrooks]. + +## [2.3.0] / 8 November 2016 + +### Minor + + * [#540]: Add optional `output` argument to mustache CLI, by [@wizawu]. + * [#597]: Add compatibility with amdclean, by [@mightyplow]. + +### Dev + + * [#553]: Assert `null` lookup when rendering an unescaped value, by [@dasilvacontin]. + * [#580], [#610]: Ignore eslint for greenkeeper updates, by [@phillipj]. + * [#560]: Fix CLI tests for Windows, by [@kookookchoozeus]. + * Run browser tests w/node v4, by [@phillipj]. + +### Docs + + * [#542]: Add API documentation to README, by [@tomekwi]. + * [#546]: Add missing syntax highlighting to README code blocks, by [@pra85]. + * [#569]: Update Ctemplate links in README, by [@mortonfox]. + * [#592]: Change "loadUser" to "loadUser()" in README, by [@Flaque]. + * [#593]: Adding doctype to HTML code example in README, by [@calvinf]. + +### Dependencies + + * eslint -> 2.2.0. Breaking changes fix by [@phillipj]. [#548] + * eslint -> 2.5.1. + * mocha -> 3.0.2. + * zuul -> 3.11.0. + +## [2.2.1] / 13 December 2015 + +### Fixes + + * Improve HTML escaping, by [@phillipj]. + * Fix inconsistency in defining global mustache object, by [@simast]. + * Fix switch-case indent error, by [@norfish]. + * Unpin chai and eslint versions, by [@dasilvacontin]. + * Update README.md with proper grammar, by [@EvanLovely]. + * Update mjackson username in README, by [@mjackson]. + * Remove syntax highlighting in README code sample, by [@imagentleman]. + * Fix typo in README, by [@Xcrucifier]. + * Fix link typo in README, by [@keirog]. + +## [2.2.0] / 15 October 2015 + +### Added + + * Add Partials support to CLI, by [@palkan]. + +### Changed + + * Move install instructions to README's top, by [@mateusortiz] + * Improved devhook install output, by [@ShashankaNataraj]. + * Clarifies and improves language in documentation, by [@jfmercer]. + * Linting CLI tool, by [@phillipj]. + * npm 2.x and node v4 on Travis, by [@phillipj]. + +### Fixes + + * Fix README spelling error to "aforementioned", by [@djchie]. + * Equal error message test in .render() for server and browser, by [@phillipj]. + +### Dependencies + + * chai -> 3.3.0 + * eslint -> 1.6.0 + +## [2.1.3] / 23 July 2015 + +### Added + + * Throw error when providing .render() with invalid template type, by [@phillipj]. + * Documents use of string literals containing double quotes, by [@jfmercer]. + +### Changed + + * Move mustache gif to githubusercontent, by [@Andersos]. + +### Fixed + + * Update UMD Shim to be resilient to HTMLElement global pollution, by [@mikesherov]. + +## [2.1.2] / 17 June 2015 + +### Added + + * Mustache global definition ([#466]) by [@yousefcisco]. + +## [2.1.1] / 11 June 2015 + +### Added + + * State that we use semver on the change log, by [@dasilvacontin]. + * Added version links to change log, by [@dasilvacontin]. + +### Fixed + + * Bugfix for using values from view's context prototype, by [@phillipj]. + * Improve test with undefined/null lookup hit using dot notation, by [@dasilvacontin]. + * Bugfix for null/undefined lookup hit when using dot notation, by [@phillipj]. + * Remove moot `version` property from bower.json, by [@kkirsche]. + * bower.json doesn't require a version bump via hook, by [@dasilvacontin]. + + +## [2.1.0] / 5 June 2015 + + * Added license attribute to package.json, by [@pgilad]. + * Minor changes to make mustache.js compatible with both WSH and ASP, by [@nagaozen]. + * Improve CLI view parsing error, by [@phillipj]. + * Bugfix for view context cache, by [@phillipj]. + +## [2.0.0] / 27 Mar 2015 + + * Fixed lookup not stopping upon finding `undefined` or `null` values, by [@dasilvacontin]. + * Refactored pre-commit hook, by [@dasilvacontin]. + +## [1.2.0] / 24 Mar 2015 + + * Added -v option to CLI, by [@phillipj]. + * Bugfix for rendering Number when it serves as the Context, by [@phillipj]. + * Specified files in package.json for a cleaner install, by [@phillipj]. + +## [1.1.0] / 18 Feb 2015 + + * Refactor Writer.renderTokens() for better readability, by [@phillipj]. + * Cleanup tests section in readme, by [@phillipj]. + * Added JSHint to tests/CI, by [@phillipj]. + * Added node v0.12 on travis, by [@phillipj]. + * Created command line tool, by [@phillipj]. + * Added *falsy* to Inverted Sections description in README, by [@kristijanmatic]. + +## [1.0.0] / 20 Dec 2014 + + * Inline tag compilation, by [@mjackson]. + * Fixed AMD registration, volo package.json entry, by [@jrburke]. + * Added spm support, by [@afc163]. + * Only access properties of objects on Context.lookup, by [@cmbuckley]. + +## [0.8.2] / 17 Mar 2014 + + * Supporting Bower through a bower.json file. + +## [0.8.1] / 3 Jan 2014 + + * Fix usage of partial templates. + +## [0.8.0] / 2 Dec 2013 + + * Remove compile* writer functions, use mustache.parse instead. Smaller API. + * Throw an error when rendering a template that contains higher-order sections and + the original template is not provided. + * Remove low-level Context.make function. + * Better code readability and inline documentation. + * Stop caching templates by name. + +## [0.7.3] / 5 Nov 2013 + + * Don't require the original template to be passed to the rendering function + when using compiled templates. This is still required when using higher-order + functions in order to be able to extract the portion of the template + that was contained by that section. Fixes [#262]. + * Performance improvements. + +## [0.7.2] / 27 Dec 2012 + + * Fixed a rendering bug ([#274]) when using nested higher-order sections. + * Better error reporting on failed parse. + * Converted tests to use mocha instead of vows. + +## [0.7.1] / 6 Dec 2012 + + * Handle empty templates gracefully. Fixes [#265], [#267], and [#270]. + * Cache partials by template, not by name. Fixes [#257]. + * Added Mustache.compileTokens to compile the output of Mustache.parse. Fixes + [#258]. + +## [0.7.0] / 10 Sep 2012 + + * Rename Renderer => Writer. + * Allow partials to be loaded dynamically using a callback (thanks + [@TiddoLangerak] for the suggestion). + * Fixed a bug with higher-order sections that prevented them from being + passed the raw text of the section from the original template. + * More concise token format. Tokens also include start/end indices in the + original template. + * High-level API is consistent with the Writer API. + * Allow partials to be passed to the pre-compiled function (thanks + [@fallenice]). + * Don't use eval (thanks [@cweider]). + +## [0.6.0] / 31 Aug 2012 + + * Use JavaScript's definition of falsy when determining whether to render an + inverted section or not. Issue [#186]. + * Use Mustache.escape to escape values inside {{}}. This function may be + reassigned to alter the default escaping behavior. Issue [#244]. + * Fixed a bug that clashed with QUnit (thanks [@kannix]). + * Added volo support (thanks [@guybedford]). + +[4.1.0]: https://github.com/janl/mustache.js/compare/v4.0.1...v4.1.0 +[4.0.1]: https://github.com/janl/mustache.js/compare/v4.0.0...v4.0.1 +[4.0.0]: https://github.com/janl/mustache.js/compare/v3.2.1...v4.0.0 +[3.2.1]: https://github.com/janl/mustache.js/compare/v3.2.0...v3.2.1 +[3.2.0]: https://github.com/janl/mustache.js/compare/v3.1.0...v3.2.0 +[3.1.0]: https://github.com/janl/mustache.js/compare/v3.0.3...v3.1.0 +[3.0.3]: https://github.com/janl/mustache.js/compare/v3.0.2...v3.0.3 +[3.0.2]: https://github.com/janl/mustache.js/compare/v3.0.1...v3.0.2 +[3.0.1]: https://github.com/janl/mustache.js/compare/v3.0.0...v3.0.1 +[3.0.0]: https://github.com/janl/mustache.js/compare/v2.3.2...v3.0.0 +[2.3.2]: https://github.com/janl/mustache.js/compare/v2.3.1...v2.3.2 +[2.3.1]: https://github.com/janl/mustache.js/compare/v2.3.0...v2.3.1 +[2.3.0]: https://github.com/janl/mustache.js/compare/v2.2.1...v2.3.0 +[2.2.1]: https://github.com/janl/mustache.js/compare/v2.2.0...v2.2.1 +[2.2.0]: https://github.com/janl/mustache.js/compare/v2.1.3...v2.2.0 +[2.1.3]: https://github.com/janl/mustache.js/compare/v2.1.2...v2.1.3 +[2.1.2]: https://github.com/janl/mustache.js/compare/v2.1.1...v2.1.2 +[2.1.1]: https://github.com/janl/mustache.js/compare/v2.1.0...v2.1.1 +[2.1.0]: https://github.com/janl/mustache.js/compare/v2.0.0...v2.1.0 +[2.0.0]: https://github.com/janl/mustache.js/compare/v1.2.0...v2.0.0 +[1.2.0]: https://github.com/janl/mustache.js/compare/v1.1.0...v1.2.0 +[1.1.0]: https://github.com/janl/mustache.js/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/janl/mustache.js/compare/0.8.2...v1.0.0 +[0.8.2]: https://github.com/janl/mustache.js/compare/0.8.1...0.8.2 +[0.8.1]: https://github.com/janl/mustache.js/compare/0.8.0...0.8.1 +[0.8.0]: https://github.com/janl/mustache.js/compare/0.7.3...0.8.0 +[0.7.3]: https://github.com/janl/mustache.js/compare/0.7.2...0.7.3 +[0.7.2]: https://github.com/janl/mustache.js/compare/0.7.1...0.7.2 +[0.7.1]: https://github.com/janl/mustache.js/compare/0.7.0...0.7.1 +[0.7.0]: https://github.com/janl/mustache.js/compare/0.6.0...0.7.0 +[0.6.0]: https://github.com/janl/mustache.js/compare/0.5.2...0.6.0 + +[#186]: https://github.com/janl/mustache.js/issues/186 +[#244]: https://github.com/janl/mustache.js/issues/244 +[#257]: https://github.com/janl/mustache.js/issues/257 +[#258]: https://github.com/janl/mustache.js/issues/258 +[#262]: https://github.com/janl/mustache.js/issues/262 +[#265]: https://github.com/janl/mustache.js/issues/265 +[#267]: https://github.com/janl/mustache.js/issues/267 +[#270]: https://github.com/janl/mustache.js/issues/270 +[#274]: https://github.com/janl/mustache.js/issues/274 +[#466]: https://github.com/janl/mustache.js/issues/466 +[#540]: https://github.com/janl/mustache.js/issues/540 +[#542]: https://github.com/janl/mustache.js/issues/542 +[#546]: https://github.com/janl/mustache.js/issues/546 +[#548]: https://github.com/janl/mustache.js/issues/548 +[#553]: https://github.com/janl/mustache.js/issues/553 +[#560]: https://github.com/janl/mustache.js/issues/560 +[#569]: https://github.com/janl/mustache.js/issues/569 +[#580]: https://github.com/janl/mustache.js/issues/580 +[#592]: https://github.com/janl/mustache.js/issues/592 +[#593]: https://github.com/janl/mustache.js/issues/593 +[#597]: https://github.com/janl/mustache.js/issues/597 +[#610]: https://github.com/janl/mustache.js/issues/610 +[#643]: https://github.com/janl/mustache.js/issues/643 +[#644]: https://github.com/janl/mustache.js/issues/644 +[#657]: https://github.com/janl/mustache.js/issues/657 +[#664]: https://github.com/janl/mustache.js/issues/664 +[#666]: https://github.com/janl/mustache.js/issues/666 +[#667]: https://github.com/janl/mustache.js/issues/667 +[#668]: https://github.com/janl/mustache.js/issues/668 +[#670]: https://github.com/janl/mustache.js/issues/670 +[#618]: https://github.com/janl/mustache.js/issues/618 +[#673]: https://github.com/janl/mustache.js/issues/673 +[#679]: https://github.com/janl/mustache.js/issues/679 +[#701]: https://github.com/janl/mustache.js/issues/701 +[#704]: https://github.com/janl/mustache.js/issues/704 +[#705]: https://github.com/janl/mustache.js/issues/705 +[#713]: https://github.com/janl/mustache.js/issues/713 +[#714]: https://github.com/janl/mustache.js/issues/714 +[#716]: https://github.com/janl/mustache.js/issues/716 +[#717]: https://github.com/janl/mustache.js/issues/717 +[#728]: https://github.com/janl/mustache.js/issues/728 +[#733]: https://github.com/janl/mustache.js/issues/733 +[#731]: https://github.com/janl/mustache.js/issues/731 +[#735]: https://github.com/janl/mustache.js/issues/735 +[#739]: https://github.com/janl/mustache.js/issues/739 +[#764]: https://github.com/janl/mustache.js/issues/764 +[#773]: https://github.com/janl/mustache.js/issues/773 + +[@afc163]: https://github.com/afc163 +[@aielo]: https://github.com/aielo +[@andersk]: https://github.com/andersk +[@Andersos]: https://github.com/Andersos +[@AndrewLeedham]: https://github.com/AndrewLeedham +[@bbrooks]: https://github.com/bbrooks +[@calvinf]: https://github.com/calvinf +[@cmbuckley]: https://github.com/cmbuckley +[@cweider]: https://github.com/cweider +[@dasilvacontin]: https://github.com/dasilvacontin +[@djchie]: https://github.com/djchie +[@eobrain]: https://github.com/eobrain +[@EvanLovely]: https://github.com/EvanLovely +[@fallenice]: https://github.com/fallenice +[@Flaque]: https://github.com/Flaque +[@guybedford]: https://github.com/guybedford +[@imagentleman]: https://github.com/imagentleman +[@JEStaubach]: https://github.com/JEStaubach +[@jfmercer]: https://github.com/jfmercer +[@jrburke]: https://github.com/jrburke +[@kannix]: https://github.com/kannix +[@keirog]: https://github.com/keirog +[@kkirsche]: https://github.com/kkirsche +[@kookookchoozeus]: https://github.com/kookookchoozeus +[@kristijanmatic]: https://github.com/kristijanmatic +[@kevindew]: https://github.com/kevindew +[@manzt]: https://github.com/manzt +[@mateusortiz]: https://github.com/mateusortiz +[@mightyplow]: https://github.com/mightyplow +[@mikesherov]: https://github.com/mikesherov +[@mjackson]: https://github.com/mjackson +[@mortonfox]: https://github.com/mortonfox +[@nagaozen]: https://github.com/nagaozen +[@norfish]: https://github.com/norfish +[@palkan]: https://github.com/palkan +[@paultopia]: https://github.com/paultopia +[@pgilad]: https://github.com/pgilad +[@phillipj]: https://github.com/phillipj +[@pineapplemachine]: https://github.com/pineapplemachine +[@pra85]: https://github.com/pra85 +[@raymond-lam]: https://github.com/raymond-lam +[@seminaoki]: https://github.com/seminaoki +[@ShashankaNataraj]: https://github.com/ShashankaNataraj +[@simast]: https://github.com/simast +[@stackchain]: https://github.com/stackchain +[@TiddoLangerak]: https://github.com/TiddoLangerak +[@tomekwi]: https://github.com/tomekwi +[@wizawu]: https://github.com/wizawu +[@wol-soft]: https://github.com/wol-soft +[@Xcrucifier]: https://github.com/Xcrucifier +[@yotammadem]: https://github.com/yotammadem +[@yousefcisco]: https://github.com/yousefcisco +[@zekth]: https://github.com/zekth diff --git a/node_modules/mustache/LICENSE b/node_modules/mustache/LICENSE new file mode 100644 index 00000000000..4df7d1aae6f --- /dev/null +++ b/node_modules/mustache/LICENSE @@ -0,0 +1,11 @@ +The MIT License + +Copyright (c) 2009 Chris Wanstrath (Ruby) +Copyright (c) 2010-2014 Jan Lehnardt (JavaScript) +Copyright (c) 2010-2015 The mustache.js community + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mustache/README.md b/node_modules/mustache/README.md new file mode 100644 index 00000000000..127dfe106c8 --- /dev/null +++ b/node_modules/mustache/README.md @@ -0,0 +1,621 @@ +# mustache.js - Logic-less {{mustache}} templates with JavaScript + +> What could be more logical awesome than no logic at all? + +[![Build Status](https://travis-ci.org/janl/mustache.js.svg?branch=master)](https://travis-ci.org/janl/mustache.js) + +[mustache.js](http://github.com/janl/mustache.js) is a zero-dependency implementation of the [mustache](http://mustache.github.com/) template system in JavaScript. + +[Mustache](http://mustache.github.com/) is a logic-less template syntax. It can be used for HTML, config files, source code - anything. It works by expanding tags in a template using values provided in a hash or object. + +We call it "logic-less" because there are no if statements, else clauses, or for loops. Instead there are only tags. Some tags are replaced with a value, some nothing, and others a series of values. + +For a language-agnostic overview of mustache's template syntax, see the `mustache(5)` [manpage](http://mustache.github.com/mustache.5.html). + +## Where to use mustache.js? + +You can use mustache.js to render mustache templates anywhere you can use JavaScript. This includes web browsers, server-side environments such as [Node.js](http://nodejs.org/), and [CouchDB](http://couchdb.apache.org/) views. + +mustache.js ships with support for the [CommonJS](http://www.commonjs.org/) module API, the [Asynchronous Module Definition](https://github.com/amdjs/amdjs-api/wiki/AMD) API (AMD) and [ECMAScript modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules). + +In addition to being a package to be used programmatically, you can use it as a [command line tool](#command-line-tool). + +And this will be your templates after you use Mustache: + +!['stache](https://cloud.githubusercontent.com/assets/288977/8779228/a3cf700e-2f02-11e5-869a-300312fb7a00.gif) + +## Install + +You can get Mustache via [npm](http://npmjs.com). + +```bash +$ npm install mustache --save +``` + +## Usage + +Below is a quick example how to use mustache.js: + +```js +var view = { + title: "Joe", + calc: function () { + return 2 + 4; + } +}; + +var output = Mustache.render("{{title}} spends {{calc}}", view); +``` + +In this example, the `Mustache.render` function takes two parameters: 1) the [mustache](http://mustache.github.com/) template and 2) a `view` object that contains the data and code needed to render the template. + +## Templates + +A [mustache](http://mustache.github.com/) template is a string that contains any number of mustache tags. Tags are indicated by the double mustaches that surround them. `{{person}}` is a tag, as is `{{#person}}`. In both examples we refer to `person` as the tag's key. There are several types of tags available in mustache.js, described below. + +There are several techniques that can be used to load templates and hand them to mustache.js, here are two of them: + +#### Include Templates + +If you need a template for a dynamic part in a static website, you can consider including the template in the static HTML file to avoid loading templates separately. Here's a small example: + +```js +// file: render.js + +function renderHello() { + var template = document.getElementById('template').innerHTML; + var rendered = Mustache.render(template, { name: 'Luke' }); + document.getElementById('target').innerHTML = rendered; +} +``` + +```html + + +
Loading...
+ + + + + + +``` + +#### Load External Templates + +If your templates reside in individual files, you can load them asynchronously and render them when they arrive. Another example using [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch): + +```js +function renderHello() { + fetch('template.mustache') + .then((response) => response.text()) + .then((template) => { + var rendered = Mustache.render(template, { name: 'Luke' }); + document.getElementById('target').innerHTML = rendered; + }); +} +``` + +### Variables + +The most basic tag type is a simple variable. A `{{name}}` tag renders the value of the `name` key in the current context. If there is no such key, nothing is rendered. + +All variables are HTML-escaped by default. If you want to render unescaped HTML, use the triple mustache: `{{{name}}}`. You can also use `&` to unescape a variable. + +If you'd like to change HTML-escaping behavior globally (for example, to template non-HTML formats), you can override Mustache's escape function. For example, to disable all escaping: `Mustache.escape = function(text) {return text;};`. + +If you want `{{name}}` _not_ to be interpreted as a mustache tag, but rather to appear exactly as `{{name}}` in the output, you must change and then restore the default delimiter. See the [Custom Delimiters](#custom-delimiters) section for more information. + +View: + +```json +{ + "name": "Chris", + "company": "GitHub" +} +``` + +Template: + +``` +* {{name}} +* {{age}} +* {{company}} +* {{{company}}} +* {{&company}} +{{=<% %>=}} +* {{company}} +<%={{ }}=%> +``` + +Output: + +```html +* Chris +* +* <b>GitHub</b> +* GitHub +* GitHub +* {{company}} +``` + +JavaScript's dot notation may be used to access keys that are properties of objects in a view. + +View: + +```json +{ + "name": { + "first": "Michael", + "last": "Jackson" + }, + "age": "RIP" +} +``` + +Template: + +```html +* {{name.first}} {{name.last}} +* {{age}} +``` + +Output: + +```html +* Michael Jackson +* RIP +``` + +### Sections + +Sections render blocks of text zero or more times, depending on the value of the key in the current context. + +A section begins with a pound and ends with a slash. That is, `{{#person}}` begins a `person` section, while `{{/person}}` ends it. The text between the two tags is referred to as that section's "block". + +The behavior of the section is determined by the value of the key. + +#### False Values or Empty Lists + +If the `person` key does not exist, or exists and has a value of `null`, `undefined`, `false`, `0`, or `NaN`, or is an empty string or an empty list, the block will not be rendered. + +View: + +```json +{ + "person": false +} +``` + +Template: + +```html +Shown. +{{#person}} +Never shown! +{{/person}} +``` + +Output: + +```html +Shown. +``` + +#### Non-Empty Lists + +If the `person` key exists and is not `null`, `undefined`, or `false`, and is not an empty list the block will be rendered one or more times. + +When the value is a list, the block is rendered once for each item in the list. The context of the block is set to the current item in the list for each iteration. In this way we can loop over collections. + +View: + +```json +{ + "stooges": [ + { "name": "Moe" }, + { "name": "Larry" }, + { "name": "Curly" } + ] +} +``` + +Template: + +```html +{{#stooges}} +{{name}} +{{/stooges}} +``` + +Output: + +```html +Moe +Larry +Curly +``` + +When looping over an array of strings, a `.` can be used to refer to the current item in the list. + +View: + +```json +{ + "musketeers": ["Athos", "Aramis", "Porthos", "D'Artagnan"] +} +``` + +Template: + +```html +{{#musketeers}} +* {{.}} +{{/musketeers}} +``` + +Output: + +```html +* Athos +* Aramis +* Porthos +* D'Artagnan +``` + +If the value of a section variable is a function, it will be called in the context of the current item in the list on each iteration. + +View: + +```js +{ + "beatles": [ + { "firstName": "John", "lastName": "Lennon" }, + { "firstName": "Paul", "lastName": "McCartney" }, + { "firstName": "George", "lastName": "Harrison" }, + { "firstName": "Ringo", "lastName": "Starr" } + ], + "name": function () { + return this.firstName + " " + this.lastName; + } +} +``` + +Template: + +```html +{{#beatles}} +* {{name}} +{{/beatles}} +``` + +Output: + +```html +* John Lennon +* Paul McCartney +* George Harrison +* Ringo Starr +``` + +#### Functions + +If the value of a section key is a function, it is called with the section's literal block of text, un-rendered, as its first argument. The second argument is a special rendering function that uses the current view as its view argument. It is called in the context of the current view object. + +View: + +```js +{ + "name": "Tater", + "bold": function () { + return function (text, render) { + return "" + render(text) + ""; + } + } +} +``` + +Template: + +```html +{{#bold}}Hi {{name}}.{{/bold}} +``` + +Output: + +```html +Hi Tater. +``` + +### Inverted Sections + +An inverted section opens with `{{^section}}` instead of `{{#section}}`. The block of an inverted section is rendered only if the value of that section's tag is `null`, `undefined`, `false`, *falsy* or an empty list. + +View: + +```json +{ + "repos": [] +} +``` + +Template: + +```html +{{#repos}}{{name}}{{/repos}} +{{^repos}}No repos :({{/repos}} +``` + +Output: + +```html +No repos :( +``` + +### Comments + +Comments begin with a bang and are ignored. The following template: + +```html +

Today{{! ignore me }}.

+``` + +Will render as follows: + +```html +

Today.

+``` + +Comments may contain newlines. + +### Partials + +Partials begin with a greater than sign, like {{> box}}. + +Partials are rendered at runtime (as opposed to compile time), so recursive partials are possible. Just avoid infinite loops. + +They also inherit the calling context. Whereas in ERB you may have this: + +```html+erb +<%= partial :next_more, :start => start, :size => size %> +``` + +Mustache requires only this: + +```html +{{> next_more}} +``` + +Why? Because the `next_more.mustache` file will inherit the `size` and `start` variables from the calling context. In this way you may want to think of partials as includes, imports, template expansion, nested templates, or subtemplates, even though those aren't literally the case here. + + +For example, this template and partial: + + base.mustache: +

Names

+ {{#names}} + {{> user}} + {{/names}} + + user.mustache: + {{name}} + +Can be thought of as a single, expanded template: + +```html +

Names

+{{#names}} + {{name}} +{{/names}} +``` + +In mustache.js an object of partials may be passed as the third argument to `Mustache.render`. The object should be keyed by the name of the partial, and its value should be the partial text. + +```js +Mustache.render(template, view, { + user: userTemplate +}); +``` + +### Custom Delimiters + +Custom delimiters can be used in place of `{{` and `}}` by setting the new values in JavaScript or in templates. + +#### Setting in JavaScript + +The `Mustache.tags` property holds an array consisting of the opening and closing tag values. Set custom values by passing a new array of tags to `render()`, which gets honored over the default values, or by overriding the `Mustache.tags` property itself: + +```js +var customTags = [ '<%', '%>' ]; +``` + +##### Pass Value into Render Method +```js +Mustache.render(template, view, {}, customTags); +``` + +##### Override Tags Property +```js +Mustache.tags = customTags; +// Subsequent parse() and render() calls will use customTags +``` + +#### Setting in Templates + +Set Delimiter tags start with an equals sign and change the tag delimiters from `{{` and `}}` to custom strings. + +Consider the following contrived example: + +```html+erb +* {{ default_tags }} +{{=<% %>=}} +* <% erb_style_tags %> +<%={{ }}=%> +* {{ default_tags_again }} +``` + +Here we have a list with three items. The first item uses the default tag style, the second uses ERB style as defined by the Set Delimiter tag, and the third returns to the default style after yet another Set Delimiter declaration. + +According to [ctemplates](https://htmlpreview.github.io/?https://raw.githubusercontent.com/OlafvdSpek/ctemplate/master/doc/howto.html), this "is useful for languages like TeX, where double-braces may occur in the text and are awkward to use for markup." + +Custom delimiters may not contain whitespace or the equals sign. + +## Pre-parsing and Caching Templates + +By default, when mustache.js first parses a template it keeps the full parsed token tree in a cache. The next time it sees that same template it skips the parsing step and renders the template much more quickly. If you'd like, you can do this ahead of time using `mustache.parse`. + +```js +Mustache.parse(template); + +// Then, sometime later. +Mustache.render(template, view); +``` + +## Command line tool + +mustache.js is shipped with a Node.js based command line tool. It might be installed as a global tool on your computer to render a mustache template of some kind + +```bash +$ npm install -g mustache + +$ mustache dataView.json myTemplate.mustache > output.html +``` + +also supports stdin. + +```bash +$ cat dataView.json | mustache - myTemplate.mustache > output.html +``` + +or as a package.json `devDependency` in a build process maybe? + +```bash +$ npm install mustache --save-dev +``` + +```json +{ + "scripts": { + "build": "mustache dataView.json myTemplate.mustache > public/output.html" + } +} +``` +```bash +$ npm run build +``` + +The command line tool is basically a wrapper around `Mustache.render` so you get all the features. + +If your templates use partials you should pass paths to partials using `-p` flag: + +```bash +$ mustache -p path/to/partial1.mustache -p path/to/partial2.mustache dataView.json myTemplate.mustache +``` + +## Plugins for JavaScript Libraries + +mustache.js may be built specifically for several different client libraries, including the following: + + - [jQuery](http://jquery.com/) + - [MooTools](http://mootools.net/) + - [Dojo](http://www.dojotoolkit.org/) + - [YUI](http://developer.yahoo.com/yui/) + - [qooxdoo](http://qooxdoo.org/) + +These may be built using [Rake](http://rake.rubyforge.org/) and one of the following commands: +```bash +$ rake jquery +$ rake mootools +$ rake dojo +$ rake yui3 +$ rake qooxdoo +``` + +## TypeScript + +Since the source code of this package is written in JavaScript, we follow the [TypeScript publishing docs](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) preferred approach +by having type definitions available via [@types/mustache](https://www.npmjs.com/package/@types/mustache). + +## Testing + +In order to run the tests you'll need to install [Node.js](http://nodejs.org/). + +You also need to install the sub module containing [Mustache specifications](http://github.com/mustache/spec) in the project root. +```bash +$ git submodule init +$ git submodule update +``` +Install dependencies. +```bash +$ npm install +``` +Then run the tests. +```bash +$ npm test +``` +The test suite consists of both unit and integration tests. If a template isn't rendering correctly for you, you can make a test for it by doing the following: + + 1. Create a template file named `mytest.mustache` in the `test/_files` + directory. Replace `mytest` with the name of your test. + 2. Create a corresponding view file named `mytest.js` in the same directory. + This file should contain a JavaScript object literal enclosed in + parentheses. See any of the other view files for an example. + 3. Create a file with the expected output in `mytest.txt` in the same + directory. + +Then, you can run the test with: +```bash +$ TEST=mytest npm run test-render +``` + +### Browser tests + +Browser tests are not included in `npm test` as they run for too long, although they are ran automatically on Travis when merged into master. Run browser tests locally in any browser: +```bash +$ npm run test-browser-local +``` +then point your browser to `http://localhost:8080/__zuul` + +## Who uses mustache.js? + +An updated list of mustache.js users is kept [on the Github wiki](https://github.com/janl/mustache.js/wiki/Beard-Competition). Add yourself or your company if you use mustache.js! + +## Contributing + +mustache.js is a mature project, but it continues to actively invite maintainers. You can help out a high-profile project that is used in a lot of places on the web. No big commitment required, if all you do is review a single [Pull Request](https://github.com/janl/mustache.js/pulls), you are a maintainer. And a hero. + +### Your First Contribution + +- review a [Pull Request](https://github.com/janl/mustache.js/pulls) +- fix an [Issue](https://github.com/janl/mustache.js/issues) +- update the [documentation](https://github.com/janl/mustache.js#usage) +- make a website +- write a tutorial + +## Thanks + +mustache.js wouldn't kick ass if it weren't for these fine souls: + + * Chris Wanstrath / defunkt + * Alexander Lang / langalex + * Sebastian Cohnen / tisba + * J Chris Anderson / jchris + * Tom Robinson / tlrobinson + * Aaron Quint / quirkey + * Douglas Crockford + * Nikita Vasilyev / NV + * Elise Wood / glytch + * Damien Mathieu / dmathieu + * Jakub Kuźma / qoobaa + * Will Leinweber / will + * dpree + * Jason Smith / jhs + * Aaron Gibralter / agibralter + * Ross Boucher / boucher + * Matt Sanford / mzsanford + * Ben Cherry / bcherry + * Michael Jackson / mjackson + * Phillip Johnsen / phillipj + * David da Silva Contín / dasilvacontin diff --git a/node_modules/mustache/bin/mustache b/node_modules/mustache/bin/mustache new file mode 100755 index 00000000000..6db073f5dde --- /dev/null +++ b/node_modules/mustache/bin/mustache @@ -0,0 +1,150 @@ +#!/usr/bin/env node + +var fs = require('fs'), + path = require('path'); + +var Mustache = require('..'); +var pkg = require('../package'); +var partials = {}; + +var partialsPaths = []; +var partialArgIndex = -1; + +while ((partialArgIndex = process.argv.indexOf('-p')) > -1) { + partialsPaths.push(process.argv.splice(partialArgIndex, 2)[1]); +} + +var viewArg = process.argv[2]; +var templateArg = process.argv[3]; +var outputArg = process.argv[4]; + +if (hasVersionArg()) { + return console.log(pkg.version); +} + +if (!templateArg || !viewArg) { + console.error('Syntax: mustache