Updated README.md and added multifile support for text2pensum.py

This commit is contained in:
sergiusz 2020-11-24 19:31:28 +01:00
parent 541173d829
commit d3d826fdcb
2 changed files with 22 additions and 25 deletions

View File

@ -12,14 +12,10 @@ As I've started learning Latin from Lingua Latina Per Se Illustrata I've encourt
- underscore-string-underscore combinations (```_us_```) are transformed intorequiered html text input field with string between underscores as a value of ```data-expected``` atribute (```<input type="text" data-expected="us" required>```). - underscore-string-underscore combinations (```_us_```) are transformed intorequiered html text input field with string between underscores as a value of ```data-expected``` atribute (```<input type="text" data-expected="us" required>```).
# TODO # TODO
- [ ] text to html parser to swiftly migrate the cloze Pensa - [x] text to html parser to swiftly migrate the cloze Pensa
- [ ] dictionairy interface - [ ] dictionairy interface
- [ ] - [ ]
# Development # Development
To run the app on your own machine: To run the app on your own machine use ```pipenv shell 'flask run'```.
1. ```pipenv shell```
2. ```export FLASK_APP=main.py```
3. ```export FLASK_ENV=development```
4. ```flask run```

5
text2pensum.py Executable file → Normal file
View File

@ -1,7 +1,8 @@
import sys import sys
import re import re
with open(sys.argv[1], 'r') as infile: for filename in sys.argv[1:]:
with open(filename, 'r') as infile:
content = infile.read() content = infile.read()
# Replace _string_ with html # Replace _string_ with html
@ -21,5 +22,5 @@ content = content.replace('o-o', 'ō')
content = content.replace('U-U', 'Ū') content = content.replace('U-U', 'Ū')
content = content.replace('u-u', 'ū') content = content.replace('u-u', 'ū')
with open(sys.argv[1] + '.html', 'w+') as outfile: with open(filename + '.html', 'w+') as outfile:
outfile.write(content) outfile.write(content)