This commit is contained in:
JJ Merelo 2018-03-12 20:33:04 +01:00
Родитель c08633c4d2
Коммит a6dc077243
6 изменённых файлов: 281 добавлений и 83 удалений

Просмотреть файл

@ -1,5 +1,6 @@
#!/bin/bash
#!/usr/bin/env perl6
echo "Processing "
echo "$1"
perl6 --doc=HTML "$1"
use v6;
use Pod::To::HTML;
put Pod::To::HTML.render(slurp);

Просмотреть файл

@ -74,7 +74,6 @@ module GitHub
if File.exist?(file = File.dirname(__FILE__) + "/commands/#{command}")
command = file
end
markup_impl(symbol, CommandImplementation.new(regexp, languages, command, name, &block))
end

Просмотреть файл

@ -51,5 +51,5 @@ command(
"restructuredtext"
)
command(::GitHub::Markups::MARKUP_POD6, :pod6tohtml, /pod6/, ["Pod6"], "pod6")
command(::GitHub::Markups::MARKUP_POD6, :pod62html, /pod6/, ["Perl 6"], "pod6")
command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod$/, ["Pod"], "pod")

Просмотреть файл

@ -52,7 +52,6 @@ class MarkupTest < Minitest::Test
define_method "test_#{markup}" do
skip "Skipping MediaWiki test because wikicloth is currently not compatible with JRuby." if markup == "mediawiki" && RUBY_PLATFORM == "java"
source = File.read(readme)
expected_file = "#{readme}.html"
expected = File.read(expected_file).rstrip
@ -67,7 +66,6 @@ class MarkupTest < Minitest::Test
f.close_write
f.read
end
assert_html_equal expected, actual, <<message
#{File.basename expected_file}'s contents are not html equal to output:
#{diff}
@ -93,8 +91,7 @@ message
assert_equal "wikicloth", GitHub::Markup.renderer('README.wiki', '<h1>Title</h1>').name
assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc', '== Title').name
assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst', 'Title').name
# assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name
# assert_equal "pod6", GitHub::Markup.renderer('README.pod6', '=begin').name
assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name
end
def test_rendering_by_symbol

Просмотреть файл

