aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/gen-doc.p646
-rw-r--r--templates/index.mustache84
-rw-r--r--templates/main.mustache69
3 files changed, 199 insertions, 0 deletions
diff --git a/bin/gen-doc.p6 b/bin/gen-doc.p6
new file mode 100644
index 0000000..1e41aa8
--- /dev/null
+++ b/bin/gen-doc.p6
@@ -0,0 +1,46 @@
+use v6;
+use Pygments;
+
+my %*POD2HTML-CALLBACKS;
+%*POD2HTML-CALLBACKS<code> = sub (:$node, :&default) {
+ Pygments.highlight($node.contents.join('\n'), "perl6",
+ :style(Pygments.style('emacs')))
+};
+
+use Pod::To::HTML;
+use Pod::Load;
+use Template::Mustache;
+
+sub git-version {
+ run('git', 'tag', '-l', :out).out.lines.first
+}
+sub pods { dir('./docs', :test( *.IO.extension eq 'pod'|'pod6' )) }
+
+my $sidebar = pods.sort.map(
+ -> $p {
+ my $f = $p.IO.extension('html').basename;
+ "<li><a href='$f'>{$f.split('.').first.tc}</a></li>"
+ });
+
+sub MAIN(:o(:$output-dir)?) {
+ $output-dir.IO.add('index.html').spurt(
+ Template::Mustache.render('./templates/index.mustache'.IO.slurp,
+ {version => git-version()}));
+
+ pods.map(
+ -> $pod {
+ say "Generating html for $pod";
+ next if $pod.IO.extension ne 'pod'|'pod6';
+ my $html = pod2html(
+ load($pod.IO),
+ :templates<templates>
+ );
+
+ my $filename = $pod.IO.extension('html');
+ my $output = $output-dir.defined ??
+ $output-dir.IO.add($filename.basename) !!
+ $filename;
+
+ spurt $output, $html;
+ });
+}
diff --git a/templates/index.mustache b/templates/index.mustache
new file mode 100644
index 0000000..92a3ed3
--- /dev/null
+++ b/templates/index.mustache
@@ -0,0 +1,84 @@
+<!doctype html>
+<html lang="{{ lang }}">
+ <head>
+ <title>Matrix::Client</title>
+ <meta charset="UTF-8" />
+ <link rel="stylesheet" href="https://code.cdn.mozilla.net/fonts/fira.css">
+ <style>
+ kbd { font-family: "Droid Sans Mono", "Luxi Mono", "Inconsolata", monospace }
+ samp { font-family: "Terminus", "Courier", "Lucida Console", monospace }
+ u { text-decoration: none }
+ .nested {
+ margin-left: 3em;
+ }
+ aside, u { opacity: 0.7 }
+ a[id^="fn-"]:target { background: #ff0 }
+ </style>
+ <style>
+ {{ style }}
+ </style>
+ </head>
+ <body class="pod">
+ <div id="___top"></div>
+ <div id="wrapper">
+ <header class="header">
+ <a class="box" href="/">
+ <img src="https://deprecated.org/raw/i/perl6-matrix@100.png" alt='perl6-matrix' />
+ <h1 id="title">
+ Perl 6 Matrix Client
+ </h1>
+ </a>
+
+ </header>
+ <aside class="menu">
+ <nav>
+ <h3>Download</h3>
+ <p>Current version <b>{{ version }}</b></p>
+ <p>Get Matrix::Client from <a href="https://github.com/matiaslina/perl6-matrix-client">Github</a>, or install it with <a href="https://github.com/ugexe/zef">zef</a></p>
+ <div class="highlight">
+ <pre style='font-size: 12px; '>zef install Matrix::Client</pre>
+ </div>
+
+ <nav>
+ <h3>Documentation</h3>
+ <ul>
+ <li><a href="basics.html">Basics</a></li>
+ <li><a href="usage.html">Usage</a></li>
+ <li>API</li>
+ <ul>
+ <li><a href="client.html">Matrix::Client</a></li>
+ <li><a href="responses.html">Matrix::Responses</a></li>
+ <li><a href="room.html">Matrix::Client::Room</a></li>
+ <li><a href="x-matrix-response.html">X::Matrix</a></li>
+ <li><a href="requester.html">Matrix::Requester</a></li>
+ </ul>
+ </ul>
+ </nav>
+ </aside>
+
+ <div class="content">
+ <h1 class='title'>Welcome!</h1>
+ This is the home of Matrix::Client. It is a perl 6 client to interact with the
+ <a href="https://matrix.org">matrix</a> protocol. This library aims to deliver a full
+ coverage of the client-server api.
+
+ Read more in the <a href="basics.html">Basic tutorial</a>.
+
+ <h2>Contribute</h2>
+ <p>Development takes place on <a href="https://github.com/matiaslina/perl6-matrix-client">Github</a> where the repository, tickets and pull requests can be viewed.</p>
+ <p>If you want to make a contribution, found a bug, or just want to propose a feature,
+ just open a ticket on github. You can also send an e-mail to me or get in touch through matrix.</p>
+
+ <h2>Author</h2>
+ <p>Matrix::Client is developed by <b>Matias Linares</b>. You can send an e-mail to
+ <i>matias AT deprecated DOT org</i> or send a message to
+ <a href="https://matrix.to/#/@matias:matrix.deprecated.org"><i>@matias:matrix.deprecated.org</i></a></p>
+ </div>
+ <footer>
+
+ <a href="https://github.com/matiaslina/perl6-matrix-client">
+ <img width=40 src="https://cdn1.iconfinder.com/data/icons/smallicons-logotypes/32/github-512.png" />
+ </a>
+ </footer>
+ </body>
+</html>
diff --git a/templates/main.mustache b/templates/main.mustache
new file mode 100644
index 0000000..78501f3
--- /dev/null
+++ b/templates/main.mustache
@@ -0,0 +1,69 @@
+<!doctype html>
+<html lang="{{ lang }}">
+ <head>
+ <title>{{{ title }}}</title>
+ <meta charset="UTF-8" />
+ <link rel="stylesheet" href="https://code.cdn.mozilla.net/fonts/fira.css">
+ <style>
+ kbd { font-family: "Droid Sans Mono", "Luxi Mono", "Inconsolata", monospace }
+ samp { font-family: "Terminus", "Courier", "Lucida Console", monospace }
+ u { text-decoration: none }
+ .nested {
+ margin-left: 3em;
+ }
+ aside, u { opacity: 0.7 }
+ a[id^="fn-"]:target { background: #ff0 }
+ </style>
+ <link rel="stylesheet" href="https://deprecated.org/raw/s/styles.css">
+ {{# metadata }}{{{ metadata }}}{{/ metadata }}
+ {{{ head }}}
+ </head>
+ <body class="pod">
+ <div id="___top"></div>
+ <div id="wrapper">
+ <header class="header">
+ <a class="box" href="/">
+ <img src="https://deprecated.org/raw/i/perl6-matrix@100.png" alt='perl6-matrix' />
+ <h1 id="title">
+ Perl 6 Matrix Client
+ </h1>
+ </a>
+ </header>
+
+ <aside class="menu">
+ <nav><h3><a href="index.html">Home</a></h3></nav>
+ {{# toc }}{{{ toc }}}{{/ toc }}
+ <nav>
+ <h3>See also</h3>
+ <ul>
+ <li><a href="basics.html">Basics</a></li>
+ <li><a href="usage.html">Usage</a></li>
+ <li><b><u>API</u></b></li>
+ <ul>
+ <li><a href="client.html">Matrix::Client</a></li>
+ <li><a href="responses.html">Matrix::Responses</a></li>
+ <li><a href="room.html">Matrix::Client::Room</a></li>
+ <li><a href="x-matrix-response.html">X::Matrix</a></li>
+ <li><a href="requester.html">Matrix::Requester</a></li>
+ </ul>
+ </ul>
+ </nav>
+ </aside>
+
+ <div class="content">
+ {{# title }}<h1 class='title'>{{{ title }}}</h1>{{/ title }}
+ {{# subtitle }}<p class='subtitle'>{{{ subtitle }}}</p>{{/ subtitle }}
+ <div class="pod-body{{^ toc }} no-toc{{/ toc }}">
+ {{# body }}{{{ . }}}{{/ body }}
+ </div>
+ {{# footnotes }}{{{ footnotes }}}{{/ footnotes }}
+ {{{ footer }}}
+ </div>
+ <footer>
+ <a href="https://github.com/matiaslina/perl6-matrix-client">
+ <img width=40 src="https://cdn1.iconfinder.com/data/icons/smallicons-logotypes/32/github-512.png" />
+ </a>
+ </footer>
+ </div>
+ </body>
+</html>