From c4797d8369be6cb8342014ae6a31992029801399 Mon Sep 17 00:00:00 2001
From: Daniel Haim <2808046+danielhaim1@users.noreply.github.com>
Date: Wed, 19 Oct 2022 10:11:15 +0200
Subject: [PATCH 1/2] README.md
---
README.md | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 3c82053..b6bbb06 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,15 @@
# Typeset
-Typeset is an HTML pre-processor for web typography which provides typographic features used traditionally in fine printing which remain unavailable to browser layout engines. Typeset's processing brings the following to your webpages:
+Typeset is an HTML pre-processor for web typography which provides typographic features used traditionally in fine printing which remain unavailable to browser layout engines. Typeset's processing brings the following to your webpages:
-- [Hanging punctuation](https://en.wikipedia.org/wiki/Hanging_punctuation)
+- [Hanging punctuation](https://en.wikipedia.org/wiki/Hanging_punctuation)
- [Ligatures](https://en.wikipedia.org/wiki/Orthographic_ligature)
-- [Optical margin alignment](https://en.wikipedia.org/wiki/Optical_margin_alignment)
-- [Punctuation substitution](src/punctuation.js)
+- [Optical margin alignment](https://en.wikipedia.org/wiki/Optical_margin_alignment)
+- [Punctuation substitution](src/punctuation.js)
- [Small caps](https://en.wikipedia.org/wiki/Small_caps)
-- [Soft hyphen insertion](https://en.wikipedia.org/wiki/Soft_hyphen)
+- [Soft hyphen insertion](https://en.wikipedia.org/wiki/Soft_hyphen)
-Typeset does not require any client-side JavaScript and uses less than a kilobyte of CSS. Processed HTML & CSS works in Internet Explorer 5 and without any CSS. Typeset can be used manually or as a plugin for [Grunt](https://github.com/mobinni/grunt-typeset) and [gulp](https://github.com/lucasconstantino/gulp-typeset).
+Typeset does not require any client-side JavaScript and uses less than a kilobyte of CSS. Processed HTML & CSS works in Internet Explorer 5 and without any CSS. Typeset can be used manually or as a plugin for [Grunt](https://github.com/mobinni/grunt-typeset) and [gulp](https://github.com/lucasconstantino/gulp-typeset).
@@ -58,7 +58,7 @@ Then tweak the CSS to match the metrics of your font and include it on your page
/*
Quotation mark
- https://en.wikipedia.org/wiki/Quotation_mark)
+ https://en.wikipedia.org/wiki/Quotation_mark
*/
/* Single quotation marks (') */
@@ -173,5 +173,4 @@ See the [LICENSE](LICENSE) file for details.
- [Language options & support](https://github.com/davidmerfield/Typeset/issues/25)
- [Widows & orphans](https://github.com/davidmerfield/Typeset/issues/34).
-- Incorporate features from [Normalize Opentype](http://kennethormandy.com/journal/normalize-opentype-css)
-- Plugins for React, Angular, Svelte, jQuery
\ No newline at end of file
+- Incorporate features from [Normalize Opentype](http://kennethormandy.com/journal/normalize-opentype-css)
\ No newline at end of file
From 42d9ef7e91af5b22f808f05993b47adcb79e3331 Mon Sep 17 00:00:00 2001
From: Daniel Haim <2808046+danielhaim1@users.noreply.github.com>
Date: Wed, 19 Oct 2022 11:47:25 +0200
Subject: [PATCH 2/2] v0.3.2a
- documentation
- replacing ... with `…`
- updated tests
---
src/punctuation.js | 12 ++++++++----
test/punctuationSpec.js | 8 ++++----
test/typesetSpec.js | 2 +-
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/punctuation.js b/src/punctuation.js
index fc290d7..6f14e9c 100644
--- a/src/punctuation.js
+++ b/src/punctuation.js
@@ -1,12 +1,16 @@
module.exports = (text) => {
- // Dashes
+
+ // M Dash
+ // https://en.wikipedia.org/wiki/Dash
text = text.replace(/--/g, "–");
text = text.replace(/ – /g, " — ");
- // Elipses
- text = text.replace(/\.\.\./g, "…");
+ // Ellipsis
+ // https://en.wikipedia.org/wiki/Ellipsis
+ text = text.replace(/\.\.\./g, "…");
- // Nbsp for punc with spaces
+ // Non-breaking space
+ // https://en.wikipedia.org/wiki/Non-breaking_space
const NBSP = " ";
const NBSP_PUNCTUATION_START = /([«¿¡]) /g;
const NBSP_PUNCTUATION_END = / ([\!\?:;\.,‽»])/g;
diff --git a/test/punctuationSpec.js b/test/punctuationSpec.js
index 1d7fabd..eaeea5e 100644
--- a/test/punctuationSpec.js
+++ b/test/punctuationSpec.js
@@ -13,16 +13,16 @@ describe("Punctuation", () => {
expect(punc(html)).to.equal("
En un lugar de la mancha
"); }); - it("should replace three dots by elipses symbol", () => { + it("should replace three dots by ellipsis symbol", () => { const html = "En un lugar de la mancha...
"; - expect(punc(html)).to.equal("En un lugar de la mancha…
"); + expect(punc(html)).to.equal("En un lugar de la mancha…
"); }); - it("should replace three dots by elipses symbol on texts with multiple matches", () => { + it("should replace three dots by ellipsis symbol on texts with multiple matches", () => { const html = "En un lugar de la mancha... De cuyo nombre no quiero acordarme... no ha mucho tiempo que vivía...
"; expect(punc(html)).to.equal( - "En un lugar de la mancha… De cuyo nombre no quiero acordarme… no ha mucho tiempo que vivía…
" + "En un lugar de la mancha… De cuyo nombre no quiero acordarme… no ha mucho tiempo que vivía…
" ); }); diff --git a/test/typesetSpec.js b/test/typesetSpec.js index e3509e8..557db32 100644 --- a/test/typesetSpec.js +++ b/test/typesetSpec.js @@ -21,7 +21,7 @@ describe("Typeset", () => { '"She\'s faster than a 120\' 4" whale." Piña coladas were widely consumed in Götterdämmerung from 1880–1912. For the low price of $20 / year from Exhibits A–E... Then the duplex came forward. "Thrice the tower, he mounted the round gunrest, \'awaking\' HTML. He can print a fixed number of dots in a square inch (for instance, 600 × 600)."
'; expect(typeset(html)).to.equal( - 'Yjarni Sigurðardóttir spoke to NATO from Iceland yesterday: “Light of my life, fire of my florins — my sin, my soul. The tip of the tongue taking a trip to 118° 19′ 43.5″.”
“She’s faster than a 120′ 4″ whale.” Piña coladas were widely consumed in Götterdämmerung from 1880–1912. For the low price of $20 / year from Exhibits A–E… Then the duplex came forward. “Thrice the tower, he mounted the round gunrest, ‘awaking’ HTML. He can print a fixed number of dots in a square inch (for instance, 600 × 600).”
' + 'Yjarni Sigurðardóttir spoke to NATO from Iceland yesterday: “Light of my life, fire of my florins — my sin, my soul. The tip of the tongue taking a trip to 118° 19′ 43.5″.”
“She’s faster than a 120′ 4″ whale.” Piña coladas were widely consumed in Götterdämmerung from 1880–1912. For the low price of $20 / year from Exhibits A–E… Then the duplex came forward. “Thrice the tower, he mounted the round gunrest, ‘awaking’ HTML. He can print a fixed number of dots in a square inch (for instance, 600 × 600).”
' ); }); });