Skip to main content

opening_split

Function opening_split 

Source
pub fn opening_split(s: &str) -> Option<(usize, usize)>
Expand description

Where a chapter’s first paragraph splits for a drop cap, as byte offsets into s: (initial_end, lead_in_end). The initial runs up to and including the first letter or digit (so it carries any opening quote before it); the lead-in is the rest of that word and two more whitespace-separated words (a lone dash counts as a word), or all of s if there are fewer. None when s has no letter or digit. Print and EPUB both split with this, so they cannot disagree; each decides for itself what may stand before the letter.