Update folding to match HTML folding behavior

Update folding to collapse sections (and render those collapsed
sections) the same way as HTML.  Also add tests for HbFoldingBuilder.