[book] tidy chapter when regenerating it

 * Remove a chapter if it contains no sections
 * Remove sections which are not present in the chapter

Maybe this version will be less disrupting.