Skip to content

Commit

Permalink
Determine whether we're starting a list of Roman numerals
Browse files Browse the repository at this point in the history
Per #1. This is a lazy solution, but it's also very achievable, so it
has that going for it.
  • Loading branch information
waldoj committed Jun 12, 2013
1 parent 84972a7 commit 69f359f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions subsection-identifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,25 @@ function parse()
{
continue;
}

/*
* If the section fragment is a Roman numeral "i", but the matched prefix candidate
* is alphabetic, then let's skip this prefix candidate and continue to iterate,
* knowing that we'll get to the Roman numeral prefix candidate soon. We ignore the
* last character, since that could potentially be the first character of the text
* (as opposed to the prefix), and is definitely not the text of our prefix (it
* could be a containing parenthesis, but we're not concerned about that now). We're
* trying to avoid actually matching an "i" if the text is, for example:
*
* "a. in the meaning of..."
*/
if (strpos(substr($section_fragment, 0, -2), 'i'))
{
if ($prefix_members[0] == 'a')
{
continue;
}
}

/*
* Great, we've successfully made a match -- we now know that this is the beginning
Expand Down

0 comments on commit 69f359f

Please sign in to comment.