retext-smartypants
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -1,94 +0,11 @@ | ||
<!--mdast setext--> | ||
<!--remark setext--> | ||
<!--lint disable no-multiple-toplevel-headings--> | ||
<!--lint disable maximum-line-length--> | ||
1.0.0 / 2015-08-22 | ||
2.0.0 / 2016-06-22 | ||
================== | ||
* Refactor api for retext@1.0.0 ([806bfa6](https://github.com/wooorm/retext-smartypants/commit/806bfa6)) | ||
* Refactor module ([`98fc106`](https://github.com/wooorm/retext-smartypants/commit/98fc106)) | ||
0.4.3 / 2015-08-04 | ||
1.0.0 / 2015-08-22 | ||
================== | ||
* Refactor api for retext@0.4.3 ([68a7eee](https://github.com/wooorm/retext-smartypants/commit/68a7eee)) | ||
0.1.6 / 2015-01-19 | ||
================== | ||
* Update changelog for 0.1.6 ([9b3f830](https://github.com/wooorm/retext-smartypants/commit/9b3f830)) | ||
* Update copyright notice in `LICENSE` to include 2015 ([07a5459](https://github.com/wooorm/retext-smartypants/commit/07a5459)) | ||
* Add link to whole license in `Readme.md` ([2d0ac83](https://github.com/wooorm/retext-smartypants/commit/2d0ac83)) | ||
* Add Duo as an instalation method in `Readme.md` ([a4588d6](https://github.com/wooorm/retext-smartypants/commit/a4588d6)) | ||
* Add links to installation methods in `Readme.md` ([a7356b3](https://github.com/wooorm/retext-smartypants/commit/a7356b3)) | ||
* Refactor fences code blocks in `Readme.md` ([d71528d](https://github.com/wooorm/retext-smartypants/commit/d71528d)) | ||
* Refactor to adhere to strict jsdoc style ([1a77462](https://github.com/wooorm/retext-smartypants/commit/1a77462)) | ||
* Add jscs-jsdoc configuration to `.jscs.json` ([92e80b7](https://github.com/wooorm/retext-smartypants/commit/92e80b7)) | ||
* Add jscs-jsdoc as a dev-dependency ([7d66558](https://github.com/wooorm/retext-smartypants/commit/7d66558)) | ||
* Refactor npm scripts for changes in npm ([3537c92](https://github.com/wooorm/retext-smartypants/commit/3537c92)) | ||
* Update eslint ([7f0559f](https://github.com/wooorm/retext-smartypants/commit/7f0559f)) | ||
* Refactor to use generic `changeinside` in new retext ([58dad85](https://github.com/wooorm/retext-smartypants/commit/58dad85)) | ||
* Update retext to stable release ([9c10b7e](https://github.com/wooorm/retext-smartypants/commit/9c10b7e)) | ||
0.1.5 / 2014-12-08 | ||
================== | ||
* Update changelog for 0.1.5 ([0c17dcc](https://github.com/wooorm/retext-smartypants/commit/0c17dcc)) | ||
* Add benchmark ([7c2e899](https://github.com/wooorm/retext-smartypants/commit/7c2e899)) | ||
* Fix wording in `Readme.md` ([fcd117d](https://github.com/wooorm/retext-smartypants/commit/fcd117d)) | ||
* Refactor npm script targets in `package.json` ([1847154](https://github.com/wooorm/retext-smartypants/commit/1847154)) | ||
* Add link to personal website to copyright in `Readme.md` ([740821f](https://github.com/wooorm/retext-smartypants/commit/740821f)) | ||
* Update eslint, retext ([5619d70](https://github.com/wooorm/retext-smartypants/commit/5619d70)) | ||
0.1.4 / 2014-11-21 | ||
================== | ||
* Update changelog for 0.1.4 ([9ea00e7](https://github.com/wooorm/retext-smartypants/commit/9ea00e7)) | ||
* Refactor `Readme.md` ([55104f9](https://github.com/wooorm/retext-smartypants/commit/55104f9)) | ||
* Add flat badges to `Readme.md` ([b199ea4](https://github.com/wooorm/retext-smartypants/commit/b199ea4)) | ||
* Fix incorrect executive rights on `test.js` ([0fca83e](https://github.com/wooorm/retext-smartypants/commit/0fca83e)) | ||
* Refactor npm script targets in `package.json` ([21ebadd](https://github.com/wooorm/retext-smartypants/commit/21ebadd)) | ||
* Add retext-inspect to dev-dependecies ([aa40732](https://github.com/wooorm/retext-smartypants/commit/aa40732)) | ||
* Update retext ([5efa0ec](https://github.com/wooorm/retext-smartypants/commit/5efa0ec)) | ||
0.1.3 / 2014-10-28 | ||
================== | ||
* Update changelog for 0.1.3 ([335a657](https://github.com/wooorm/retext-smartypants/commit/335a657)) | ||
* Add `.eslintrc` ([6e140cf](https://github.com/wooorm/retext-smartypants/commit/6e140cf)) | ||
* Refactor to disallow space after object keys ([7523abf](https://github.com/wooorm/retext-smartypants/commit/7523abf)) | ||
* Refactor for changes in retext ([3b83025](https://github.com/wooorm/retext-smartypants/commit/3b83025)) | ||
* Update eslint, mocha, retext, retext-content, retext-visit ([b5a992d](https://github.com/wooorm/retext-smartypants/commit/b5a992d)) | ||
0.1.2 / 2014-10-21 | ||
================== | ||
* Update changelog for 0.1.2 ([399490e](https://github.com/wooorm/retext-smartypants/commit/399490e)) | ||
* Refactor .jscs.json ([0bd9d3e](https://github.com/wooorm/retext-smartypants/commit/0bd9d3e)) | ||
* Update retext ([1d01edc](https://github.com/wooorm/retext-smartypants/commit/1d01edc)) | ||
0.1.1 / 2014-10-15 | ||
================== | ||
* Update changelog for 0.1.1 ([f7fea14](https://github.com/wooorm/retext-smartypants/commit/f7fea14)) | ||
* Update tests for changes in retext-visit ([4e88d0c](https://github.com/wooorm/retext-smartypants/commit/4e88d0c)) | ||
* Update smartypants, retext, retext-content, retext-visit ([cdf6fde](https://github.com/wooorm/retext-smartypants/commit/cdf6fde)) | ||
* Update .gitignore, .npmignore, bower ignore ([7c6f987](https://github.com/wooorm/retext-smartypants/commit/7c6f987)) | ||
* Move spec to test.js ([b19f5fd](https://github.com/wooorm/retext-smartypants/commit/b19f5fd)) | ||
0.1.0 / 2014-09-27 | ||
================== | ||
* Update changelog for 0.1.0 ([2e212b9](https://github.com/wooorm/retext-smartypants/commit/2e212b9)) | ||
* Refactor Readme.md ([778c756](https://github.com/wooorm/retext-smartypants/commit/778c756)) | ||
* Refactor API ([a46c295](https://github.com/wooorm/retext-smartypants/commit/a46c295)) | ||
* Remove browser test ([363f5cd](https://github.com/wooorm/retext-smartypants/commit/363f5cd)) | ||
* Update .gitignore, .npmignore ([197f7a5](https://github.com/wooorm/retext-smartypants/commit/197f7a5)) | ||
* Fix property order in component.json, package.json, bower.json ([3fa0d34](https://github.com/wooorm/retext-smartypants/commit/3fa0d34)) | ||
* Refactor spec ([59fe989](https://github.com/wooorm/retext-smartypants/commit/59fe989)) | ||
* Update retext, retext-visit, retext-content ([9aaa9b1](https://github.com/wooorm/retext-smartypants/commit/9aaa9b1)) | ||
* Fix several typo’s ([eb5fd0a](https://github.com/wooorm/retext-smartypants/commit/eb5fd0a)) | ||
0.0.1 / 2014-09-15 | ||
================== |
98
index.js
/** | ||
* @author Titus Wormer | ||
* @copyright 2014-2015 Titus Wormer | ||
* @copyright 2014 Titus Wormer | ||
* @license MIT | ||
* @module retext:smartypants | ||
* @fileoverview Count smartypantss in Retext. | ||
* @fileoverview Retext implementation of SmartyPants. | ||
*/ | ||
@@ -11,13 +11,12 @@ | ||
/* | ||
* Dependencies. | ||
*/ | ||
/* eslint-env commonjs */ | ||
/* Dependencies. */ | ||
var visit = require('unist-util-visit'); | ||
var nlcstToString = require('nlcst-to-string'); | ||
/* | ||
* Types. | ||
*/ | ||
/* Map of educators. */ | ||
var educators = {}; | ||
/* Types. */ | ||
var PUNCTUATION_NODE = 'PunctuationNode'; | ||
@@ -28,6 +27,3 @@ var SYMBOL_NODE = 'SymbolNode'; | ||
/* | ||
* Characters. | ||
*/ | ||
/* Characters. */ | ||
var EXPRESSION_DECADE = /^\d\ds$/; | ||
@@ -59,8 +55,2 @@ var FULL_STOPS_THREE = /^\.{3,}$/; | ||
/* | ||
* Map of educators. | ||
*/ | ||
var educators = {}; | ||
/** | ||
@@ -139,2 +129,4 @@ * Transform two dahes into an em-dash. | ||
* @param {NLCSTPunctuationNode} node - Node to transform. | ||
* @param {number} index - Position of `node` in `parent`. | ||
* @param {Node} parent - Parent of `node`. | ||
*/ | ||
@@ -151,6 +143,3 @@ function ellipses(node, index, parent) { | ||
/* | ||
* Simple node with three dots and without white-space. | ||
*/ | ||
/* Simple node with three dots and without white-space. */ | ||
if (FULL_STOPS_THREE.test(node.value)) { | ||
@@ -166,6 +155,3 @@ node.value = ELLIPSIS; | ||
/* | ||
* Search for dot-nodes with white-space between. | ||
*/ | ||
/* Search for dot-nodes with white-space between. */ | ||
nodes = []; | ||
@@ -175,9 +161,6 @@ position = index; | ||
/* | ||
* It’s possible that the node is merged with an | ||
/* It’s possible that the node is merged with an | ||
* adjacent word-node. In that code, we cannot | ||
* transform it because there’s no reference to the | ||
* grandparent. | ||
*/ | ||
* grandparent. */ | ||
while (--position > 0) { | ||
@@ -223,2 +206,4 @@ sibling = siblings[position]; | ||
* @param {NLCSTPunctuationNode} node - Node to transform. | ||
* @param {number} index - Position of `node` in `parent`. | ||
* @param {Node} parent - Parent of `node`. | ||
*/ | ||
@@ -248,9 +233,6 @@ function quotes(node, index, parent) { | ||
) { | ||
/* | ||
* Special case if the very first character is | ||
/* Special case if the very first character is | ||
* a quote followed by punctuation at a | ||
* non-word-break. Close the quotes by brute | ||
* force. | ||
*/ | ||
* force. */ | ||
node.value = CLOSING_QUOTE_MAP[value]; | ||
@@ -265,8 +247,6 @@ } else if ( | ||
) { | ||
/* | ||
* Special case for double sets of quotes: | ||
/* Special case for double sets of quotes: | ||
* | ||
* He said, "'Quoted' words in a larger quote." | ||
*/ | ||
node.value = OPENING_QUOTE_MAP[value]; | ||
@@ -278,8 +258,6 @@ next.value = OPENING_QUOTE_MAP[nextValue]; | ||
) { | ||
/* | ||
* Special case for decade abbreviations: | ||
/* Special case for decade abbreviations: | ||
* | ||
* the '80s | ||
*/ | ||
node.value = CLOSING_QUOTE_MAP[value]; | ||
@@ -296,6 +274,3 @@ } else if ( | ||
) { | ||
/* | ||
* Get most opening single quotes. | ||
*/ | ||
/* Get most opening single quotes. */ | ||
node.value = OPENING_QUOTE_MAP[value]; | ||
@@ -310,6 +285,3 @@ } else if ( | ||
) { | ||
/* | ||
* Closing quotes | ||
*/ | ||
/* Closing quotes */ | ||
node.value = CLOSING_QUOTE_MAP[value]; | ||
@@ -330,23 +302,20 @@ } else if ( | ||
/* | ||
* Expose educators. | ||
*/ | ||
/* Expose educators. */ | ||
educators.dashes = { | ||
'true': dashes, | ||
'oldschool': oldschool, | ||
'inverted': inverted | ||
true: dashes, | ||
oldschool: oldschool, | ||
inverted: inverted | ||
}; | ||
educators.backticks = { | ||
'true': backticks, | ||
'all': all | ||
true: backticks, | ||
all: all | ||
}; | ||
educators.ellipses = { | ||
'true': ellipses | ||
true: ellipses | ||
}; | ||
educators.quotes = { | ||
'true': quotes | ||
true: quotes | ||
}; | ||
@@ -388,2 +357,4 @@ | ||
* | ||
* @param {Unified} processor - Processor. | ||
* @param {Object} [options] - Configuration. | ||
* @return {Function} - `transformer`. | ||
@@ -496,6 +467,3 @@ */ | ||
/* | ||
* Expose. | ||
*/ | ||
/* Expose. */ | ||
module.exports = attacher; |
{ | ||
"name": "retext-smartypants", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Retext implementation of SmartyPants", | ||
@@ -10,42 +10,45 @@ "license": "MIT", | ||
], | ||
"files": [ | ||
"index.js" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/wooorm/retext-smartypants.git" | ||
}, | ||
"bugs": "https://github.com/wooorm/retext-smartypants/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
"contributors": [ | ||
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)" | ||
], | ||
"dependencies": { | ||
"nlcst-to-string": "^0.1.5", | ||
"nlcst-to-string": "^2.0.0", | ||
"unist-util-visit": "^1.0.0" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"repository": "wooorm/retext-smartypants", | ||
"author": "Titus Wormer <tituswormer@gmail.com>", | ||
"devDependencies": { | ||
"browserify": "^11.0.1", | ||
"chalk": "^1.0.0", | ||
"eslint": "^1.0.0", | ||
"browserify": "^13.0.1", | ||
"eslint": "^2.0.0", | ||
"esmangle": "^1.0.1", | ||
"istanbul": "^0.3.0", | ||
"jscs": "^2.0.0", | ||
"jscs-jsdoc": "^1.0.0", | ||
"mdast": "^1.0.0", | ||
"mdast-comment-config": "^1.0.0", | ||
"mdast-github": "^1.0.0", | ||
"mdast-lint": "^1.0.0", | ||
"mdast-slug": "^1.0.0", | ||
"mdast-validate-links": "^1.0.0", | ||
"mocha": "^2.0.0", | ||
"retext": "^1.0.0-rc.3" | ||
"istanbul": "^0.4.0", | ||
"jscs": "^3.0.0", | ||
"jscs-jsdoc": "^2.0.0", | ||
"remark-cli": "^1.0.0", | ||
"remark-comment-config": "^4.0.0", | ||
"remark-github": "^5.0.0", | ||
"remark-lint": "^4.0.0", | ||
"remark-validate-links": "^4.0.0", | ||
"retext": "^3.0.0", | ||
"tape": "^4.0.0" | ||
}, | ||
"scripts": { | ||
"test-api": "mocha --check-leaks test.js", | ||
"test-coverage": "istanbul cover _mocha -- test.js", | ||
"test-travis": "npm run test-coverage", | ||
"test": "npm run test-api", | ||
"build-md": "remark . --quiet --frail", | ||
"build-bundle": "browserify index.js --bare -s retextSmartypants > retext-smartypants.js", | ||
"build-mangle": "esmangle retext-smartypants.js > retext-smartypants.min.js", | ||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", | ||
"lint-api": "eslint .", | ||
"lint-style": "jscs --reporter inline .", | ||
"lint": "npm run lint-api && npm run lint-style", | ||
"make": "npm run lint && npm run test-coverage", | ||
"build-bundle": "browserify index.js --no-builtins -s retextSmartypants > retext-smartypants.js", | ||
"postbuild-bundle": "esmangle retext-smartypants.js > retext-smartypants.min.js", | ||
"build-md": "mdast . --quiet", | ||
"build": "npm run build-bundle && npm run build-md" | ||
"test-api": "node test.js", | ||
"test-coverage": "istanbul cover test.js", | ||
"test": "npm run build && npm run lint && npm run test-coverage" | ||
} | ||
} |
@@ -1,8 +0,10 @@ | ||
# retext-smartypants [![Build Status](https://img.shields.io/travis/wooorm/retext-smartypants.svg)](https://travis-ci.org/wooorm/retext-smartypants) [![Coverage Status](https://img.shields.io/codecov/c/github/wooorm/retext-smartypants.svg)](https://codecov.io/github/wooorm/retext-smartypants) | ||
# retext-smartypants [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
[**retext**](https://github.com/wooorm/retext) implementation of [smartypants](http://daringfireball.net/projects/smartypants/). | ||
<!--lint disable heading-increment list-item-spacing--> | ||
[smartypants][] in [**retext**][retext]. | ||
## Installation | ||
[npm](https://docs.npmjs.com/cli/install): | ||
[npm][npm-install]: | ||
@@ -13,7 +15,4 @@ ```bash | ||
**retext-smartypants** is also available for [bower](http://bower.io/#install-packages), | ||
[component](https://github.com/componentjs/component), and | ||
[duo](http://duojs.org/#getting-started), and as an AMD, CommonJS, and globals | ||
module, [uncompressed](retext-smartypants.js) and | ||
[compressed](retext-smartypants.min.js). | ||
**retext-smartypants** is also available as an AMD, CommonJS, and | ||
globals module, [uncompressed and compressed][releases]. | ||
@@ -37,38 +36,53 @@ ## Usage | ||
### [retext](https://github.com/wooorm/retext/tree/feature/stable#api).[use](https://github.com/wooorm/retext/tree/feature/stable#retextuseplugin-options)(smartypants\[, options\]) | ||
### `retext().use(smartypants[, options])` | ||
Replaces “dumb” punctuation marks with “smart” punctuation marks. | ||
**Parameters** | ||
###### `options` | ||
* `smartypants` — This plug-in; | ||
* `quotes` (`boolean`, default: `true`) | ||
— Converts “dumb” double and single quotes to smart double or | ||
single quotes; | ||
* `ellipses` (`boolean`, default: `true`) | ||
— Converts triple dot characters (with or without spaces between) | ||
into a single unicode ellipsis character; | ||
* `backticks` (`boolean` or `'all'`, default: `true`) | ||
— When `true`, converts double back-ticks into an opening double | ||
quote, and double “dumb” single quotes into a closing double quote; | ||
When `'all'`: does the preceding, and converts single back-ticks | ||
into an opening single quote, and a “dumb” single quote into a | ||
closing single quote. | ||
* `options` (`Object`, optional): Any option can be set to `false` to be | ||
turned off. | ||
**Note!** Quotes can not be `true` when `backticks` is `'all'`; | ||
* `quotes` (`boolean`, default: `true`) | ||
— Converts dumb double and single quotes to smart double or single | ||
quotes; | ||
* `dashes` (`boolean` or `'oldschool'`, `'inverted'`, default: `true`) | ||
— When `true`, converts two dashes into an em-dash character; | ||
When `'oldschool'`, converts two dashes into an en-dash, and three | ||
dashes into an em-dash; When `'inverted'`, converts two dashes into | ||
an em-dash, and three dashes into an en-dash. | ||
* `ellipses` (`boolean`, default: `true`) | ||
— Converts triple dot characters (with or without spaces between) into | ||
a single unicode ellipsis character; | ||
## License | ||
* `backticks` (`boolean` or `"all"`, default: `true`) | ||
— When `true`, converts double back-ticks into an opening double quote, | ||
and double dumb single quotes into a closing double quote; | ||
When `"all"`: does the preceding, and converts single back-ticks into an | ||
opening single quote, and a dumb single quote into a closing single | ||
quote. | ||
[MIT][license] © [Titus Wormer][author] | ||
**Note!** Quotes can not be `true` when `backticks` is `"all"`; | ||
<!-- Definitions --> | ||
* `dashes` (`boolean` or `"oldschool"`, `"inverted"`, default: `true`) | ||
— When `true`, converts two dashes into an em-dash character; | ||
When `"oldschool"`, converts two dashes into an en-dash, and three | ||
dashes into an em-dash; When `"inverted"`, converts two dashes into | ||
an em-dash, and three dashes into an en-dash. | ||
[travis-badge]: https://img.shields.io/travis/wooorm/retext-smartypants.svg | ||
## License | ||
[travis]: https://travis-ci.org/wooorm/retext-smartypants | ||
[MIT](LICENSE) © [Titus Wormer](http://wooorm.com) | ||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/retext-smartypants.svg | ||
[codecov]: https://codecov.io/github/wooorm/retext-smartypants | ||
[npm-install]: https://docs.npmjs.com/cli/install | ||
[releases]: https://github.com/wooorm/retext-smartypants/releases | ||
[license]: LICENSE | ||
[author]: http://wooorm.com | ||
[retext]: https://github.com/wooorm/retext | ||
[smartypants]: http://daringfireball.net/projects/smartypants |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
13
87
0
0
16276
395
+ Addednlcst-to-string@2.0.4(transitive)
- Removednlcst-to-string@0.1.5(transitive)
Updatednlcst-to-string@^2.0.0