Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
leger
flatlatex
Commits
e0a6ee1a
Commit
e0a6ee1a
authored
Mar 05, 2021
by
Jean-Benoist Leger
Browse files
ignore newlines in LaTeX (option)
parent
3cf04a45
Changes
1
Hide whitespace changes
Inline
Side-by-side
flatlatex/conv.py
View file @
e0a6ee1a
...
...
@@ -40,9 +40,11 @@ class converter:
allowed (True by default).
:attrib allow_combinings: boolean which indicate if combining characters
are allowed (True by default).
:attrib ignore_newlines: boolean which indicates if newlines must be removed
(True by default).
"""
def
__init__
(
self
,
allow_zw
=
True
,
allow_combinings
=
True
):
def
__init__
(
self
,
allow_zw
=
True
,
allow_combinings
=
True
,
ignore_newlines
=
True
):
"""Initialize a convert method."""
self
.
__cmds
=
{}
...
...
@@ -75,12 +77,15 @@ class converter:
# config section
self
.
allow_zw
=
allow_zw
self
.
allow_combinings
=
allow_combinings
self
.
ignore_newlines
=
ignore_newlines
def
convert
(
self
,
expr
):
"""Convert LaTeX math to Unicode text.
:param expr: LaTeX math expression to convert"""
if
self
.
ignore_newlines
:
expr
=
expr
.
replace
(
'
\r
'
,
''
).
replace
(
'
\n
'
,
''
)
parsed
=
parser
.
parse
(
expr
)
outvec
=
[]
idx
=
0
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment