不要用 p6doc 显示声明块

Don't show declarator blocks with p6doc

我已经编写了一个小示例文件来了解更多关于 Perl 6 POD 的信息,并且我正在使用 p6doc 从 POD 文档中呈现一个小手册页。然而,p6doc 也尝试解析 POD 文档之外的声明块。这在输出中看起来不是特别好。使用 p6doc 时有没有办法忽略声明块?

我使用的代码示例是:

#! /usr/bin/env perl6

use v6.c;

#| Greet people on the command line.
sub MAIN (
    #| A name to greet.
    $names,

    #| Optional. Additional names to greet.
    *@names,
) {
    *
}

=begin pod

=NAME    greeter
=AUTHOR  Patrick Spek
=VERSION 0.0.1

The greeter application greets someone via a terminal. At least 1 name is
required, but multiple names can be given to greet many people in one go.
=end pod

p6doc给出的输出是:

sub MAIN(
    $names, # A name to greet.
    *@names, # Optional. Additional names to greet.
)
Greet people on the command line.

class $names
A name to greet.

class *@names
Optional. Additional names to greet.

NAME
greeter

AUTHOR
Patrick Spek

VERSION
0.0.1

The greeter application greets someone via a terminal. At least 1 name is
required, but multiple names can be given to greet many people in one go.

NAME 部分之前的所有内容都是我要从 p6doc 输出中删除的内容。

declarator blocks outside the POD document.

一些似乎仍然值得首先快速提及的小事:

  • 最好将其称为 pod(或 Pod 或 Pod6 或 POD6)而不是 POD,以将其与 P5 的 POD 区分开来,因为它不向后兼容,就像 P6 不向后兼容一样兼容P5;

  • 语法 =begin pod ... =end pod 没有声明 "the pod document"。它声明了一个 pod 块,它是构成整个 pod 文档的众多块之一。你可以有几个。之所以提到这一点,是因为声明块也是 pod 块。这就是他们被收录的原因。

Is there a way to ignore the declarator blocks when using p6doc?

您可以 运行 通过 shell 命令级别的过滤器输出。

但请参阅我的下一条评论,了解可能的更好方法。

I'm using p6doc

p6docperl6 --doc.

的包装

perl6 --doc 提供的结果与您在问题中显示的结果完全相同,但有一个输出 post-processing 选项(并且不仅限于已安装的模块)。

假设您可以改为使用 perl6 --doc

perl6 -doc,没有 --doc 选项的参数,使用 the default pod output filter.

使用 perl6 --doc=MyFilter.pm6 您可以 运行 通过已安装的自定义过滤器模块 Pod::To::MyFilter.pm6

有关可用作示例的过滤器的完整列表,请参阅 a search of modules.perl6.org for pod::to