braillebaseoutputstring 1.0.0__tar.gz
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.
- braillebaseoutputstring-1.0.0/LICENSE +21 -0
- braillebaseoutputstring-1.0.0/PKG-INFO +15 -0
- braillebaseoutputstring-1.0.0/README.md +1 -0
- braillebaseoutputstring-1.0.0/braillebaseoutputstring/__init__.py +382 -0
- braillebaseoutputstring-1.0.0/braillebaseoutputstring.egg-info/PKG-INFO +15 -0
- braillebaseoutputstring-1.0.0/braillebaseoutputstring.egg-info/SOURCES.txt +8 -0
- braillebaseoutputstring-1.0.0/braillebaseoutputstring.egg-info/dependency_links.txt +1 -0
- braillebaseoutputstring-1.0.0/braillebaseoutputstring.egg-info/top_level.txt +1 -0
- braillebaseoutputstring-1.0.0/pyproject.toml +19 -0
- braillebaseoutputstring-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nagao Yuji
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the “Software”), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: braillebaseoutputstring
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A complete and extensible Unicode Braille processing library.
|
|
5
|
+
Author: Nagao Yuji
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/DukaCrazy/braillebase
|
|
8
|
+
Project-URL: Documentation, https://braillebase.blogspot.com/
|
|
9
|
+
Keywords: braille,unicode,accessibility,API,binary,blind,education
|
|
10
|
+
Requires-Python: >=3.6
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
braillebaseoutputstring
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
braillebaseoutputstring
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
class BrailleBaseOutputString():
|
|
2
|
+
|
|
3
|
+
def __init__(self, braille_list: list[str], binary_list: list[list[int]], binary_string_list: list[str], unicode_list: list[str], dot_count_list: list[int], dot_numbering_list: list[list[int]], dot_numbering_stringList: list[str], reverse_braille_list: list[str], braille_index: dict[str, int]):
|
|
4
|
+
self.__BrailleList = braille_list
|
|
5
|
+
self.__BinaryList = binary_list
|
|
6
|
+
self.__BinaryStringList = binary_string_list
|
|
7
|
+
self.__UnicodeList = unicode_list
|
|
8
|
+
self.__DotCountList = dot_count_list
|
|
9
|
+
self.__DotNumberingList = dot_numbering_list
|
|
10
|
+
self.__DotNumberingStringList = dot_numbering_stringList
|
|
11
|
+
self.__ReverseBrailleList = reverse_braille_list
|
|
12
|
+
self.__BrailleIndex = braille_index
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
#0005-A
|
|
16
|
+
def output_all_json(self, brailles_map: dict) -> str:
|
|
17
|
+
"""
|
|
18
|
+
Generates a JSON array containing all braille-related data for each character in the input text.
|
|
19
|
+
Each entry includes: original letter, braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
20
|
+
"""
|
|
21
|
+
import json
|
|
22
|
+
|
|
23
|
+
result = []
|
|
24
|
+
|
|
25
|
+
for key, braille_list in brailles_map.items():
|
|
26
|
+
|
|
27
|
+
#iToken
|
|
28
|
+
for braille_cell in braille_list[1]:
|
|
29
|
+
|
|
30
|
+
idx = self.__BrailleList.index(braille_cell)
|
|
31
|
+
|
|
32
|
+
result.append({
|
|
33
|
+
"index": key,
|
|
34
|
+
"Letter": braille_list[0],
|
|
35
|
+
|
|
36
|
+
"Braille": self.__BrailleList[idx],
|
|
37
|
+
"Binary": self.__BinaryStringList[idx],
|
|
38
|
+
"Numbering": self.__DotNumberingStringList[idx],
|
|
39
|
+
"Unicode": "U+" + self.__UnicodeList[idx],
|
|
40
|
+
|
|
41
|
+
"ReverseBraille": self.__BrailleList[self.__BrailleList.index(self.__ReverseBrailleList[idx])],
|
|
42
|
+
"ReverseBinary": self.__BinaryStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])],
|
|
43
|
+
"ReverseNumbering": self.__DotNumberingStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])],
|
|
44
|
+
"ReverseUnicode": "U+" + self.__UnicodeList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
return json.dumps(result, ensure_ascii=False, indent=4)
|
|
48
|
+
|
|
49
|
+
#0005-B
|
|
50
|
+
def output_all_csv(self, brailles_map: dict) -> str:
|
|
51
|
+
"""
|
|
52
|
+
Generates a CSV string containing all braille-related data for each character in the input text.
|
|
53
|
+
Each row includes: letter, braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
54
|
+
"""
|
|
55
|
+
import csv
|
|
56
|
+
import io
|
|
57
|
+
|
|
58
|
+
output = io.StringIO()
|
|
59
|
+
writer = csv.writer(output)
|
|
60
|
+
|
|
61
|
+
writer.writerow([
|
|
62
|
+
"index",
|
|
63
|
+
"Letter",
|
|
64
|
+
|
|
65
|
+
"Braille",
|
|
66
|
+
"Binary",
|
|
67
|
+
"Numbering",
|
|
68
|
+
"Unicode",
|
|
69
|
+
|
|
70
|
+
"ReverseBraille",
|
|
71
|
+
"ReverseBinary",
|
|
72
|
+
"ReverseNumbering",
|
|
73
|
+
"ReverseUnicode",
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
for key, braille_list in brailles_map.items():
|
|
77
|
+
|
|
78
|
+
#iToken
|
|
79
|
+
for braille_cell in braille_list[1]:
|
|
80
|
+
|
|
81
|
+
idx = self.__BrailleList.index(braille_cell)
|
|
82
|
+
|
|
83
|
+
writer.writerow([
|
|
84
|
+
key,
|
|
85
|
+
braille_list[0],
|
|
86
|
+
|
|
87
|
+
self.__BrailleList[idx],
|
|
88
|
+
self.__BinaryStringList[idx],
|
|
89
|
+
self.__DotNumberingStringList[idx],
|
|
90
|
+
"U+" + self.__UnicodeList[idx],
|
|
91
|
+
|
|
92
|
+
self.__BrailleList[self.__BrailleList.index(self.__ReverseBrailleList[idx])],
|
|
93
|
+
self.__BinaryStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])],
|
|
94
|
+
self.__DotNumberingStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])],
|
|
95
|
+
"U+" + self.__UnicodeList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]
|
|
96
|
+
])
|
|
97
|
+
|
|
98
|
+
return output.getvalue()
|
|
99
|
+
|
|
100
|
+
#0005-C
|
|
101
|
+
def output_all_xml(self, brailles_map: dict) -> str:
|
|
102
|
+
"""
|
|
103
|
+
Generates a formatted XML string containing all braille-related data for each character in the input text.
|
|
104
|
+
Each <item> node includes: letter, braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
105
|
+
"""
|
|
106
|
+
import xml.etree.ElementTree as ET
|
|
107
|
+
import xml.dom.minidom as minidom
|
|
108
|
+
|
|
109
|
+
root = ET.Element("braille_output")
|
|
110
|
+
|
|
111
|
+
for key, braille_list in brailles_map.items():
|
|
112
|
+
|
|
113
|
+
#iToken
|
|
114
|
+
for braille_cell in braille_list[1]:
|
|
115
|
+
|
|
116
|
+
idx = self.__BrailleList.index(braille_cell)
|
|
117
|
+
|
|
118
|
+
item = ET.SubElement(root, "item")
|
|
119
|
+
ET.SubElement(item, "index").text = str(key)
|
|
120
|
+
ET.SubElement(item, "Letter").text = braille_list[0]
|
|
121
|
+
|
|
122
|
+
ET.SubElement(item, "Braille").text = self.__BrailleList[idx]
|
|
123
|
+
ET.SubElement(item, "Binary").text = self.__BinaryStringList[idx]
|
|
124
|
+
ET.SubElement(item, "Numbering").text = self.__DotNumberingStringList[idx]
|
|
125
|
+
ET.SubElement(item, "Unicode").text = "U+" + self.__UnicodeList[idx]
|
|
126
|
+
|
|
127
|
+
ET.SubElement(item, "ReverseBraille").text = self.__BrailleList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]
|
|
128
|
+
ET.SubElement(item, "ReverseBinary").text = self.__BinaryStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]
|
|
129
|
+
ET.SubElement(item, "ReverseNumbering").text = self.__DotNumberingStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]
|
|
130
|
+
ET.SubElement(item, "ReverseUnicode").text = "U+" + self.__UnicodeList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
rough_xml = ET.tostring(root, encoding="utf-8")
|
|
134
|
+
reparsed = minidom.parseString(rough_xml)
|
|
135
|
+
return reparsed.toprettyxml(indent=" ", encoding="utf-8").decode("utf-8")
|
|
136
|
+
|
|
137
|
+
#0005-D
|
|
138
|
+
def output_all_yaml(self, brailles_map: dict) -> str:
|
|
139
|
+
"""
|
|
140
|
+
Generates a YAML-formatted string containing all braille-related data for each character in the input text.
|
|
141
|
+
Each entry includes: letter, braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
142
|
+
"""
|
|
143
|
+
lines = []
|
|
144
|
+
|
|
145
|
+
for key, braille_list in brailles_map.items():
|
|
146
|
+
|
|
147
|
+
#iToken
|
|
148
|
+
for braille_cell in braille_list[1]:
|
|
149
|
+
|
|
150
|
+
idx = self.__BrailleList.index(braille_cell)
|
|
151
|
+
|
|
152
|
+
lines.append(f"- index: {key}")
|
|
153
|
+
lines.append(f" Letter: \"{braille_list[0]}\"")
|
|
154
|
+
|
|
155
|
+
lines.append(f" Braille: \"{self.__BrailleList[idx]}\"")
|
|
156
|
+
lines.append(f" Binary: \"{self.__BinaryStringList[idx]}\"")
|
|
157
|
+
lines.append(f" Numbering: \"{self.__DotNumberingStringList[idx]}\"")
|
|
158
|
+
lines.append(f" Unicode: \"{"U+" + self.__UnicodeList[idx]}\"")
|
|
159
|
+
|
|
160
|
+
lines.append(f" ReverseBraille: \"{self.__BrailleList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}\"")
|
|
161
|
+
lines.append(f" ReverseBinary: \"{self.__BinaryStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}\"")
|
|
162
|
+
lines.append(f" ReverseNumbering: \"{self.__DotNumberingStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}\"")
|
|
163
|
+
lines.append(f" ReverseUnicode: \"{"U+" + self.__UnicodeList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}\"")
|
|
164
|
+
lines.append("")
|
|
165
|
+
|
|
166
|
+
return "\n".join(lines)
|
|
167
|
+
|
|
168
|
+
#0005-E
|
|
169
|
+
def output_all_markdown(self, brailles_map: dict, braille: list, reverse_braille: list, text: str, footer = "Thank you for using Braille Base.") -> str:
|
|
170
|
+
"""
|
|
171
|
+
Generates a Markdown-formatted string containing all braille-related data for each character in the input text.
|
|
172
|
+
Each section includes: braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
173
|
+
"""
|
|
174
|
+
lines = []
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
lines.append("## Character -> Braille")
|
|
178
|
+
lines.append(f"### Text: {text}")
|
|
179
|
+
lines.append(f"### Text: {braille}")
|
|
180
|
+
lines.append(f"### Text: {reverse_braille}")
|
|
181
|
+
|
|
182
|
+
for key, braille_list in brailles_map.items():
|
|
183
|
+
|
|
184
|
+
#iToken
|
|
185
|
+
for braille_cell in braille_list[1]:
|
|
186
|
+
|
|
187
|
+
idx = self.__BrailleList.index(braille_cell)
|
|
188
|
+
|
|
189
|
+
lines.append(f"- **index:** {key}")
|
|
190
|
+
lines.append(f"- **Letter:** {braille_list[0]}")
|
|
191
|
+
|
|
192
|
+
lines.append(f"- **Braille:** {self.__BrailleList[idx]}")
|
|
193
|
+
lines.append(f"- **Binary:** {self.__BinaryStringList[idx]}")
|
|
194
|
+
lines.append(f"- **Numbering:** {self.__DotNumberingStringList[idx]}")
|
|
195
|
+
lines.append(f"- **Unicode:** {"U+" + self.__UnicodeList[idx]}")
|
|
196
|
+
|
|
197
|
+
lines.append(f"- **ReverseBraille:** {self.__BrailleList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}")
|
|
198
|
+
lines.append(f"- **ReverseBinary:** {self.__BinaryStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}")
|
|
199
|
+
lines.append(f"- **ReverseNumbering:** {self.__DotNumberingStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}")
|
|
200
|
+
lines.append(f"- **ReverseUnicode:** {"U+" + self.__UnicodeList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}")
|
|
201
|
+
lines.append("")
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
lines.append(f"- {footer}")
|
|
205
|
+
|
|
206
|
+
return "\n".join(lines)
|
|
207
|
+
|
|
208
|
+
#0005-F 0000
|
|
209
|
+
def output_all_html(self, brailles_map: dict, braille: list, reverse_braille: list, text: str, footer = "Thank you for using Braille Base.") -> str:
|
|
210
|
+
"""
|
|
211
|
+
Generates an HTML-formatted string containing all braille-related data for each character in the input text.
|
|
212
|
+
Each section includes: braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
213
|
+
"""
|
|
214
|
+
lines = []
|
|
215
|
+
|
|
216
|
+
lines.append('<!DOCTYPE html>')
|
|
217
|
+
lines.append('<html>')
|
|
218
|
+
lines.append('<head>')
|
|
219
|
+
lines.append(' <meta charset="UTF-8">')
|
|
220
|
+
lines.append(' <title>Braille Base - HTML Generate</title>')
|
|
221
|
+
lines.append(' <style>')
|
|
222
|
+
lines.append(' table { border-collapse: collapse; width: 400px; font-family: sans-serif; }')
|
|
223
|
+
lines.append(' td { border: 1px solid #000; padding: 6px 10px; }')
|
|
224
|
+
lines.append(' .cell-letter { font-size: 48px; text-align: center; vertical-align: middle; width: 100px; }')
|
|
225
|
+
lines.append(' </style>')
|
|
226
|
+
lines.append('</head>')
|
|
227
|
+
lines.append('<body>')
|
|
228
|
+
|
|
229
|
+
lines.append('<div class="text-output">')
|
|
230
|
+
lines.append('<h2>Text</h2>')
|
|
231
|
+
lines.append(f'<p>{text}</p>')
|
|
232
|
+
lines.append('</div>')
|
|
233
|
+
|
|
234
|
+
lines.append('<div class="read-braille-output">')
|
|
235
|
+
lines.append('<h2>Read Braille</h2>')
|
|
236
|
+
lines.append(f'<p>{braille}</p>')
|
|
237
|
+
lines.append('</div>')
|
|
238
|
+
|
|
239
|
+
lines.append('<div class="read-braille-output">')
|
|
240
|
+
lines.append('<h2>Write Braille</h2>')
|
|
241
|
+
lines.append(f'<p>{reverse_braille}</p>')
|
|
242
|
+
lines.append('</div>')
|
|
243
|
+
|
|
244
|
+
lines.append('<div class="braille-table-output">')
|
|
245
|
+
|
|
246
|
+
for key, braille_list in brailles_map.items():
|
|
247
|
+
lines.append(f' <h3>Letter {key}</h3>')
|
|
248
|
+
lines.append('<table>')
|
|
249
|
+
|
|
250
|
+
#iToken
|
|
251
|
+
for braille_cell in braille_list[1]:
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
idx = self.__BrailleList.index(braille_cell)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
lines.append(f' <tr> <td class="cell-letter" rowspan="10">{braille_list[0]}</td>')
|
|
258
|
+
#Braille
|
|
259
|
+
lines.append(f' <td colspan="2"><b>Read Braille</b></td>')
|
|
260
|
+
lines.append(f' <tr> <td>Braille:</td><td>{self.__BrailleList[idx]}</td> </tr>')
|
|
261
|
+
lines.append(f' <tr> <td>Binary:</td><td>{self.__BinaryStringList[idx]}</td> </tr>')
|
|
262
|
+
lines.append(f' <tr> <td>Numbering:</td><td>{self.__DotNumberingStringList[idx]}</td> </tr>')
|
|
263
|
+
lines.append(f' <tr> <td>Unicode:</td><td>U+{self.__UnicodeList[idx]}</td> </tr>')
|
|
264
|
+
#Reverse Braille
|
|
265
|
+
lines.append(f' <tr> <td colspan="2"><b>Write Braille</b></td> </tr>')
|
|
266
|
+
lines.append(f' <tr> <td>Braille:</td><td>{self.__BrailleList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}</td> </tr>')
|
|
267
|
+
lines.append(f' <tr> <td>Binary:</td><td>{self.__BinaryStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}</td> </tr>')
|
|
268
|
+
lines.append(f' <tr> <td>Numbering:</td><td>{self.__DotNumberingStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}</td> </tr>')
|
|
269
|
+
lines.append(f' <tr> <td>Unicode:</td><td>U+{self.__UnicodeList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}</td> </tr>')
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
lines.append('</table>')
|
|
274
|
+
lines.append('<br>')
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
lines.append('</div>')
|
|
278
|
+
lines.append(f'<footer><p>{footer}</p></footer>')
|
|
279
|
+
lines.append('</body>')
|
|
280
|
+
lines.append('</html>')
|
|
281
|
+
|
|
282
|
+
return "\n".join(lines)
|
|
283
|
+
|
|
284
|
+
#0005-GA
|
|
285
|
+
def output_all_txt(self, brailles_map: dict, braille: list, reverse_braille: list, text: str, footer = "Thank you for using Braille Base.") -> str:
|
|
286
|
+
"""
|
|
287
|
+
Generates a plain text string containing all braille-related data for each character in the input text.
|
|
288
|
+
Each block includes: braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
289
|
+
"""
|
|
290
|
+
lines = []
|
|
291
|
+
|
|
292
|
+
lines.append("Character -> Braille")
|
|
293
|
+
lines.append("")
|
|
294
|
+
lines.append(f"Text: {text}")
|
|
295
|
+
lines.append(f"Braille: {braille}")
|
|
296
|
+
lines.append(f"Reverse Braille: {reverse_braille}")
|
|
297
|
+
lines.append("")
|
|
298
|
+
for key, braille_list in brailles_map.items():
|
|
299
|
+
|
|
300
|
+
#iToken
|
|
301
|
+
for braille_cell in braille_list[1]:
|
|
302
|
+
|
|
303
|
+
idx = self.__BrailleList.index(braille_cell)
|
|
304
|
+
|
|
305
|
+
lines.append(f"index: {key}")
|
|
306
|
+
lines.append(f"Letter: {braille_list[0]}")
|
|
307
|
+
|
|
308
|
+
lines.append(f"Braille: {self.__BrailleList[idx]}")
|
|
309
|
+
lines.append(f"Binary: {self.__BinaryStringList[idx]}")
|
|
310
|
+
lines.append(f"Numbering List: {self.__DotNumberingStringList[idx]}")
|
|
311
|
+
lines.append(f"Unicode: {"U+" + self.__UnicodeList[idx]}")
|
|
312
|
+
|
|
313
|
+
lines.append(f"ReverseBraille: {self.__BrailleList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}")
|
|
314
|
+
lines.append(f"ReverseBinary: {self.__BinaryStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}")
|
|
315
|
+
lines.append(f"ReverseNumbering: {self.__DotNumberingStringList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}")
|
|
316
|
+
lines.append(f"ReverseUnicode: {"U+" + self.__UnicodeList[self.__BrailleList.index(self.__ReverseBrailleList[idx])]}")
|
|
317
|
+
lines.append("-" * 40)
|
|
318
|
+
lines.append("")
|
|
319
|
+
|
|
320
|
+
lines.append(footer)
|
|
321
|
+
return "\n".join(lines)
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
#0005-F 0000
|
|
325
|
+
def output_all_html_test(self, brailles_map: dict, braille: list, reverse_braille: list, text: str, footer = "Thank you for using Braille Base.") -> str:
|
|
326
|
+
"""
|
|
327
|
+
Generates an HTML-formatted string containing all braille-related data for each character in the input text.
|
|
328
|
+
Each section includes: braille symbol, index, binary string, binary array, Unicode value, dot count, numbering string, and numbering list.
|
|
329
|
+
"""
|
|
330
|
+
lines = []
|
|
331
|
+
|
|
332
|
+
lines.append('<!DOCTYPE html>')
|
|
333
|
+
lines.append('<html>')
|
|
334
|
+
lines.append('<head>')
|
|
335
|
+
lines.append(' <meta charset="UTF-8">')
|
|
336
|
+
lines.append(' <title>Braille Base - HTML Generate</title>')
|
|
337
|
+
lines.append(' <style>')
|
|
338
|
+
lines.append(' table { border-collapse: collapse; width: 400px; font-family: sans-serif; }')
|
|
339
|
+
lines.append(' td { border: 1px solid #000; padding: 6px 10px; }')
|
|
340
|
+
lines.append(' .cell-letter { font-size: 48px; text-align: center; vertical-align: middle; width: 100px; }')
|
|
341
|
+
lines.append(' </style>')
|
|
342
|
+
lines.append('</head>')
|
|
343
|
+
lines.append('<body>')
|
|
344
|
+
|
|
345
|
+
lines.append('<div class="text-output">')
|
|
346
|
+
lines.append('<h2>Text</h2>')
|
|
347
|
+
lines.append(f'<p>{text}</p>')
|
|
348
|
+
lines.append('</div>')
|
|
349
|
+
|
|
350
|
+
lines.append('<div class="read-braille-output">')
|
|
351
|
+
lines.append('<h2>Read Braille</h2>')
|
|
352
|
+
lines.append(f'<p>{braille}</p>')
|
|
353
|
+
lines.append('</div>')
|
|
354
|
+
|
|
355
|
+
lines.append('<div class="read-braille-output">')
|
|
356
|
+
lines.append('<h2>Write Braille</h2>')
|
|
357
|
+
lines.append(f'<p>{reverse_braille}</p>')
|
|
358
|
+
lines.append('</div>')
|
|
359
|
+
|
|
360
|
+
lines.append('<div class="braille-table-output">')
|
|
361
|
+
|
|
362
|
+
for key, braille_list in brailles_map.items():
|
|
363
|
+
lines.append('<table>')
|
|
364
|
+
|
|
365
|
+
#iToken
|
|
366
|
+
for braille_cell in braille_list[1]:
|
|
367
|
+
idx = self.__BrailleList.index(braille_cell)
|
|
368
|
+
|
|
369
|
+
lines.append(f' <tr> <td class="cell-letter" rowspan="3" colspan="2">{braille_list[0]}</td>')
|
|
370
|
+
#Braille
|
|
371
|
+
lines.append(f' <tr> <td>Braille:</td><td>{self.__BrailleList[idx]}</td> </tr>')
|
|
372
|
+
lines.append(f' <tr> <td>Numbering:</td><td>{self.__DotNumberingStringList[idx]}</td> </tr>')
|
|
373
|
+
|
|
374
|
+
lines.append('</table>')
|
|
375
|
+
lines.append('<br>')
|
|
376
|
+
|
|
377
|
+
lines.append('</div>')
|
|
378
|
+
lines.append(f'<footer><p>{footer}</p></footer>')
|
|
379
|
+
lines.append('</body>')
|
|
380
|
+
lines.append('</html>')
|
|
381
|
+
|
|
382
|
+
return "\n".join(lines)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: braillebaseoutputstring
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A complete and extensible Unicode Braille processing library.
|
|
5
|
+
Author: Nagao Yuji
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/DukaCrazy/braillebase
|
|
8
|
+
Project-URL: Documentation, https://braillebase.blogspot.com/
|
|
9
|
+
Keywords: braille,unicode,accessibility,API,binary,blind,education
|
|
10
|
+
Requires-Python: >=3.6
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
braillebaseoutputstring
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
braillebaseoutputstring/__init__.py
|
|
5
|
+
braillebaseoutputstring.egg-info/PKG-INFO
|
|
6
|
+
braillebaseoutputstring.egg-info/SOURCES.txt
|
|
7
|
+
braillebaseoutputstring.egg-info/dependency_links.txt
|
|
8
|
+
braillebaseoutputstring.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
braillebaseoutputstring
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "braillebaseoutputstring"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "A complete and extensible Unicode Braille processing library."
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Nagao Yuji" }
|
|
11
|
+
]
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
license = { text = "MIT" }
|
|
14
|
+
requires-python = ">=3.6"
|
|
15
|
+
keywords = ["braille", "unicode", "accessibility", "API", "binary", "blind", "education"]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://github.com/DukaCrazy/braillebase"
|
|
19
|
+
Documentation = "https://braillebase.blogspot.com/"
|