-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
12,661 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Tokenize example: | ||
|
||
```js | ||
string = `\ | ||
Hello world's!\ | ||
`; | ||
<Tokenize string={string} /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
|
||
import {tokenize} from '../../tokenizers'; | ||
|
||
/** | ||
* Adds two numbers together. | ||
* @param {string} string the string input. | ||
* @return {object} The react component. | ||
*/ | ||
function Tokenize({ | ||
string, | ||
}) { | ||
const tokens = tokenize(string); | ||
const tokenItems = tokens.map((token) => | ||
<li> | ||
{token} | ||
</li> | ||
); | ||
|
||
return ( | ||
<ul>{tokenItems}</ul> | ||
); | ||
} | ||
|
||
export default Tokenize; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Greedy Examples: | ||
|
||
Edit the options and watch the effect on the output. | ||
|
||
```js | ||
import {tokenize} from '../tokenizers.js'; | ||
|
||
const text = `“Didn’t David's 10,000 abençoando-os our h-e'a-rt's 'burn' disciples—and everyone else—what us?” -Luke 2,4.3:2`; | ||
|
||
const options = { | ||
text, | ||
includeWords: true, | ||
includeNumbers: true, | ||
includeWhitespace: false, | ||
includePunctuation: true, | ||
greedy: true, | ||
verbose: false, | ||
} | ||
const tokens = tokenize(options); | ||
const tokenItems = tokens.map(token => { | ||
const string = (typeof token === 'string') ? token : JSON.stringify(token, null, 2); | ||
return (<li>{string}</li>); | ||
}); | ||
|
||
<> | ||
<p>{text}</p> | ||
<ol>{tokenItems}</ol> | ||
</> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const Path = require('path'); | ||
const upperFirst = require('lodash/upperFirst'); | ||
const camelCase = require('lodash/camelCase'); | ||
const { name, version, repository } = require('./package.json'); | ||
const { styles, theme } = require('./styleguide.styles'); | ||
|
||
let sections = [ | ||
{ | ||
name: 'README', | ||
content: 'README.md', | ||
}, | ||
{ | ||
name: 'Greedy', | ||
content: 'src/docs/Greedy.md', | ||
}, | ||
]; | ||
|
||
module.exports = { | ||
title: `${upperFirst(camelCase(name))} v${version}`, | ||
ribbon: { | ||
url: repository.url, | ||
text: 'View on GitHub' | ||
}, | ||
webpackConfig: require('react-scripts/config/webpack.config')('development'), | ||
// serverPort: 3000, | ||
styles, | ||
theme, | ||
getComponentPathLine: (componentPath) => { | ||
const dirname = Path.dirname(componentPath, '.js'); | ||
const file = dirname.split('/').slice(-1)[0]; | ||
const componentName = upperFirst(camelCase(file)); | ||
return `import { ${componentName} } from "${name}";`; | ||
}, | ||
usageMode: 'expand', | ||
exampleMode: 'expand', | ||
pagePerSection: true, | ||
sections, | ||
}; |
Oops, something went wrong.