@ -1,67 +1,152 @@
=begin Html
<img style="float: right; margin: 0 0 1em 1em" src="/images/camelia.png" alt="" id="home_logo"/>
Welcome to the official documentation of the <a href="https://perl6.org">Perl 6</a>
programming language!
Besides online browsing and searching, you can also
<a href="/perl6.xhtml">view everything in one file</a> or
<a href="https://github.com/perl6/doc">contribute</a>
by reporting mistakes or sending patches.
=begin pod
<hr/>
=TITLE About the Docs
<dl>
=SUBTITLE Meta-documentation
<dt><a href="/language.html">Language Reference &amp; Tutorials</a></dt>
<dd>
A collection of documents describing, in detail, the various
conceptual parts of the language.
<!--
If you're new to Perl 6,
language>intro is a good place to start.
-->
This document collection represents the on-going effort to document the Perl 6 programming
language with the goals of being: comprehensive; easy to use; easy to
navigate; and useful to both newcomers and experienced Perl 6
programmers.
</dd>
An HTML version of the documentation is located online at
L<https://docs.perl6.org>.
<dt><a href="/type.html">Type Reference</a></dt>
<dd>
Index of built-in classes and roles.
</dd>
The official source for this documentation is located at L<perl6/doc on
GitHub|https://github.com/perl6/doc>.
<dt><a href="/routine.html">Routine Reference</a></dt>
<dd>
Index of built-in subroutines and methods.
</dd>
This particular document is a quick overview of the process
described in more detail in L<CONTRIBUTING on GitHub|https://github.com/perl6/doc/blob/master/CONTRIBUTING.md>.
This document also provides a short introduction to writing Perl 6
Pod files, which can be rendered into HTML and other formats.
<dt><a href="/programs.html">Perl 6 Programs</a></dt>
<dd>
A collection of documents describing how to
run the Perl 6 executable program and other utilities,
how to debug Perl 6 programs, and how to hack on Perl 6
source code.
</dd>
=head1 Structure
<!--
<dt><a href="/module.html">Module Reference</a></dt>
<dd>
Index of modules that are part of the official core distribution.
</dd>
-->
All of the documentation is written in Perl 6 Pod and kept in the C<doc/>
directory, and the C<doc/Language/> and C<doc/Type/> sub-directories.
These files are processed as collections of definitions or
"documentables", which are then post-processed and linked together.
</dl>
=head1 Generating HTML from Pod
<hr/>
To generate HTML from the Pod files, you'll need:
=item A recent version of the Rakudo Perl 6 compiler
<p>The Perl 6 homepage offers <a href="https://perl6.org/resources/">a
comprehensive list of Perl 6 resources</a>, including tutorials, how-tos
and <a href="/language/faq">FAQs (Frequently Asked Questions)</a>.</p>
=item The Perl 6 modules Pod::To::HTML, Pod::To::BigPage, and URI::Escape
(can be installed via L<zef|https://github.com/ugexe/zef>).
<p>
Perl&nbsp;6 compiler developers may also be interested in
<a href="https://github.com/perl6/roast">The Perl&nbsp;6 Specification</a>.
Documentation for the different but related <a href="https://www.perl.org/">Perl 5</a> language
can be found on the <a href="http://perldoc.perl.org/">Perl 5 documentation website</a>.
</p>
=end Html
=item B<Optional>: L<GraphViz|http://graphviz.org>, for creating graphs
of the relationships between Perl 6 types
=item B<Optional>: L<Atom Highlights|https://github.com/atom/highlights> and L<language-perl6|https://atom.io/packages/language-perl6>, for syntax
highlighting
To generate the documentation into the C<html/> folder, run:
=begin code :lang<shell>
perl6 htmlify.p6
=end code
To host the documentation from a web server, have Perl 5
and Mojolicious::Lite installed, then run:
=begin code :lang<shell>
perl app.pl daemon
=end code
=head1 Contributing
The documentation is written in Perl 6 Pod.
For a quick introduction to Perl 6 Pod, see L<Perl 6 Pod|https://docs.perl6.org/language/pod>.
For full details about the Perl 6 Pod specification, see L<Synopsis 26, Documentation|https://design.perl6.org/S26.html>.
=head2 Adding definitions
Documentables can be defined using an C<=headN> Pod directive, where
C<N> is greater than zero (e.g., C<=head1>, C<=head2>, …).
All of the paragraphs and blocks following that directive, up until the
next directive of the same level, will be considered part of the
documentable. So, in:
=begin code :allow<R> :skip-test
=head2 R<My Definition>
Some paragraphs, followed by some code:
my Code $examples = "amazing";
Mind === blown.
=head3 Minor details about R<My Definition>
It's fantastic.
=head2 And now, for something completely different
=end code
The documentable R<My Definition> extends down to the C<=head2 And now…>.
Documentables may contain other documentables. Class documentables, for
example, often contain the methods the class implements.
Definitions must be in one of the following forms to be recognized as
the start of a documentable named, say, þ. First the code in the document source:
=begin code :skip-test
=item X<C<How to use the þ infix> | infix,þ> (This a special case, which
is always considered a definition)
=item C<The þ Infix>
=item B<The C<þ> Infix>
=item C<Infix þ>
=item B<Infix C<þ>>
=item C<trait is cached> (A special case for the L<trait|/language/functions#Traits> documentables)
=end code
Then the results on the rendered page:
=item X<C<How to use the þ infix> | infix,þ> (This is a special case, which
is always considered a definition)
=item C<The þ Infix>
=item B<The C<þ> Infix>
=item C<Infix þ>
=item B<Infix C<þ>>
=item C<trait is cached> (A special case for the L<trait|/language/functions#Traits> documentables)
These items should now be searchable by using the search field in the HTML docs.
You can add emphasis with bold (B<V< B<> >>) or italicized (B<V< I<> >>),
with or without code formatting (B<V< C<> >>). Due to current parser limitations,
special steps have to be taken to use B<V< X<> >> with other formatting codes; for example:
=begin code :skip-test
=item X<B<foo>|foo> a fancy subroutine
=end code
renders like this
=item X<B<foo>|foo> a fancy subroutine
Notice that text after a pipe ('|') has no formatting. Also note that B<V< C<> >>
preserves spaces and treats text as verbatim.
=end pod
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

Просмотреть файл

@ -1,16 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8" />
<style>
About the Docs
/* code gets the browser-default font
* kbd gets a slightly less common monospace font
* samp gets the hard pixelly fonts
*/
kbd { font-family: "Droid Sans Mono", "Luxi Mono", "Inconsolata", monospace }
samp { font-family: "Terminus", "Courier", "Lucida Console", monospace }
/* WHATWG HTML frowns on the use of <u> because it looks like a link,
/* WHATWG HTML frowns on the use of &lt;u&gt; because it looks like a link,
* so we make it not look like one.
*/
u { text-decoration: none }
@ -20,23 +18,141 @@
// footnote things:
aside, u { opacity: 0.7 }
a[id^="fn-"]:target { background: #ff0 }
</style>
<link rel="stylesheet" href="//design.perl6.org/perl.css">
</head>
<body class="pod">
<div id="___top"></div>
<div></div>
<h1>About the Docs</h1>
<p>Meta-documentation</p>
<table>
<h2>Table of Contents</h2>
<tr>
<td>1</td>
<td><a href="#Structure">Structure</a></td>
</tr>
<tr>
<td>2</td>
<td><a href="#Generating_HTML_from_Pod">Generating HTML from Pod</a></td>
</tr>
<tr>
<td>3</td>
<td><a href="#Contributing">Contributing</a></td>
</tr>
<tr>
<td>3.1</td>
<td><a href="#Adding_definitions">Adding definitions</a></td>
</tr>
</table>
<div>
<p>This document collection represents the on-going effort to document the Perl 6 programming language with the goals of being: comprehensive; easy to use; easy to navigate; and useful to both newcomers and experienced Perl 6 programmers.</p>
<p>An HTML version of the documentation is located online at <a href="https://docs.perl6.org">https://docs.perl6.org</a>.</p>
<p>The official source for this documentation is located at <a href="https://github.com/perl6/doc">perl6/doc on GitHub</a>.</p>
<p>This particular document is a quick overview of the process described in more detail in <a href="https://github.com/perl6/doc/blob/master/CONTRIBUTING.md">CONTRIBUTING on GitHub</a>. This document also provides a short introduction to writing Perl 6 Pod files, which can be rendered into HTML and other formats.</p>
<h1><a href="#___top" title="go to top of document">Structure</a></h1>
<p>All of the documentation is written in Perl 6 Pod and kept in the <code>doc/</code> directory, and the <code>doc/Language/</code> and <code>doc/Type/</code> sub-directories. These files are processed as collections of definitions or "documentables", which are then post-processed and linked together.</p>
<h1><a href="#___top" title="go to top of document">Generating HTML from Pod</a></h1>
<p>To generate HTML from the Pod files, you'll need:</p>
<ul>
<li>
<p>A recent version of the Rakudo Perl 6 compiler</p>
</li>
<li>
<p>The Perl 6 modules Pod::To::HTML, Pod::To::BigPage, and URI::Escape (can be installed via <a href="https://github.com/ugexe/zef">zef</a>).</p>
</li>
<li>
<p><strong>Optional</strong>: <a href="http://graphviz.org">GraphViz</a>, for creating graphs of the relationships between Perl 6 types</p>
</li>
<li>
<p><strong>Optional</strong>: <a href="https://github.com/atom/highlights">Atom Highlights</a> and <a href="https://atom.io/packages/language-perl6">language-perl6</a>, for syntax highlighting</p>
</li>
</ul>
<p>To generate the documentation into the <code>html/</code> folder, run:</p>
<pre>perl6 htmlify.p6
</pre>
<p>To host the documentation from a web server, have Perl 5 and Mojolicious::Lite installed, then run:</p>
<pre>perl app.pl daemon
</pre>
<h1><a href="#___top" title="go to top of document">Contributing</a></h1>
<p>The documentation is written in Perl 6 Pod.</p>
<p>For a quick introduction to Perl 6 Pod, see <a href="https://docs.perl6.org/language/pod">Perl 6 Pod</a>.</p>
<p>For full details about the Perl 6 Pod specification, see <a href="https://design.perl6.org/S26.html">Synopsis 26, Documentation</a>.</p>
<h2><a href="#___top" title="go to top of document">Adding definitions</a></h2>
<p>Documentables can be defined using an <code>=headN</code> Pod directive, where <code>N</code> is greater than zero (e.g., <code>=head1</code>, <code>=head2</code>, …).</p>
<p>All of the paragraphs and blocks following that directive, up until the next directive of the same level, will be considered part of the documentable. So, in:</p>
<pre>=head2 <var>My Definition</var>
Some paragraphs, followed by some code:
my Code $examples = "amazing";
Mind === blown.
=head3 Minor details about <var>My Definition</var>
It's fantastic.
=head2 And now, for something completely different
</pre>
<p>The documentable <var>My Definition</var> extends down to the <code>=head2 And now…</code>.</p>
<p>Documentables may contain other documentables. Class documentables, for example, often contain the methods the class implements.</p>
<p>Definitions must be in one of the following forms to be recognized as the start of a documentable named, say, þ. First the code in the document source:</p>
<pre>=item X&lt;C&lt;How to use the þ infix&gt; | infix,þ&gt; (This a special case, which
is always considered a definition)
=item C&lt;The þ Infix&gt;
=item B&lt;The C&lt;þ&gt; Infix&gt;
=item C&lt;Infix þ&gt;
=item B&lt;Infix C&lt;þ&gt;&gt;
=item C&lt;trait is cached&gt; (A special case for the L&lt;trait|/language/functions#Traits&gt; documentables)
</pre>
<p>Then the results on the rendered page:</p>
<ul>
<li>
<p><a name="index-entry-infix_%C3%BE-How_to_use_the_%C3%BE_infix"><code>How to use the þ infix</code></a> (This is a special case, which is always considered a definition)</p>
</li>
<li>
<p><code>The þ Infix</code></p>
</li>
<li>
<p><strong>The <code>þ</code> Infix</strong></p>
</li>
<li>
<p><code>Infix þ</code></p>
</li>
<li>
<p><strong>Infix <code>þ</code></strong></p>
</li>
<li>
<p><code>trait is cached</code> (A special case for the <a href="/language/functions#Traits">trait</a> documentables)</p>
</li>
</ul>
<p>These items should now be searchable by using the search field in the HTML docs.</p>
<p>You can add emphasis with bold (<strong> B&lt;&gt; </strong>) or italicized (<strong> I&lt;&gt; </strong>), with or without code formatting (<strong> C&lt;&gt; </strong>). Due to current parser limitations, special steps have to be taken to use <strong> X&lt;&gt; </strong> with other formatting codes; for example:</p>
<pre>=item X&lt;B&lt;foo&gt;|foo&gt; a fancy subroutine
</pre>
<p>renders like this</p>
<ul>
<li>
<p><a name="index-entry-foo-foo"><strong>foo</strong></a> a fancy subroutine</p>
</li>
</ul>
<p>Notice that text after a pipe ('|') has no formatting. Also note that <strong> C&lt;&gt; </strong> preserves spaces and treats text as verbatim.</p>
<div class="pod-body
no-toc
">
<img style="float: right; margin: 0 0 1em 1em" src="/images/camelia.png" alt="" id="home_logo"/> Welcome to the official documentation of the <a href="https://perl6.org">Perl 6</a> programming language! Besides online browsing and searching, you can also <a href="/perl6.xhtml">view everything in one file</a> or <a href="https://github.com/perl6/doc">contribute</a> by reporting mistakes or sending patches.<hr/><dl><dt><a href="/language.html">Language Reference & Tutorials</a></dt> <dd> A collection of documents describing, in detail, the various conceptual parts of the language. <!-- If you're new to Perl 6, language>intro is a good place to start. --></dd><dt><a href="/type.html">Type Reference</a></dt> <dd> Index of built-in classes and roles. </dd><dt><a href="/routine.html">Routine Reference</a></dt> <dd> Index of built-in subroutines and methods. </dd><dt><a href="/programs.html">Perl 6 Programs</a></dt> <dd> A collection of documents describing how to run the Perl 6 executable program and other utilities, how to debug Perl 6 programs, and how to hack on Perl 6 source code. </dd><!-- <dt><a href="/module.html">Module Reference</a></dt> <dd> Index of modules that are part of the official core distribution. </dd> --></dl><hr/><p>The Perl 6 homepage offers <a href="https://perl6.org/resources/">a comprehensive list of Perl 6 resources</a>, including tutorials, how-tos and <a href="/language/faq">FAQs (Frequently Asked Questions)</a>.</p><p> Perl&nbsp;6 compiler developers may also be interested in <a href="https://github.com/perl6/roast">The Perl&nbsp;6 Specification</a>. Documentation for the different but related <a href="https://www.perl.org/">Perl 5</a> language can be found on the <a href="http://perldoc.perl.org/">Perl 5 documentation website</a>. </p>
</div>
</body>
</html>