Differences between revisions 1 and 2
Revision 1 as of 2010-07-10 09:08:28
Size: 1679
Editor: FranklinPiat
Comment: add pkg2wikipage
Revision 2 as of 2021-05-19 02:02:58
Size: 1681
Editor: PaulWise
Comment: update links
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
This bash snippet produces a paragraph with link to the specified package page on http://packages.debian.org and the contained manpage (hosted on http://manpages.debian.net) This bash snippet produces a paragraph with link to the specified package page on https://packages.debian.org and the contained manpage (hosted on https://manpages.debian.org)

Translation(s): none


This page contains various scripts used to produce some wiki content

pkg2wikipage

This bash snippet produces a paragraph with link to the specified package page on https://packages.debian.org and the contained manpage (hosted on https://manpages.debian.org)

   1 function pkg2wikipage() {
   2 pkg=$1
   3 
   4 apt-cache search "^$pkg\$" | sed -e 's,^, * DebianPkg:,'
   5 for p in $(dpkg -L $pkg | grep -E '/usr/share/man/man[18]/') ; do
   6   s=$(echo $p |sed -e 's,.*/man\([0-9]\)/.*,\1,')
   7   m=$(echo $p | sed -e 's,.*/\([^\.]*\)\..*,\1,' )
   8   apropos -l -e -s $s $m | sed -e 's,^\([^ ]\+\) (\([^)]\)),  * [[DebianMan:\2/\1|\1(\2)]],'
   9 done
  10 }

Sample output: running pkg2wikipage reportbug produces the MoinMoin markup:

 * DebianPkg:reportbug - reports bugs in the Debian distribution
  * [[DebianMan:1/reportbug|reportbug(1)]] - reports a bug to a debbugs server
  * [[DebianMan:1/querybts|querybts(1)]]   - view outstanding bug reports on a debbugs server

which is rendered as:

  • reportbug - reports bugs in the Debian distribution