Skip to content

Commit

Permalink
SAK-41800 Allow the character X or x in ISBN (sakaiproject#6919)
Browse files Browse the repository at this point in the history
Old 10 digit ISBNS can have an X as the check digit. This fixes the Rwiki ISBN Macro to allow the X character.
  • Loading branch information
buckett authored and Miguel Pellicer committed May 20, 2019
1 parent 8c70e68 commit a95cbfc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void execute(Writer writer, MacroParameter params)

if (params.getLength() == 1)
{
String isbn = params.get("0").replaceAll("[^0-9-]", "");
String isbn = params.get("0").replaceAll("[^0-9xX-]", "");
BookServices.getInstance().appendUrl(writer, isbn); //$NON-NLS-1$
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,12 @@ public void testIsbn()
"(<a href=\"http://www.amazon.com/exec/obidos/ASIN/0201615630\">Amazon.com</a>)",
result);
}

public void testIsbnX() {
String result = EngineManager.getInstance().render("{isbn:059615448X}",
context);
assertEquals(
"(<a href=\"http://www.amazon.com/exec/obidos/ASIN/059615448X\">Amazon.com</a>)",
result);
}
}

0 comments on commit a95cbfc

Please sign in to comment.