normalizePath handles spaces for use in resolvePath

This commit is contained in:
Jerry Holmes 2017-05-10 22:13:03 -04:00
parent 018616dc68
commit f7c2dec8e8
3 changed files with 4 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -12,6 +12,9 @@
_posts: {
"2015-02-14-this-is-a-post.md": {
content: "---\ntitle: This is a YAML front matter post\nimage: /nf-logo.png\ndate: 2015-02-14T00:00:00.000Z\n---\n\n# I Am a Title in Markdown\n\nHello, world\n\n* One Thing\n* Another Thing\n* A Third Thing\n"
},
"2015-02-14-this-is-test-post.md": {
content: "---\ntitle: This is a test post\nimage: /Photo 1-lobby_FS.jpg\ndate: 2015-02-14T00:00:00.000Z\n---\n\n# I Am a Title in Markdown\n\nHello, world\n\n* One Thing\n* Another Thing\n* A Third Thing\n"
},
"2015-02-15-this-is-a-json-frontmatter-post.md": {
content: "{\n\"title\": \"This is a JSON front matter post\",\n\"image\": \"/nf-logo.png\",\n\"date\": \"2015-02-15T00:00:00.000Z\"\n}\n\n# I Am a Title in Markdown\n\nHello, world\n\n* One Thing\n* Another Thing\n* A Third Thing\n"

View File

@ -1,5 +1,5 @@
const absolutePath = new RegExp('^(?:[a-z]+:)?//', 'i');
const normalizePath = path => path.replace(/[\\\/]+/g, '/');
const normalizePath = path => path.replace(/[\\\/]+/g, '/').replace(/[\s]+/g, '%20');
export function resolvePath(path, basePath) { // eslint-disable-line
// No path provided, skip