Browse Source

fix new lines format

main
ghost 10 months ago
parent
commit
46fefa0e90
  1. 32
      src/controller/room.php
  2. 2
      src/view/post.gemini

32
src/controller/room.php

@ -261,17 +261,21 @@ class Room @@ -261,17 +261,21 @@ class Room
$quote = '>' .
trim(
preg_replace(
'/^@([A-z0-9]{64})/',
'/^@([A-z0-9]{64}[\n\r]?)/',
null,
// Add quote after each new line
str_replace(
PHP_EOL,
PHP_EOL . '>',
preg_replace(
'/[\n\r]+/',
PHP_EOL,
// Ignore markup
$this->_plain(
$post['value']
)
)
)
),
'>'
);
@ -284,9 +288,13 @@ class Room @@ -284,9 +288,13 @@ class Room
$record['value'] = preg_replace(
'/^@([A-z0-9]{64})/',
null,
preg_replace(
'/[\n\r]+/',
PHP_EOL,
$this->_plain(
$record['value']
)
)
);
}
}
@ -302,8 +310,7 @@ class Room @@ -302,8 +310,7 @@ class Room
'{author}',
'{quote}',
'{message}',
'{reply}',
PHP_EOL . PHP_EOL
'{reply}'
],
[
$record['txid'],
@ -312,8 +319,12 @@ class Room @@ -312,8 +319,12 @@ class Room
),
'@' . $matches[2],
$quote,
preg_replace(
'/[\n\r]+/',
PHP_EOL,
$this->_plain(
$record['value']
)
),
$this->_url( // @TODO
sprintf(
@ -321,8 +332,7 @@ class Room @@ -321,8 +332,7 @@ class Room
$namespace,
$record['txid'],
)
),
PHP_EOL
)
],
file_get_contents(
__DIR__ . '/../view/post.gemini'
@ -414,12 +424,20 @@ class Room @@ -414,12 +424,20 @@ class Room
'#',
'##',
'###',
'=>',
'>',
'*',
'```',
'```'
],
[
' #',
' ##',
' ###',
' =>',
' >',
' *',
' ```'
],
null,
$value
)
);

2
src/view/post.gemini

@ -1,7 +1,5 @@ @@ -1,7 +1,5 @@
### {author} [{time}]
{quote}
{message}
=> {reply} Reply

Loading…
Cancel
Save