ソフトウェア/pukiwiki/gist.inc.php の履歴(No.1)
更新- 履歴一覧
- 差分 を表示
- 現在との差分 を表示
- ソース を表示
- ソフトウェア/pukiwiki/gist.inc.php へ行く。
- 1
gist のコードを貼り込めるようにした†
していたのに公開し忘れてた。
https://mushikago.com/i/?p=7801 で紹介されている gist-embed を使ってる。
LANG:php
<?php
// 現在、ファイルが複数ある時に対応していない
// http://ayapi.github.io/posts/embeddinggists/
// のようにするともっといろいろできるらしい
function plugin_gist_convert_sub($s)
{
if (!$s) {
return '';
}
if (preg_match('/^[0-9,]+$/', $s)) {
return ' data-gist-highlight-line="' + $s + '"';
}
if (preg_match('/^[,0-9\-]+$/', $s)) {
return ' data-gist-line="' + $s + '"';
}
return ' data-gist-file="' + $s + '"';
}
function plugin_gist_convert()
{
global $script, $vars, $asin, $asin_all;
$args = func_get_args();
$id = $args[0];
$options = plugin_gist_convert_sub($args[1])
+ plugin_gist_convert_sub($args[2])
+ plugin_gist_convert_sub($args[3]);
return "<code data-gist-id=\"$id\"$options></code>";
// return "<script src=\"https://gist.github.com/$id.js\"></script>";
}
?>
スキンの方に、
LANG:html <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.7.1/gist-embed.min.js"></script>
も必要。
使用例†
github も貼れるようにすると良いのかも†
https://www.moongift.jp/2013/11/gist-it-githubのファイルをgist風に埋め込み表示/
gist-it というのを使うと良いみたい。
Counter: 3587 (from 2010/06/03),
today: 1,
yesterday: 4