Compare commits
No commits in common. "1de5e568efd5f9014e6404b1df7858654a685375" and "2fff247ac1c36b242ff65d9986fcccbb0063c0ab" have entirely different histories.
1de5e568ef
...
2fff247ac1
2
run.php
2
run.php
@ -49,7 +49,7 @@ foreach ($titles as $title) {
|
|||||||
|
|
||||||
$sanitized_title = $title;
|
$sanitized_title = $title;
|
||||||
$sanitized_title = strtolower($sanitized_title);
|
$sanitized_title = strtolower($sanitized_title);
|
||||||
$sanitized_title = str_replace([' ', ',', '\''], ['-'], $sanitized_title);
|
$sanitized_title = str_replace([' ', ','], ['-'], $sanitized_title);
|
||||||
$sanitized_title .= '.gmi';
|
$sanitized_title .= '.gmi';
|
||||||
|
|
||||||
$output_path = $gemlog_output_path . '/' . $sanitized_title;
|
$output_path = $gemlog_output_path . '/' . $sanitized_title;
|
||||||
|
@ -7,7 +7,6 @@ namespace LogseqGem;
|
|||||||
use League\CommonMark\Node\Inline\Text;
|
use League\CommonMark\Node\Inline\Text;
|
||||||
use League\CommonMark\Extension\CommonMark\Node\Inline\Link;
|
use League\CommonMark\Extension\CommonMark\Node\Inline\Link;
|
||||||
use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock;
|
use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock;
|
||||||
use League\CommonMark\Extension\CommonMark\Node\Block\ListItem;
|
|
||||||
|
|
||||||
class ArticleParser extends Parser {
|
class ArticleParser extends Parser {
|
||||||
private ?array $properties;
|
private ?array $properties;
|
||||||
@ -18,22 +17,14 @@ class ArticleParser extends Parser {
|
|||||||
|
|
||||||
$in_frontmatter = true;
|
$in_frontmatter = true;
|
||||||
|
|
||||||
$node = null; //current node
|
// we only update this for significant nodes
|
||||||
$last_node = null; //updated every time
|
$previous_node = null;
|
||||||
$previous_node = null; // we only update this for significant nodes
|
|
||||||
|
|
||||||
$walker = $this->document->walker();
|
$walker = $this->document->walker();
|
||||||
while ($event = $walker->next()) {
|
while ($event = $walker->next()) {
|
||||||
$entering = $event->isEntering();
|
$entering = $event->isEntering();
|
||||||
$last_node = $node;
|
|
||||||
$node = $event->getNode();
|
$node = $event->getNode();
|
||||||
|
|
||||||
// treat empty node as a newline
|
|
||||||
if ($node instanceof ListItem && $last_node === $node && !$entering) {
|
|
||||||
$gemtext[] = '';
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$entering) {
|
if (!$entering) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
%CONTENT%
|
%CONTENT%
|
||||||
|
|
||||||
✑ Annika
|
- annika // %DATE_FORMATTED%
|
||||||
📅 %DATE_FORMATTED%
|
|
||||||
|
|
||||||
=> /gemlog.gmi gemlog
|
=> /gemlog.gmi gemlog
|
||||||
=> / home
|
=> / home
|
||||||
|
@ -89,10 +89,4 @@ class ArticleParserTest extends TestCase {
|
|||||||
$this->parser->convert();
|
$this->parser->convert();
|
||||||
$this->assertTrue($this->parser->isPublished());
|
$this->assertTrue($this->parser->isPublished());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNewlineBetweenLinks() {
|
|
||||||
$this->setArticleText("\n- [foo](bar)\n-\n- [bar](foo)");
|
|
||||||
$this->parser->load(vfsStream::url('root/article.md'));
|
|
||||||
$this->assertSame("=> bar foo\n\n=> foo bar", $this->parser->convert());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user