Browse Source

Add template elements based on meta tags

Fixes #20.
master v2.5.0
F.W. Dekker 4 months ago
parent
commit
161a36b308
Signed by: FWDekker GPG Key ID: 78B3EAF58145AF25
  1. 264
      package-lock.json
  2. 10
      package.json
  3. 55
      src/main/js/main.js
  4. 24
      src/test/index.html

264
package-lock.json

@ -1,27 +1,27 @@
{
"name": "@fwdekker/template",
"version": "2.2.2",
"version": "2.5.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@fwdekker/template",
"version": "2.2.2",
"version": "2.5.0",
"license": "MIT",
"dependencies": {
"milligram": "^1.4.1",
"normalize.css": "^8.0.1"
},
"devDependencies": {
"grunt": "^1.4.0",
"grunt-cli": "^1.4.2",
"grunt": "^1.4.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-cssmin": "^4.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-focus": "^1.0.0",
"grunt-webpack": "^4.0.3",
"webpack": "^5.36.0",
"webpack-cli": "^4.6.0"
"webpack": "^5.38.1",
"webpack-cli": "^4.7.2"
}
},
"node_modules/@discoveryjs/json-ext": {
@ -218,9 +218,9 @@
}
},
"node_modules/@webpack-cli/configtest": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.0.2.tgz",
"integrity": "sha512-3OBzV2fBGZ5TBfdW50cha1lHDVf9vlvRXnjpVbJBa20pSZQaSkMJZiwA8V2vD9ogyeXn8nU5s5A6mHyf5jhMzA==",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.0.4.tgz",
"integrity": "sha512-cs3XLy+UcxiP6bj0A6u7MLLuwdXJ1c3Dtc0RkKg+wiI1g/Ti1om8+/2hc2A2B60NbBNAbMgyBMHvyymWm/j4wQ==",
"dev": true,
"peerDependencies": {
"webpack": "4.x.x || 5.x.x",
@ -228,9 +228,9 @@
}
},
"node_modules/@webpack-cli/info": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.2.3.tgz",
"integrity": "sha512-lLek3/T7u40lTqzCGpC6CAbY6+vXhdhmwFRxZLMnRm6/sIF/7qMpT8MocXCRQfz0JAh63wpbXLMnsQ5162WS7Q==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.3.0.tgz",
"integrity": "sha512-ASiVB3t9LOKHs5DyVUcxpraBXDOKubYu/ihHhU+t1UPpxsivg6Od2E2qU4gJCekfEddzRBzHhzA/Acyw/mlK/w==",
"dev": true,
"dependencies": {
"envinfo": "^7.7.3"
@ -240,9 +240,9 @@
}
},
"node_modules/@webpack-cli/serve": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.3.1.tgz",
"integrity": "sha512-0qXvpeYO6vaNoRBI52/UsbcaBydJCggoBBnIo/ovQQdn6fug0BgwsjorV1hVS7fMqGVTZGcVxv8334gjmbj5hw==",
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.5.1.tgz",
"integrity": "sha512-4vSVUiOPJLmr45S8rMGy7WDvpWxfFxfP/Qx/cxZFCfvoypTYpPPL1X8VIZMe0WTA+Jr7blUxwUSEZNkjoMTgSw==",
"dev": true,
"peerDependencies": {
"webpack-cli": "4.x.x"
@ -301,15 +301,6 @@
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
"dev": true
},
"node_modules/ansi-colors": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
"dev": true,
"engines": {
"node": ">=6"
}
},
"node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
@ -390,22 +381,26 @@
}
},
"node_modules/browserslist": {
"version": "4.16.3",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.3.tgz",
"integrity": "sha512-vIyhWmIkULaq04Gt93txdh+j02yX/JzlyhLYbV3YQCn/zvES3JnY7TifHHvvr1w5hTDluNKMkV05cs4vy8Q7sw==",
"version": "4.16.6",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz",
"integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==",
"dev": true,
"dependencies": {
"caniuse-lite": "^1.0.30001181",
"colorette": "^1.2.1",
"electron-to-chromium": "^1.3.649",
"caniuse-lite": "^1.0.30001219",
"colorette": "^1.2.2",
"electron-to-chromium": "^1.3.723",
"escalade": "^3.1.1",
"node-releases": "^1.1.70"
"node-releases": "^1.1.71"
},
"bin": {
"browserslist": "cli.js"
},
"engines": {
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/browserslist"
}
},
"node_modules/buffer-from": {
@ -431,10 +426,14 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001204",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001204.tgz",
"integrity": "sha512-JUdjWpcxfJ9IPamy2f5JaRDCaqJOxDzOSKtbdx4rH9VivMd1vIzoPumsJa9LoMIi4Fx2BV2KZOxWhNkBjaYivQ==",
"dev": true
"version": "1.0.30001235",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001235.tgz",
"integrity": "sha512-zWEwIVqnzPkSAXOUlQnPW2oKoYb2aLQ4Q5ejdjBcnH63rfypaW34CxaeBn1VMya2XaEU3P/R2qHpWyj+l0BT1A==",
"dev": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/browserslist"
}
},
"node_modules/chalk": {
"version": "4.1.0",
@ -601,9 +600,9 @@
"dev": true
},
"node_modules/electron-to-chromium": {
"version": "1.3.700",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.700.tgz",
"integrity": "sha512-wQtaxVZzpOeCjW1CGuC5W3bYjE2jglvk076LcTautBOB9UtHztty7wNzjVsndiMcSsdUsdMy5w76w5J1U7OPTQ==",
"version": "1.3.749",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.749.tgz",
"integrity": "sha512-F+v2zxZgw/fMwPz/VUGIggG4ZndDsYy0vlpthi3tjmDZlcfbhN5mYW0evXUsBr2sUtuDANFtle410A9u/sd/4A==",
"dev": true
},
"node_modules/enhanced-resolve": {
@ -619,18 +618,6 @@
"node": ">=10.13.0"
}
},
"node_modules/enquirer": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
"integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==",
"dev": true,
"dependencies": {
"ansi-colors": "^4.1.1"
},
"engines": {
"node": ">=8.6"
}
},
"node_modules/envinfo": {
"version": "7.8.1",
"resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz",
@ -1053,9 +1040,9 @@
"dev": true
},
"node_modules/grunt": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/grunt/-/grunt-1.4.0.tgz",
"integrity": "sha512-yRFc0GVCDu9yxqOFzpuXQ2pEdgtLDnFv5Qz54jfIcNnpJ8Z7B7P7kPkT4VMuRvm+N+QOsI8C4v/Q0DSaoj3LgQ==",
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/grunt/-/grunt-1.4.1.tgz",
"integrity": "sha512-ZXIYXTsAVrA7sM+jZxjQdrBOAg7DyMUplOMhTaspMRExei+fD0BTwdWXnn0W5SXqhb/Q/nlkzXclSi3IH55PIA==",
"dev": true,
"dependencies": {
"dateformat": "~3.0.3",
@ -1064,7 +1051,7 @@
"findup-sync": "~0.3.0",
"glob": "~7.1.6",
"grunt-cli": "~1.4.2",
"grunt-known-options": "~1.1.1",
"grunt-known-options": "~2.0.0",
"grunt-legacy-log": "~3.0.0",
"grunt-legacy-util": "~2.0.1",
"iconv-lite": "~0.4.13",
@ -1082,12 +1069,12 @@
}
},
"node_modules/grunt-cli": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.4.2.tgz",
"integrity": "sha512-wsu6BZh7KCnfeaSkDrKIAvOlqGKxNRTZjc8xfZlvxCByQIqUfZ31kh5uHpPnhQ4NdVgvaWaVxa1LUbVU80nACw==",
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.4.3.tgz",
"integrity": "sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ==",
"dev": true,
"dependencies": {
"grunt-known-options": "~1.1.1",
"grunt-known-options": "~2.0.0",
"interpret": "~1.1.0",
"liftup": "~3.0.1",
"nopt": "~4.0.1",
@ -1207,9 +1194,9 @@
}
},
"node_modules/grunt-known-options": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.1.tgz",
"integrity": "sha512-cHwsLqoighpu7TuYj5RonnEuxGVFnztcUqTqp5rXFGYL4OuPFofwC4Ycg7n9fYwvK6F5WbYgeVOwph9Crs2fsQ==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-2.0.0.tgz",
"integrity": "sha512-GD7cTz0I4SAede1/+pAbmJRG44zFLPipVtdL9o3vqx9IEyb7b4/Y3s7r6ofI3CchR5GvYJ+8buCSioDv5dQLiA==",
"dev": true,
"engines": {
"node": ">=0.10.0"
@ -2534,9 +2521,9 @@
"dev": true
},
"node_modules/watchpack": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.1.1.tgz",
"integrity": "sha512-Oo7LXCmc1eE1AjyuSBmtC3+Wy4HcV8PxWh2kP6fOl8yTlNS7r0K9l1ao2lrrUza7V39Y3D/BbJgY8VeSlc5JKw==",
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.2.0.tgz",
"integrity": "sha512-up4YAn/XHgZHIxFBVCdlMiWDj6WaLKpwVeGQk2I5thdYxF/KmF0aaz6TfJZ/hfl1h/XlcDr7k1KH7ThDagpFaA==",
"dev": true,
"dependencies": {
"glob-to-regexp": "^0.4.1",
@ -2547,9 +2534,9 @@
}
},
"node_modules/webpack": {
"version": "5.36.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.36.0.tgz",
"integrity": "sha512-HdOhLXClUEwTnzQnzpSG9iL00ej23ojvfnGpF49ba0MkuAT2q+WhQilHFFJHOIVRBqbzakQ1vCWQV2K+QLX0Qw==",
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.38.1.tgz",
"integrity": "sha512-OqRmYD1OJbHZph6RUMD93GcCZy4Z4wC0ele4FXyYF0J6AxO1vOSuIlU1hkS/lDlR9CDYBz64MZRmdbdnFFoT2g==",
"dev": true,
"dependencies": {
"@types/eslint-scope": "^3.7.0",
@ -2562,7 +2549,7 @@
"chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.8.0",
"es-module-lexer": "^0.4.0",
"eslint-scope": "^5.1.1",
"eslint-scope": "5.1.1",
"events": "^3.2.0",
"glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.2.4",
@ -2573,8 +2560,8 @@
"schema-utils": "^3.0.0",
"tapable": "^2.1.1",
"terser-webpack-plugin": "^5.1.1",
"watchpack": "^2.0.0",
"webpack-sources": "^2.1.1"
"watchpack": "^2.2.0",
"webpack-sources": "^2.3.0"
},
"bin": {
"webpack": "bin/webpack.js"
@ -2593,18 +2580,17 @@
}
},
"node_modules/webpack-cli": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.6.0.tgz",
"integrity": "sha512-9YV+qTcGMjQFiY7Nb1kmnupvb1x40lfpj8pwdO/bom+sQiP4OBMKjHq29YQrlDWDPZO9r/qWaRRywKaRDKqBTA==",
"version": "4.7.2",
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.7.2.tgz",
"integrity": "sha512-mEoLmnmOIZQNiRl0ebnjzQ74Hk0iKS5SiEEnpq3dRezoyR3yPaeQZCMCe+db4524pj1Pd5ghZXjT41KLzIhSLw==",
"dev": true,
"dependencies": {
"@discoveryjs/json-ext": "^0.5.0",
"@webpack-cli/configtest": "^1.0.2",
"@webpack-cli/info": "^1.2.3",
"@webpack-cli/serve": "^1.3.1",
"@webpack-cli/configtest": "^1.0.4",
"@webpack-cli/info": "^1.3.0",
"@webpack-cli/serve": "^1.5.1",
"colorette": "^1.2.1",
"commander": "^7.0.0",
"enquirer": "^2.3.6",
"execa": "^5.0.0",
"fastest-levenshtein": "^1.0.12",
"import-local": "^3.0.2",
@ -2681,9 +2667,9 @@
}
},
"node_modules/webpack-sources": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.2.0.tgz",
"integrity": "sha512-bQsA24JLwcnWGArOKUxYKhX3Mz/nK1Xf6hxullKERyktjNMC4x8koOeaDNTA2fEJ09BdWLbM/iTW0ithREUP0w==",
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.3.0.tgz",
"integrity": "sha512-WyOdtwSvOML1kbgtXbTDnEW0jkJ7hZr/bDByIwszhWd/4XX1A3XMkrbFMsuH4+/MfLlZCUzlAdg4r7jaGKEIgQ==",
"dev": true,
"dependencies": {
"source-list-map": "^2.0.1",
@ -2942,25 +2928,25 @@
}
},
"@webpack-cli/configtest": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.0.2.tgz",
"integrity": "sha512-3OBzV2fBGZ5TBfdW50cha1lHDVf9vlvRXnjpVbJBa20pSZQaSkMJZiwA8V2vD9ogyeXn8nU5s5A6mHyf5jhMzA==",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.0.4.tgz",
"integrity": "sha512-cs3XLy+UcxiP6bj0A6u7MLLuwdXJ1c3Dtc0RkKg+wiI1g/Ti1om8+/2hc2A2B60NbBNAbMgyBMHvyymWm/j4wQ==",
"dev": true,
"requires": {}
},
"@webpack-cli/info": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.2.3.tgz",
"integrity": "sha512-lLek3/T7u40lTqzCGpC6CAbY6+vXhdhmwFRxZLMnRm6/sIF/7qMpT8MocXCRQfz0JAh63wpbXLMnsQ5162WS7Q==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.3.0.tgz",
"integrity": "sha512-ASiVB3t9LOKHs5DyVUcxpraBXDOKubYu/ihHhU+t1UPpxsivg6Od2E2qU4gJCekfEddzRBzHhzA/Acyw/mlK/w==",
"dev": true,
"requires": {
"envinfo": "^7.7.3"
}
},
"@webpack-cli/serve": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.3.1.tgz",
"integrity": "sha512-0qXvpeYO6vaNoRBI52/UsbcaBydJCggoBBnIo/ovQQdn6fug0BgwsjorV1hVS7fMqGVTZGcVxv8334gjmbj5hw==",
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.5.1.tgz",
"integrity": "sha512-4vSVUiOPJLmr45S8rMGy7WDvpWxfFxfP/Qx/cxZFCfvoypTYpPPL1X8VIZMe0WTA+Jr7blUxwUSEZNkjoMTgSw==",
"dev": true,
"requires": {}
},
@ -3006,12 +2992,6 @@
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
"dev": true
},
"ansi-colors": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
"dev": true
},
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
@ -3085,16 +3065,16 @@
}
},
"browserslist": {
"version": "4.16.3",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.3.tgz",
"integrity": "sha512-vIyhWmIkULaq04Gt93txdh+j02yX/JzlyhLYbV3YQCn/zvES3JnY7TifHHvvr1w5hTDluNKMkV05cs4vy8Q7sw==",
"version": "4.16.6",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz",
"integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==",
"dev": true,
"requires": {
"caniuse-lite": "^1.0.30001181",
"colorette": "^1.2.1",
"electron-to-chromium": "^1.3.649",
"caniuse-lite": "^1.0.30001219",
"colorette": "^1.2.2",
"electron-to-chromium": "^1.3.723",
"escalade": "^3.1.1",
"node-releases": "^1.1.70"
"node-releases": "^1.1.71"
}
},
"buffer-from": {
@ -3120,9 +3100,9 @@
}
},
"caniuse-lite": {
"version": "1.0.30001204",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001204.tgz",
"integrity": "sha512-JUdjWpcxfJ9IPamy2f5JaRDCaqJOxDzOSKtbdx4rH9VivMd1vIzoPumsJa9LoMIi4Fx2BV2KZOxWhNkBjaYivQ==",
"version": "1.0.30001235",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001235.tgz",
"integrity": "sha512-zWEwIVqnzPkSAXOUlQnPW2oKoYb2aLQ4Q5ejdjBcnH63rfypaW34CxaeBn1VMya2XaEU3P/R2qHpWyj+l0BT1A==",
"dev": true
},
"chalk": {
@ -3259,9 +3239,9 @@
"dev": true
},
"electron-to-chromium": {
"version": "1.3.700",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.700.tgz",
"integrity": "sha512-wQtaxVZzpOeCjW1CGuC5W3bYjE2jglvk076LcTautBOB9UtHztty7wNzjVsndiMcSsdUsdMy5w76w5J1U7OPTQ==",
"version": "1.3.749",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.749.tgz",
"integrity": "sha512-F+v2zxZgw/fMwPz/VUGIggG4ZndDsYy0vlpthi3tjmDZlcfbhN5mYW0evXUsBr2sUtuDANFtle410A9u/sd/4A==",
"dev": true
},
"enhanced-resolve": {
@ -3274,15 +3254,6 @@
"tapable": "^2.2.0"
}
},
"enquirer": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
"integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==",
"dev": true,
"requires": {
"ansi-colors": "^4.1.1"
}
},
"envinfo": {
"version": "7.8.1",
"resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz",
@ -3615,9 +3586,9 @@
"dev": true
},
"grunt": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/grunt/-/grunt-1.4.0.tgz",
"integrity": "sha512-yRFc0GVCDu9yxqOFzpuXQ2pEdgtLDnFv5Qz54jfIcNnpJ8Z7B7P7kPkT4VMuRvm+N+QOsI8C4v/Q0DSaoj3LgQ==",
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/grunt/-/grunt-1.4.1.tgz",
"integrity": "sha512-ZXIYXTsAVrA7sM+jZxjQdrBOAg7DyMUplOMhTaspMRExei+fD0BTwdWXnn0W5SXqhb/Q/nlkzXclSi3IH55PIA==",
"dev": true,
"requires": {
"dateformat": "~3.0.3",
@ -3626,7 +3597,7 @@
"findup-sync": "~0.3.0",
"glob": "~7.1.6",
"grunt-cli": "~1.4.2",
"grunt-known-options": "~1.1.1",
"grunt-known-options": "~2.0.0",
"grunt-legacy-log": "~3.0.0",
"grunt-legacy-util": "~2.0.1",
"iconv-lite": "~0.4.13",
@ -3638,12 +3609,12 @@
}
},
"grunt-cli": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.4.2.tgz",
"integrity": "sha512-wsu6BZh7KCnfeaSkDrKIAvOlqGKxNRTZjc8xfZlvxCByQIqUfZ31kh5uHpPnhQ4NdVgvaWaVxa1LUbVU80nACw==",
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.4.3.tgz",
"integrity": "sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ==",
"dev": true,
"requires": {
"grunt-known-options": "~1.1.1",
"grunt-known-options": "~2.0.0",
"interpret": "~1.1.0",
"liftup": "~3.0.1",
"nopt": "~4.0.1",
@ -3742,9 +3713,9 @@
"dev": true
},
"grunt-known-options": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.1.tgz",
"integrity": "sha512-cHwsLqoighpu7TuYj5RonnEuxGVFnztcUqTqp5rXFGYL4OuPFofwC4Ycg7n9fYwvK6F5WbYgeVOwph9Crs2fsQ==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-2.0.0.tgz",
"integrity": "sha512-GD7cTz0I4SAede1/+pAbmJRG44zFLPipVtdL9o3vqx9IEyb7b4/Y3s7r6ofI3CchR5GvYJ+8buCSioDv5dQLiA==",
"dev": true
},
"grunt-legacy-log": {
@ -4788,9 +4759,9 @@
"dev": true
},
"watchpack": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.1.1.tgz",
"integrity": "sha512-Oo7LXCmc1eE1AjyuSBmtC3+Wy4HcV8PxWh2kP6fOl8yTlNS7r0K9l1ao2lrrUza7V39Y3D/BbJgY8VeSlc5JKw==",
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.2.0.tgz",
"integrity": "sha512-up4YAn/XHgZHIxFBVCdlMiWDj6WaLKpwVeGQk2I5thdYxF/KmF0aaz6TfJZ/hfl1h/XlcDr7k1KH7ThDagpFaA==",
"dev": true,
"requires": {
"glob-to-regexp": "^0.4.1",
@ -4798,9 +4769,9 @@
}
},
"webpack": {
"version": "5.36.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.36.0.tgz",
"integrity": "sha512-HdOhLXClUEwTnzQnzpSG9iL00ej23ojvfnGpF49ba0MkuAT2q+WhQilHFFJHOIVRBqbzakQ1vCWQV2K+QLX0Qw==",
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.38.1.tgz",
"integrity": "sha512-OqRmYD1OJbHZph6RUMD93GcCZy4Z4wC0ele4FXyYF0J6AxO1vOSuIlU1hkS/lDlR9CDYBz64MZRmdbdnFFoT2g==",
"dev": true,
"requires": {
"@types/eslint-scope": "^3.7.0",
@ -4813,7 +4784,7 @@
"chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.8.0",
"es-module-lexer": "^0.4.0",
"eslint-scope": "^5.1.1",
"eslint-scope": "5.1.1",
"events": "^3.2.0",
"glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.2.4",
@ -4824,23 +4795,22 @@
"schema-utils": "^3.0.0",
"tapable": "^2.1.1",
"terser-webpack-plugin": "^5.1.1",
"watchpack": "^2.0.0",
"webpack-sources": "^2.1.1"
"watchpack": "^2.2.0",
"webpack-sources": "^2.3.0"
}
},
"webpack-cli": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.6.0.tgz",
"integrity": "sha512-9YV+qTcGMjQFiY7Nb1kmnupvb1x40lfpj8pwdO/bom+sQiP4OBMKjHq29YQrlDWDPZO9r/qWaRRywKaRDKqBTA==",
"version": "4.7.2",
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.7.2.tgz",
"integrity": "sha512-mEoLmnmOIZQNiRl0ebnjzQ74Hk0iKS5SiEEnpq3dRezoyR3yPaeQZCMCe+db4524pj1Pd5ghZXjT41KLzIhSLw==",
"dev": true,
"requires": {
"@discoveryjs/json-ext": "^0.5.0",
"@webpack-cli/configtest": "^1.0.2",
"@webpack-cli/info": "^1.2.3",
"@webpack-cli/serve": "^1.3.1",
"@webpack-cli/configtest": "^1.0.4",
"@webpack-cli/info": "^1.3.0",
"@webpack-cli/serve": "^1.5.1",
"colorette": "^1.2.1",
"commander": "^7.0.0",
"enquirer": "^2.3.6",
"execa": "^5.0.0",
"fastest-levenshtein": "^1.0.12",
"import-local": "^3.0.2",
@ -4884,9 +4854,9 @@
}
},
"webpack-sources": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.2.0.tgz",
"integrity": "sha512-bQsA24JLwcnWGArOKUxYKhX3Mz/nK1Xf6hxullKERyktjNMC4x8koOeaDNTA2fEJ09BdWLbM/iTW0ithREUP0w==",
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.3.0.tgz",
"integrity": "sha512-WyOdtwSvOML1kbgtXbTDnEW0jkJ7hZr/bDByIwszhWd/4XX1A3XMkrbFMsuH4+/MfLlZCUzlAdg4r7jaGKEIgQ==",
"dev": true,
"requires": {
"source-list-map": "^2.0.1",

10
package.json

@ -1,6 +1,6 @@
{
"name": "@fwdekker/template",
"version": "2.4.1",
"version": "2.5.0",
"description": "The base template for pages on fwdekker.com.",
"author": "Felix W. Dekker",
"license": "MIT",
@ -28,14 +28,14 @@
"normalize.css": "^8.0.1"
},
"devDependencies": {
"grunt": "^1.4.0",
"grunt-cli": "^1.4.2",
"grunt": "^1.4.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-cssmin": "^4.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-focus": "^1.0.0",
"grunt-webpack": "^4.0.3",
"webpack": "^5.36.0",
"webpack-cli": "^4.6.0"
"webpack": "^5.38.1",
"webpack-cli": "^4.7.2"
}
}

