Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.
This commit is contained in:
21
node_modules/section-matter/LICENSE
generated
vendored
Normal file
21
node_modules/section-matter/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
236
node_modules/section-matter/README.md
generated
vendored
Normal file
236
node_modules/section-matter/README.md
generated
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
# section-matter [](https://www.npmjs.com/package/section-matter) [](https://npmjs.org/package/section-matter) [](https://npmjs.org/package/section-matter) [](https://travis-ci.org/jonschlinkert/section-matter)
|
||||
|
||||
> Like front-matter, but supports multiple sections in a document.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save section-matter
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String|Buffer|Object}**: If input is an object, it's `content` property must be a string or buffer.
|
||||
* **{Object}**: options
|
||||
* `returns` **{Object}**: Returns an object with a `content` string and an array of `sections` objects.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var sections = require('{%= name %}');
|
||||
var result = sections(input, options);
|
||||
// { content: 'Content before sections', sections: [] }
|
||||
```
|
||||
|
||||
See available [options](#options).
|
||||
|
||||
## Example
|
||||
|
||||
_With the exception of front-matter, **which must be the very first thing in the string**, the opening delimiter of all other sections must be followed by a string to be used as the `key` for the section._
|
||||
|
||||
Given the following string:
|
||||
|
||||
```
|
||||
Content before the sections.
|
||||
|
||||
---
|
||||
|
||||
More content.
|
||||
|
||||
---one
|
||||
title: One
|
||||
---
|
||||
|
||||
This is the first section.
|
||||
```
|
||||
|
||||
The following code:
|
||||
|
||||
```js
|
||||
console.log(sections(input));
|
||||
```
|
||||
|
||||
Results in:
|
||||
|
||||
```js
|
||||
{
|
||||
content: 'Content before the sections.\n\n---\n\nMore content.\n',
|
||||
sections: [
|
||||
{
|
||||
key: 'one',
|
||||
data: 'title: One',
|
||||
content: '\nThis is the first section.'
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### options.section_parse
|
||||
|
||||
**Type**: `function`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
Function to be called on each section after it's parsed from the string.
|
||||
|
||||
**Example**
|
||||
|
||||
Given the following string (`foo.md`):
|
||||
|
||||
```
|
||||
This is content before the sections.
|
||||
|
||||
---one
|
||||
title: First section
|
||||
---
|
||||
|
||||
This is section one.
|
||||
|
||||
---two
|
||||
title: Second section
|
||||
---
|
||||
|
||||
This is section two.
|
||||
```
|
||||
|
||||
Using the following custom `section_parse` function:
|
||||
|
||||
```js
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var yaml = require('js-yaml');
|
||||
var sections = require('section-matter');
|
||||
|
||||
var str = fs.readFileSync('foo.md');
|
||||
var options = {
|
||||
section_parse: function(section) {
|
||||
console.log(section)
|
||||
section.key = 'section-' + section.key;
|
||||
section.data = yaml.safeLoad(section.data);
|
||||
}
|
||||
};
|
||||
|
||||
var result = sections(str, options);
|
||||
console.log(result);
|
||||
```
|
||||
|
||||
Results in:
|
||||
|
||||
```js
|
||||
{
|
||||
content: 'This is content before the sections.\n',
|
||||
sections: [
|
||||
{
|
||||
key: 'section-one',
|
||||
data: { title: 'First section' },
|
||||
content: '\nThis is section one.\n'
|
||||
},
|
||||
{
|
||||
key: 'section-two',
|
||||
data: { title: 'Second section' },
|
||||
content: '\nThis is section two.\n'
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### options.section_delimiter
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Default**: `---`
|
||||
|
||||
Delimiter to use as the separator for sections. _With the exception of front-matter, which must be the very first thing in the string, the opening delimiter of all other sections must be followed by a string to be used as the `key` for the section._
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var input = '~~~\ntitle: bar\n~~~\n\nfoo\n~~~one\ntitle: One\n~~~\nThis is one';
|
||||
console.log(sections(input, {section_delimiter: '~~~'}));
|
||||
```
|
||||
|
||||
Results in:
|
||||
|
||||
```js
|
||||
{
|
||||
content: '',
|
||||
sections: [
|
||||
{
|
||||
key: '',
|
||||
data: 'title: bar',
|
||||
content: '\nfoo'
|
||||
},
|
||||
{
|
||||
key: 'one',
|
||||
data: 'title: One',
|
||||
content: 'This is one'
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## About
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
- [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit")
|
||||
- [gray-matter](https://www.npmjs.com/package/gray-matter): Parse front-matter from a string or file. Fast, reliable and easy to use. Parses YAML… [more](https://github.com/jonschlinkert/gray-matter) | [homepage](https://github.com/jonschlinkert/gray-matter "Parse front-matter from a string or file. Fast, reliable and easy to use. Parses YAML front matter by default, but also has support for YAML, JSON, TOML or Coffee Front-Matter, with options to set custom delimiters. Used by metalsmith, assemble, verb and ")
|
||||
- [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.")
|
||||
|
||||
### Contributors
|
||||
|
||||
### Author
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on October 23, 2017._
|
||||
|
136
node_modules/section-matter/index.js
generated
vendored
Normal file
136
node_modules/section-matter/index.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
'use strict';
|
||||
|
||||
var typeOf = require('kind-of');
|
||||
var extend = require('extend-shallow');
|
||||
|
||||
/**
|
||||
* Parse sections in `input` with the given `options`.
|
||||
*
|
||||
* ```js
|
||||
* var sections = require('{%= name %}');
|
||||
* var result = sections(input, options);
|
||||
* // { content: 'Content before sections', sections: [] }
|
||||
* ```
|
||||
* @param {String|Buffer|Object} `input` If input is an object, it's `content` property must be a string or buffer.
|
||||
* @param {Object} options
|
||||
* @return {Object} Returns an object with a `content` string and an array of `sections` objects.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(input, options) {
|
||||
if (typeof options === 'function') {
|
||||
options = { parse: options };
|
||||
}
|
||||
|
||||
var file = toObject(input);
|
||||
var defaults = {section_delimiter: '---', parse: identity};
|
||||
var opts = extend({}, defaults, options);
|
||||
var delim = opts.section_delimiter;
|
||||
var lines = file.content.split(/\r?\n/);
|
||||
var sections = null;
|
||||
var section = createSection();
|
||||
var content = [];
|
||||
var stack = [];
|
||||
|
||||
function initSections(val) {
|
||||
file.content = val;
|
||||
sections = [];
|
||||
content = [];
|
||||
}
|
||||
|
||||
function closeSection(val) {
|
||||
if (stack.length) {
|
||||
section.key = getKey(stack[0], delim);
|
||||
section.content = val;
|
||||
opts.parse(section, sections);
|
||||
sections.push(section);
|
||||
section = createSection();
|
||||
content = [];
|
||||
stack = [];
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var line = lines[i];
|
||||
var len = stack.length;
|
||||
var ln = line.trim();
|
||||
|
||||
if (isDelimiter(ln, delim)) {
|
||||
if (ln.length === 3 && i !== 0) {
|
||||
if (len === 0 || len === 2) {
|
||||
content.push(line);
|
||||
continue;
|
||||
}
|
||||
stack.push(ln);
|
||||
section.data = content.join('\n');
|
||||
content = [];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sections === null) {
|
||||
initSections(content.join('\n'));
|
||||
}
|
||||
|
||||
if (len === 2) {
|
||||
closeSection(content.join('\n'));
|
||||
}
|
||||
|
||||
stack.push(ln);
|
||||
continue;
|
||||
}
|
||||
|
||||
content.push(line);
|
||||
}
|
||||
|
||||
if (sections === null) {
|
||||
initSections(content.join('\n'));
|
||||
} else {
|
||||
closeSection(content.join('\n'));
|
||||
}
|
||||
|
||||
file.sections = sections;
|
||||
return file;
|
||||
};
|
||||
|
||||
function isDelimiter(line, delim) {
|
||||
if (line.slice(0, delim.length) !== delim) {
|
||||
return false;
|
||||
}
|
||||
if (line.charAt(delim.length + 1) === delim.slice(-1)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function toObject(input) {
|
||||
if (typeOf(input) !== 'object') {
|
||||
input = { content: input };
|
||||
}
|
||||
|
||||
if (typeof input.content !== 'string' && !isBuffer(input.content)) {
|
||||
throw new TypeError('expected a buffer or string');
|
||||
}
|
||||
|
||||
input.content = input.content.toString();
|
||||
input.sections = [];
|
||||
return input;
|
||||
}
|
||||
|
||||
function getKey(val, delim) {
|
||||
return val ? val.slice(delim.length).trim() : '';
|
||||
}
|
||||
|
||||
function createSection() {
|
||||
return { key: '', data: '', content: '' };
|
||||
}
|
||||
|
||||
function identity(val) {
|
||||
return val;
|
||||
}
|
||||
|
||||
function isBuffer(val) {
|
||||
if (val && val.constructor && typeof val.constructor.isBuffer === 'function') {
|
||||
return val.constructor.isBuffer(val);
|
||||
}
|
||||
return false;
|
||||
}
|
55
node_modules/section-matter/package.json
generated
vendored
Normal file
55
node_modules/section-matter/package.json
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "section-matter",
|
||||
"description": "Like front-matter, but supports multiple sections in a document.",
|
||||
"version": "1.0.0",
|
||||
"homepage": "https://github.com/jonschlinkert/section-matter",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"repository": "jonschlinkert/section-matter",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/section-matter/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"extend-shallow": "^2.0.1",
|
||||
"kind-of": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^1.0.0",
|
||||
"js-yaml": "^3.10.0",
|
||||
"mocha": "^4.0.1"
|
||||
},
|
||||
"keywords": [
|
||||
"matter",
|
||||
"section"
|
||||
],
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"gray-matter",
|
||||
"assemble",
|
||||
"verb"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user