Skip to content

Commit

Permalink
Merge pull request #1 from camchenry/add-eleventy-site
Browse files Browse the repository at this point in the history
Merge to main
  • Loading branch information
camchenry authored Jul 7, 2022
2 parents 0f6e880 + 737c5b8 commit 191a67f
Show file tree
Hide file tree
Showing 11 changed files with 6,228 additions and 10 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Deploy to GitHub Pages

on: workflow_dispatch

jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- name: Build
run: "cd docs && npm run build"
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
publish_branch: docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ pnpm-lock.yaml
yarn.lock
.nyc_output
*.map
docs/_site
23 changes: 23 additions & 0 deletions docs/.eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = function (eleventyConfig) {
// Copy assets to the output directory as-is
eleventyConfig.addPassthroughCopy("img");
eleventyConfig.addPassthroughCopy("css");
eleventyConfig.addPassthroughCopy("js");
eleventyConfig.addPassthroughCopy("vendor");
eleventyConfig.addPassthroughCopy("favicon.ico");

return {
// Control which files Eleventy will process
// e.g.: *.md, *.njk, *.html, *.liquid
templateFormats: ["html", "njk"],
// Process .html files with nunjucks
htmlTemplateEngine: "njk",
// Path prefix for URLs
pathPrefix: "/",
// Config for input/output/data/etc. directories
dir: {
input: ".",
output: "_site",
},
};
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
permalink: '/development/benchmark.html'
---

<!DOCTYPE html>
<html>

Expand Down
4 changes: 4 additions & 0 deletions docs/development/index.html → docs/development/index.njk
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
permalink: '/development/index.html'
---

<!DOCTYPE html>
<html>

Expand Down
4 changes: 4 additions & 0 deletions docs/development/test.html → docs/development/test.njk
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
permalink: '/development/test.html'
---

<!DOCTYPE html>
<html>

Expand Down
24 changes: 14 additions & 10 deletions docs/documentation.html → docs/documentation.njk
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
permalink: '/documentation.html'
---

<!DOCTYPE html>
<html>

Expand Down Expand Up @@ -153,7 +157,7 @@ <h3 id="generating-a-parser-command-line">Command Line</h3>
<pre><code class="language-console">$ peggy arithmetics.pegjs</code></pre>

<p>This writes parser source code into a file with the same name as the grammar
file but with .js extension. You can also specify the output file
file but with &ldquo;.js&rdquo; extension. You can also specify the output file
explicitly:</p>

<pre><code class="language-console">$ peggy -o arithmetics-parser.js arithmetics.pegjs</code></pre>
Expand Down Expand Up @@ -558,16 +562,16 @@ <h2 id="grammar-syntax-and-semantics">Grammar Syntax and Semantics</h2>
first rule, which is also called the <em>start rule</em>.</p>

<p>A rule name must be a JavaScript identifier. It is followed by an equality
sign (“=”) and a parsing expression. If the rule has a human-readable name, it
sign (&ldquo;=&rdquo;) and a parsing expression. If the rule has a human-readable name, it
is written as a JavaScript string between the rule name and the equality sign.
Rules need to be separated only by whitespace (their beginning is easily
recognizable), but a semicolon (“;”) after the parsing expression is
recognizable), but a semicolon (&ldquo;;&rdquo;) after the parsing expression is
allowed.</p>

<p>The first rule can be preceded by a <em>global initializer</em> and/or a
<em>per-parse initializer</em>, in that order. Both are pieces of JavaScript
code in double curly braces (“{{” and “}}”) and single curly braces (“{” and
“}”) respectively. All variables and functions defined in both
code in double curly braces (&ldquo;{{'{{'}}&rdquo; and &ldquo;}}&rdquo;) and single curly braces (&ldquo;{&rdquo; and
&ldquo;}&rdquo;) respectively. All variables and functions defined in both
<em>initializers</em> are accessible in rule actions and semantic predicates.
Curly braces in both <em>initializers</em> code must be balanced.</p>
<p>The <em>global initializer</em> is executed once and only once, when the
Expand All @@ -584,7 +588,7 @@ <h2 id="grammar-syntax-and-semantics">Grammar Syntax and Semantics</h2>
<p>Let's look at the example grammar from above using a <em>global
initializer</em> and a <em>per-parse initializer</em>:</p>

<pre><code class="language-peggy">{{
<pre><code class="language-peggy">{{'{{'}}
function makeInteger(o) {
return parseInt(o.join(""), 10);
}
Expand Down Expand Up @@ -638,7 +642,7 @@ <h2 id="grammar-syntax-and-semantics">Grammar Syntax and Semantics</h2>
match result when parsing is successful.</p>

<p>One special case of parser expression is a <em>parser action</em> &mdash; a
piece of JavaScript code inside curly braces (“{” and “}”) that takes match
piece of JavaScript code inside curly braces (&ldquo;{&rdquo; and &ldquo;}&rdquo;) that takes match
results of some of the the preceding expressions and returns a JavaScript value.
This value is considered match result of the preceding expression (in other
words, the parser action is a match result transformer).</p>
Expand Down Expand Up @@ -717,9 +721,9 @@ <h3 id="grammar-syntax-and-semantics-parsing-expression-types">Parsing Expressio
<p>Match one character from a set and return it as a string. The characters
in the list can be escaped in exactly the same way as in JavaScript string.
The list of characters can also contain ranges (e.g. <code>[a-z]</code>
means all lowercase letters). Preceding the characters with <code>^</code>
inverts the matched set (e.g. <code>[^a-z]</code> means all character but
lowercase letters). Appending <code>i</code> right after the literal makes
means &ldquo;all lowercase letters&rdquo;). Preceding the characters with <code>^</code>
inverts the matched set (e.g. <code>[^a-z]</code> means &ldquo;all character but
lowercase letters&rdquo;). Appending <code>i</code> right after the literal makes
the match case-insensitive.</p>

<div class="example">
Expand Down
4 changes: 4 additions & 0 deletions docs/index.html → docs/index.njk
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
permalink: '/index.html'
---

<!DOCTYPE html>
<html>

Expand Down
3 changes: 3 additions & 0 deletions docs/online.html → docs/online.njk
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
permalink: "/online.html"
---
<!DOCTYPE html>
<html>

Expand Down
Loading

0 comments on commit 191a67f

Please sign in to comment.