-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86ed9ca
commit d45848e
Showing
51 changed files
with
177 additions
and
234 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2023 Bruno Prieto | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# LaTeX Translator | ||
|
||
This package is a LaTeX translator that allows you to convert LaTeX code into plain text TXT format. | ||
|
||
## Installation | ||
|
||
To install this package, simply run the following command: | ||
|
||
$ pip install latextranslator | ||
|
||
## Usage | ||
|
||
You can review the full list of commands by running `latextranslator --help`. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"""A LaTeX to TXT file translator.""" | ||
import click | ||
from .main import translate | ||
|
||
__version__ = "0.1.0" | ||
|
||
@click.command() | ||
@click.argument('file_name') | ||
@click.version_option(__version__) | ||
def cli(file_name): | ||
translate(file_name) | ||
click.echo("Traducido correctamente") |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import tex2all |
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
blindtex/interpreter/reader.py → ...translator/blindtex/interpreter/reader.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
blindtex/latex2ast/converter.py → ...ranslator/blindtex/latex2ast/converter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
blindtex/mainBlindtex.py → latextranslator/blindtex/mainBlindtex.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#-*-:coding:utf-8-*- | ||
import re | ||
from . import translator as tl | ||
|
||
def translate(file_name): | ||
codigo = tl.string(file_name, False) | ||
#Revisa si hay archivos incrustados en el tex principal para agregarlos a codigo | ||
patron = re.compile(r'\\input *\{(?P<archivo>[^\{\}#]*)\}') | ||
ArchivosHijos = patron.findall(codigo) | ||
patron=re.compile(r'\.tex$') | ||
for i in ArchivosHijos: | ||
if len(patron.findall(i))==0: j=i+'.tex' | ||
else: j=i | ||
codigo = codigo.replace('\\input{'+i+'}', tl.string(j, True)) | ||
codigo = tl.graficos(codigo) | ||
formulas=tl.buscar_formulas(codigo, 1) | ||
ecuaciones=tl.buscar_formulas(codigo, 2) | ||
codigos=tl.buscar_codigos(codigo) | ||
codigo=tl.reemplazar_formulas(codigo, ecuaciones, 'ecuacion', 'r') | ||
codigo=tl.reemplazar_formulas(codigo, formulas, 'formula', 'r') | ||
codigo=tl.reemplazar_formulas(codigo, codigos, 'codigo', 'r') | ||
ecuaciones=tl.traducir_formulas(ecuaciones) | ||
formulas=tl.traducir_formulas(formulas) | ||
codigo = tl.titulos(codigo) | ||
codigo = tl.limpiar_basura(codigo) | ||
codigo = tl.enumeracion(codigo) | ||
codigo=tl.reemplazar_formulas(codigo, ecuaciones, 'ecuacion', 'w') | ||
codigo=tl.reemplazar_formulas(codigo, formulas, 'formula', 'w') | ||
codigo=tl.reemplazar_formulas(codigo, codigos, 'codigo', 'w') | ||
codigo=tl.split_codigo(codigo) | ||
codigo=re.sub(r'\n{3,}', r'\n\n', codigo) | ||
codigo=codigo.replace('\n', '\r\n') | ||
tl.traducido(codigo, f"{file_name[:-4]} traducido.txt") | ||
return f"{file_name[:-4]} traducido.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.