Generating pad HTML with tags like <span data-TAG="VALUE"> instead of <TAG:VALUE>
parent
1a5985dc75
commit
ed5262650a
|
@ -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:
|
||||
```
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue