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

<strong> tags are not parsed correctly from HTML #65

Closed
hperl opened this issue Jun 25, 2013 · 3 comments
Closed

<strong> tags are not parsed correctly from HTML #65

hperl opened this issue Jun 25, 2013 · 3 comments
Assignees

Comments

@hperl
Copy link
Contributor

hperl commented Jun 25, 2013

<strong> tags are not parsed correctly if they start or end with a space.

Using the API, the following does not parse:

irb(main):039:0> puts Kramdown::Document.new("<strong>oops </strong>", {input: 'html'}).to_latex

=> nil

<b> behaves correctly:

irb(main):040:0> puts Kramdown::Document.new("<b>oops </b>", {input: 'html'}).to_latex
\emph{oops }
=> nil

The same issue exists with <em> (not working) and <i> (working).

@ghost ghost assigned gettalong Jun 25, 2013
@gettalong
Copy link
Owner

Thanks!

The problem is that the text inside the HTML tags ends with a whitespace which prevents the conversion of the HTML element to a native :strong element. However, there are special rules in the LaTeX converter to convert HTML <i> and <b> tags, but not <strong> and <em> tags.

@hperl
Copy link
Contributor Author

hperl commented Jun 25, 2013

Thank you very much for the quick response.

What you say about the whitespace preventing conversion to markdown/kramdown makes absolute sense. I just was not thinking of that, since I only want LaTeX.

Anyway, there seems to be another bug where a <b> tag gets converted differenly depending on whitespace:

Correct without whitespace (convert to \textbf{}):

[21] pry(main)> puts Kramdown::Document.new("<b>oops</b>", {input: 'html'}).to_latex
\textbf{oops}
=> nil

Incorrect with whitespace (convert to \emph{}):

[22] pry(main)> puts Kramdown::Document.new("<b>oops </b>", {input: 'html'}).to_latex
\emph{oops }
=> nil

I fixed these issues in the pull request.

@gettalong
Copy link
Owner

Thanks for the pull request!

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