Skip to content
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

Using HTML in the definition #2

Open
nyg opened this issue Mar 7, 2018 · 1 comment
Open

Using HTML in the definition #2

nyg opened this issue Mar 7, 2018 · 1 comment

Comments

@nyg
Copy link

nyg commented Mar 7, 2018

Hello and thanks for your tool :)

In your code there are the following lines:

defn = defn.replace("\\\\","\\").\
        replace(">", "\\>").\
        replace("<", "\\<").\
        replace("\\n","<br/>\n").\
        strip()

This will of course break any HTML that is in the word definition (<p> becomes \<p\>, etc). So my question is: what's the purpose of the above code? I removed it and was still able to generate a dictionary that looked okay on my Kindle.

Many thanks,
nyg

@nyg nyg changed the title Adding HTML in the definition Using HTML in the definition Mar 7, 2018
@apeyser
Copy link
Owner

apeyser commented Nov 18, 2018

Precisely -- the opf format is itself xml, so the html must be escaped somehow. I don't recall how the opf needs to properly escape the html (maybe proper xml escapes or maybe just backslashes), but I didn't need anything more sophisticated for my uses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants