Logical switch for type of header promotion to use
We now have implementations of at least two different header promotion strategies that can be useful for importing book chapters:
- The original, classic header promotion based on analysis of font size, formatting, and an analysis of the entire document (pretty good right now)
- Header promotion based upon the outline levels of a document (some tweaks and further testing required)
Classic header promotion works best with docxs that aren't structured with Word styles; in these instances, outline-level analysis doesn't work at all because there aren't any outline levels specified. But if the author has used Word styles, outline level header promotion seems to work better than the classic approach more often than not. Combining the two promotion strategies together doesn't work well - it should be one approach or the other.
At this point, what we need is a logical switch that analyzes the document and decides whether to use the classic approach or the outline level approach. I don't know exactly what the criteria to make the decision should be - probably something along the lines of counting the number of times outline levels are specified in Word as a proxy for whether it's structured or not - but I can propose something for that. In the meantime, @wendell do you have ideas about how such a one-track-or-the-other switch could be implemented in the pipeline? Laying the groundwork for this seems like the next thing to do for header promotion.