Skip to content
  • Martin Ågren's avatar
    doc-diff: add `--cut-header-footer` · e6050772
    Martin Ågren authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    AsciiDoc and Asciidoctor do not agree on what to write in the header and
    footer of each man-page, i.e., the very first and the very last line of
    *.[157]. Those differences can certainly be interesting in their own
    right, but they clutter the output of `./doc-diff --from-asciidoc
    --to-asciidoctor HEAD HEAD` quite a bit since the diff contains some
    10-15 lines of noise per file diffed.
    
    Teach doc-diff to cut away the first two and last two lines, i.e., the
    header/footer and the empty line immediately following/preceding it.
    Because Asciidoctor uses an extra empty line compared to AsciiDoc,
    remove one more line at each end of the file, but only if it's empty.
    
    An alternative approach might be to pass down `--no-header-footer`,
    which both AsciiDoc and Asciidoctor understand, but it has some
    drawbacks. First of all, the result doesn't build -- `xmlto` stumbles on
    the resulting xml since it has multiple root elements. Second, it cuts
    too much -- dropping the header loses the synopsis, which would be
    interesting to diff.
    
    Like in the previous commit, encode this option into the directory name
    of the "installed" and "rendered" files. Otherwise, we wouldn't be able
    to trust that what we use out of that cache actually corresponds to the
    options given for this run. (We could optimize this caching a little
    since this flag doesn't affect the contents of "installed" at all, but
    let's punt on that.)
    
    Signed-off-by: default avatarMartin Ågren <martin.agren@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    e6050772