diff options
Diffstat (limited to 'node_modules/typographic-quotes')
| -rw-r--r-- | node_modules/typographic-quotes/.npmignore | 3 | ||||
| -rw-r--r-- | node_modules/typographic-quotes/.travis.yml | 8 | ||||
| -rw-r--r-- | node_modules/typographic-quotes/README.md | 76 | ||||
| -rw-r--r-- | node_modules/typographic-quotes/index.es5.js | 50 | ||||
| -rw-r--r-- | node_modules/typographic-quotes/index.js | 23 | ||||
| -rw-r--r-- | node_modules/typographic-quotes/package.json | 72 | ||||
| -rw-r--r-- | node_modules/typographic-quotes/test.js | 55 |
7 files changed, 0 insertions, 287 deletions
diff --git a/node_modules/typographic-quotes/.npmignore b/node_modules/typographic-quotes/.npmignore deleted file mode 100644 index 648ea07..0000000 --- a/node_modules/typographic-quotes/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -coverage -npm-debug.log diff --git a/node_modules/typographic-quotes/.travis.yml b/node_modules/typographic-quotes/.travis.yml deleted file mode 100644 index 6769e3a..0000000 --- a/node_modules/typographic-quotes/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - v5 - - v4 - - '0.12' - - '0.10' -after_script: - - 'npm run coveralls' diff --git a/node_modules/typographic-quotes/README.md b/node_modules/typographic-quotes/README.md deleted file mode 100644 index 8d3084f..0000000 --- a/node_modules/typographic-quotes/README.md +++ /dev/null @@ -1,76 +0,0 @@ -# typographic-quotes - -[![NPM version][npm-image]][npm-url] -[![Build Status][travis-image]][travis-url] -[![Coveralls Status][coveralls-image]][coveralls-url] -[![Dependency Status][depstat-image]][depstat-url] - -> [Always use curly quotes][rtfm] - -Micro module to help eliminate one of the [bad typewriter habits][habits]. - - -## Install - -```sh -npm install --save typographic-quotes -``` - - -## Usage - -Use typographic quotes for your text with respect to your locale, basically for -proper primary and secondary quotes. Pass object with specified locale field as -second parameter. **`locale` field is mandatory.** This module relies on -[`typographic-quotes-l10n-db`][quotesDB] in choosing proper quotes -for every language. - - -> In American English, double quotes are used normally (the “primary” style). -> If quote marks are used inside another pair of quote marks, then single quotes -> are used as the “secondary” style. For example: “Didn't she say ‘I like red -> best’ when asked her favorite wine?” he wondered to himself. -— [from the Wikipedia](http://en.wikipedia.org/wiki/Quotation_mark) - -```js -var quotes = require('typographic-quotes'); - -// in american english (en-us) primary quotes are “”, and secondary are ‘’. -// in danish (da) primary quotes are »«, and secondary are ›‹. - -// `locale` field is mandatory -quotes(`foo 'foo' bar`, { locale: 'en-us' }); // foo “foo” bar -quotes(`foo 'foo' bar`, { locale: 'da' }); // foo »foo« bar -quotes(`foo "foo 'inside' bar" bar`, { locale: 'en-us' }); // foo “foo ‘inside’ bar” bar -quotes(`foo 'foo "inside" bar' bar`, { locale: 'da' }); // foo »foo ›inside‹ bar« bar -``` - -[quotesDB]: https://www.npmjs.com/package/typographic-quotes-l10n-db - - -## Apostrophes - -If you want to see proper apostrophes too, take a look at [apostrophes][typographic-apostrophes] and [apostrophes-for-possessive-plurals][typographic-apostrophes-for-possessive-plurals] typographic modules. Use first one before this module, second after: `apostrophes → quotes → apostrophes-for-possessive-plurals` (order is important). Check complex usage in [typography playground][playground]. - -[typographic-apostrophes]: https://www.npmjs.com/package/typographic-apostrophes -[typographic-apostrophes-for-possessive-plurals]: https://www.npmjs.com/package/typographic-apostrophes-for-possessive-plurals -[playground]: https://github.com/matmuchrapna/typographic-playground - -## License - -MIT © [Vladimir Starkov](https://iamstarkov.com/) - -[rtfm]: http://practicaltypography.com/straight-and-curly-quotes.html -[habits]: http://practicaltypography.com/typewriter-habits.html - -[npm-url]: https://npmjs.org/package/typographic-quotes -[npm-image]: http://img.shields.io/npm/v/typographic-quotes.svg - -[travis-url]: https://travis-ci.org/iamstarkov/typographic-quotes -[travis-image]: http://img.shields.io/travis/iamstarkov/typographic-quotes.svg - -[coveralls-url]: https://coveralls.io/r/iamstarkov/typographic-quotes -[coveralls-image]: http://img.shields.io/coveralls/iamstarkov/typographic-quotes.svg - -[depstat-url]: https://david-dm.org/iamstarkov/typographic-quotes -[depstat-image]: https://david-dm.org/iamstarkov/typographic-quotes.svg diff --git a/node_modules/typographic-quotes/index.es5.js b/node_modules/typographic-quotes/index.es5.js deleted file mode 100644 index a338ae9..0000000 --- a/node_modules/typographic-quotes/index.es5.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports['default'] = typographicQuotes; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _typographicQuotesL10nDb = require('typographic-quotes-l10n-db'); - -var _typographicQuotesL10nDb2 = _interopRequireDefault(_typographicQuotesL10nDb); - -function typographicQuotes() { - var input = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; - - var _ref = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var locale = _ref.locale; - - if (Object.keys(_typographicQuotesL10nDb2['default']).indexOf(locale) === -1) { - return input; - } - var localeQuotes = _typographicQuotesL10nDb2['default'][locale]; - var separator = ''; - - var pattern = /(^|\s)(?:"(.*?)"|'(.*?)')(\s|$|\.|,|\?|!)/gim; - var handleQuotes = function handleQuotes(quotes, cb) { - return function (match) { - var before = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; - var part1 = arguments.length <= 2 || arguments[2] === undefined ? '' : arguments[2]; - var part2 = arguments.length <= 3 || arguments[3] === undefined ? '' : arguments[3]; - var after = arguments.length <= 4 || arguments[4] === undefined ? '' : arguments[4]; - - var text = part1 + part2; - if (cb) { - text = text.replace(pattern, cb); - } - if (locale === 'fr') { - separator = ' '; - } - return '' + before + quotes[0] + separator + text + separator + quotes[1] + after; - }; - }; - - return input.replace(pattern, handleQuotes(localeQuotes.slice(0, 2), handleQuotes(localeQuotes.slice(2, 4)))); -} - -module.exports = exports['default']; - diff --git a/node_modules/typographic-quotes/index.js b/node_modules/typographic-quotes/index.js deleted file mode 100644 index 08aae4b..0000000 --- a/node_modules/typographic-quotes/index.js +++ /dev/null @@ -1,23 +0,0 @@ -import db from 'typographic-quotes-l10n-db'; - -export default function typographicQuotes(input = '', { locale } = {}) { - if (Object.keys(db).indexOf(locale) === -1) { - return input; - } - const localeQuotes = db[locale]; - let separator = ''; - - const pattern = /(^|\s)(?:"(.*?)"|'(.*?)')(\s|$|\.|,|\?|!)/gim; - const handleQuotes = (quotes, cb) => - (match, before='', part1='', part2='', after='') => { - let text = (part1 + part2); - if (cb) { text = text.replace(pattern, cb); } - if (locale === 'fr') { separator = ' '; } - return `${before}${quotes[0]}${separator}${text}${separator}${quotes[1]}${after}`; - } - - return input.replace(pattern, - handleQuotes( - localeQuotes.slice(0, 2), - handleQuotes(localeQuotes.slice(2, 4)))) -} diff --git a/node_modules/typographic-quotes/package.json b/node_modules/typographic-quotes/package.json deleted file mode 100644 index 0626493..0000000 --- a/node_modules/typographic-quotes/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "_from": "typographic-quotes@^2.0.1", - "_id": "[email protected]", - "_inBundle": false, - "_integrity": "sha1-YlttS7jU+u9JGxI6chfvOAFZZ4U=", - "_location": "/typographic-quotes", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "typographic-quotes@^2.0.1", - "name": "typographic-quotes", - "escapedName": "typographic-quotes", - "rawSpec": "^2.0.1", - "saveSpec": null, - "fetchSpec": "^2.0.1" - }, - "_requiredBy": [ - "/at-quotes" - ], - "_resolved": "https://registry.npmjs.org/typographic-quotes/-/typographic-quotes-2.0.1.tgz", - "_shasum": "625b6d4bb8d4faef491b123a7217ef3801596785", - "_spec": "typographic-quotes@^2.0.1", - "_where": "E:\\Documents\\GitHub\\s5nical\\node_modules\\at-quotes", - "author": { - "name": "Vladimir Starkov", - "email": "[email protected]", - "url": "http://vstarkov.com/" - }, - "bugs": { - "url": "https://github.com/matmuchrapna/typographic-quotes/issues" - }, - "bundleDependencies": false, - "dependencies": { - "typographic-quotes-l10n-db": "^1.0.0" - }, - "deprecated": false, - "description": "Always use curly quotes", - "devDependencies": { - "babel": "^5.0.0", - "coveralls": "^2.11.2", - "husky": "^0.7.0", - "istanbul": "^0.3.11", - "mocha": "^2.2.1", - "mocha-lcov-reporter": "0.0.2" - }, - "homepage": "https://github.com/matmuchrapna/typographic-quotes", - "keywords": [ - "typographic", - "quotes", - "textr" - ], - "license": "MIT", - "main": "index.es5.js", - "name": "typographic-quotes", - "repository": { - "type": "git", - "url": "git+https://github.com/matmuchrapna/typographic-quotes.git" - }, - "scripts": { - "coverage": "istanbul cover _mocha -- --require babel/register", - "coveralls": "coveralls < coverage/lcov.info", - "postpublish": "rm *.es5.js && git push --follow-tags", - "precommit": "npm test", - "precoveralls": "npm run coverage", - "prepublish": "npm run transpile", - "tdd": "mocha --require babel/register --watch", - "test": "mocha --require babel/register", - "transpile": "babel index.js > index.es5.js" - }, - "version": "2.0.1" -} diff --git a/node_modules/typographic-quotes/test.js b/node_modules/typographic-quotes/test.js deleted file mode 100644 index b8b3e72..0000000 --- a/node_modules/typographic-quotes/test.js +++ /dev/null @@ -1,55 +0,0 @@ -import quotes from './index'; -import { equal } from 'assert'; - -const american = { locale: 'en-us' }; -const russian = { locale: 'ru' }; -const french = { locale: 'fr' }; - -it('should do nothing if locale is undefined', () => - equal(quotes(`foo 'foo' bar`), `foo 'foo' bar`)); - -it('should fix simple quotes', () => { - equal(quotes(`foo 'foo' bar`, american), `foo “foo” bar`); - equal(quotes(`foo "foo" bar`, american), `foo “foo” bar`); -}); - -it('should fix nested quotes', () => { - equal(quotes(`foo "foo 'inside' bar" bar`, american), `foo “foo ‘inside’ bar” bar`); - equal(quotes(`foo 'foo "inside" bar' bar`, american), `foo “foo ‘inside’ bar” bar`); -}); - -it('should fix simple quotes for French', () => - equal(quotes(`foo 'foo' bar`, french), `foo « foo » bar`)); - -it('should not fuck up not closed quotes', () => - equal(quotes(`foo "foo" "bar`, american), `foo “foo” "bar`)); - -it('should fix simple quotes in the start', () => - equal(quotes(`'foo' bar`, american), `“foo” bar`)); - -it('should fix simple quotes in the end', () => - equal(quotes(`foo 'foo'`, american), `foo “foo”`)); - -it('should fix simple quotes ending quite before dot', () => - equal(quotes(`foo 'foo'. bar`, american), `foo “foo”. bar`)); - -it('should fix simple quotes ending quite before coma', () => - equal(quotes(`foo "foo", bar`, american), `foo “foo”, bar`)); - -it('should fix simple quotes and not messing up with apostrophes', () => - equal(quotes(`foo's 'foo' bar`, american), `foo's “foo” bar`)); - -it('should fix simple several quotes in a row', () => - equal(quotes(`foo 'foo' bar 'foo' bar`, american), `foo “foo” bar “foo” bar`)); - -it('should fix nested quotes for French', () => - equal(quotes(`foo "foo 'inside' bar" bar`, french), `foo « foo “ inside ” bar » bar`)); - -it('should fix nested quotes in start', () => - equal(quotes(`"foo 'inside' bar" bar`, american), `“foo ‘inside’ bar” bar`)); - -it('should fix nested quotes in end', () => - equal(quotes(`foo "foo 'inside' bar"`, american), `foo “foo ‘inside’ bar”`)); - -it('should not change apostrophes', () => - equal(quotes(`I'm not changing apostrophes`, american), `I'm not changing apostrophes`)); |