Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Update whastnew template and rake task #8393

Merged
merged 3 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
18 changes: 11 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ task :whatsnew do
print 'Generating data for the What\'s New digest: $ '.magenta

# Generate tmp/whats-new.yml
if since.nil? || since.empty?
sh 'bin/whatsup_github', 'since', last_update
elsif since.is_a? String
sh 'bin/whatsup_github', 'since', since
else
abort 'The "since" argument must be a string. Example: "jul 4"'
end
report =
if since.nil? || since.empty?
`bin/whatsup_github since '#{last_update}'`
elsif since.is_a? String
`bin/whatsup_github since #{since}`
else
abort 'The "since" argument must be a string. Example: "jul 4"'
end

# Merge generated tmp/whats-new.yml with existing src/_data/whats-new.yml
generated_data = YAML.load_file generated_file
Expand All @@ -94,6 +95,9 @@ task :whatsnew do

puts "Writing updates to #{current_file}"
File.write current_file, current_data.to_yaml

abort report if report.include? 'MISSING whatsnew'
puts report
end

desc 'Generate index for Algolia'
Expand Down
29 changes: 17 additions & 12 deletions src/whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,40 @@ title: What's new on DevDocs

{% assign grouped_by_year = entries | group_by_exp: "entry", "entry.date | date: '%Y'" %}

{% for group in grouped_by_year limit:2 %}
{% for year_group in grouped_by_year limit:2 %}

## {{ group.name }}
{% assign grouped_by_month = year_group.items | group_by_exp: "entry", "entry.date | date: '%B'" %}
## {{ year_group.name }}

{% for month_group in grouped_by_month %}
### {{ month_group.name }}

{% assign grouped_by_date = month_group.items | group_by: "date" %}

{% for date_group in grouped_by_date %}
#### {{ date_group.name }}

<table>
<thead>
<tr>
<th>Description</th>
<th>Versions</th>
<th>Type</th>
<th>Date</th>
<th>Pull request</th>
</tr>
</thead>
<tbody>
{% for item in group.items %}
{% for item in date_group.items %}
<tr>
<td>{{ item.description | markdownify }}</td>
<td>{{ item.versions }}</td>
<td>{{ item.type }}</td>
<td>
{%- if item.link -%}
<a href="{{ item.link }}">{{ item.date | date: "%B&nbsp;%e" }}</a>
{%- else -%}
{{ item.date | date: "%B&nbsp;%e" }}
{%- endif -%}
</td>
<td><a href="{{ item.link }}">{{ item.link | split: "/" | last }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}<!-- date_group -->
{% endfor %}<!-- month_group -->

{% endfor %}
{% endfor %}<!-- year_group -->