Skip to content

Commit

Permalink
Footnote parsing should no longer hang.
Browse files Browse the repository at this point in the history
  • Loading branch information
GottaGetSwifty committed Dec 7, 2016
1 parent d50d224 commit 27bb366
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion app/app/src/main/java/adapters/ReadingPagerAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public Object instantiateItem(final ViewGroup container, final int position) {
view = getNextBookView(inflater);
}
else{

view = inflater.inflate(R.layout.reading_pager_layout, container, false);
view.setEnabled(false);
WebView textWebView = (WebView) view.findViewById(R.id.chapterWebView);
Expand Down
8 changes: 4 additions & 4 deletions app/app/src/main/java/model/parsers/USFMParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class USFMParser {

private static final Pattern SP_REGEX = Pattern.compile("\\\\sp.*");
private static final Pattern ADD_REGEX = Pattern.compile("\\\\add.*\\\\add\\*", Pattern.DOTALL);
private static final Pattern FOOTNOTE_REGEX = Pattern.compile("(\\\\f)(\\s+)((.*)(\\n*)){1,5}(\\\\f[*])");
private static final Pattern FOOTNOTE_REGEX = Pattern.compile("\\\\f\\s+.*\\n*\\\\f[*]");
private static final Pattern FOOTNOTE_TEXT_REGEX = Pattern.compile("\\\\f.*\\\\f\\*", Pattern.DOTALL);
private static final Pattern FOOTNOTE_VERSE_REGEX = Pattern.compile("\\\\fqa.*\\\\f[*]");

Expand Down Expand Up @@ -276,16 +276,16 @@ private String replaceQs(String text) {
return text;
}

private String findFootnotes(String text){
private String findFootnotes(String text) {

Matcher verseMatcher = FOOTNOTE_REGEX.matcher(text);

ArrayList<String> verseText = new ArrayList<String>();
ArrayList<String> verseText = new ArrayList<>();
while (verseMatcher.find()) {
verseText.add(verseMatcher.group(0));
}

if(verseText.size() > 0){
if(verseText.size() > 0) {
for(String footnote : verseText){
String footnoteText = findFootnoteText(footnote);
String footnoteNumberText = "<sup class=\"footnote-number\">" + Integer.toString(this.footnoteNumber) + "</sup>";
Expand Down

0 comments on commit 27bb366

Please sign in to comment.