Skip to content

Commit

Permalink
Some preparation for #151
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainhalle committed Mar 31, 2021
1 parent 3d77030 commit e37cdb8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions Source/Core/src/ca/uqac/lif/textidote/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public static int mainLoop(String[] args, InputStream in, PrintStream out, Print

// Setup command line parser and arguments
CliParser cli_parser = new CliParser();
//cli_parser.addArgument(new Argument().withLongName("autocheck").withDescription("Checks grammar in auto-detected language"));
cli_parser.addArgument(new Argument().withLongName("check").withArgument("lang").withDescription("Checks grammar in language lang"));
cli_parser.addArgument(new Argument().withLongName("firstlang").withArgument("lang").withDescription("Checks for false friends with the author's first language lang and the language specified in --check"));
cli_parser.addArgument(new Argument().withLongName("clean").withDescription("Remove markup from input file"));
Expand Down Expand Up @@ -458,9 +459,12 @@ else if (input_type == Linter.Language.MARKDOWN || filename.endsWith(".md"))
List<String> dictionary = new ArrayList<String>();
String lang_s = "";
String firstlang_s = "";
if (map.hasOption("check"))
if (map.hasOption("check") || map.hasOption("autocheck"))
{
lang_s = map.getOptionValue("check");
if (map.hasOption("check"))
{
lang_s = map.getOptionValue("check");
}
// Try to read dictionary from an Aspell file
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ protected AnnotatedString removeMarkup(AnnotatedString as_out, int line_pos)
// Footnotes (ignore)
as_out = as_out.replaceAll("\\\\footnote\\{.*?\\}", "");
// Replace citations by dummy placeholder
as_out = as_out.replaceAll("\\\\(cite|citep|citel|parencite)(\\[.*?\\])*\\{.*?\\}", "[0]");
as_out = as_out.replaceAll("\\\\(cite|citep|citel|parencite|textcite)(\\[.*?\\])*\\{.*?\\}", "[0]");
// Replace verbatim by dummy placeholder
as_out = as_out.replaceAll("\\\\verb\\+[^\\+]*?\\+", "[0]");
as_out = as_out.replaceAll("\\\\verb\"[^\"]*?\"", "[0]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,10 @@ public void testNoin2()
@Test
public void testNoin3()
{
AnnotatedString in_string = AnnotatedString.read(new Scanner("from~\\cite{foo}"));
AnnotatedString in_string = AnnotatedString.read(new Scanner("from \\cite[Section 1.2]{foo}"));
Rule r = m_rules.get("sh:c:noin");
List<Advice> ad_list = r.evaluate(in_string, in_string);
assertFalse(ad_list.isEmpty());
assertTrue(ad_list.isEmpty());
}

@Test
Expand Down

0 comments on commit e37cdb8

Please sign in to comment.