You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A PE reported a bug where, after promoting a sub-chapter file heading
from a B- to an A-level heading, the section disappeared. This is a
bummer! What was happening was that we were only pulling in the first
section of a subchapter file, assuming that there would be only one
top-level heading in that file. This sometimes isn't the case! Normally
we'd want to enforce that for chapters, i.e., that there is only one
top-level section, but in this case we want to allow multiples, since
they're getting "demoted" later anyway (or rather: getting included
_inside_ the main heading.
So, to solve for this, this commit:
* Retains the logic for primary chapter files, instead throwing a
warning in the log and in the console that there are multiple
top-level headings in a chapter file if it's the "main" chapter file.
IMO this is best practice, since it'll help enforce ORM style, and
accommodating this would be a bigger rewrite (and this is an in-flight
book production-needing fix).
* Improves subchapter handling logic, now finding the main article and
including any non-bibliography top-level sections in the resultant
chapter.
* Adds tests around all these things (coverage still 100%)
I think it's an open question whether or not we want to allow multiple
top-level sections in a main file (at least for the purposes of
Atlas-only builds), but we'll call that outside the scope for now.
Update: Refactor and also handle bibliographies better; this was exposed
during the refactor, but essentially we weren't handling bibliography
_files_ well, and so I updated the logic to basically say "if we don't
have a non-bib section, but we do have a bib section, make that the
chapter."
0 commit comments