|
|
@ -496,48 +496,6 @@ $server->setHandler( |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 'gemtext': |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Key |
|
|
|
|
|
|
|
$result[] = null; |
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'# %s', |
|
|
|
|
|
|
|
trim( |
|
|
|
|
|
|
|
preg_replace( // single-line |
|
|
|
|
|
|
|
'/[\s]+/', |
|
|
|
|
|
|
|
' ', |
|
|
|
|
|
|
|
$record['key'] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Value |
|
|
|
|
|
|
|
$result[] = null; |
|
|
|
|
|
|
|
$result[] = trim( |
|
|
|
|
|
|
|
preg_replace( |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'/[\n\r]{3,}/', // remove extra breaks |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
PHP_EOL . PHP_EOL, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
$record['value'] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Time |
|
|
|
|
|
|
|
$result[] = null; |
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'%s in %d', |
|
|
|
|
|
|
|
date( |
|
|
|
|
|
|
|
'Y-m-d', |
|
|
|
|
|
|
|
$record['time'] |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
$record['block'] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
|
|
|
|
|
|
|
|
// Key |
|
|
|
// Key |
|
|
@ -558,7 +516,7 @@ $server->setHandler( |
|
|
|
$result[] = trim( |
|
|
|
$result[] = trim( |
|
|
|
preg_replace( |
|
|
|
preg_replace( |
|
|
|
[ |
|
|
|
[ |
|
|
|
'/(^|\s+)(#|\*|```|=>)/', // escape gemini text |
|
|
|
'/(^|\s+)(#|##)/', // escape h1, h2, hashtags |
|
|
|
'/[\n\r]{3,}/', // remove extra breaks |
|
|
|
'/[\n\r]{3,}/', // remove extra breaks |
|
|
|
], |
|
|
|
], |
|
|
|
[ |
|
|
|
[ |
|
|
@ -594,23 +552,6 @@ $server->setHandler( |
|
|
|
{ |
|
|
|
{ |
|
|
|
case 'raw': |
|
|
|
case 'raw': |
|
|
|
|
|
|
|
|
|
|
|
$result[] = null; |
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'=> /%s?gemtext %s', |
|
|
|
|
|
|
|
$record['transaction'], |
|
|
|
|
|
|
|
$config->geminiapp->string->view->gemtext |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'=> /%s %s', |
|
|
|
|
|
|
|
$record['transaction'], |
|
|
|
|
|
|
|
$config->geminiapp->string->view->reader |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'gemtext': |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result[] = null; |
|
|
|
$result[] = null; |
|
|
|
$result[] = sprintf( |
|
|
|
$result[] = sprintf( |
|
|
|
'=> /%s %s', |
|
|
|
'=> /%s %s', |
|
|
@ -618,23 +559,11 @@ $server->setHandler( |
|
|
|
$config->geminiapp->string->view->reader |
|
|
|
$config->geminiapp->string->view->reader |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'=> /%s?raw %s', |
|
|
|
|
|
|
|
$record['transaction'], |
|
|
|
|
|
|
|
$config->geminiapp->string->view->raw |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
|
|
|
|
|
|
|
|
$result[] = null; |
|
|
|
$result[] = null; |
|
|
|
$result[] = sprintf( |
|
|
|
|
|
|
|
'=> /%s?gemtext %s', |
|
|
|
|
|
|
|
$record['transaction'], |
|
|
|
|
|
|
|
$config->geminiapp->string->view->gemtext |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result[] = sprintf( |
|
|
|
$result[] = sprintf( |
|
|
|
'=> /%s?raw %s', |
|
|
|
'=> /%s?raw %s', |
|
|
|
$record['transaction'], |
|
|
|
$record['transaction'], |
|
|
|