Skip to content

Commit

Permalink
Integrate patternslib docs, add new collect:patternslibdocs run script
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTango committed Dec 2, 2020
1 parent e1876be commit 3525cf5
Show file tree
Hide file tree
Showing 9 changed files with 171 additions and 7 deletions.
23 changes: 22 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");

module.exports = function(eleventyConfig) {
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.addPlugin(syntaxHighlight);
//eleventyConfig.addPassthroughCopy({"src/pat": "pat"});
eleventyConfig.addPassthroughCopy({"favicon.ico": "favicon.ico"});
Expand All @@ -29,11 +30,31 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addCollection("patterns", function(collectionApi) {
return collectionApi.getFilteredByGlob("src/pat/**/README.md");
});
eleventyConfig.addCollection("plpatterns", function(collectionApi) {
return collectionApi.getFilteredByGlob("docs/patternslib/src/pat/**/*.md");
});

eleventyConfig.addLiquidFilter("replaceString", function(arg1, arg2, arg3) {
eleventyConfig.addFilter("replaceString", function(arg1, arg2, arg3) {
return arg1.replace(arg2, arg3);
});

eleventyConfig.addFilter('pageTitle', item => {
if (item.data.title && item.data.title !== '') {
return `${item.data.title}`;
}
let url_parts = item.data.page.filePathStem.split('/');
return url_parts[url_parts.length - 2];
});

eleventyConfig.addFilter('stringify', function(value) {
return JSON.stringify(value);
});

eleventyConfig.addFilter('slugFromUrl', item => {
let url_parts = item.url.split('/');
return url_parts[url_parts.length];
});

eleventyConfig["dir"] = {
input: "./",
ouput: "docs/_site",
Expand Down
1 change: 0 additions & 1 deletion .eleventyignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ mockup.egg-info/
mockup/
news/
.nix/
docs/
CONTRIBUTE
GETTING_STARTED
LEARN
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ stats.json
/mockup/coverage
/yarn-error.log
/stamp-npm
/docs/patternslib/src/
8 changes: 8 additions & 0 deletions docs/_includes/layout.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
}}</a>
</li>
{% endfor %}
<li>---</li>
{% for pattern in collections.plpatterns %}
<li class="">
<a class="menu-item" href="{{ pattern.url }}">{{
pattern | pageTitle
}}</a>
</li>
{% endfor %}
</ul>
</nav>

Expand Down
44 changes: 44 additions & 0 deletions docs/_includes/layout_patternslib.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Mockup docs</title>
<link rel="icon" type="image/png" href="/favicon.ico" />
<link rel="stylesheet" href="/dist/main.css" />
<link rel="stylesheet" href="/dist/prism-themes/themes/prism-atom-dark.css" />
<link rel="stylesheet" href="/dist/bootstrap/dist/css/bootstrap.min.css" />
<script type="text/javascript" src="/dist/bundle.js"></script>
<script type="module" src="/dist/fakeserver.js"></script>
</head>
<body>
<div id="main-wrapper">
<nav id="sidebar">
<ul class="menu">
<li class="">
<a class="" href="/">Home</a>
</li>
{% for pattern in collections.patterns %}
<li class="">
<a class="menu-item" href="{{ pattern.url }}">{{
pattern.data.title
}}</a>
</li>
{% endfor %}
<li>---</li>
{% for pattern in collections.plpatterns %}
<li class="">
<a class="menu-item" href="{{ pattern.url }}">{{
pattern | pageTitle
}}</a>
</li>
{% endfor %}
</ul>
</nav>

<main id="content">
<h1>{{ title }}</h1>
{{ content }}
</main>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions docs/patternslib/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = "layout_patternslib.liquid"
13 changes: 13 additions & 0 deletions docs/patternslib/patternslib.11tydata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
eleventyComputed: {
title: data => {
let url_parts = data.page.filePathStem.split('/');
return url_parts[url_parts.length - 2].replace('-', ' ').replace(/\w\S*/g, (w) => (w.replace(/^\w/, (c) => c.toUpperCase())));
},
permalink: data => {
let url_parts = data.page.filePathStem.split('/');
return `patternslib/${url_parts[url_parts.length - 2]}/`;
}
},
layout: "layout_patternslib.liquid"
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"bootstrap": "^5.0.0-alpha3",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^6.2.0",
"copyfiles": "^2.4.1",
"core-js": "3",
"css-loader": "^3.5.3",
"duplicate-package-checker-webpack-plugin": "^3.0.0",
Expand Down Expand Up @@ -114,7 +115,7 @@
"test": "jest --watch",
"testonce": "jest",
"postinstall": "patch --forward node_modules/select2/select2.js < patches/select2.patch || true",
"docs-collect-patterns": "#DEACTIVATED#copyup -V src/pat/**/README.md docs/",
"collect:patternslibdocs": "copyup -V node_modules/patternslib/src/pat/**/documentation.md docs/",
"start:webpack": "webpack-dev-server --config webpack.config.js --info-verbosity verbose --env.NODE_ENV=development",
"start:docs": "ELEVENTY_ENV=development npx @11ty/eleventy --serve --output docs/_site/",
"start": "npm-run-all clean --parallel start:*"
Expand Down
84 changes: 80 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2537,6 +2537,14 @@ cliui@^6.0.0:
strip-ansi "^6.0.0"
wrap-ansi "^6.2.0"

cliui@^7.0.2:
version "7.0.4"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f"
dependencies:
string-width "^4.2.0"
strip-ansi "^6.0.0"
wrap-ansi "^7.0.0"

co@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
Expand Down Expand Up @@ -2741,6 +2749,18 @@ copy-webpack-plugin@^6.2.0:
serialize-javascript "^5.0.1"
webpack-sources "^1.4.3"

copyfiles@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/copyfiles/-/copyfiles-2.4.1.tgz#d2dcff60aaad1015f09d0b66e7f0f1c5cd3c5da5"
dependencies:
glob "^7.0.5"
minimatch "^3.0.3"
mkdirp "^1.0.4"
noms "0.0.0"
through2 "^2.0.1"
untildify "^4.0.0"
yargs "^16.1.0"

core-js-compat@^3.6.2:
version "3.6.5"
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.5.tgz#2a51d9a4e25dfd6e690251aa81f99e3c05481f1c"
Expand Down Expand Up @@ -3553,6 +3573,10 @@ escalade@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.0.tgz#e8e2d7c7a8b76f6ee64c2181d6b8151441602d4e"

escalade@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"

escape-html@~1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
Expand Down Expand Up @@ -4136,7 +4160,7 @@ gensync@^1.0.0-beta.1:
version "1.0.0-beta.1"
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269"

get-caller-file@^2.0.1:
get-caller-file@^2.0.1, get-caller-file@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"

Expand Down Expand Up @@ -4195,7 +4219,7 @@ glob-parent@^5.0.0, glob-parent@^5.1.0, glob-parent@^5.1.1, glob-parent@~5.1.0:
dependencies:
is-glob "^4.0.1"

glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
version "7.1.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
dependencies:
Expand Down Expand Up @@ -5991,7 +6015,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"

minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4:
minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
dependencies:
Expand Down Expand Up @@ -6247,6 +6271,13 @@ node-releases@^1.1.61:
version "1.1.61"
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.61.tgz#707b0fca9ce4e11783612ba4a2fcba09047af16e"

noms@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/noms/-/noms-0.0.0.tgz#da8ebd9f3af9d6760919b27d9cdc8092a7332859"
dependencies:
inherits "^2.0.1"
readable-stream "~1.0.31"

nopt@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88"
Expand Down Expand Up @@ -7231,6 +7262,15 @@ readable-stream@^3.0.6, readable-stream@^3.6.0:
string_decoder "^1.1.1"
util-deprecate "^1.0.1"

readable-stream@~1.0.31:
version "1.0.34"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c"
dependencies:
core-util-is "~1.0.0"
inherits "~2.0.1"
isarray "0.0.1"
string_decoder "~0.10.x"

readdirp@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525"
Expand Down Expand Up @@ -8220,6 +8260,10 @@ string_decoder@^1.0.0, string_decoder@^1.1.1:
dependencies:
safe-buffer "~5.2.0"

string_decoder@~0.10.x:
version "0.10.31"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"

string_decoder@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
Expand Down Expand Up @@ -8412,7 +8456,7 @@ throat@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b"

through2@^2.0.0:
through2@^2.0.0, through2@^2.0.1:
version "2.0.5"
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd"
dependencies:
Expand Down Expand Up @@ -8709,6 +8753,10 @@ unset-value@^1.0.0:
has-value "^0.3.1"
isobject "^3.0.0"

untildify@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b"

upath@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894"
Expand Down Expand Up @@ -9102,6 +9150,14 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
Expand Down Expand Up @@ -9165,6 +9221,10 @@ y18n@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"

y18n@^5.0.5:
version "5.0.5"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.5.tgz#8769ec08d03b1ea2df2500acef561743bbb9ab18"

yallist@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
Expand Down Expand Up @@ -9198,6 +9258,10 @@ yargs-parser@^18.1.2, yargs-parser@^18.1.3:
camelcase "^5.0.0"
decamelize "^1.2.0"

yargs-parser@^20.2.2:
version "20.2.4"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54"

yargs@13.3.0:
version "13.3.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83"
Expand Down Expand Up @@ -9260,6 +9324,18 @@ yargs@^15.4.1:
y18n "^4.0.0"
yargs-parser "^18.1.2"

yargs@^16.1.0:
version "16.1.1"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.1.1.tgz#5a4a095bd1ca806b0a50d0c03611d38034d219a1"
dependencies:
cliui "^7.0.2"
escalade "^3.1.1"
get-caller-file "^2.0.5"
require-directory "^2.1.1"
string-width "^4.2.0"
y18n "^5.0.5"
yargs-parser "^20.2.2"

yargs@~3.10.0:
version "3.10.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1"
Expand Down

0 comments on commit 3525cf5

Please sign in to comment.