First, thanks to sevenofeights for posting almost exactly the macro I needed to make my life easier at my day job. Second, I've tweaked it for my particular case, in which separate separate file and revision tags are used instead of the header tag. I'm attaching the tweaked version to this post in case it will be of use to anyone. Cheers!