From 5259402f5c6a60b22724e1cede1580916f398b4f Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Tue, 9 Jan 2018 21:10:30 +0000 Subject: [PATCH] lib/php/out/vim_hash.php --- lib/php/out.php | 11 +++++++---- lib/php/out/vim_hash.php | 14 +++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/php/out.php b/lib/php/out.php index 4c899792..ebfddd33 100644 --- a/lib/php/out.php +++ b/lib/php/out.php @@ -209,11 +209,13 @@ Class Out extends Nb { } public static function end(&$o) { - #if (isset($o['end'])) echo $o['end']($o); + if (!empty($o['align'])) { + foreach ($o['rows'] as $rec) { - $values = []; + self::type_call('row',$o,$rec); + $values = []; foreach ($rec as $k => $v) { $v = self::mb_str_pad($v, $o['length'][$k], ' ', STR_PAD_RIGHT); $values[] = $v; @@ -221,12 +223,13 @@ Class Out extends Nb { echo rtrim(join($o['sep'],$values)) . $o['eol']; } - return; - } + + } self::type_call('end',$o); if (isset($o['enclose'])) echo $o['enclose'][1]; unset($o['row_count']); + } public static function rows_get($type,$data,$head=array()) { diff --git a/lib/php/out/vim_hash.php b/lib/php/out/vim_hash.php index 6947139b..5abbc192 100644 --- a/lib/php/out/vim_hash.php +++ b/lib/php/out/vim_hash.php @@ -1,8 +1,16 @@ self::p('sep',':'), 'eol' => "\n", 'quote' => "'", -'row' => function (&$o,&$row) { - debug('zaza'); - return true; +'row' => function (&$o,&$r) { + static $count; + echo '\\'.( empty($count) ? ' ' : ',' ); + $count++; + + $keys = array_keys($r); + for ($i=2;$i -- 2.47.3