Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions content/release-notes/whatsnew/changelog-core.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@ aliases:

**See also:** [Enterprise changelog][Enterprise changelog], [Masterfiles changelog][Masterfiles changelog]

<pre>

{{< CFEngine_include_markdown(core/CHANGELOG.md) >}}

</pre>
4 changes: 0 additions & 4 deletions content/release-notes/whatsnew/changelog-enterprise.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@ aliases:

**See also:** [Core changelog][Changelog], [Masterfiles changelog][Masterfiles changelog]

<pre>

{{< CFEngine_include_markdown(enterprise/CHANGELOG.md) >}}

</pre>
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@ aliases:

**See also:** [Core changelog][Changelog], [Enterprise changelog][Enterprise changelog]

<pre>

{{< CFEngine_include_markdown(masterfiles/CHANGELOG.md) >}}

</pre>
19 changes: 19 additions & 0 deletions generator/_scripts/cfdoc_linkresolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
import re
import cfdoc_qa as qa

JIRA_BASE_URL = "https://northerntech.atlassian.net/browse/"
# Pattern to match Jira ticket references (ENT-1234, CFE-4567, etc.)
JIRA_TICKET_PATTERN = re.compile(r"\b(ENT|CFE)-(\d+)\b")


def run(config):
markdown_files = config["markdown_files"]
Expand Down Expand Up @@ -115,6 +119,13 @@ def headerToAnchor(header):
return anchor


def convertJiraTicketsToLinks(line):
"""Convert Jira ticket references (ENT-1234, CFE-4567) to markdown links."""
return JIRA_TICKET_PATTERN.sub(
lambda m: "[%s](%s%s)" % (m[0], JIRA_BASE_URL, m[0]), line
)
Comment on lines +123 to +126
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aleksandrychev Parsing markdown with regex seems like it could easily break. What if the selection is a link already, for example:

- For more information, see: [ENT-13694](https://northerntech.atlassian.net/browse/ENT-13694)

Or:

- For more information, see: https://northerntech.atlassian.net/browse/ENT-13694



def parseMarkdownForAnchors(file_name, config):
in_file = open(file_name, "r")
lines = in_file.readlines()
Expand Down Expand Up @@ -305,6 +316,14 @@ def applyLinkMap(file_name, config):
else:
break
new_line += markdown_line

# Convert Jira ticket references to links (only outside code blocks)
if not in_pre:
original_line = new_line
new_line = convertJiraTicketsToLinks(new_line)
if new_line != original_line:
write_changes = True

new_lines.append(new_line)
previous_empty = markdown_line.lstrip() == ""

Expand Down