Skip to content

Commit

Permalink
Closes #147
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainhalle committed Mar 31, 2021
1 parent 181424b commit ace6a5a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ protected boolean isEnvironmentStart(/*@ non_null @*/ String line)
for (String e_name : m_environmentsToIgnore)
{
// Also loop through user-specified environments
if (line.matches(".*\\\\begin\\s*\\{\\s*" + e_name + "\\s*\\}.*"))
if (line.matches(".*\\\\begin\\s*\\{\\s*" + Pattern.quote(e_name) + "\\s*\\}.*"))
{
return true;
}
Expand All @@ -247,7 +247,7 @@ protected boolean isEnvironmentEnd(/*@ non_null @*/ String line)
for (String e_name : m_environmentsToIgnore)
{
// Also loop through user-specified environments
if (line.matches(".*\\\\end\\s*\\{\\s*" + e_name + "\\s*\\}.*"))
if (line.matches(".*\\\\end\\s*\\{\\s*" + Pattern.quote(e_name) + "\\s*\\}.*"))
{
return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
TeXtidote, a linter for LaTeX documents
Copyright (C) 2018-2019 Sylvain Hallé
Copyright (C) 2018-2021 Sylvain Hallé
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -101,7 +101,8 @@ public CheckLanguage(/*@ nullable @*/ Language lang, /*@ nullable @*/ Language f
handleUserDictionary();
}

public void handleUserDictionary() {
public void handleUserDictionary()
{
for (org.languagetool.rules.Rule rule : m_languageTool.getAllActiveRules())
{
if (rule instanceof SpellingCheckRule)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ public void testRemoveEnvironments3() throws TextCleanerException
assertTrue(as.isEmpty());
}

@Test
public void testRemoveEnvironments4() throws TextCleanerException
{
LatexCleaner detexer = new LatexCleaner();
detexer.setIgnoreBeforeDocument(false);
detexer.ignoreEnvironment("IEEEeqnarray*");
AnnotatedString as = detexer.clean(AnnotatedString.read(new Scanner(LatexCleanerTest.class.getResourceAsStream("data/test4.tex"))));
assertTrue(as.isEmpty());
}

@Test
public void testRemoveAccents1() throws TextCleanerException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
\begin{IEEEeqnarray*}
foo
\end{IEEEeqnarray*}

0 comments on commit ace6a5a

Please sign in to comment.