2

I documented some perl files with POD and made a webpage with pod2html. Is it possible to set a favicon to that?

=pod

=encoding UTF-8

=begin pod2html

<link rel="..." type="..." href="/...">

=end pod2html

=cut

But there is nothing in my html file about this favicon.

And where have I put this image to? Is it possible to put it in the perl file directly?

Andy A.
  • 1,392
  • 5
  • 15
  • 28
  • Having read [the source](https://metacpan.org/release/XSAWYERX/perl-5.34.0/source/ext/Pod-Html/lib/Pod/Html.pm) I don't think that is possible. The only things you can pass in for the `` tag are the title and the URL for a single CSS stylesheet. I think you need to post-process the output. – simbabque Nov 09 '21 at 09:53
  • So I have to build my own POD translator? – Andy A. Nov 09 '21 at 11:55
  • No, I would probably subclass the module that `pod2html` uses under the hood, and add post-processing to inject the favicon. Then make your own `pod2html` script that uses your module rather than the original one, and use that. – simbabque Nov 09 '21 at 15:43
  • @simbabque Ah, a little batch script calling _pod2html_ and then calling _sed_ for example to put ` – Andy A. Nov 10 '21 at 07:25
  • That could work too. But I was thinking of a proper Perl subclass. But the one function inside that module does everything including producing the file, so it might be easier to do what you've proposed. – simbabque Nov 10 '21 at 11:39

1 Answers1

1

Using a little batch script:

#!/bin/bash

pod2html my_pod_file.pl > my_html.html

sed -i '/<title/{ a <link rel="..." type="..." href="/..." />
; :label n; b label } my_html.html

sed -i '/<title/a <link ... ' my_html.html would work too, but then sed adds a line after all title tags.


If you use $1 instead of my_pod_file.pl and $2 instead of my_html.html, you can call your script like ./my_script my_pod_file.pl my_html.html.


Instead of "sed" you can use "ed":

ed my_html.html << EOF
/<title/a
<link ...
.
wq
EOF

Thanks to ubuntuusers.de

Andy A.
  • 1,392
  • 5
  • 15
  • 28