Skip to content

Commit

Permalink
update a sonar issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorsten Marx committed Sep 17, 2024
1 parent e8ee3c6 commit 8b796b8
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class CodeBlockRule implements BlockElementRule {

protected static final Pattern PATTERN = Pattern.compile(
"^(`{3})(?<lang>[a-zA-Z0-9]*)?$\n(?<code>[\\s\\S]*?)\n^(`{3})$",
"^(`{3})(?<lang>[a-zA-Z0-9]+)?$\n(?<code>[\\s\\S]*?)\n^(`{3})$",
Pattern.MULTILINE | Pattern.DOTALL | Pattern.UNIX_LINES);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
public class DefinitionListBlockRule implements BlockElementRule {

private static final Pattern PATTERN = Pattern.compile(
"(?<content>((^.+)\n(: .+(\\n|\\Z))+)+)",
"(?<content>(^.+?\n(: .+?(\n|\\Z))+)+)",
Pattern.MULTILINE);


@Override
public Block next(String md) {
Matcher matcher = PATTERN.matcher(md);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@
public class HorizontalRuleBlockRule implements BlockElementRule {

private static final Pattern PATTERN = Pattern.compile(
"^(\\*|\\-|_){3,}(\\n|\\Z)",
Pattern.MULTILINE | Pattern.DOTALL);

"^([\\*\\-_]){3,}(\\n|\\Z)", Pattern.MULTILINE | Pattern.DOTALL);


@Override
public Block next(String md) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
public class ListBlockRule implements BlockElementRule {

private static final Pattern PATTERN_ORDERED_LIST = Pattern.compile(
"^[0-9]+\\. (.+?)(^\n|\\Z)",
"^[0-9]+\\. (.+?)((^\n)|\\Z)",
Pattern.MULTILINE | Pattern.DOTALL);

private static final Pattern PATTERN_UNORDERED_LIST = Pattern.compile(
"^[-\\*\\+]{1} (.+?)(^\n|\\Z)",
"^[-\\*\\+]{1} (.+?)((^\n)|\\Z)",
Pattern.MULTILINE | Pattern.DOTALL);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
public class ParagraphBlockRule implements BlockElementRule {

private static final Pattern PATTERN = Pattern.compile(
"(\\A|^\\n|\\Z)(?<content>.+?)(^\\n|\\Z)",
"(\\A|(^\n)|\\Z)(?<content>.+?)((^\n)|\\Z)",
Pattern.MULTILINE | Pattern.DOTALL);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
public class TableBlockRule implements BlockElementRule {

private static final Pattern PATTERN = Pattern.compile(
"(^[\\|]{1}(.+?))(^\n|\\Z)",
"(^[\\|]{1}(.+?))((^\n)|\\Z)",
Pattern.MULTILINE | Pattern.DOTALL);

private static final Pattern HEADER_DELIMITER = Pattern.compile("-{3,}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class TaskListBlockRule implements BlockElementRule {

private static final Pattern PATTERN = Pattern.compile(
"(^- \\[([ x]?)\\] (.+?)\n)+(^\\n|\\Z)",
"(^- \\[([ x]?)\\] (.+?)\n)+((^\n)|\\Z)",
Pattern.MULTILINE);

private static final Pattern CHECKED_PATTERN = Pattern.compile(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.condation.cms.content.markdown.rules;
package com.condation.cms.content.markdown.rules.block;

/*-
* #%L
Expand Down

0 comments on commit 8b796b8

Please sign in to comment.