Example of dumper (along with references) using Pod::Simple?

[email protected] (Martin Quinson) Thu, 21 May 2020 17:45:59 +0200
Newsgroups perl.pod-people
Message-ID <20200521154559.GA7792@cafuron>
--Kj7319i9nmIyA2yE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello,

I'm one of the authors of the https://po4a.org/ tool, which eases the
translation of documentation in various formats. The idea is to parse
the documentations, keep the structure and replace the content in
english with the translated content. See
https://po4a.org/man/man1/po4a.1.php for more information.

(beware, the mailing lists of both projects are CCed)


po4a is written in Perl, and uses Pod::Parser so far, but I'm
considering switching to Pod::Simple instead, thus this email.

I seem to understand that Pod::Parser is kinda deprecated and
Pod::Simple superior (I guess you agree?). In addition, my biggest
concern with Pod::Parser is that the reported line numbers are wrong.
The library reports fancyful locations for the blocks it reports.
For example, the following page reports that the presented page is in
file po4a, line 2 (there is a link to the bottom right).
https://hosted.weblate.org/translate/po4a/po4a-doc/en/?checksum=3D439ba747a=
dcb37ed
But when you click on that link, you see that it's not the right
location at all. That's line 2 of the POD chunks, not of the whole file.

I had a look at Pod::Simple to see how to convert po4a to the
modernity, but I would appreciate to have some guidance, please. For
reference, our code is here:
https://github.com/mquinson/po4a/blob/master/lib/Locale/Po4a/Pod.pm

For now, we override initialize(), command(), verbatim() and
textblock() and then call parse_from_file() on the provided file.

First question: which of the many Pod::Simple examples should I look
at to adapt this code? Sorry for this silly question, but you really
have many examples...=20

Second question: How do you retrieve the line number in the original
text in your parsers? Will I have the same issue with the reported
line numbers ignoring the cut parts of the file?

Third question: Is it possible to get some information from the
external blocks? (the parts that are not POD in the file) I would like
to "see" the comments added to these parts, searching for specific
comments that are intended for the translators. This is to implement
something similar to --add-command of xgettext.


Summarizing the first questions, I'm looking for a Pod::Simple example
that would dump the content to stdout along with the line numbers at
which the blocks are found.

And if you feel that I'm off tracks and that my questions are not
relevant, I really need your guidance...

Thanks in advance,
Mt.

--=20
Never trust a programmer in a suit.

--Kj7319i9nmIyA2yE
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEET76cTupS7xPVQWYSmL2XJE9zvqcFAl7GojQACgkQmL2XJE9z
vqeLKRAAgJdXhU4H2Ms9+bASfqwxVW53/9uZp/N6TVvAXeIF+JBvqttKwszPILtU
bxKhAzpchAnReaWoDhLggLfLbxXIjUzaMdJhJWwMRWQAfYtOPE33dWaMRIbmwQOP
hRawT41OFFyynr3jbgqImjS0VTh6zIy9rTHaZU96FmPzAwxucIZ7wriTd8U2/Y9r
bXq1z3tD6qLciyol+e7F/m5n1G1XugKsXgl3YZIoXEbJ+bWkSvAjMm/nbcywexoN
P2P/jAZXzLZ9K2DA/xq5yKl9NV64l5uYE8R+a/6+u5kHZV8ZTjrGGhCYnrbkEjIN
Vx0eG4U566F5WfTPyOPA6fcC1zRc1HpqVjA/CzLLi9zLn4GBck4KUP1VjzuHu91V
H9nhm+SJSDYGsk7+a8eYedVWcIjw1uCHlhvtqx4eI6Z/xpHqMbkkRxQyg3af9myt
uFrmaJPFLeG040t0Mij5n9hTt3kr04A8C/d89rMBcoIaBGZdCu515I4K9NWh3V+P
0hgzIy8wVOT7QgoF1dqTqzQRQaHxNXNFvP6NgYj/zAslU9ZOmTwGBtAHINgXfa9m
OsXnQ+8orbxUNLVxhZx3X0GCXRjn6soKbKyTQ0fePQ0T9ry05sHY1kXFpNmtjyHo
ZHGM5BVP0J6LOCW1X2QVboSY45p5Gw+tFHRcDFtzZ38iLNADQpI=
=DfLN
-----END PGP SIGNATURE-----

--Kj7319i9nmIyA2yE--