Files @ a8710b4b9f2a
Branch filter:

Location: website/www/conservancy/static/admin/js/urlify.js

Denver Gingerich
Copyleft Compliance: mostly minor fixes to new pgs

These are mostly minor edits (typo fixes, etc.) to the enforcement
strategy and firmware liberation pages that were just added.

The one large change was to replace the first paragraph of the
enforcement strategy page with the full Conservancy description used
previously. The glue text used to shorten it appeared unsalvageable
and it wasn't immediately obvious how to replace it with something
better, so we used the full description instead.
function URLify(s, num_chars) {
    // changes, e.g., "Petty theft" to "petty_theft"
    // remove all these words from the string before urlifying
    removelist = ["a", "an", "as", "at", "before", "but", "by", "for", "from",
                  "is", "in", "into", "like", "of", "off", "on", "onto", "per",
                  "since", "than", "the", "this", "that", "to", "up", "via",
                  "with"];
    r = new RegExp('\\b(' + removelist.join('|') + ')\\b', 'gi');
    s = s.replace(r, '');
    s = s.replace(/[^-A-Z0-9\s]/gi, '');  // remove unneeded chars
    s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces
    s = s.replace(/[-\s]+/g, '-');   // convert spaces to hyphens
    s = s.toLowerCase();             // convert to lowercase
    return s.substring(0, num_chars);// trim to first num_chars chars
}