tsv-quote-converters 1.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/README.md +109 -0
- package/dist/favicon.svg +1 -0
- package/dist/tsv-quote-converters.mjs +55400 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# TSV Quote Converters package (tsv-quote-converters)
|
|
2
|
+
|
|
3
|
+
A Node.js package for converting quotes between original biblical languages (Greek/Hebrew) and Gateway Languages in TSV files.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install tsv-quote-converters
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Convert original language quotes to Gateway Language quotes (`addGLQuoteCols`)
|
|
14
|
+
- Convert Gateway Language quotes back to original language quotes (`convertGLQuotes2OLQuotes`)
|
|
15
|
+
- Handles complex quote alignments and multiple occurrences
|
|
16
|
+
- Supports multiple target Gateway Language Bibles
|
|
17
|
+
- Maintains TSV format integrity
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Adding Gateway Language Quote Columns
|
|
22
|
+
|
|
23
|
+
Convert original language quotes to Gateway Language quotes by adding new columns:
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
import { addGLQuoteCols } from 'tsv-quote-converters';
|
|
27
|
+
|
|
28
|
+
const params = {
|
|
29
|
+
// Required parameters
|
|
30
|
+
bibleLinks: ['unfoldingWord/en_ult/master'], // Array of Bible repos to use
|
|
31
|
+
bookCode: 'eph', // Bible book code (e.g., 'eph', 'gen')
|
|
32
|
+
tsvContent: yourTsvString, // TSV content with 'Quote' column
|
|
33
|
+
|
|
34
|
+
// Optional parameters
|
|
35
|
+
trySeparatorsAndOccurrences: true, // Try different quote separators
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const result = await addGLQuoteCols(params);
|
|
39
|
+
console.log(result.output); // Modified TSV with new GLQuote/GLOccurrence columns
|
|
40
|
+
console.log(result.errors); // Array of any errors encountered
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Converting Gateway Language Quotes to Original Language
|
|
44
|
+
|
|
45
|
+
Convert Gateway Language quotes in the Quote column back to original language:
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
import { convertGLQuotes2OLQuotes } from 'tsv-quote-converters';
|
|
49
|
+
|
|
50
|
+
const params = {
|
|
51
|
+
// Required parameters
|
|
52
|
+
bibleLinks: ['unfoldingWord/en_ult/master'], // Bible used for current quotes
|
|
53
|
+
bookCode: 'eph', // Bible book code
|
|
54
|
+
tsvContent: yourTsvString, // TSV content with GL quotes
|
|
55
|
+
|
|
56
|
+
// Optional parameters
|
|
57
|
+
trySeparatorsAndOccurrences: true, // Try different quote separators
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const result = await convertGLQuotes2OLQuotes(params);
|
|
61
|
+
console.log(result.output); // Modified TSV with original language quotes
|
|
62
|
+
console.log(result.errors); // Array of any errors encountered
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Input TSV Format
|
|
66
|
+
|
|
67
|
+
Your input TSV must include these columns:
|
|
68
|
+
- `Reference` - Chapter:verse reference
|
|
69
|
+
- `Quote` - The quote to convert
|
|
70
|
+
- `Occurrence` - Occurrence number of the quote
|
|
71
|
+
|
|
72
|
+
Example input:
|
|
73
|
+
```
|
|
74
|
+
Reference ID Tags SupportReference Quote Occurrence Note
|
|
75
|
+
1:1 abc1 Παῦλος 1 Note text here
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Output Format
|
|
79
|
+
|
|
80
|
+
### addGLQuoteCols
|
|
81
|
+
Adds two columns per target Bible:
|
|
82
|
+
- `GLQuote` - The converted Gateway Language quote
|
|
83
|
+
- `GLOccurrence` - The occurrence number in the Gateway Language
|
|
84
|
+
|
|
85
|
+
### convertGLQuotes2OLQuotes
|
|
86
|
+
Updates existing columns:
|
|
87
|
+
- `Quote` - Replaced with original language quote
|
|
88
|
+
- `Occurrence` - Updated to match original language occurrence
|
|
89
|
+
|
|
90
|
+
## Error Handling
|
|
91
|
+
|
|
92
|
+
Both functions return an object with:
|
|
93
|
+
- `output` - The modified TSV content (string)
|
|
94
|
+
- `errors` - Array of error messages for any failed conversions
|
|
95
|
+
|
|
96
|
+
## Live Demo
|
|
97
|
+
|
|
98
|
+
Try it out in our [interactive documentation](https://unfoldingword.github.io/tsv-quote-converters/)
|
|
99
|
+
|
|
100
|
+
## Contributing
|
|
101
|
+
|
|
102
|
+
Visit our [GitHub repository](https://github.com/unfoldingWord/tsv-quote-converters) to contribute.
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
ISC
|
|
107
|
+
|
|
108
|
+
See: [LICENSE.md](https://github.com/unfoldingWord/tsv-quote-converters/blob/main/LICENSE.md)
|
|
109
|
+
```
|
package/dist/favicon.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg height="64" viewBox="0 0 64 64" width="64" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd" transform="translate(7 9)"><g fill="#fff"><path d="m0 45c0 1.656 1.343 3 3 3h9v-12h-12z"/><path d="m0 36h12v-12h-12z"/><path d="m12 48h12v-12h-12z"/><path d="m24 48h12v-12h-12z"/><path d="m12 36h12v-12h-12z"/><path d="m24 36h12v-12h-12z"/><path d="m36 36h12v-12h-12z"/><path d="m0 24h12v-12h-12z"/><path d="m12 24h12v-12h-12z"/><path d="m24 24h12v-12h-12z"/><path d="m36 24h12v-12h-12z"/></g><path d="m45 0h-42c-1.657 0-3 1.344-3 3v9h48v-9c0-1.656-1.343-3-3-3" fill="#4baadc"/><path d="m36 36v12h9c1.657 0 3-1.344 3-3v-9z" fill="#fff"/><path d="m45 0h-42c-1.657 0-3 1.343-3 3v42c0 1.657 1.343 3 3 3h42c1.657 0 3-1.343 3-3v-42c0-1.657-1.343-3-3-3z" stroke="#1e69a0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><path d="m0 12h48" stroke="#1e69a0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><path d="m0 24h48" stroke="#1e69a0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><path d="m0 36h48" stroke="#1e69a0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><path d="m24 12v36" stroke="#1e69a0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><path d="m36 12v36" stroke="#1e69a0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><path d="m12 12v36" stroke="#1e69a0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/></g></svg>
|