karlberry has asked for the wisdom of the Perl Monks concerning the following question:
This small self-contained program, including a little pod at the end:
#!/usr/bin/env perl use strict; use warnings; use Pod::Usage; pod2usage(-exitstatus => 0, -verbose => 99, -sections => 'ACTIONS/back.*', -noperldoc => 1); __END__ =head1 ACTIONS Para for actions. =head2 backup I<pkg> B<please> dest Para for backup.
gives me this unexpected output, with the marked-up "pkg" and "please" text on the head2 line missing:
backup dest: + Para for backup.
I'm trying to use markup on a head2 line, and then select it with pod2usage's -section option. The marked-up text is omitted, though the regular head2 text comes out fine.
Perhaps this is beyond the scope of what pod2usage is intended to do, but I couldn't find anything either explicitly disallowing or allowing it in the Pod::Usage documentation, and the POD documentation does explicitly say that formatting codes are allowed on header lines.
Incidentally, the -noperldoc => 1 is there just to eliminate the possibility of interactions with pagers or the like. It doesn't actually change the behavior, so far as I can see.
This is only about the pod2usage() function. The output from the pod2text and pod2html utilities, for example, correctly includes the marked-up text (again, "pkg" and "please" in the above). (Well, The table of contents from the pod2html output just has the text without any actual markup ("pkg" rather than "<i>pkg</>"), but that seems fine.)
I tried enabling the use constant DEBUG => 7 in Pod/Simple/BlackBox.pm and could see that the markup got parsed and returned as nested lists (as expected). At what level the marked-up text gets elided, I could not discern without putting in lots more effort. So I thought I'd post here before going further.
This was on i686-linux with perl 5.20.1, compiled (with gcc 4.9.2) and installed from the original source. I tried a variety of older Perl versions, both distro-supplied and my compilations, with the same results (or, if old enough, -sections is not supported).
Thanks for any fixes, workarounds, or other clues. --karl
P.S. Just in case you're wondering why I want to do this in the first place: <i>...</i> seemed like the best way to specify metavariables in a synopsis, and I like to give a synopsis of subcommands as headings. That way, the pod2html output is nicer, since the synopses show up in the table of contents. We do this in the documentation for our so-called TeX Live Manager program. For instance, the real pod for our backup subcommand is this:
=head2 backup [--clean[=I<N>]] [--backupdir I<dir>] [--all | I<pkg>].. +.
The HTML output for the full tlmgr pod can be seen at http://tug.org/texlive/doc/tlmgr.html (seems I'm not allowed to include that as a live link), where the synopsis of the subcommands can be seen up front in the toc.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pod2usage() -sections omits marked-up text from =head lines?
by Anonymous Monk on Jan 14, 2015 at 00:31 UTC | |
|
Re: pod2usage() -sections omits marked-up text from =head lines?
by Anonymous Monk on Jan 14, 2015 at 01:48 UTC | |
|
Re: pod2usage() -sections omits marked-up text from =head lines?
by locked_user sundialsvc4 (Abbot) on Jan 14, 2015 at 19:20 UTC | |
by Anonymous Monk on Jan 14, 2015 at 22:25 UTC |