-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start of generating markdown checklist (#2104)
* Start of generating markdown checklist This isn't complete, but starts down the path of creating a checklist in GitHub Flavored Markdown. Signed-off-by: David A. Wheeler <[email protected]> * Provide markdown format (as a todo list) Signed-off-by: David A. Wheeler <[email protected]> * Remove checkboxes from heading lines Signed-off-by: David A. Wheeler <[email protected]> * Mark description as html_safe If this isn't marked as html_safe, some of the descriptions look bad because it shows the HTML code instead of its intent. Signed-off-by: David A. Wheeler <[email protected]> * Append current time to markdown output Include the current time, so people who use the checklist as a workflow will know when the checklist was generated. Signed-off-by: David A. Wheeler <[email protected]> --------- Signed-off-by: David A. Wheeler <[email protected]>
- Loading branch information
1 parent
b81895c
commit 5fa6e01
Showing
5 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<%- | ||
criteria_level = @criteria_level || '0' | ||
def criterion_to_checkbox(value) | ||
case value | ||
when 'Met', 'N/A' | ||
'[x]' | ||
else | ||
'[ ]' | ||
end | ||
end | ||
# TODO: Major & minor levels should be marked "done" if contents done | ||
-%> | ||
# <%= @project.name %> | ||
|
||
[<%= @project.name | ||
%>](https://bestpractices.dev/projects/<%= @project.id | ||
%>?criteria_level=<%= criteria_level %>): | ||
|
||
<%- FullCriteriaHash[criteria_level].each do |major, major_info| -%> | ||
- **<%= t("headings.#{major}") %>** | ||
<%- major_info.each do |minor, minor_info| -%> | ||
- *<%= t("headings.#{minor}") %>* | ||
<%- minor_info.each do |criterion, criterion_info| -%> | ||
- <%= criterion_to_checkbox(@project["#{criterion}_status".to_sym]) | ||
%> <%= | ||
t("criteria.#{criteria_level}.#{criterion}.description").html_safe | ||
%><%= | ||
# Only add a "details" tag with details if there *are* any details | ||
# "Details" and the other strings here are from trusted sources. | ||
details = I18n.t("criteria.#{criteria_level}.#{criterion}.details", | ||
default: '') | ||
if details.present? | ||
'<details><summary> '.html_safe | ||
else | ||
' ' | ||
end | ||
%>[<%= criterion %>]<%= | ||
if details.present? | ||
"</summary>#{details}</details>".html_safe | ||
else | ||
'' | ||
end | ||
%> | ||
<%- end -%> | ||
<%- end -%> | ||
<%- end -%> | ||
<%= Time.new.iso8601 %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters