documentation - 不要使用 p6doc 显示声明符 block

标签 documentation raku

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

我正在使用的代码示例是:

#! /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没有声明“pod 文档”。它声明了一个 pod block ,它是构成整个 pod 文档的众多 block 之一。你可以有几个。之所以提到这一点,是因为声明器 block 也是 pod block 。这就是他们被包括在内的原因。

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



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

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

    I'm using p6doc


    p6docperl6 --doc 的包装器.
    perl6 --doc提供与您在问题中显示的完全相同的结果,但具有输出后处理选项(并且不仅限于已安装的模块)。

    假设您可以切换到使用 perl6 --doc反而:
    perl6 -doc , 没有参数到 --doc选项,使用 the default pod output filter .

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

    a search of modules.perl6.org for pod::to 获取可用作示例的过滤器的完整列表。

    关于documentation - 不要使用 p6doc 显示声明符 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50983870/

    相关文章:

    python - 使用自定义装饰器/属性记录 Python Bottle API

    sql - 如何记录sql查询

    function - 解释器中的 Perl 6 函数参数语法 (REPL)

    raku - perl6的stat函数

    c# - 如何在 c# xml 文档中引用枚举常量

    documentation - 评论总是错误的——对还是不对?

    java - 离线 Java 文档

    arrays - 如何使用 >> 处理嵌套数组并返回一个平面数组?

    ncurses - 为什么在 delwin() 之后的 initscr() 返回 undef?

    byte - Raku 中的 `bytes.fromhex` 和 `to_bytes` 方法?