aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@gmail.com>2019-04-13 20:12:51 -0300
committerMatias Linares <matiaslina@gmail.com>2019-04-13 20:12:51 -0300
commit7e3ec5cd9242c24d364ee78d9398650fbf06cf1a (patch)
treef419f0ec4697c715118113966760ee267d812c0c
parent34fa5a371e98fbfb6d50fcc232e9f6bf171ad905 (diff)
downloadperl6-pygments-7e3ec5cd9242c24d364ee78d9398650fbf06cf1a.tar.gz
Update docs
-rw-r--r--META6.json6
-rw-r--r--README.md2
-rw-r--r--lib/Pygments.pm611
3 files changed, 11 insertions, 8 deletions
diff --git a/META6.json b/META6.json
index 9d38d51..40e5546 100644
--- a/META6.json
+++ b/META6.json
@@ -16,8 +16,10 @@
"resources" : [
"perl.py"
],
- "source-url" : "https://github.com/matiaslina/perl6-pygments",
+ "source-url" : "https://github.com/matiaslina/perl6-pygments.git",
"tags" : [ ],
- "test-depends" : [ ],
+ "test-depends" : [
+ "Test::META"
+ ],
"version" : "0.0.1"
}
diff --git a/README.md b/README.md
index 2a28bdb..24288aa 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ Printing some code with a terminal formatter.
# OUTPUT: 「I love Rust」 love => 「love」 lang => 「Rust」
ENDCODE
- # Format a full html with line numbers and theme `manni`
+ # Output to terminal with line numbers.
Pygments.highlight(
$code, "perl6", :formatter<terminal>,
:linenos(True)
diff --git a/lib/Pygments.pm6 b/lib/Pygments.pm6
index a303f18..0a73457 100644
--- a/lib/Pygments.pm6
+++ b/lib/Pygments.pm6
@@ -4,6 +4,7 @@ unit class Pygments:ver<0.0.1>;
use Inline::Python;
my Inline::Python $py;
+
method !ip {
return $py if $py.defined;
@@ -21,7 +22,7 @@ method !ip {
}
method call($name, |c) {
- self!ip.call('__main__', $name, |c)
+ self!ip().call('__main__', $name, |c)
}
method highlight(Str $code, $lexer = Any, :$formatter = 'html', *%options) is export {
@@ -32,7 +33,7 @@ method highlight(Str $code, $lexer = Any, :$formatter = 'html', *%options) is ex
};
my $f = $.formatter($formatter, |%options);
- self!ip.call('pygments', 'highlight', $code, $l, $f)
+ self!ip().call('pygments', 'highlight', $code, $l, $f)
}
method formatter($name, *%options) is export {
@@ -40,11 +41,11 @@ method formatter($name, *%options) is export {
}
method style(Str $name = 'default') {
- self!ip.call('pygments.styles', 'get_style_by_name', $name)
+ self!ip().call('pygments.styles', 'get_style_by_name', $name)
}
method styles {
- self!ip.run('list(STYLE_MAP.keys())', :eval).map: *.decode
+ self!ip().run('list(STYLE_MAP.keys())', :eval).map: *.decode
}
=begin pod
@@ -72,7 +73,7 @@ Printing some code with a terminal formatter.
# OUTPUT: 「I love Rust」 love => 「love」 lang => 「Rust」
ENDCODE
- # Format a full html with line numbers and theme `manni`
+ # Output to terminal with line numbers.
Pygments.highlight(
$code, "perl6", :formatter<terminal>,
:linenos(True)