55
src/main/js/main.js

@ -193,5 +193,60 @@ const footerLink = function(prefix, text, url, suffix) {
};
/**
* Runs the functions `nav`, `header`, and `footer` after the page has loaded using properties defined in the meta tags.
*
* The remaining functions are invoked only if the corresponding `target` meta property is set to select an existing
* element. The HTML element returned by the function is then added as a child to the element specified by the query
* selector in the `target` property. The parameters to the function invocation can be set using other meta properties.
* The format of meta properties is `fwd:<function>:<property>`, where `property` is the same as the name of the
* parameter of that function, except that instead of camelcase words are separated by dashes. For example, `vcsURL`
* becomes `vcs-url`.
*
* Meta properties can be set by including `<meta name="fwd:<function>:<property>" content="<value>" />` in the HTML
* page on which this module is included. The `<value>` is then passed without modification as a parameter to the
* function. Leaving out the `<value>` by writing `<meta name="fwd:<function>:property" />` instead results in passing
* `null` as the value. Not including the meta tag at all corresponds to passing `undefined` to the function. See the
* documentation of the respective functions for more details on the parameters that they accept.
*
* Note that the function is invoked only if `fwd:<function>:target` is a query selector for an existing element. This
* means that it is possible to mix how the functions are invoked; for example, one can use meta properties to pass
* parameters to `nav`, but also invoke `header` in a separate function manually.
*/
doAfterLoad(() => {
const getMetaProperty = (name) => {
const element = $(`meta[name="${name}"]`);
return element === null ? undefined : element.getAttribute("content");
};
const navTarget = $(getMetaProperty("fwd:nav:target"));
if (navTarget !== null) {
navTarget.appendChild(nav(getMetaProperty("fwd:nav:highlight-path")));
}
const headerTarget = $(getMetaProperty("fwd:header:target"));
if (headerTarget !== null) {
headerTarget.appendChild(header({
title: getMetaProperty("fwd:header:title"),
description: getMetaProperty("fwd:header:description"),
}));
}
const footerTarget = $(getMetaProperty("fwd:footer:target"));
if (footerTarget !== null) {
footerTarget.appendChild(footer({
author: getMetaProperty("fwd:footer:author"),
authorURL: getMetaProperty("fwd:footer:author-url"),
license: getMetaProperty("fwd:footer:license"),
licenseURL: getMetaProperty("fwd:footer:license-url"),
vcs: getMetaProperty("fwd:footer:vcs"),
vcsURL: getMetaProperty("fwd:footer:vcs-url"),
version: getMetaProperty("fwd:footer:version"),
privacyPolicyURL: getMetaProperty("fwd:footer:privacy-policy-url"),
}));
}
});
// Export to namespace
fwdekker = {stringToHtml, $, doAfterLoad, nav, header, footer};

