Word count for markdown updated with test#1354
Merged
JohnNiang merged 7 commits intohalo-dev:masterfrom May 2, 2021
MasterWanna:master
Merged
Word count for markdown updated with test#1354JohnNiang merged 7 commits intohalo-dev:masterfrom MasterWanna:master
JohnNiang merged 7 commits intohalo-dev:masterfrom
MasterWanna:master
Conversation
JohnNiang
requested changes
Apr 19, 2021
| ".png)"; | ||
|
|
||
| @Test | ||
| @Transactional |
| @Slf4j | ||
| public class BasePostServiceImplTest { | ||
|
|
||
| String markdownWithPicture = "字数测试,测试这篇文章加上图片有没有问题\n" + |
Member
There was a problem hiding this comment.
真是 markdown 有很多种格式,希望能够考虑完全。建议先把测试用例写好,再写代码。
LIlGG
reviewed
Apr 20, 2021
src/main/java/run/halo/app/service/impl/BasePostServiceImpl.java
Outdated
Show resolved
Hide resolved
ruibaby
requested changes
Apr 20, 2021
| */ | ||
|
|
||
| public static long markdownWordCount(String originalContent) { | ||
| originalContent = MarkdownUtils.renderHtml(originalContent); |
Member
There was a problem hiding this comment.
不太明白你这里为什么要再渲染一次 Markdown,在上面已经渲染过了。
Member
There was a problem hiding this comment.
而且这应该处理的是 html 内容,而不是 Markdown,使用 Markdown 作为主线是不是有点问题?直接改为处理 HTML 就好了。
Contributor
Author
There was a problem hiding this comment.
这里markdown都可以转为html,html直接去掉标签,再去掉一些特殊字符就可以直接取length了,这边的测试样例应该怎么写呢?是以markdown为基础测试还是以html为基础做测试呢?
Member
There was a problem hiding this comment.
这里markdown都可以转为html,html直接去掉标签,再去掉一些特殊字符就可以直接取length了,这边的测试样例应该怎么写呢?是以markdown为基础测试还是以html为基础做测试呢?
以 html
Contributor
Author
There was a problem hiding this comment.
可以先写成markdown的形式再进行渲染,将渲染完的结果进行测试吗?
LIlGG
requested changes
Apr 23, 2021
src/main/java/run/halo/app/service/impl/BasePostServiceImpl.java
Outdated
Show resolved
Hide resolved
JohnNiang
requested changes
Apr 24, 2021
| import run.halo.app.utils.MarkdownUtils; | ||
|
|
||
| @Slf4j | ||
| public class HTMLWordCountTest { |
Member
There was a problem hiding this comment.
需要增加一个复杂的测试用例(比如将以下所有测试用例合并)、空字符串、null 以及纯文本格式。
JohnNiang
requested changes
May 1, 2021
ruibaby
pushed a commit
to ruibaby/halo
that referenced
this pull request
Jun 11, 2021
* Word count for markdown updated with test * HTML word count updated with test * Convert pattern to static final variable * More HTML test added * Workaround URL added * CS304 issue link URL added * Pure HTML Test added, checkstyle checked Co-authored-by: MasterWanna <MasterWanna@users.noreply.github.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Word count algorithm for markdown updated ignoring what should be removed.