Skip to content

Commit

Permalink
Merge pull request #2 from macvim-dev/prerelease-whatsnew-page
Browse files Browse the repository at this point in the history
Support pre-release builds in What's New page
  • Loading branch information
ychin authored Oct 20, 2023
2 parents be2fbc0 + ad8d8dc commit 6a15135
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 21 deletions.
28 changes: 17 additions & 11 deletions _data/releases.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# This lists all the releases so the front page can automatically reference the
# release number and our "What's New" page works.
- 178
- 177
- 176
- 174
- 173
- 172
- 171
- 170
- 169
- 166
- 165

# The prereleases list should only be filled if there's an active prerelease.
# Otherwise it should be empty.
prereleases:

releases:
- 178
- 177
- 176
- 174
- 173
- 172
- 171
- 170
- 169
- 166
- 165
2 changes: 0 additions & 2 deletions _includes/releases/r176.1.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<p>MacVim r176.1 (prerelease)</p>

<p>Updated to Vim 9.0.1403</p>

<ul>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
---
<!DOCTYPE html>
{% assign latest_release=site.data.releases[0] %}
{% assign latest_release=site.data.releases.releases[0] %}
<html lang="en-us">
<head>
<meta charset="UTF-8">
Expand Down
1 change: 0 additions & 1 deletion javascripts/main.js

This file was deleted.

19 changes: 13 additions & 6 deletions release-notes/whatsnew.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@
</style>
</head>
<body>
{% for release in site.data.releases %}
{% for release in site.data.releases.prereleases %}
<section id={{ release }}>
<header> <h1>MacVim r{{ release }} (prerelease)</h1></header>
{% include releases/r{{ release }}.html %}
</section>
{% endfor %}

{% for release in site.data.releases.releases %}

{% comment %}
We try to show more than 1 releases in case the user is doing a multiple
Expand All @@ -100,18 +107,18 @@
let fromRev = NaN;
let toRev = NaN;
if (params.has('from') && params.has('to')) {
fromRev = parseInt(params.get('from'));
toRev = parseInt(params.get('to'));
fromRev = parseFloat(params.get('from'));
toRev = parseFloat(params.get('to'));
}
else if (params.has('version')) {
toRev = parseInt(params.get('version'));
toRev = parseFloat(params.get('version'));
fromRev = toRev - 1;
}
if (!isNaN(fromRev) && !isNaN(toRev)) {
let foundOne = false;
let sections = document.getElementsByTagName('section');
for (let i = 0; i < sections.length; i++) {
const secRev = parseInt(sections[i].id);
const secRev = parseFloat(sections[i].id);
if (!isNaN(secRev)) {
if (secRev <= fromRev || secRev > toRev)
sections[i].style.display = 'none';
Expand All @@ -122,7 +129,7 @@
}
}
if (!foundOne) {
sections[0].style.display = 'block'; // Just show the latest if the input range is not valid so we don't show an empty page
document.getElementsByClassName('item-0')[0].style.display = 'block'; // Just show the latest if the input range is not valid so we don't show an empty page
}
}
</script>
Expand Down

0 comments on commit 6a15135

Please sign in to comment.