Skip to content

Commit 42edee4

Browse files
committed
detect sentence boundary when close-paren is after stop
1 parent ec5919a commit 42edee4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

typography.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt Apache-2.0
22
// (the above comment is for LibreJS)
33

4-
// Web page typography helper v1.5 (c) 2011-2014,2016,2019-2021 Silas S. Brown.
4+
// Web page typography helper v1.51 (c) 2011-2014,2016,2019-2021 Silas S. Brown.
55

66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -79,7 +79,7 @@ if(document.getElementsByTagName && navigator.userAgent.indexOf("Googlebot/")==-
7979
typefix = function(str) {
8080
if (supports_dashes) str=str.replace(/'neath /g,"\u2019neath ").replace(/ '11 /g," \u201911 ").replace(/'mid /g,"\u2019mid ").replace(/'s /g,"\u2019s ").replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/[ \n]'/g," \u2018").replace(/``/g,"\u201C").replace(/`/g,"\u2018").replace(/^''([a-zA-Z])/,"\u201C$1").replace(/^'([a-zA-Z])/,"\u2018$1").replace(/''/g,"\u201D").replace(/'/g,"\u2019").replace(/[ \n]"/g," \u201C").replace(/^"([a-zA-Z])/,"\u201C$1").replace(/\("/g,"(\u201C").replace(/"/g,"\u201D");
8181
// (ought to be able to say \s instead of [ \n] above, but it doesn't seem to work on all browsers; however we will use it for supports_spacing below as that's less likely to look right on browsers that don't support \s anyway)
82-
if (supports_spacing) str=str.replace(/([A-Za-z][A-Za-z][)]?(<!--.*?-->[)]?)*[.?!][\u2019\u201d]*(<!--.*?-->)*[\u2019\u201d]*)\s+((<!--.*?-->\s*)*[^A-Za-z]*[A-Z])/g,"$1\u2002"+(supports_0space?"\u200B":"")+"$4"); // use en-space between sentences (must be after quote substitution above), plus zero-width space (if supported) to confirm this is a breakpoint (as some versions of at least Webkit don't break at en-space by default)
82+
if (supports_spacing) str=str.replace(/([A-Za-z][A-Za-z][)]?(<!--.*?-->[)]?)*[.?!][)\u2019\u201d]*(<!--.*?-->)*[)\u2019\u201d]*)\s+((<!--.*?-->\s*)*[^A-Za-z]*[A-Z])/g,"$1\u2002"+(supports_0space?"\u200B":"")+"$4"); // use en-space between sentences (must be after quote substitution above), plus zero-width space (if supported) to confirm this is a breakpoint (as some versions of at least Webkit don't break at en-space by default)
8383
if (supports_ligatures) str=str.replace(/([^f])fi/g,"$1\ufb01").replace(/([^f])fl/g,"$1\ufb02");
8484
// .replace(/ff/g,"\ufb00"); - doesn't always work so well (might be a different font)
8585
// also took out .replace(/ffl/g,"\ufb04").replace(/ffi/g,"\ufb03")

0 commit comments

Comments
 (0)