/
githubmirror
/
hexo
Обзор
Документация
Войти
/
githubmirror
/
hexo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/fixtures/post_render.ts
80 строк
2 KB
D-Sketon
refactor: migrate typescript (#5430)
30 мар 2024, 14:31
Не верифицирован
30 мар 2024, 14:31
a3b9638
Код
Авторство
О чём код?
import { highlight } from 'hexo-util'; const code = [ 'if tired && night:', ' sleep()' ].join('\n'); export const content = [ '# Title', '``` python', code, '```', 'some content', '', '## Another title', '{% blockquote %}', 'quote content 1', '{% endblockquote %}', '', '{% quote Hello World %}', 'quote content 2', '{% endquote %}' ].join('\n'); export const expected = [ '<h1 id="Title"><a href="#Title" class="headerlink" title="Title"></a>Title</h1>', highlight(code, {lang: 'python'}), '\n<p>some content</p>\n', '<h2 id="Another-title"><a href="#Another-title" class="headerlink" title="Another title"></a>Another title</h2>', '<blockquote>', '<p>quote content 1</p>\n', '</blockquote>\n\n', '<blockquote><p>quote content 2</p>\n', '<footer><strong>Hello World</strong></footer></blockquote>' ].join(''); export const expected_disable_nunjucks = [ '<h1 id="Title"><a href="#Title" class="headerlink" title="Title"></a>Title</h1>', highlight(code, {lang: 'python'}), '\n<p>some content</p>\n', '<h2 id="Another-title"><a href="#Another-title" class="headerlink" title="Another title"></a>Another title</h2>', '<p>{% blockquote %}<br>', 'quote content 1<br>', '{% endblockquote %}</p>\n', '<p>{% quote Hello World %}<br>', 'quote content 2<br>', '{% endquote %}</p>' ].join(''); export const content_for_issue_3346 = [ '# Title', '```', '{% test1 %}', '{{ test2 }}', '```', 'some content', '', '## Another title', '{% blockquote %}', 'quote content', '{% endblockquote %}' ].join('\n'); export const expected_for_issue_3346 = [ '<h1 id="Title"><a href="#Title" class="headerlink" title="Title"></a>Title</h1>', highlight('{% test1 %}\n{{ test2 }}').replace(/{/g, '{').replace(/}/g, '}'), // Escaped by backtick_code_block '\n<p>some content</p>\n', '<h2 id="Another-title"><a href="#Another-title" class="headerlink" title="Another title"></a>Another title</h2>', '<blockquote>', '<p>quote content</p>\n', '</blockquote>' ].join(''); export const content_for_issue_4460 = [ '```html', '<body>', '<!-- here goes the rest of the page -->', '</body>', '```' ].join('\n');