Skip to content

Commit 69f359f

Browse files
committed
Determine whether we're starting a list of Roman numerals
Per #1. This is a lazy solution, but it's also very achievable, so it has that going for it.
1 parent 84972a7 commit 69f359f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

subsection-identifier.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,25 @@ function parse()
105105
{
106106
continue;
107107
}
108+
109+
/*
110+
* If the section fragment is a Roman numeral "i", but the matched prefix candidate
111+
* is alphabetic, then let's skip this prefix candidate and continue to iterate,
112+
* knowing that we'll get to the Roman numeral prefix candidate soon. We ignore the
113+
* last character, since that could potentially be the first character of the text
114+
* (as opposed to the prefix), and is definitely not the text of our prefix (it
115+
* could be a containing parenthesis, but we're not concerned about that now). We're
116+
* trying to avoid actually matching an "i" if the text is, for example:
117+
*
118+
* "a. in the meaning of..."
119+
*/
120+
if (strpos(substr($section_fragment, 0, -2), 'i'))
121+
{
122+
if ($prefix_members[0] == 'a')
123+
{
124+
continue;
125+
}
126+
}
108127

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

0 commit comments

Comments
 (0)