mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-16 19:26:12 -04:00
Refactor: Improve CHANGELOG.md formatting
This commit refactors the Liquid templating in `CHANGELOG.md` to: - Indent Liquid logic for better readability. - Improve spacing around headings (##, ###) and list items (-) for a cleaner rendered output.
This commit is contained in:
+49
-40
@@ -14,9 +14,9 @@ title: "Changelog"
|
|||||||
{% assign no_comments = clean_body | replace: "<!-- Release notes generated using configuration in .github/release.yml", "" %}
|
{% assign no_comments = clean_body | replace: "<!-- Release notes generated using configuration in .github/release.yml", "" %}
|
||||||
{% assign no_comments = no_comments | split: "-->" %}
|
{% assign no_comments = no_comments | split: "-->" %}
|
||||||
{% if no_comments.size > 1 %}
|
{% if no_comments.size > 1 %}
|
||||||
{% assign clean_content = no_comments[1] | strip %}
|
{% assign clean_content = no_comments[1] | strip %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% assign clean_content = no_comments[0] | strip %}
|
{% assign clean_content = no_comments[0] | strip %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% comment %} Make links clickable {% endcomment %}
|
{% comment %} Make links clickable {% endcomment %}
|
||||||
@@ -24,58 +24,67 @@ title: "Changelog"
|
|||||||
" %}
|
" %}
|
||||||
{% assign processed_lines = "" %}
|
{% assign processed_lines = "" %}
|
||||||
{% for line in lines %}
|
{% for line in lines %}
|
||||||
{% if line contains "**Full Changelog**:" %}
|
{% if line contains "**Full Changelog**:" %}
|
||||||
{% comment %} Handle Full Changelog links {% endcomment %}
|
{% comment %} Handle Full Changelog links {% endcomment %}
|
||||||
{% assign parts = line | split: ": " %}
|
{% assign parts = line | split: ": " %}
|
||||||
{% if parts.size > 1 %}
|
{% if parts.size > 1 %}
|
||||||
{% assign url = parts[1] | strip %}
|
{% assign url = parts[1] | strip %}
|
||||||
{% assign clickable_line = "**[View Changes](" | append: url | append: ")**" %}
|
{% assign clickable_line = "**[View Changes](" | append: url | append: ")**" %}
|
||||||
{% assign processed_lines = processed_lines | append: clickable_line | append: "
|
{% assign processed_lines = processed_lines | append: clickable_line | append: "
|
||||||
" %}
|
" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% assign processed_lines = processed_lines | append: line | append: "
|
{% assign processed_lines = processed_lines | append: line | append: "
|
||||||
" %}
|
" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elsif line contains " in https://github.com/" and line contains "/pull/" %}
|
{% elsif line contains " in https://github.com/" and line contains "/pull/" %}
|
||||||
{% comment %} Handle pull request links {% endcomment %}
|
{% comment %} Handle pull request links {% endcomment %}
|
||||||
{% assign pr_parts = line | split: " in https://github.com/" %}
|
{% assign pr_parts = line | split: " in https://github.com/" %}
|
||||||
{% if pr_parts.size > 1 %}
|
{% if pr_parts.size > 1 %}
|
||||||
{% assign before_url = pr_parts[0] %}
|
{% assign before_url = pr_parts[0] %}
|
||||||
{% assign after_url = pr_parts[1] %}
|
{% assign after_url = pr_parts[1] %}
|
||||||
{% assign url = "https://github.com/" | append: after_url %}
|
{% assign url = "https://github.com/" | append: after_url %}
|
||||||
{% assign pr_number = after_url | split: "/pull/" %}
|
{% assign pr_number = after_url | split: "/pull/" %}
|
||||||
{% if pr_number.size > 1 %}
|
{% if pr_number.size > 1 %}
|
||||||
{% assign pr_num = pr_number[1] | split: " " | first %}
|
{% assign pr_num = pr_number[1] | split: " " | first %}
|
||||||
{% assign clickable_line = before_url | append: " in [#" | append: pr_num | append: "](" | append: url | append: ")" %}
|
{% assign clickable_line = before_url | append: " in [#" | append: pr_num | append: "](" | append: url | append: ")" %}
|
||||||
{% assign processed_lines = processed_lines | append: clickable_line | append: "
|
{% assign processed_lines = processed_lines | append: clickable_line | append: "
|
||||||
" %}
|
" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% assign processed_lines = processed_lines | append: line | append: "
|
{% assign processed_lines = processed_lines | append: line | append: "
|
||||||
" %}
|
" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% assign processed_lines = processed_lines | append: line | append: "
|
{% assign processed_lines = processed_lines | append: line | append: "
|
||||||
" %}
|
" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% assign processed_lines = processed_lines | append: line | append: "
|
{% assign processed_lines = processed_lines | append: line | append: "
|
||||||
" %}
|
" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% comment %} Check if there are any bullet points (actual release notes) {% endcomment %}
|
{% comment %} Add proper spacing between sections and bullet points {% endcomment %}
|
||||||
{% if processed_lines contains "## " or processed_lines contains "- " %}
|
{% assign final_content = processed_lines | replace: "
|
||||||
{% assign spaced_content = processed_lines | replace: "
|
### ", "
|
||||||
|
|
||||||
|
### " %}
|
||||||
|
{% assign final_content = final_content | replace: "
|
||||||
|
## ", "
|
||||||
|
|
||||||
|
## " %}
|
||||||
|
{% assign final_content = final_content | replace: "
|
||||||
- ", "
|
- ", "
|
||||||
|
|
||||||
- " %}
|
- " %}
|
||||||
{{ spaced_content | markdownify }}
|
|
||||||
{% else %}
|
{% comment %} Check if there are any bullet points (actual release notes) {% endcomment %}
|
||||||
|
{% if final_content contains "## " or final_content contains "- " %}
|
||||||
|
{{ final_content | markdownify }}
|
||||||
|
{% else %}
|
||||||
*No release notes available.*
|
*No release notes available.*
|
||||||
|
|
||||||
{{ processed_lines | markdownify }}
|
{{ final_content | markdownify }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
---
|
---
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
Reference in New Issue
Block a user