@tricoteuses/tisseuse 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +22 -0
- package/README.md +5 -0
- package/dist/index.js +707 -0
- package/dist/lib/asserts.d.ts +1 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/numbers.d.ts +6 -0
- package/dist/lib/server/auditors/config.d.ts +4 -0
- package/dist/lib/server/config.d.ts +18 -0
- package/dist/lib/server/databases/index.d.ts +10 -0
- package/dist/lib/server/text_links.d.ts +46 -0
- package/dist/lib/server/text_links.test.d.ts +1 -0
- package/dist/lib/server/text_parsers/transformers.d.ts +3 -0
- package/dist/lib/strings.d.ts +1 -0
- package/dist/lib/text_parsers/actions.d.ts +1 -0
- package/dist/lib/text_parsers/actions.test.d.ts +1 -0
- package/dist/lib/text_parsers/articles.d.ts +53 -0
- package/dist/lib/text_parsers/articles.test.d.ts +1 -0
- package/dist/lib/text_parsers/ast.d.ts +136 -0
- package/dist/lib/text_parsers/citations.d.ts +7 -0
- package/dist/lib/text_parsers/citations.test.d.ts +1 -0
- package/dist/lib/text_parsers/dates.d.ts +6 -0
- package/dist/lib/text_parsers/dates.test.d.ts +1 -0
- package/dist/lib/text_parsers/divisions.d.ts +29 -0
- package/dist/lib/text_parsers/divisions.test.d.ts +1 -0
- package/dist/lib/text_parsers/helpers.d.ts +10 -0
- package/dist/lib/text_parsers/index.d.ts +4 -0
- package/dist/lib/text_parsers/index.test.d.ts +1 -0
- package/dist/lib/text_parsers/numbers.d.ts +17 -0
- package/dist/lib/text_parsers/numbers.test.d.ts +1 -0
- package/dist/lib/text_parsers/parsers.d.ts +51 -0
- package/dist/lib/text_parsers/parsers.test.d.ts +1 -0
- package/dist/lib/text_parsers/portions.d.ts +53 -0
- package/dist/lib/text_parsers/portions.test.d.ts +1 -0
- package/dist/lib/text_parsers/positions.d.ts +4 -0
- package/dist/lib/text_parsers/prepositions.d.ts +6 -0
- package/dist/lib/text_parsers/prepositions.test.d.ts +1 -0
- package/dist/lib/text_parsers/references.d.ts +13 -0
- package/dist/lib/text_parsers/references.test.d.ts +1 -0
- package/dist/lib/text_parsers/relative_locations.d.ts +9 -0
- package/dist/lib/text_parsers/relative_locations.test.d.ts +1 -0
- package/dist/lib/text_parsers/separators.d.ts +7 -0
- package/dist/lib/text_parsers/simplifiers.d.ts +13 -0
- package/dist/lib/text_parsers/simplifiers.test.d.ts +1 -0
- package/dist/lib/text_parsers/texts.d.ts +42 -0
- package/dist/lib/text_parsers/texts.test.d.ts +1 -0
- package/dist/lib/text_parsers/transformers.d.ts +53 -0
- package/dist/lib/text_parsers/typography.d.ts +9 -0
- package/dist/lib/text_parsers/typography.test.d.ts +1 -0
- package/dist/scripts/add_links_to_html_document.d.ts +1 -0
- package/dist/scripts/add_references_to_html_document.d.ts +6 -0
- package/dist/scripts/extract_texts_infos.d.ts +1 -0
- package/dist/scripts/extract_texts_titles_infos.d.ts +1 -0
- package/dist/scripts/html_document_to_text.d.ts +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { TextPosition } from './positions.js';
|
|
2
|
+
export interface FragmentReverseTransformation {
|
|
3
|
+
innerPrefix?: string;
|
|
4
|
+
innerSuffix?: string;
|
|
5
|
+
outerPrefix?: string;
|
|
6
|
+
outerSuffix?: string;
|
|
7
|
+
position: TextPosition;
|
|
8
|
+
}
|
|
9
|
+
export interface SourceMapSegment {
|
|
10
|
+
inputIndex: number;
|
|
11
|
+
inputLength: number;
|
|
12
|
+
matchingSegmentIndex?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Added only by `convertHtmlElementsToText`
|
|
15
|
+
*
|
|
16
|
+
* It allows `iterOriginalMergedPositionsFromTransformed` function
|
|
17
|
+
* to reorganize HTML elements.
|
|
18
|
+
*/
|
|
19
|
+
openingTag?: string;
|
|
20
|
+
outputIndex: number;
|
|
21
|
+
outputLength: number;
|
|
22
|
+
}
|
|
23
|
+
export type Transformation = TransformationLeaf | TransformationNode;
|
|
24
|
+
export interface TransformationLeaf {
|
|
25
|
+
input: string;
|
|
26
|
+
output: string;
|
|
27
|
+
sourceMap: SourceMapSegment[];
|
|
28
|
+
title: string;
|
|
29
|
+
}
|
|
30
|
+
export interface TransformationNode {
|
|
31
|
+
input: string;
|
|
32
|
+
output: string;
|
|
33
|
+
transformations: Transformation[];
|
|
34
|
+
title: string;
|
|
35
|
+
}
|
|
36
|
+
export type Transformer = (text: string) => Transformation;
|
|
37
|
+
export type TransformerLeaf = (text: string) => TransformationLeaf;
|
|
38
|
+
export type TransformerNode = (text: string) => TransformationNode;
|
|
39
|
+
export declare const tagRegExp: RegExp;
|
|
40
|
+
export declare function chainTransformers(title: string, transformers: Array<Transformer>): TransformerNode;
|
|
41
|
+
/**
|
|
42
|
+
* Caution: This iterator fails when successive original positions overlap.
|
|
43
|
+
*/
|
|
44
|
+
export declare function iterOriginalMergedPositionsFromTransformed(transformation: Transformation): Generator<FragmentReverseTransformation, void, TextPosition | undefined>;
|
|
45
|
+
/**
|
|
46
|
+
* Caution: This iterator fails when successive original positions overlap.
|
|
47
|
+
*/
|
|
48
|
+
export declare function originalMergedPositionsFromTransformed(transformation: Transformation, transformedPositions: TextPosition[]): FragmentReverseTransformation[];
|
|
49
|
+
/**
|
|
50
|
+
* Note: The original positions are split when they overlap.
|
|
51
|
+
* So, there may be more original positions than transformed positions.
|
|
52
|
+
*/
|
|
53
|
+
export declare function originalSplitPositionsFromTransformed(transformation: Transformation, positions: TextPosition[]): TextPosition[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const apostrophe: import('./parsers.js').TextParser;
|
|
2
|
+
export declare const espace: import('./parsers.js').TextParser;
|
|
3
|
+
export declare const espaceOuRien: import('./parsers.js').TextParser;
|
|
4
|
+
export declare const lettreAsciiMinuscule: import('./parsers.js').TextParser;
|
|
5
|
+
export declare const nonLettre: import('./parsers.js').TextParser;
|
|
6
|
+
export declare const numero: import('./parsers.js').TextParser;
|
|
7
|
+
export declare const tiret: import('./parsers.js').TextParser;
|
|
8
|
+
export declare const virgule: import('./parsers.js').TextParser;
|
|
9
|
+
export declare const virguleOuEspace: import('./parsers.js').TextParser;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tricoteuses/tisseuse",
|
|
3
|
+
"description": "Link (to) French legislative documents",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Assemblée nationale",
|
|
7
|
+
"France",
|
|
8
|
+
"Légifrance",
|
|
9
|
+
"law",
|
|
10
|
+
"open data",
|
|
11
|
+
"Parliament",
|
|
12
|
+
"Sénat"
|
|
13
|
+
],
|
|
14
|
+
"author": "Emmanuel Raviart <emmanuel@raviart.com>",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://git.tricoteuses.fr/logiciels/tricoteuses-juridique/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://tricoteuses.fr/",
|
|
19
|
+
"license": "AGPL-3.0-or-later",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://git.tricoteuses.fr/logiciels/tricoteuses-juridique.git"
|
|
23
|
+
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22.14.0"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"typedoc": "./src/index.ts",
|
|
34
|
+
"import": "./lib/index.js",
|
|
35
|
+
"types": "./lib/index.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "vite build",
|
|
44
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
45
|
+
"lint": "eslint .",
|
|
46
|
+
"prepare": "npm run build",
|
|
47
|
+
"test": "vitest"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@auditors/core": "^0.7.4",
|
|
51
|
+
"@tricoteuses/assemblee": "^2.3.1",
|
|
52
|
+
"@tricoteuses/legifrance": "^0.14.0",
|
|
53
|
+
"@types/fs-extra": "^11.0.4",
|
|
54
|
+
"@types/node": "^24.3.1",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "^8.43.0",
|
|
56
|
+
"@typescript-eslint/parser": "^8.43.0",
|
|
57
|
+
"dedent-js": "^1.0.1",
|
|
58
|
+
"dotenv": "^17.2.2",
|
|
59
|
+
"eslint": "^9.35.0",
|
|
60
|
+
"fs-extra": "^11.3.1",
|
|
61
|
+
"postgres": "^3.4.7",
|
|
62
|
+
"prettier": "^3.0.0",
|
|
63
|
+
"sade": "^1.8.1",
|
|
64
|
+
"typescript": "^5.0.0",
|
|
65
|
+
"vite": "^7.1.5",
|
|
66
|
+
"vite-plugin-dts": "^4.5.4",
|
|
67
|
+
"vitest": "^3.2.4"
|
|
68
|
+
}
|
|
69
|
+
}
|