pukiwikiをscrapbox jsonにするプログラム
個人的に使ったので貼っておくbsahd.icon
プラグインフォルダに配置して、?plugin=jsondumpで使う
HTMLのソースにJSONがあるのでコピペで保存、インポート
code:jsondump.inc.php
<?php
// PukiWiki - Yet another WikiWikiWeb clone.
// jsondump.inc.php
// Copyright 2024 bsahd
// License: GPL v2 or (at your option) any later version
// filelist.inc.phpをベースに作成しています
// JsonDump plugin: show json dump
function plugin_jsondump_action()
{
global $vars, $_title_list, $_title_filelist, $whatsnew;
// Redirected from filelist plugin?
$filelist = false;
return array(
'msg'=>$filelist ? $_title_filelist : $_title_list,
'body'=>plugin_jsondump_getlist($filelist));
}
// Get a list
function plugin_jsondump_getlist($withfilename = FALSE)
{
global $non_list, $whatsnew;
$pages = array_diff(get_existpages(), array($whatsnew));
$html = array("pages"=>array());
foreach($pages as $file=>$page) {
$temp = explode("\n",file_get_contents('wiki/'.$file));
$html"pages"[] = array("title"=>$page,"lines"=>$temp); }
return json_encode($html,JSON_PRETTY_PRINT);
}