Skip to content

Commit

Permalink
To fix blockquote rendering based on review/confluence test
Browse files Browse the repository at this point in the history
- Fix regex for GHAlertsClassifier
- Fix confluence macro box id from warn to warning
  • Loading branch information
prokod committed Sep 25, 2024
1 parent 360f878 commit 1ec3a11
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions pkg/mark/renderer/blockquote.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (
)

func (t BlockQuoteType) String() string {
return []string{"info", "note", "warn", "tip", "none"}[t]
return []string{"info", "note", "warning", "tip", "none"}[t]
}

type BlockQuoteLevelMap map[ast.Node]int
Expand All @@ -67,9 +67,9 @@ func LegacyBlockQuoteClassifier() BlockQuoteClassifier {
func GHAlertsBlockQuoteClassifier() BlockQuoteClassifier {
return BlockQuoteClassifier{
patternMap: map[string]*regexp.Regexp{
"info": regexp.MustCompile(`(?i)^\!info|important`),
"info": regexp.MustCompile(`(?i)^\!(info|important)`),
"note": regexp.MustCompile(`(?i)^\!note`),
"warn": regexp.MustCompile(`(?i)^\!warning|caution`),
"warn": regexp.MustCompile(`(?i)^\!(warning|caution)`),
"tip": regexp.MustCompile(`(?i)^\!tip`),
},
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/mark/testdata/quotes-droph1.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h2 id="first-heading">First Heading</h2>
<p><strong>Warn (Should not be picked as blockquote type)</strong></p>
</ac:rich-text-body></ac:structured-macro>
<h2 id="second-heading">Second Heading</h2>
<ac:structured-macro ac:name="warn"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<p><strong>Warn</strong></p>
<ul>
<li>Warn bullet 1</li>
Expand Down Expand Up @@ -63,7 +63,7 @@ <h3 id="tip-type-alert-heading">Tip Type Alert Heading</h3>
</ul>
</ac:rich-text-body></ac:structured-macro>
<h3 id="warning-type-alert-heading">Warning Type Alert Heading</h3>
<ac:structured-macro ac:name="warn"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<p>[!WARNING]</p>
<ul>
<li>Warning bullet 1</li>
Expand All @@ -78,7 +78,7 @@ <h3 id="importantcaution-type-alert-heading">Important/Caution Type Alert Headin
<li>Important bullet 2</li>
</ul>
</ac:rich-text-body></ac:structured-macro>
<ac:structured-macro ac:name="warn"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<p>[!CAUTION]</p>
<ul>
<li>Important bullet 1</li>
Expand Down
6 changes: 3 additions & 3 deletions pkg/mark/testdata/quotes-stripnewlines.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h2 id="first-heading">First Heading</h2>
<p><strong>Warn (Should not be picked as blockquote type)</strong></p>
</ac:rich-text-body></ac:structured-macro>
<h2 id="second-heading">Second Heading</h2>
<ac:structured-macro ac:name="warn"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<p><strong>Warn</strong></p>
<ul>
<li>Warn bullet 1</li>
Expand Down Expand Up @@ -61,7 +61,7 @@ <h3 id="tip-type-alert-heading">Tip Type Alert Heading</h3>
</ul>
</ac:rich-text-body></ac:structured-macro>
<h3 id="warning-type-alert-heading">Warning Type Alert Heading</h3>
<ac:structured-macro ac:name="warn"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<p>[!WARNING]</p>
<ul>
<li>Warning bullet 1</li>
Expand All @@ -76,7 +76,7 @@ <h3 id="importantcaution-type-alert-heading">Important/Caution Type Alert Headin
<li>Important bullet 2</li>
</ul>
</ac:rich-text-body></ac:structured-macro>
<ac:structured-macro ac:name="warn"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<p>[!CAUTION]</p>
<ul>
<li>Important bullet 1</li>
Expand Down
6 changes: 3 additions & 3 deletions pkg/mark/testdata/quotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h2 id="first-heading">First Heading</h2>
<p><strong>Warn (Should not be picked as blockquote type)</strong></p>
</ac:rich-text-body></ac:structured-macro>
<h2 id="second-heading">Second Heading</h2>
<ac:structured-macro ac:name="warn"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<p><strong>Warn</strong></p>
<ul>
<li>Warn bullet 1</li>
Expand Down Expand Up @@ -64,7 +64,7 @@ <h3 id="tip-type-alert-heading">Tip Type Alert Heading</h3>
</ul>
</ac:rich-text-body></ac:structured-macro>
<h3 id="warning-type-alert-heading">Warning Type Alert Heading</h3>
<ac:structured-macro ac:name="warn"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<p>[!WARNING]</p>
<ul>
<li>Warning bullet 1</li>
Expand All @@ -79,7 +79,7 @@ <h3 id="importantcaution-type-alert-heading">Important/Caution Type Alert Headin
<li>Important bullet 2</li>
</ul>
</ac:rich-text-body></ac:structured-macro>
<ac:structured-macro ac:name="warn"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="icon">true</ac:parameter><ac:rich-text-body>
<p>[!CAUTION]</p>
<ul>
<li>Important bullet 1</li>
Expand Down

0 comments on commit 1ec3a11

Please sign in to comment.