0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-28 20:03:02 +00:00

Add tests for arbitrary attributes.

Also shifted around the adding of spaces for the attributes.
This commit is contained in:
David Bolack
2023-11-07 19:07:58 -06:00
parent c58c8777f1
commit 837306c9a7
2 changed files with 10 additions and 3 deletions

View File

@@ -338,13 +338,13 @@ const processStyleTags = (string)=>{
const styles = tags.map((tag)=>tag.replace(/:"?([^"]*)"?/g, ':$1;').trim());
if(attributes.length) {
attributes = attributes.map((attribute)=>attribute.replace(/(\w+)=(.+)/, '$1="$2"'));
attributes = attributes.map((attribute)=>attribute.replace(/(\w+)=(.+)/, ' $1="$2"'));
}
return `${classes.join(' ')}" ` +
`${id ? `id="${id}"` : ''} ` +
`${styles.length ? `style="${styles.join(' ')}"` : ''} ` +
`${attributes.length ? attributes.join(' ') : ''}`;
`${styles.length ? `style="${styles.join(' ')}"` : ''}` +
`${attributes.length ? attributes.join('') : ''}`;
};
module.exports = {