Commit d19bac71 authored by Eduardo Sanz García's avatar Eduardo Sanz García Committed by Eduardo

Reorder parameters for _getMetaTags function

The new order feels more logical,
`attributeName="{prefix}{delimiter}..."`:

1. attribute name to be parsed in the metatags
2. prefix
3. delimiter
parent ad20c5f2
...@@ -84,12 +84,12 @@ export class HTMLMetadata { ...@@ -84,12 +84,12 @@ export class HTMLMetadata {
title: document.title, title: document.title,
link: [], link: [],
dc: this._getMetaTags('dc', 'name', '.'), dc: this._getMetaTags('name', 'dc', '.'),
eprints: this._getMetaTags('eprints', 'name', '.'), eprints: this._getMetaTags('name', 'eprints', '.'),
facebook: this._getMetaTags('og', 'property', ':'), facebook: this._getMetaTags('property', 'og', ':'),
highwire: this._getMetaTags('citation', 'name', '_'), highwire: this._getMetaTags('name', 'citation', '_'),
prism: this._getMetaTags('prism', 'name', '.'), prism: this._getMetaTags('name', 'prism', '.'),
twitter: this._getMetaTags('twitter', 'name', ':'), twitter: this._getMetaTags('name', 'twitter', ':'),
}; };
const favicon = this._getFavicon(); const favicon = this._getFavicon();
...@@ -112,12 +112,12 @@ export class HTMLMetadata { ...@@ -112,12 +112,12 @@ export class HTMLMetadata {
* Return an array of all the `content` values of `<meta>` tags on the page * Return an array of all the `content` values of `<meta>` tags on the page
* where the attribute named `attribute` begins with `<prefix><delimiter>`. * where the attribute named `attribute` begins with `<prefix><delimiter>`.
* *
* @param {string} prefix
* @param {string} attribute * @param {string} attribute
* @param {string} delimiter * @param {string} prefix - it is interpreted as a regex
* @param {string} delimiter - it is interpreted as a regex
* @return {Record<string,string[]>} * @return {Record<string,string[]>}
*/ */
_getMetaTags(prefix, attribute, delimiter) { _getMetaTags(attribute, prefix, delimiter) {
/** @type {Record<string,string[]>} */ /** @type {Record<string,string[]>} */
const tags = {}; const tags = {};
for (let meta of Array.from(this.document.querySelectorAll('meta'))) { for (let meta of Array.from(this.document.querySelectorAll('meta'))) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment