Add initial 11ty website structure
This commit is contained in:
1 parent
62b6bbdcbc
commit
80214bf42d
1378 files changed
+204162
No files matched your search
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Simeon Velichkov <simeonvelichkov@gmail.com>
|
||||
|
||||
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.
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
|
||||
# slugify
|
||||
|
||||
[![npm-version]][npm] [![coveralls-status]][coveralls]
|
||||
|
||||
```js
|
||||
var slugify = require('slugify')
|
||||
|
||||
slugify('some string') // some-string
|
||||
|
||||
// if you prefer something other than '-' as separator
|
||||
slugify('some string', '_') // some_string
|
||||
```
|
||||
|
||||
- Vanilla ES2015 JavaScript
|
||||
- If you need to use Slugify with older browsers, consider using [version 1.4.7](https://github.com/simov/slugify/releases/tag/v1.4.7)
|
||||
- No dependencies
|
||||
- Coerces foreign symbols to their English equivalent (check out the [charMap][charmap] for more details)
|
||||
- Works in the browser (window.slugify) and AMD/CommonJS-flavored module loaders
|
||||
|
||||
## Options
|
||||
|
||||
```js
|
||||
slugify('some string', {
|
||||
replacement: '-', // replace spaces with replacement character, defaults to `-`
|
||||
remove: undefined, // remove characters that match regex, defaults to `undefined`
|
||||
lower: false, // convert to lower case, defaults to `false`
|
||||
strict: false, // strip special characters except replacement, defaults to `false`
|
||||
locale: 'vi', // language code of the locale to use
|
||||
trim: true // trim leading and trailing replacement chars, defaults to `true`
|
||||
})
|
||||
```
|
||||
|
||||
## Remove
|
||||
|
||||
For example, to remove `*+~.()'"!:@` from the result slug, you can use `slugify('..', {remove: /[*+~.()'"!:@]/g})`.
|
||||
|
||||
* If the value of `remove` is a regular expression, it should be a
|
||||
[character class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes)
|
||||
and only a character class. It should also use the
|
||||
[global flag](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global).
|
||||
(For example: `/[*+~.()'"!:@]/g`.) Otherwise, the `remove` option might not
|
||||
work as expected.
|
||||
* If the value of `remove` is a string, it should be a single character.
|
||||
Otherwise, the `remove` option might not work as expected.
|
||||
|
||||
## Locales
|
||||
|
||||
The main `charmap.json` file contains all known characters and their transliteration. All new characters should be added there first. In case you stumble upon a character already set in `charmap.json`, but not transliterated correctly according to your language, then you have to add those characters in `locales.json` to override the already existing transliteration in `charmap.json`, but for your locale only.
|
||||
|
||||
You can get the correct language code of your language from [here](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
|
||||
|
||||
## Extend
|
||||
|
||||
Out of the box `slugify` comes with support for a handful of Unicode symbols. For example the `☢` (radioactive) symbol is not defined in the [`charMap`][charmap] and therefore it will be stripped by default:
|
||||
|
||||
```js
|
||||
slugify('unicode ♥ is ☢') // unicode-love-is
|
||||
```
|
||||
|
||||
However you can extend the supported symbols, or override the existing ones with your own:
|
||||
|
||||
```js
|
||||
slugify.extend({'☢': 'radioactive'})
|
||||
slugify('unicode ♥ is ☢') // unicode-love-is-radioactive
|
||||
```
|
||||
|
||||
Keep in mind that the `extend` method extends/overrides the default `charMap` for the entire process. In case you need a fresh instance of the slugify's `charMap` object you have to clean up the module cache first:
|
||||
|
||||
```js
|
||||
delete require.cache[require.resolve('slugify')]
|
||||
var slugify = require('slugify')
|
||||
```
|
||||
|
||||
## Contribute
|
||||
|
||||
1. Add chars to `charmap.json`
|
||||
2. Run tests `npm test`
|
||||
3. The tests will build the charmap in `index.js` and will sort the `charmap.json`
|
||||
4. Commit **all** modified files
|
||||
|
||||
---
|
||||
|
||||
> Originally this was a vanilla javascript port of [node-slug][node-slug].<br>
|
||||
> Note that the original [slug][slug] module has been ported to vanilla javascript too.
|
||||
|
||||
|
||||
[npm-version]: https://img.shields.io/npm/v/slugify.svg?style=flat-square (NPM Package Version)
|
||||
[coveralls-status]: https://img.shields.io/coveralls/simov/slugify.svg?style=flat-square (Test Coverage - Coveralls)
|
||||
|
||||
[npm]: https://www.npmjs.com/package/slugify
|
||||
[coveralls]: https://coveralls.io/r/simov/slugify?branch=master
|
||||
|
||||
[node-slug]: https://github.com/dodo/node-slug
|
||||
[slug]: https://www.npmjs.com/package/slug
|
||||
[unicode]: https://www.npmjs.com/package/unicode
|
||||
[index]: https://github.com/simov/slugify/blob/master/index.js
|
||||
[charmap]: https://github.com/simov/slugify/blob/master/config/charmap.json
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "slugify",
|
||||
"version": "1.6.9",
|
||||
"description": "Slugifies a String",
|
||||
"keywords": [
|
||||
"slugify",
|
||||
"slug",
|
||||
"url",
|
||||
"urlify"
|
||||
],
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/simov/slugify",
|
||||
"author": "Simeon Velichkov <simeonvelichkov@gmail.com> (https://simov.github.io)",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/simov/slugify.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^3.1.0",
|
||||
"github-changes": "^2.0.3",
|
||||
"mocha": "^7.2.0",
|
||||
"nyc": "^15.1.0"
|
||||
},
|
||||
"main": "./slugify.js",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"slugify.d.ts",
|
||||
"slugify.js"
|
||||
],
|
||||
"types": "slugify.d.ts",
|
||||
"scripts": {
|
||||
"build": "node bin/build",
|
||||
"build:changelog": "github-changes --owner simov --repository slugify --only-pulls --use-commit-body --date-format '(YYYY-MM-DD)' --file CHANGELOG.md --verbose",
|
||||
"test:ci": "npx mocha --recursive",
|
||||
"test:cov": "npx nyc --reporter=lcov --reporter=text-summary mocha -- --recursive",
|
||||
"test": "npm run build && npm run test:ci"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
declare namespace slugify {
|
||||
type ExtendArgs = {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export function extend (args: ExtendArgs): void;
|
||||
const _default: typeof slugify;
|
||||
export { _default as default };
|
||||
}
|
||||
|
||||
declare function slugify(
|
||||
string: string,
|
||||
options?:
|
||||
| {
|
||||
replacement?: string;
|
||||
remove?: RegExp;
|
||||
lower?: boolean;
|
||||
strict?: boolean;
|
||||
locale?: string;
|
||||
trim?: boolean;
|
||||
}
|
||||
| string,
|
||||
|
||||
): string;
|
||||
|
||||
export = slugify;
|
||||
export as namespace slugify;
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
|
||||
;(function (name, root, factory) {
|
||||
if (typeof exports === 'object') {
|
||||
module.exports = factory()
|
||||
module.exports['default'] = factory()
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
else if (typeof define === 'function' && define.amd) {
|
||||
define(factory)
|
||||
}
|
||||
else {
|
||||
root[name] = factory()
|
||||
}
|
||||
}('slugify', this, function () {
|
||||
var charMap = JSON.parse('{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","Ō":"O","ō":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ũ":"U","ũ":"u","Ū":"u","ū":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","Ə":"E","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Lj":"LJ","lj":"lj","Nj":"NJ","nj":"nj","Ș":"S","ș":"s","Ț":"T","ț":"t","ə":"e","˚":"o","Ά":"A","Έ":"E","Ή":"H","Ί":"I","Ό":"O","Ύ":"Y","Ώ":"W","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","έ":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","ς":"s","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ϊ":"i","ϋ":"y","ό":"o","ύ":"y","ώ":"w","Ё":"Yo","Ђ":"DJ","Є":"Ye","І":"I","Ї":"Yi","Ј":"J","Љ":"LJ","Њ":"NJ","Ћ":"C","Џ":"DZ","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"u","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","ё":"yo","ђ":"dj","є":"ye","і":"i","ї":"yi","ј":"j","љ":"lj","њ":"nj","ћ":"c","ѝ":"u","џ":"dz","Ґ":"G","ґ":"g","Ғ":"GH","ғ":"gh","Қ":"KH","қ":"kh","Ң":"NG","ң":"ng","Ү":"UE","ү":"ue","Ұ":"U","ұ":"u","Һ":"H","һ":"h","Ә":"AE","ә":"ae","Ө":"OE","ө":"oe","Ա":"A","Բ":"B","Գ":"G","Դ":"D","Ե":"E","Զ":"Z","Է":"E\'","Ը":"Y\'","Թ":"T\'","Ժ":"JH","Ի":"I","Լ":"L","Խ":"X","Ծ":"C\'","Կ":"K","Հ":"H","Ձ":"D\'","Ղ":"GH","Ճ":"TW","Մ":"M","Յ":"Y","Ն":"N","Շ":"SH","Չ":"CH","Պ":"P","Ջ":"J","Ռ":"R\'","Ս":"S","Վ":"V","Տ":"T","Ր":"R","Ց":"C","Փ":"P\'","Ք":"Q\'","Օ":"O\'\'","Ֆ":"F","և":"EV","ء":"a","آ":"aa","أ":"a","ؤ":"u","إ":"i","ئ":"e","ا":"a","ب":"b","ة":"h","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ى":"a","ي":"y","ً":"an","ٌ":"on","ٍ":"en","َ":"a","ُ":"u","ِ":"e","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","پ":"p","چ":"ch","ژ":"zh","ک":"k","گ":"g","ی":"y","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","฿":"baht","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"f","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","Ṣ":"S","ṣ":"s","Ẁ":"W","ẁ":"w","Ẃ":"W","ẃ":"w","Ẅ":"W","ẅ":"w","ẞ":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","ậ":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","Line truncated
|
||||
var locales = JSON.parse('{"bg":{"Й":"Y","Ц":"Ts","Щ":"Sht","Ъ":"A","Ь":"Y","й":"y","ц":"ts","щ":"sht","ъ":"a","ь":"y"},"de":{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue","ß":"ss","%":"prozent","&":"und","|":"oder","∑":"summe","∞":"unendlich","♥":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","¢":"centavos","£":"libras","¤":"moneda","₣":"francos","∑":"suma","∞":"infinito","♥":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","¢":"centime","£":"livre","¤":"devise","₣":"franc","∑":"somme","∞":"infini","♥":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","¢":"centavo","∑":"soma","£":"libra","∞":"infinito","♥":"amor"},"uk":{"И":"Y","и":"y","Й":"Y","й":"y","Ц":"Ts","ц":"ts","Х":"Kh","х":"kh","Щ":"Shch","щ":"shch","Г":"H","г":"h"},"vi":{"Đ":"D","đ":"d"},"da":{"Ø":"OE","ø":"oe","Å":"AA","å":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"større end"},"nb":{"&":"og","Å":"AA","Æ":"AE","Ø":"OE","å":"aa","æ":"ae","ø":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","Å":"AA","Ä":"AE","Ö":"OE","å":"aa","ä":"ae","ö":"oe"}}')
|
||||
|
||||
function replace (string, options) {
|
||||
if (typeof string !== 'string') {
|
||||
throw new Error('slugify: string argument expected')
|
||||
}
|
||||
|
||||
options = (typeof options === 'string')
|
||||
? {replacement: options}
|
||||
: options || {}
|
||||
|
||||
var locale = locales[options.locale] || {}
|
||||
|
||||
var replacement = options.replacement === undefined ? '-' : options.replacement
|
||||
|
||||
var trim = options.trim === undefined ? true : options.trim
|
||||
|
||||
var slug = string.normalize().split('')
|
||||
// replace characters based on charMap
|
||||
.reduce(function (result, ch) {
|
||||
var appendChar = locale[ch];
|
||||
if (appendChar === undefined) appendChar = charMap[ch];
|
||||
if (appendChar === undefined) appendChar = ch;
|
||||
if (appendChar === replacement) appendChar = ' ';
|
||||
return result + appendChar
|
||||
// remove not allowed characters
|
||||
.replace(options.remove || /[^\w\s$*_+~.()'"!\-:@]+/g, '')
|
||||
}, '');
|
||||
|
||||
if (options.strict) {
|
||||
slug = slug.replace(/[^A-Za-z0-9\s]/g, '');
|
||||
}
|
||||
|
||||
if (trim) {
|
||||
slug = slug.trim()
|
||||
}
|
||||
|
||||
// Replace spaces with replacement character, treating multiple consecutive
|
||||
// spaces as a single space.
|
||||
slug = slug.replace(/\s+/g, replacement);
|
||||
|
||||
if (options.lower) {
|
||||
slug = slug.toLowerCase()
|
||||
}
|
||||
|
||||
return slug
|
||||
}
|
||||
|
||||
replace.extend = function (customMap) {
|
||||
Object.assign(charMap, customMap)
|
||||
}
|
||||
|
||||
return replace
|
||||
}))
|
||||
Reference in new issue
Block a user