Generate (currently empty :( ) repository of Code de procédure pénale
This commit is contained in:
parent
c5537c1276
commit
7752259231
4 changed files with 542 additions and 15 deletions
262
package-lock.json
generated
262
package-lock.json
generated
|
@ -30,10 +30,12 @@
|
|||
"@types/morgan": "^1.9.4",
|
||||
"@types/object-hash": "^3.0.6",
|
||||
"@types/papaparse": "^5.3.7",
|
||||
"@types/slug": "^5.0.9",
|
||||
"augmented-data-viewer": "^0.6.4",
|
||||
"autoprefixer": "^10.4.7",
|
||||
"bits-ui": "^1.0.0-next.65",
|
||||
"clsx": "^2.1.1",
|
||||
"dedent-js": "^1.0.1",
|
||||
"dotenv": "^16.0.1",
|
||||
"eslint": "^9.10.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
|
@ -41,6 +43,7 @@
|
|||
"fs-extra": "^11.1.0",
|
||||
"globals": "^15.9.0",
|
||||
"iconify-icon": "^2.0.0",
|
||||
"isomorphic-git": "^1.27.2",
|
||||
"metslesliens": "git+https://git.en-root.org/eraviart/metslesliens.git",
|
||||
"morgan": "^1.10.0",
|
||||
"object-hash": "^3.0.0",
|
||||
|
@ -51,6 +54,7 @@
|
|||
"prettier-plugin-tailwindcss": "^0.6.5",
|
||||
"publint": "^0.2.11",
|
||||
"sade": "^1.8.1",
|
||||
"slug": "^10.0.0",
|
||||
"svelte": "^5.1.10",
|
||||
"svelte-check": "^4.0.2",
|
||||
"tailwind-merge": "^2.5.5",
|
||||
|
@ -1613,6 +1617,13 @@
|
|||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/slug": {
|
||||
"version": "5.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/slug/-/slug-5.0.9.tgz",
|
||||
"integrity": "sha512-6Yp8BSplP35Esa/wOG1wLNKiqXevpQTEF/RcL/NV6BBQaMmZh4YlDwCgrrFSoUE4xAGvnKd5c+lkQJmPrBAzfQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/tough-cookie": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz",
|
||||
|
@ -2042,6 +2053,13 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/async-lock": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/async-lock/-/async-lock-1.4.1.tgz",
|
||||
"integrity": "sha512-Az2ZTpuytrtqENulXwO3GGv1Bztugx6TT37NIo7imr/Qo0gsYiGtSdBa2B6fsXhTpVZDNfu1Qn3pk531e3q+nQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
|
@ -2394,6 +2412,13 @@
|
|||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/clean-git-ref": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/clean-git-ref/-/clean-git-ref-2.0.1.tgz",
|
||||
"integrity": "sha512-bLSptAy2P0s6hU4PzuIMKmMJJSE6gLXGH1cntDu7bWJUksvuM+7ReOK61mozULErYvP6a15rnYl0zFDef+pyPw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/clsx": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
||||
|
@ -2503,6 +2528,19 @@
|
|||
"url": "https://opencollective.com/core-js"
|
||||
}
|
||||
},
|
||||
"node_modules/crc-32": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
|
||||
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"crc32": "bin/crc32.njs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
|
@ -2628,6 +2666,22 @@
|
|||
"integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/decompress-response": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
|
||||
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mimic-response": "^3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/dedent-js": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dedent-js/-/dedent-js-1.0.1.tgz",
|
||||
|
@ -2760,6 +2814,13 @@
|
|||
"integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/diff3": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/diff3/-/diff3-0.0.3.tgz",
|
||||
"integrity": "sha512-iSq8ngPOt0K53A6eVr4d5Kn6GNrM2nQZtC740pzIriHtn4pOQ2lyzEXQMBeVcWERN0ye7fhBsk9PbLLQOnUx/g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/dlv": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
|
||||
|
@ -4399,6 +4460,43 @@
|
|||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/isomorphic-git": {
|
||||
"version": "1.27.2",
|
||||
"resolved": "https://registry.npmjs.org/isomorphic-git/-/isomorphic-git-1.27.2.tgz",
|
||||
"integrity": "sha512-nCiz+ieOkWb5kDJSSckDTiMjTcgkxqH2xuiQmw1Y6O/spwx4d6TKYSfGCd4f71HGvUYcRSUGqJEI+3uN6UQlOw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"async-lock": "^1.4.1",
|
||||
"clean-git-ref": "^2.0.1",
|
||||
"crc-32": "^1.2.0",
|
||||
"diff3": "0.0.3",
|
||||
"ignore": "^5.1.4",
|
||||
"minimisted": "^2.0.0",
|
||||
"pako": "^1.0.10",
|
||||
"path-browserify": "^1.0.1",
|
||||
"pify": "^4.0.1",
|
||||
"readable-stream": "^3.4.0",
|
||||
"sha.js": "^2.4.9",
|
||||
"simple-get": "^4.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"isogit": "cli.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/isomorphic-git/node_modules/pify": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
|
||||
"integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/jackspeak": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz",
|
||||
|
@ -4741,6 +4839,19 @@
|
|||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mimic-response": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
|
||||
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
|
@ -4754,6 +4865,26 @@
|
|||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/minimisted": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/minimisted/-/minimisted-2.0.1.tgz",
|
||||
"integrity": "sha512-1oPjfuLQa2caorJUM8HV8lGgWCc0qqAO1MNv/k05G4qslmsndV/5WdNZrqCiyqiz3wohia2Ij2B7w2Dr7/IyrA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.5"
|
||||
}
|
||||
},
|
||||
"node_modules/minipass": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
||||
|
@ -5366,6 +5497,13 @@
|
|||
"integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
|
||||
"license": "BlueOak-1.0.0"
|
||||
},
|
||||
"node_modules/pako": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
|
||||
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==",
|
||||
"dev": true,
|
||||
"license": "(MIT AND Zlib)"
|
||||
},
|
||||
"node_modules/papaparse": {
|
||||
"version": "5.4.1",
|
||||
"resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.4.1.tgz",
|
||||
|
@ -5409,6 +5547,13 @@
|
|||
"tslib": "^2.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/path-browserify": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz",
|
||||
"integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/path-exists": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||
|
@ -5918,6 +6063,21 @@
|
|||
"pify": "^2.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.2.tgz",
|
||||
|
@ -6182,6 +6342,20 @@
|
|||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/sha.js": {
|
||||
"version": "2.4.11",
|
||||
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
|
||||
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
|
||||
"dev": true,
|
||||
"license": "(MIT AND BSD-3-Clause)",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.1",
|
||||
"safe-buffer": "^5.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"sha.js": "bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
|
@ -6234,6 +6408,53 @@
|
|||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/simple-concat": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
|
||||
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/simple-get": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
|
||||
"integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"decompress-response": "^6.0.0",
|
||||
"once": "^1.3.1",
|
||||
"simple-concat": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sirv": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sirv/-/sirv-3.0.0.tgz",
|
||||
|
@ -6249,6 +6470,16 @@
|
|||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/slug": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/slug/-/slug-10.0.0.tgz",
|
||||
"integrity": "sha512-M8s2PWOUeSCdD4S1NH5lCzXg2zFV1fozrtfr0FSKl65x+EF1rUowj+/vyFlnHgxPxWzT+DL0VXKfYc1DHJoymg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"slug": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
|
@ -6278,6 +6509,37 @@
|
|||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/string_decoder/node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
|
||||
|
|
|
@ -67,10 +67,12 @@
|
|||
"@types/morgan": "^1.9.4",
|
||||
"@types/object-hash": "^3.0.6",
|
||||
"@types/papaparse": "^5.3.7",
|
||||
"@types/slug": "^5.0.9",
|
||||
"augmented-data-viewer": "^0.6.4",
|
||||
"autoprefixer": "^10.4.7",
|
||||
"bits-ui": "^1.0.0-next.65",
|
||||
"clsx": "^2.1.1",
|
||||
"dedent-js": "^1.0.1",
|
||||
"dotenv": "^16.0.1",
|
||||
"eslint": "^9.10.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
|
@ -78,6 +80,7 @@
|
|||
"fs-extra": "^11.1.0",
|
||||
"globals": "^15.9.0",
|
||||
"iconify-icon": "^2.0.0",
|
||||
"isomorphic-git": "^1.27.2",
|
||||
"metslesliens": "git+https://git.en-root.org/eraviart/metslesliens.git",
|
||||
"morgan": "^1.10.0",
|
||||
"object-hash": "^3.0.0",
|
||||
|
@ -88,6 +91,7 @@
|
|||
"prettier-plugin-tailwindcss": "^0.6.5",
|
||||
"publint": "^0.2.11",
|
||||
"sade": "^1.8.1",
|
||||
"slug": "^10.0.0",
|
||||
"svelte": "^5.1.10",
|
||||
"svelte-check": "^4.0.2",
|
||||
"tailwind-merge": "^2.5.5",
|
||||
|
|
36
src/lib/strings.ts
Normal file
36
src/lib/strings.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
import originalSlugify from "slug"
|
||||
|
||||
export const diacritiquesMinuscule: { [letter: string]: string } = {
|
||||
ae: "(ae|æ)",
|
||||
oe: "(oe|œ)",
|
||||
a: "(a|â|ä|à)",
|
||||
c: "(c|ç)",
|
||||
e: "(e|é|ê|ë|è)",
|
||||
i: "(i|î|ï)",
|
||||
o: "(o|ô|ö)",
|
||||
u: "(u|û|ü|ù)",
|
||||
y: "(y|ÿ)",
|
||||
"'": "('|‘|’)",
|
||||
"‘": "(‘|'|’)",
|
||||
"’": "(’|'|‘)",
|
||||
}
|
||||
|
||||
const slugifyCharmap = {
|
||||
...originalSlugify.defaults.charmap,
|
||||
"'": " ",
|
||||
"@": " ",
|
||||
".": " ",
|
||||
}
|
||||
|
||||
export function slugify(string: string, replacement?: string | null) {
|
||||
const options: {
|
||||
charmap: { [character: string]: string }
|
||||
mode: string
|
||||
replacement: string
|
||||
} = {
|
||||
charmap: slugifyCharmap,
|
||||
mode: "rfc3986",
|
||||
replacement: replacement || "-",
|
||||
}
|
||||
return originalSlugify(string, options)
|
||||
}
|
|
@ -1,4 +1,8 @@
|
|||
import assert from "assert"
|
||||
import dedent from "dedent-js"
|
||||
import fs from "fs-extra"
|
||||
import git from "isomorphic-git"
|
||||
import path from "path"
|
||||
import sade from "sade"
|
||||
|
||||
import type { JorfArticle, JorfTexteVersion } from "$lib/legal/jorf"
|
||||
|
@ -13,11 +17,13 @@ import type {
|
|||
} from "$lib/legal/legi"
|
||||
import type { ArticleLienDb, TexteVersionLienDb } from "$lib/legal/shared"
|
||||
import { db } from "$lib/server/databases"
|
||||
import { slugify } from "$lib/strings"
|
||||
|
||||
type Action = "CREATE" | "DELETE"
|
||||
|
||||
interface Context {
|
||||
articleById: Record<string, JorfArticle | LegiArticle>
|
||||
currentInternalIds: Set<string>
|
||||
infosArticleModificateurById: Record<
|
||||
string,
|
||||
Record<Action, string | undefined>
|
||||
|
@ -25,6 +31,7 @@ interface Context {
|
|||
infosTexteModificateurById: Record<string, Record<Action, string | undefined>>
|
||||
legiTexteInternalIds: Set<string>
|
||||
sectionTaById: Record<string, LegiSectionTa>
|
||||
targetDir: string
|
||||
texteManquantById: Record<string, TexteManquant>
|
||||
texteVersionById: Record<string, JorfTexteVersion | LegiTexteVersion | null>
|
||||
}
|
||||
|
@ -699,10 +706,12 @@ async function exportLegiTexteToMarkdown(
|
|||
): Promise<void> {
|
||||
const context: Context = {
|
||||
articleById: {},
|
||||
currentInternalIds: new Set(),
|
||||
infosArticleModificateurById: {},
|
||||
infosTexteModificateurById: {},
|
||||
legiTexteInternalIds: new Set(),
|
||||
sectionTaById: {},
|
||||
targetDir,
|
||||
texteManquantById: {},
|
||||
texteVersionById: {},
|
||||
}
|
||||
|
@ -791,6 +800,8 @@ async function exportLegiTexteToMarkdown(
|
|||
}
|
||||
}
|
||||
|
||||
// Sort of textes modificateurs by date
|
||||
|
||||
const textesModificateursIds = new Set<string>()
|
||||
for (const infosTexteModificateur of Object.values(
|
||||
context.infosTexteModificateurById,
|
||||
|
@ -829,6 +840,45 @@ async function exportLegiTexteToMarkdown(
|
|||
textesModificateursId.push(texteModificateurId)
|
||||
}
|
||||
|
||||
// Generation of Git repository
|
||||
|
||||
await fs.remove(targetDir)
|
||||
await fs.mkdir(targetDir, { recursive: true })
|
||||
await git.init({
|
||||
defaultBranch: "main",
|
||||
dir: targetDir,
|
||||
fs,
|
||||
})
|
||||
|
||||
const codeTitle =
|
||||
texteVersion.META.META_SPEC.META_TEXTE_VERSION.TITREFULL ??
|
||||
texteVersion.META.META_SPEC.META_TEXTE_VERSION.TITRE ??
|
||||
texteVersion.META.META_COMMUN.ID
|
||||
const codeDirName = slugify(codeTitle, "_")
|
||||
const codeRepositoryRelativeDir = codeDirName
|
||||
await fs.writeFile(
|
||||
path.join(targetDir, "README.md"),
|
||||
dedent`
|
||||
# Codes juridiques en Git et Markdown
|
||||
|
||||
- [${codeTitle}](${codeDirName})
|
||||
`,
|
||||
)
|
||||
await git.add({
|
||||
dir: targetDir,
|
||||
filepath: "README.md",
|
||||
fs,
|
||||
})
|
||||
await git.commit({
|
||||
dir: targetDir,
|
||||
fs,
|
||||
author: {
|
||||
email: "codes_juridiques@tricoteuses.fr",
|
||||
name: "République française",
|
||||
},
|
||||
message: "Création du README.md",
|
||||
})
|
||||
|
||||
for (const [date, textesModificateursId] of Object.entries(
|
||||
textesModificateursIdByDate,
|
||||
).toSorted(([date1], [date2]) => date1.localeCompare(date2))) {
|
||||
|
@ -840,16 +890,180 @@ async function exportLegiTexteToMarkdown(
|
|||
| TexteManquant = context.texteManquantById[
|
||||
texteModificateurId
|
||||
] as TexteManquant
|
||||
let texteModificateurTitle: string
|
||||
if (texteVersionModificateur === undefined) {
|
||||
texteVersionModificateur = (await getOrLoadTexteVersion(
|
||||
context,
|
||||
texteModificateurId,
|
||||
)) as JorfTexteVersion | LegiTexteVersion
|
||||
console.log(
|
||||
` ${texteModificateurId} ${texteVersionModificateur.META.META_SPEC.META_TEXTE_VERSION.TITREFULL}`,
|
||||
)
|
||||
texteModificateurTitle =
|
||||
texteVersionModificateur.META.META_SPEC.META_TEXTE_VERSION
|
||||
.TITREFULL ??
|
||||
texteVersionModificateur.META.META_SPEC.META_TEXTE_VERSION.TITRE ??
|
||||
texteVersionModificateur.META.META_COMMUN.ID
|
||||
} else {
|
||||
console.log(` ${texteModificateurId} !!! Texte non trouvé !!!`)
|
||||
texteModificateurTitle = "!!! Texte non trouvé !!!"
|
||||
}
|
||||
console.log(` ${texteModificateurId} ${texteModificateurTitle}`)
|
||||
|
||||
await generateGitDirectory(
|
||||
context,
|
||||
2,
|
||||
codeTitle,
|
||||
liensArticles,
|
||||
textelrStructure?.LIEN_SECTION_TA,
|
||||
codeRepositoryRelativeDir,
|
||||
texteModificateurId,
|
||||
)
|
||||
await git.commit({
|
||||
dir: targetDir,
|
||||
fs,
|
||||
author: {
|
||||
email: "codes_juridiques@tricoteuses.fr",
|
||||
name: "République française",
|
||||
},
|
||||
message: texteModificateurTitle,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function generateGitDirectory(
|
||||
context: Context,
|
||||
depth: number,
|
||||
title: string,
|
||||
liensArticles: LegiSectionTaLienArt[] | undefined,
|
||||
liensSectionTa: LegiSectionTaLienSectionTa[] | undefined,
|
||||
repositoryRelativeDir: string,
|
||||
texteModificateurId: string,
|
||||
) {
|
||||
await fs.ensureDir(path.join(context.targetDir, repositoryRelativeDir))
|
||||
const readmeLinks: Array<{ href: string; title: string }> = []
|
||||
|
||||
if (liensArticles !== undefined) {
|
||||
for (const lienArticle of liensArticles) {
|
||||
const articleId = lienArticle["@id"]
|
||||
const article = (await getOrLoadArticle(
|
||||
context,
|
||||
articleId,
|
||||
)) as LegiArticle
|
||||
const articleTitle = `Article ${article.META.META_SPEC.META_ARTICLE.NUM ?? articleId}`
|
||||
const articleFilename = `${slugify(articleTitle, "_")}.md`
|
||||
const articleRepositoryRelativeFilePath = path.join(
|
||||
repositoryRelativeDir,
|
||||
articleFilename,
|
||||
)
|
||||
const infosTextModificateur =
|
||||
context.infosTexteModificateurById[articleId]
|
||||
if (context.currentInternalIds.has(articleId)) {
|
||||
if (infosTextModificateur.DELETE === texteModificateurId) {
|
||||
await fs.remove(
|
||||
path.join(context.targetDir, articleRepositoryRelativeFilePath),
|
||||
)
|
||||
context.currentInternalIds.delete(articleId)
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
if (infosTextModificateur.CREATE === texteModificateurId) {
|
||||
context.currentInternalIds.add(articleId)
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
await fs.writeFile(
|
||||
path.join(context.targetDir, articleRepositoryRelativeFilePath),
|
||||
dedent`
|
||||
###### ${articleTitle}
|
||||
|
||||
${article.BLOC_TEXTUEL?.CONTENU}
|
||||
`,
|
||||
)
|
||||
await git.add({
|
||||
dir: context.targetDir,
|
||||
filepath: articleRepositoryRelativeFilePath,
|
||||
fs,
|
||||
})
|
||||
readmeLinks.push({ href: articleFilename, title: articleTitle })
|
||||
}
|
||||
}
|
||||
|
||||
if (liensSectionTa !== undefined) {
|
||||
for (const lienSectionTa of liensSectionTa) {
|
||||
const sectionTaId = lienSectionTa["@id"]
|
||||
const sectionTa = (await getOrLoadSectionTa(
|
||||
context,
|
||||
sectionTaId,
|
||||
)) as LegiSectionTa
|
||||
const sectionTaTitle =
|
||||
sectionTa.TITRE_TA?.split(":")[0].trim() ?? sectionTaId
|
||||
const sectionTaDirName = slugify(sectionTaTitle, "_")
|
||||
const sectionTaRepositoryRelativeDir = path.join(
|
||||
repositoryRelativeDir,
|
||||
sectionTaDirName,
|
||||
)
|
||||
const infosTextModificateur =
|
||||
context.infosTexteModificateurById[sectionTaId]
|
||||
if (context.currentInternalIds.has(sectionTaId)) {
|
||||
if (infosTextModificateur.DELETE === texteModificateurId) {
|
||||
await fs.remove(
|
||||
path.join(context.targetDir, sectionTaRepositoryRelativeDir),
|
||||
)
|
||||
context.currentInternalIds.delete(sectionTaId)
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
if (infosTextModificateur.CREATE === texteModificateurId) {
|
||||
context.currentInternalIds.add(sectionTaId)
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
readmeLinks.push({ href: sectionTaDirName, title: sectionTaTitle })
|
||||
}
|
||||
}
|
||||
|
||||
const readmeRepositoryRelativeFilePath = path.join(
|
||||
repositoryRelativeDir,
|
||||
"README.md",
|
||||
)
|
||||
await fs.writeFile(
|
||||
path.join(context.targetDir, readmeRepositoryRelativeFilePath),
|
||||
dedent`
|
||||
${"#".repeat(Math.min(depth, 6))} ${title}
|
||||
|
||||
${readmeLinks.map(({ href, title }) => `- [${title}](${href})`).join("\n")}
|
||||
`,
|
||||
)
|
||||
await git.add({
|
||||
dir: context.targetDir,
|
||||
filepath: readmeRepositoryRelativeFilePath,
|
||||
fs,
|
||||
})
|
||||
|
||||
if (liensSectionTa !== undefined) {
|
||||
for (const lienSectionTa of liensSectionTa) {
|
||||
const sectionTaId = lienSectionTa["@id"]
|
||||
if (context.currentInternalIds.has(sectionTaId)) {
|
||||
const sectionTa = (await getOrLoadSectionTa(
|
||||
context,
|
||||
sectionTaId,
|
||||
)) as LegiSectionTa
|
||||
const sectionTaTitle =
|
||||
sectionTa.TITRE_TA?.split(":")[0].trim() ?? sectionTaId
|
||||
const sectionTaDirName = slugify(sectionTaTitle, "_")
|
||||
const sectionTaRepositoryRelativeDir = path.join(
|
||||
repositoryRelativeDir,
|
||||
sectionTaDirName,
|
||||
)
|
||||
await generateGitDirectory(
|
||||
context,
|
||||
depth + 1,
|
||||
sectionTaTitle,
|
||||
sectionTa?.STRUCTURE_TA?.LIEN_ART,
|
||||
sectionTa?.STRUCTURE_TA?.LIEN_SECTION_TA,
|
||||
sectionTaRepositoryRelativeDir,
|
||||
texteModificateurId,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -872,6 +1086,23 @@ async function getOrLoadArticle(
|
|||
return article
|
||||
}
|
||||
|
||||
async function getOrLoadSectionTa(
|
||||
context: Context,
|
||||
sectionTaId: string,
|
||||
): Promise<LegiSectionTa> {
|
||||
let sectionTa = context.sectionTaById[sectionTaId]
|
||||
if (sectionTa === undefined) {
|
||||
sectionTa = (
|
||||
await db<{ data: LegiSectionTa }[]>`
|
||||
SELECT data FROM section_ta WHERE id = ${sectionTaId}
|
||||
`
|
||||
)[0]?.data
|
||||
assert.notStrictEqual(sectionTa, undefined)
|
||||
context.sectionTaById[sectionTaId] = sectionTa
|
||||
}
|
||||
return sectionTa
|
||||
}
|
||||
|
||||
async function getOrLoadTexteVersion(
|
||||
context: Context,
|
||||
texteId: string,
|
||||
|
@ -908,17 +1139,11 @@ async function* walkStructureTree(
|
|||
const liensSectionTa = structure?.LIEN_SECTION_TA
|
||||
if (liensSectionTa !== undefined) {
|
||||
for (const lienSectionTa of liensSectionTa) {
|
||||
let childSectionTa = context.sectionTaById[lienSectionTa["@id"]]
|
||||
if (childSectionTa === undefined) {
|
||||
childSectionTa = (
|
||||
await db<{ data: LegiSectionTa }[]>`
|
||||
SELECT data FROM section_ta WHERE id = ${lienSectionTa["@id"]}
|
||||
`
|
||||
)[0]?.data
|
||||
assert.notStrictEqual(childSectionTa, undefined)
|
||||
context.sectionTaById[lienSectionTa["@id"]] = childSectionTa
|
||||
context.legiTexteInternalIds.add(lienSectionTa["@id"])
|
||||
}
|
||||
const childSectionTa = await getOrLoadSectionTa(
|
||||
context,
|
||||
lienSectionTa["@id"],
|
||||
)
|
||||
context.legiTexteInternalIds.add(lienSectionTa["@id"])
|
||||
yield { lienSectionTa, parentsSectionTa, sectionTa: childSectionTa }
|
||||
const childStructure = childSectionTa.STRUCTURE_TA
|
||||
if (childStructure !== undefined) {
|
||||
|
|
Loading…
Add table
Reference in a new issue