美文网首页Raku Programming Language
使用 Perl 6 创建 Jekyll 文章模版

使用 Perl 6 创建 Jekyll 文章模版

作者: 焉知非鱼 | 来源:发表于2018-04-02 13:12 被阅读9次
#| 使用 Perl 6 自动创建 Jekyll 文章模版
sub MAIN(:$f) {
    my $file = Date.today ~ '-' ~ $f.subst(/\s+/, '-', :g) ~ '.md';
    chdir "/Users/ohmycloud/blogs/youngforperl6" or die;
    shell("git fetch origin master");
    chdir "/Users/ohmycloud/blogs/youngforperl6/_posts" or die;
    my $fh = "$file".IO.open(:mode<wo>, :create);

    $fh.say: qq:to/EOF/;
    ---
    layout: post
    title: $f
    categories: [Perl 6]
    tags: [Perl6]
    ---
    EOF
    shell("Atom $file");
}

使用:

perl6 test.pl6 -f='使用 Perl 6 创建 Jekyll 文章模版'

相关文章

网友评论

    本文标题:使用 Perl 6 创建 Jekyll 文章模版

    本文链接:https://www.haomeiwen.com/subject/xpothftx.html