-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to escape_string
to avoid already escaped characters
#34042
Labels
good first issue
Indicates a good issue for first-time contributors to Julia
Comments
JeffBezanson
added
the
good first issue
Indicates a good issue for first-time contributors to Julia
label
Feb 29, 2020
Hi, |
Hi @rohanxyzg ! I was about to submit a PR addressing this issue :) I did not do this earlier because I was working on preparing PrettyTables.jl to be used in DataFrames.jl and I thought I would not need this anymore. I was wrong. |
Done! |
Keno
pushed a commit
that referenced
this issue
Dec 25, 2020
* Arg. to avoid escaping backslahes (escape_string) This commit adds an argument to `escape_string` to assume that all backslashes (`\\`) are already escaped. Hence, `\\cdot` becomes `\\cdot` instead of `\\\\cdot`. The default value to this argument is `false`. Hence, this does not break any existing code since `escape_string` behaves exactly the same as before if no additional option is passed. Closes #34042 * Replace `bsescaped` arg. with `keep` keyword * Update NEWS.md * Fix doc tests * Add compat annotation Co-authored-by: Ronan Arraes Jardim Chagas <ronan.arraes@MacBook-Pro-de-Ronan.local>
ElOceanografo
pushed a commit
to ElOceanografo/julia
that referenced
this issue
May 4, 2021
* Arg. to avoid escaping backslahes (escape_string) This commit adds an argument to `escape_string` to assume that all backslashes (`\\`) are already escaped. Hence, `\\cdot` becomes `\\cdot` instead of `\\\\cdot`. The default value to this argument is `false`. Hence, this does not break any existing code since `escape_string` behaves exactly the same as before if no additional option is passed. Closes JuliaLang#34042 * Replace `bsescaped` arg. with `keep` keyword * Update NEWS.md * Fix doc tests * Add compat annotation Co-authored-by: Ronan Arraes Jardim Chagas <ronan.arraes@MacBook-Pro-de-Ronan.local>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
In PrettyTables.jl, sometimes it happens that a string has already some characters escaped, like
\\cdot
, but others not, like\n
. However, I need to callescape_string
every time to handle the other non-escaped characters (like\n
), otherwise the output will break badly.For example, if I try to pass to PrettyTables.jl a cell that has a LaTeX equation:
then it will print:
because
escape_string
always treat\\
as two backslashes instead of one escaped backslash.To solve this problem, I needed to copy the entire
escape_string
function and remove the line that transform\\
into\\\\
. It would be nice, IMHO, if Julia'sescape_string
has a keyword option to assume\\
as an already escaped backslash.If this is accepted, I can submit a PR.
The text was updated successfully, but these errors were encountered: