Skip to content

Commit

Permalink
fix badge samples and markup on website
Browse files Browse the repository at this point in the history
  • Loading branch information
jantman committed Nov 26, 2015
1 parent 72b90fd commit 02c957a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ repostatus.org API/specification changelog
- Update README.md docs on making changes to the site.
- Merge fixed-up [PR #16](https://github.com/jantman/repostatus.org/pull/16) - Convert hyphen to en dash in badge title text
- Fix [#14](https://github.com/jantman/repostatus.org/issues/14) - WIP is incorrectly capitalized as 'Wip'
- Fix example markup links on website.

1.0.0 (2015-08-05)
------------------
Expand Down
29 changes: 12 additions & 17 deletions gh_pages/_layouts/minimal.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,36 @@
<script type="application/javascript">
var badge_data;

$.getJSON('badges/0.1.0/badges.json', function(json){ badge_data = json; });
$.getJSON('badges/latest/badges.json', function(json){ badge_data = json; });

function showsample(badgename, markup) {
output = '';
outtype = '';
if ( markup == "md" ) {
output = make_md(badgename, badge_data[badgename]['url'], badge_data[badgename]['description']);
output = make_md(badgename, badge_data[badgename]['display_name'], badge_data[badgename]['url'], badge_data[badgename]['description']);
outtype = "Markdown";
} else if ( markup == "rst" ) {
output = make_rst(badgename, badge_data[badgename]['url'], badge_data[badgename]['description']);
output = make_rst(badgename, badge_data[badgename]['display_name'], badge_data[badgename]['url'], badge_data[badgename]['description']);
outtype = "ReST";
} else if ( markup == "html") {
output = make_html(badgename, badge_data[badgename]['url'], badge_data[badgename]['description']);
output = make_html(badgename, badge_data[badgename]['display_name'], badge_data[badgename]['url'], badge_data[badgename]['description']);
outtype = "HTML";
}
$("#samplecode").html(output);
$("#sampletitle").html(outtype + " for " + capitalizeFirstLetter(badgename) + " Status (<a href=\"http://www.repostatus.org/badges/0.1.0/" + badgename + "_" + markup + ".txt\">direct link</a>)");
$("#sampletitle").html(outtype + " for " + badge_data[badgename]['display_name'] + " Status (<a href=\"http://www.repostatus.org/badges/latest/" + badgename + "_" + markup + ".txt\">direct link</a>)");
$("#samplewrapper").show();
}

function make_md(badgename, url, desc) {
return "<code>" + htmlEncode("[![Project Status: " + capitalizeFirstLetter(badgename) + " - " + desc + "](" + url + ")](http://www.repostatus.org/#" + badgename + ")") + "</code>";
function make_md(badgename, display_name, url, desc) {
return "<code>" + htmlEncode("[![Project Status: " + display_name + " - " + desc + "](" + url + ")](http://www.repostatus.org/#" + badgename + ")") + "</code>";
}

function make_rst(badgename, url, desc) {
return "<code>" + htmlEncode(".. image:: " + url) + "</code><br />&nbsp;&nbsp;&nbsp;<code>" + htmlEncode(":alt: Project Status: " + capitalizeFirstLetter(badgename) + " - " + desc) + "</code><br />&nbsp;&nbsp;&nbsp;<code>" + htmlEncode(":target: http://www.repostatus.org/#" + badgename) + "</code>";
function make_rst(badgename, display_name, url, desc) {
return "<code>" + htmlEncode(".. image:: " + url) + "</code><br />&nbsp;&nbsp;&nbsp;<code>" + htmlEncode(":alt: Project Status: " + display_name + " - " + desc) + "</code><br />&nbsp;&nbsp;&nbsp;<code>" + htmlEncode(":target: http://www.repostatus.org/#" + badgename) + "</code>";
}

function make_html(badgename, url, desc) {
return "<code>" + htmlEncode("<a href=\"http://www.repostatus.org/#" + badgename + "\"><img src=\"" + url + "\" alt=\"Project Status: " + capitalizeFirstLetter(badgename) + " - " + desc + "\" \></a>") + "</code>";
}

function capitalizeFirstLetter(string)
{
return string.charAt(0).toUpperCase() + string.slice(1);
function make_html(badgename, display_name, url, desc) {
return "<code>" + htmlEncode("<a href=\"http://www.repostatus.org/#" + badgename + "\"><img src=\"" + url + "\" alt=\"Project Status: " + display_name + " - " + desc + "\" \></a>") + "</code>";
}

function htmlEncode(value) {
Expand All @@ -63,7 +58,7 @@
<header>
<h1>repostatus.org</h1>
<p>A standard to easily communicate to humans and machines the development/support and usability status of software repositories/projects.</p>
<p><a href="http://www.repostatus.org/#active"><img src="http://www.repostatus.org/badges/0.1.0/active.svg" alt="Project Status: Active - The project has reached a stable, usable state and is being actively developed." /></a></p>
<p><a href="http://www.repostatus.org/#active"><img src="http://www.repostatus.org/badges/latest/active.svg" alt="Project Status: Active - The project has reached a stable, usable state and is being actively developed." /></a></p>
<p class="view"><a href="https://github.com/jantman/repostatus.org">View the Project on GitHub <small>jantman/repostatus.org</small></a></p>

<p class="view"><a href="/">Home</a></p>
Expand Down
2 changes: 1 addition & 1 deletion gh_pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Setting up your project to use RepoStatus.org is as simple as adding the appropr
Below are the various status icons, along with paste-able markup to add them in a variety of markup languages. Feel free to alter the alt-text (after the first ``-``) to suit your needs.

* __Concept__ [![Project Status: Concept – Minimal or no implementation has been done yet.](http://www.repostatus.org/badges/latest/concept.svg)](http://www.repostatus.org/#concept) [markdown](javascript:showsample('concept','md')) [ReST](javascript:showsample('concept','rst')) [HTML](javascript:showsample('concept','html'))
* __WIP__ [![Project Status: Wip – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](http://www.repostatus.org/badges/latest/wip.svg)](http://www.repostatus.org/#wip) [markdown](javascript:showsample('wip','md')) [ReST](javascript:showsample('wip','rst')) [HTML](javascript:showsample('wip','html'))
* __WIP__ [![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](http://www.repostatus.org/badges/latest/wip.svg)](http://www.repostatus.org/#wip) [markdown](javascript:showsample('wip','md')) [ReST](javascript:showsample('wip','rst')) [HTML](javascript:showsample('wip','html'))
* __Suspended__ [![Project Status: Suspended – Initial development has started, but there has not yet been a stable, usable release; work has been stopped for the time being but the author(s) intend on resuming work.](http://www.repostatus.org/badges/latest/suspended.svg)](http://www.repostatus.org/#suspended) [markdown](javascript:showsample('suspended','md')) [ReST](javascript:showsample('suspended','rst')) [HTML](javascript:showsample('suspended','html'))
* __Abandoned__ [![Project Status: Abandoned – Initial development has started, but there has not yet been a stable, usable release; the project has been abandoned and the author(s) do not intend on continuing development.](http://www.repostatus.org/badges/latest/abandoned.svg)](http://www.repostatus.org/#abandoned) [markdown](javascript:showsample('abandoned','md')) [ReST](javascript:showsample('abandoned','rst')) [HTML](javascript:showsample('abandoned','html'))
* __Active__ [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [markdown](javascript:showsample('active','md')) [ReST](javascript:showsample('active','rst')) [HTML](javascript:showsample('active','html'))
Expand Down

0 comments on commit 02c957a

Please sign in to comment.