mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-17 18:22:33 +00:00
Fix illegal character in query
* See: https://www.ietf.org/rfc/rfc1738.txt
This commit is contained in:
parent
1dd1c71fdd
commit
d3dc791145
@ -18,7 +18,7 @@ module.exports = function() {
|
||||
});
|
||||
|
||||
fontFamilies = fontFamilies.map(name => name.trim().replace(/\s/g, '+') + fontStyles);
|
||||
fontFamilies = [...new Set(fontFamilies)].join('|');
|
||||
fontFamilies = [...new Set(fontFamilies)].join('%7C');
|
||||
|
||||
// Merge extra parameters to the final processed font string
|
||||
return fontFamilies ? `<link rel="stylesheet" href="${fontHost}/css?family=${fontFamilies}&display=swap&subset=latin,latin-ext">` : '';
|
||||
|
||||
@ -55,7 +55,7 @@ describe('font', () => {
|
||||
family : 'Palatino',
|
||||
external: true
|
||||
};
|
||||
nextFont().should.eql(`<link rel="stylesheet" href="${fontHost}/css?family=Amatic+SC${fontStyles}|Palatino${fontStyles}&display=swap&subset=latin,latin-ext">`);
|
||||
nextFont().should.eql(`<link rel="stylesheet" href="${fontHost}/css?family=Amatic+SC${fontStyles}%7CPalatino${fontStyles}&display=swap&subset=latin,latin-ext">`);
|
||||
});
|
||||
|
||||
it('duplicate', () => {
|
||||
@ -81,6 +81,6 @@ describe('font', () => {
|
||||
family : 'Palatino',
|
||||
external: true
|
||||
};
|
||||
nextFont().should.eql(`<link rel="stylesheet" href="${fontHost}/css?family=Roboto+Slab${fontStyles}|Noto+Serif+SC${fontStyles}|Palatino${fontStyles}&display=swap&subset=latin,latin-ext">`);
|
||||
nextFont().should.eql(`<link rel="stylesheet" href="${fontHost}/css?family=Roboto+Slab${fontStyles}%7CNoto+Serif+SC${fontStyles}%7CPalatino${fontStyles}&display=swap&subset=latin,latin-ext">`);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user