24
src/test/index.html

@ -8,6 +8,15 @@
<meta name="description" content="A test page" />
<meta name="theme-color" content="#0033cc" />
<meta name="fwd:nav:target" content="#nav" />
<meta name="fwd:nav:highlight-path" content="/Tools/Dice/" />
<meta name="fwd:header:target" content="#header" />
<meta name="fwd:header:title" content="Test" />
<meta name="fwd:header:description" content="A test page" />
<meta name="fwd:footer:target" content="#footer" />
<meta name="fwd:footer:vcs-url" content="https://git.fwdekker.com/FWDekker/fwdekker-template/" />
<meta name="fwd:footer:version" content="vTEST" />
<title>Tools | FWDekker</title>
<link rel="stylesheet" href="https://static.fwdekker.com/fonts/roboto/roboto.css" />
@ -22,7 +31,7 @@
instructions on how to enable JavaScript in your web browser</a>.
</p>
</noscript>
<main class="hidden">
<main>
<div id="nav"></div>
<div id="contents">
<div id="header"></div>
@ -38,18 +47,5 @@
<!--suppress HtmlUnknownTarget -->
<script src="../../dist/template.js"></script>
<script>
const {$, doAfterLoad, footer, header, nav} = window.fwdekker;
doAfterLoad(() => {
$("#nav").appendChild(nav("/Tools/Dice/"));
$("#header").appendChild(header({title: "Test", description: "A test page"}));
$("#footer").appendChild(footer({
vcsURL: "https://git.fwdekker.com/FWDekker/fwdekker-template/",
version: "vTEST"
}));
$("main").classList.remove("hidden");
});
</script>
</body>
</html>

Loading…
Cancel
Save