Update uri -> url in the front end + examples (#2006)
This continues a consistency update we’ve been making to standardize on URL based on a recommendation from WHATWG: https://url.spec.whatwg.org/#goals This also helps with copying and pasting between all-badge-examples and new-style services, where it’s otherwise easy to make a mistake. Ref: #1322 #1341
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
export function markdown(badgeUri, link, title) {
|
||||
const withoutLink = ``
|
||||
export function markdown(badgeUrl, link, title) {
|
||||
const withoutLink = ``
|
||||
if (link) {
|
||||
return `[${withoutLink}](${link})`
|
||||
} else {
|
||||
@@ -7,8 +7,8 @@ export function markdown(badgeUri, link, title) {
|
||||
}
|
||||
}
|
||||
|
||||
export function reStructuredText(badgeUri, link, title) {
|
||||
let result = `.. image:: ${badgeUri}`
|
||||
export function reStructuredText(badgeUrl, link, title) {
|
||||
let result = `.. image:: ${badgeUrl}`
|
||||
if (title) {
|
||||
result += ` :alt: ${title}`
|
||||
}
|
||||
@@ -59,17 +59,17 @@ export function renderAsciiDocAttributes(positional, named) {
|
||||
}
|
||||
}
|
||||
|
||||
export function asciiDoc(badgeUri, link, title) {
|
||||
export function asciiDoc(badgeUrl, link, title) {
|
||||
const positional = title ? [title] : []
|
||||
const named = link ? { link } : {}
|
||||
const attrs = renderAsciiDocAttributes(positional, named)
|
||||
return `image:${badgeUri}${attrs}`
|
||||
return `image:${badgeUrl}${attrs}`
|
||||
}
|
||||
|
||||
export default function generateAllMarkup(badgeUri, link, title) {
|
||||
export default function generateAllMarkup(badgeUrl, link, title) {
|
||||
// This is a wee bit "clever". It runs each of the three functions on the
|
||||
// parameters provided, and returns the result in an object.
|
||||
return mapValues({ markdown, reStructuredText, asciiDoc }, fn =>
|
||||
fn(badgeUri, link, title)
|
||||
fn(badgeUrl, link, title)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user