Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds POD6, the markup language for Perl6, to the repo #1173

Merged
merged 21 commits into from
Dec 12, 2018
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Gemfile.lock
vendor/
.project
.buildpath
*~
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ git:
before_install:
- sudo apt-get update -qq
- sudo apt-get install perl
- wget -O /tmp/perl6.deb https://github.com/nxadm/rakudo-pkg/releases/download/v2018.02.1/rakudo-pkg-Ubuntu14.04_2018.02.1-01_amd64.deb && sudo dpkg -i /tmp/perl6.deb && export PATH=$PATH:/.perl6/bin:/opt/rakudo-pkg/bin && install-zef-as-user && zef install Pod::To::HTML
kivikakk marked this conversation as resolved.
Show resolved Hide resolved
- curl -L http://cpanmin.us | perl - --sudo App::cpanminus
- sudo cpanm --installdeps --notest Pod::Simple
- sudo pip install docutils
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a
* [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org)
* [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::XHTML`
comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.

* [.pod6](https://docs.perl6.org/language/pod) -- No additional
dependency.
JJ marked this conversation as resolved.
Show resolved Hide resolved

Installation
-----------
Expand All @@ -38,6 +39,14 @@ Installation
gem install github-markup
```

or

```
bundle install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe do this change as a separate PR? There's already another one with some README additions that this might be combined with

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which one do you mean?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

```

from this directory

Usage
-----

Expand Down
6 changes: 6 additions & 0 deletions lib/github/commands/pod62html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env perl6

use v6;

use Pod::To::HTML;
put Pod::To::HTML.render(slurp);
2 changes: 1 addition & 1 deletion lib/github/markup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module Markups
MARKUP_RDOC = :rdoc
MARKUP_RST = :rst
MARKUP_TEXTILE = :textile
MARKUP_POD6 = :pod6
end

module Markup
Expand Down Expand Up @@ -73,7 +74,6 @@ def command(symbol, command, regexp, languages, name, &block)
if File.exist?(file = File.dirname(__FILE__) + "/commands/#{command}")
command = file
end

markup_impl(symbol, CommandImplementation.new(regexp, languages, command, name, &block))
end

Expand Down
3 changes: 2 additions & 1 deletion lib/github/markups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@
"restructuredtext"
)

command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod/, ["Pod"], "pod")
command(::GitHub::Markups::MARKUP_POD6, :pod62html, /pod6/, ["Perl 6"], "pod6")
command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod$/, ["Pod"], "pod")
kivikakk marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 2 additions & 4 deletions test/markup_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# encoding: UTF-8
# encoding: utf-8

$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"

Expand Down Expand Up @@ -52,7 +52,6 @@ def call

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
Expand All @@ -67,7 +66,6 @@ def call
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}
Expand All @@ -93,7 +91,7 @@ def test_each_render_has_a_name
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', '=begin').name
assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name
kivikakk marked this conversation as resolved.
Show resolved Hide resolved
end

def test_rendering_by_symbol
Expand Down
152 changes: 152 additions & 0 deletions test/markups/README.pod6
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
=begin pod

=TITLE About the Docs

=SUBTITLE Meta-documentation

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.

An HTML version of the documentation is located online at
L<https://docs.perl6.org>.

The official source for this documentation is located at L<perl6/doc on
GitHub|https://github.com/perl6/doc>.

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.

=head1 Structure

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.

=head1 Generating HTML from Pod

To generate HTML from the Pod files, you'll need:

=item A recent version of the Rakudo Perl 6 compiler

=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>).

=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
Loading