Generating pad HTML with tags like <span data-TAG="VALUE"> instead of <TAG:VALUE>

This commit is contained in:
Luiza Pagliari 2015-09-07 03:55:56 -07:00
parent 1a5985dc75
commit ed5262650a
2 changed files with 3 additions and 3 deletions

View File

@ -357,7 +357,7 @@ Things in context:
1. Pad object
This hook will allow a plug-in developer to include more properties and attributes to support during HTML Export. An Array should be returned. If a value in this array is a string, the exported HTML will contain tags like `<tag_name>` for the content where attributes are `['tag_name', 'true']`; if a value in this array is a pair `['tag_name', 'value']`, the exported HTML will contain tags like `<tag_name:value>` for the content where attributes are `['tag_name', 'value']`.
This hook will allow a plug-in developer to include more properties and attributes to support during HTML Export. An Array should be returned. If a value in this array is a string, the exported HTML will contain tags like `<tag_name>` for the content where attributes are `['tag_name', 'true']`; if a value in this array is a pair `['tag_name', 'value']`, the exported HTML will contain tags like `<span data-tag_name:"value">` for the content where attributes are `['tag_name', 'value']`.
Example:
```

View File

@ -81,10 +81,10 @@ function getHTMLFromAtext(pad, atext, authorColors)
hooks.aCallAll("exportHtmlAdditionalTags", pad, function(err, newProps){
// newProps can be simply a string (which means it is stored as attribute in the form of ['tag', 'true'])
// or it can be a pair of values in an Array (for the case when it is stored as ['tag', 'value']).
// The later scenario will generate HTML with tags like <tag:value>
// The later scenario will generate HTML with tags like <span data-tag="value">
newProps.forEach(function (propName, i){
if (_.isArray(propName)) {
tags.push(propName[0] + ":" + propName[1]);
tags.push('span data-' + propName[0] + '="' + propName[1] + '"');
} else {
tags.push(propName);
}