发布片段(Smultron的附加组件)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了发布片段(Smultron的附加组件)相关的知识,希望对你有一定的参考价值。
#!/usr/bin/perl -w use strict; use Frontier::Client; # # Post a snippet (add-on for Smultron) # perl smultron snipperl rpc # # (paste the script as a New Command in Tools menu, for example: Post it) # (then select lines of code and run the script, Tools -> Commands -> Post it) # # post title grabbed from first non-empty comment, if any # tags grabbed from second non-empty comment, if any # language set to first tag, if many of them, else set to bash # my $key = ''; # (your API key) my $tempfile = '%%s'; my $title='no title yet'; my $code = ''; my $tags = ''; my $language = 'bash'; my $flag = 0; while (<FC>) { if (/^#[^!]s*(.+)/ && $flag == 0) { $title = $1; $flag++; } elsif (/^#[^!]s*(.+)/ && $flag == 1) { $tags = $1; $flag++; if (/(w+) (.+)/) { $language = $1; $tags = $2; } } $code = $code . $_; } my @args = ($key, $title, $code, $tags, $language); my $result = $session->call('snippet.post', @args);
以上是关于发布片段(Smultron的附加组件)的主要内容,如果未能解决你的问题,请参考以下文章