[TriLUG] OT: Maintaining public/private versions of a document

Steve Litt via TriLUG trilug at trilug.org
Sun Jul 28 20:16:16 EDT 2019


On Sun, 28 Jul 2019 00:42:01 -0700
Huan Truong via TriLUG <trilug at trilug.org> wrote:


> - If you want a private and a public version, then you can perhaps
> mark the private sections to start with a #, then make a makefile like
> so:
> 
> public: source_file
>     cat source_file | sed "s/^\#.*$//" > source_public
>     <whatever command to compile your source_public file to pdf>
> 
> private: source_file
>     cat source_file | sed "s/^\# //" > source_private
>     <whatever command to compile your source_private file to pdf>


The preceding is breathtakingly beautiful in its simplicity. I'd use
something like _huan_\s* instead of # because # is easy to mistake for
a comment. You could even hook it to a loop that fires every 30
seconds, to keep your PDF compiled at all time. If the source didn't
change, almost no processing gets done.

Also, you could have stuff like _huanepub+_ to include it in an epub,
or _huanpdf-_ to not include it in a PDF. I write books to multiple
formats, so this could come in very handy.

I'm copying this also to my publishing mailing list because it's very
relevant to them. Thanks for this great idea.

SteveT

Steve Litt 
July 2019 featured book: Troubleshooting Techniques
     of the Successful Technologist
http://www.troubleshooters.com/techniques


More information about the TriLUG mailing list