WIP Experimental Japanese TXT doc text wrapper
This commit is contained in:
parent
80a74f4931
commit
8800a58533
1 changed files with 27 additions and 0 deletions
27
docs/cjkwrap-docs.py
Executable file
27
docs/cjkwrap-docs.py
Executable file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# FIXME: Under construction!
|
||||||
|
# Experimental script to try and wrap
|
||||||
|
# Japanese plaintext docs, since `links` does not
|
||||||
|
# currently do this properly. -bjk 2023.07.15
|
||||||
|
|
||||||
|
import cjkwrap
|
||||||
|
|
||||||
|
with open('ja_JP.UTF-8/README.txt') as f:
|
||||||
|
while True:
|
||||||
|
line = f.readline()
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
|
|
||||||
|
oldlen = len(line)
|
||||||
|
line = line.lstrip()
|
||||||
|
newlen = len(line)
|
||||||
|
indent = oldlen - newlen
|
||||||
|
|
||||||
|
wrappedlines = cjkwrap.wrap(line, 78 - indent)
|
||||||
|
for l in wrappedlines:
|
||||||
|
print(" " * indent, end="")
|
||||||
|
print(l)
|
||||||
|
|
||||||
|
f.close()
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue