Skip to content

Commit

Permalink
Merge pull request nicolas-raoul#83 from flerda/v2.1-latex
Browse files Browse the repository at this point in the history
Updates to LaTeX code.
  • Loading branch information
flerda committed Jul 29, 2013
2 parents 8a30749 + 53833f0 commit 3f1522c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/com/ichi2/libanki/LaTeX.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package com.ichi2.libanki;

import android.text.Html;

import com.ichi2.libanki.hooks.Hook;
import com.ichi2.libanki.hooks.Hooks;

Expand Down Expand Up @@ -108,12 +106,7 @@ private static String _imgLink(Collection col, String latex) {
* @return
*/
private static String _latexFromHtml(Collection col, String latex) {
// entitydefs defines nbsp as \xa0 instead of a standard space, so we
// replace it first
latex = latex.replace(" ", " ");
latex = latex.replaceAll("<br( /)?>|<div>", "\n");
// replace <div> etc with spaces
latex = latex.replaceAll("<.+?>", " ");
latex = Utils.stripHTML(latex);
return latex;
}
Expand Down
3 changes: 3 additions & 0 deletions src/com/ichi2/libanki/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ private String minimizeHTML(String s) {
* @return The text with its HTML entities unescaped.
*/
private static String entsToTxt(String html) {
// entitydefs defines nbsp as \xa0 instead of a standard space, so we
// replace it first
html = html.replace("&nbsp;", " ");
Matcher htmlEntities = htmlEntitiesPattern.matcher(html);
StringBuffer sb = new StringBuffer();
while (htmlEntities.find()) {
Expand Down

0 comments on commit 3f1522c

Please sign in to comment.