From 013294b384ab6dec0320f4c2ce6aa7a810b1630a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 15 Jan 2015 09:34:01 -0800 Subject: Added normalize-reference.js. This does a proper unicode case fold instead of just using toUpperCase. It is also faster, partly because we can do one pass for space and case normalization. Modified from the NPM package fold-case; proper credit given in source and COPYING. --- js/lib/inlines.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'js/lib/inlines.js') diff --git a/js/lib/inlines.js b/js/lib/inlines.js index 46e4644..8bd70c2 100644 --- a/js/lib/inlines.js +++ b/js/lib/inlines.js @@ -2,6 +2,8 @@ var Node = require('./node'); var common = require('./common'); +var normalizeReference = require('./normalize-reference'); + var normalizeURI = common.normalizeURI; var unescapeString = common.unescapeString; var fromCodePoint = require('./from-code-point.js'); @@ -92,14 +94,6 @@ var reLinkLabel = /^\[(?:[^\\\[\]]|\\[\[\]]){0,1000}\]/; // Matches a string of non-special characters. var reMain = /^[^\n`\[\]\\!<&*_]+/m; -// Normalize reference label: collapse internal whitespace -// to single space, remove leading/trailing whitespace, case fold. -var normalizeReference = function(s) { - return s.trim() - .replace(/\s+/, ' ') - .toUpperCase(); -}; - var text = function(s) { var node = new Node('Text'); node.literal = s; -- cgit v1.2.3