Tidy up parser node edit dialogs and help text

This commit is contained in:
Nick O'Leary
2017-05-23 14:18:09 +01:00
parent 7978f85f7a
commit 749b0d7019
6 changed files with 123 additions and 74 deletions

View File

@@ -6,33 +6,50 @@
</div>
<hr align="middle"/>
<div class="form-row">
<label style="width:100%;"><i class="fa fa-gears"></i> <span data-i18n="xml.label.x2o"></span></label>
<div class="form-row">
<i style="margin-left:16px;" class="fa fa-key"></i> <span data-i18n="xml.label.represent"></span> <input type="text" id="node-input-attr" style="text-align:center; width:40px" placeholder="$">
</div>
<div class="form-row">
<i style="margin-left:16px;" class="fa fa-key"></i> <span data-i18n="xml.label.prefix"></span> <input type="text" id="node-input-chr" style="text-align:center; width:40px" placeholder="_">
</div>
<div class="form-tips"><span data-i18n="xml.tip"></span></div>
<label style="width:100%; border-bottom: 1px solid #eee;"><span data-i18n="xml.label.x2o"></span></label>
</div>
<div class="form-row" style="padding-left: 20px;">
<label style="width:250px;" for="node-input-attr" data-i18n="xml.label.represent"></label> <input type="text" id="node-input-attr" style="text-align:center; width:40px" placeholder="$">
</div>
<div class="form-row" style="padding-left: 20px;">
<label style="width:250px;" for="node-input-chr" data-i18n="xml.label.prefix"></label> <input type="text" id="node-input-chr" style="text-align:center; width:40px" placeholder="_">
</div>
</script>
<script type="text/x-red" data-help-name="xml">
<p>A function that parses the <code>msg.payload</code> to convert xml to or from a javascript
object. Places the result in the payload.</p>
<p>Converts between an XML string and its JavaScript object representation, in either direction.</p>
<h3>Inputs</h3>
<ul>
<li>If the input is a string it tries to parse it as XML and creates a javascript object.</li>
<li>If the input is a javascript object it tries to build an XML string.</li>
</ul>
<dl class="message-properties">
<dt class="optional">options <span class="property-type">string</span></dt>
<dd>You can also pass in a <code>msg.options</code> object to override all the multitude of parameters. See
<a href="https://github.com/Leonidas-from-XIV/node-xml2js/blob/master/README.md#options" target="_blank">the xml2js docs</a>
<dt>payload<span class="property-type">object | string</span></dt>
<dd>A JavaScript object or XML string.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">object | string</span></dt>
<dd>
<ul>
<li>If the input is a string it tries to parse it as XML and creates a JavaScript object.</li>
<li>If the input is a JavaScript object it tries to build an XML string.</li>
</ul>
</dd>
<dt class="optional">options <span class="property-type">object</span></dt>
<dd>This optional property can be used to pass in any of the options supported by the underlying
library used to convert to and from XML. See <a href="https://github.com/Leonidas-from-XIV/node-xml2js/blob/master/README.md#options" target="_blank">the xml2js docs</a>
for more information.</dd>
</dl>
<h3>Details</h3>
<p>If set, options in the edit dialogue override those passed in on the msg.options object.</p>
<p>When converting between XML and an object, any XML attributes are added as a property named <code>$</code> by default.
Any text content is added as a property named <code>_</code>. These property names can be specified in the node configuration.</p>
<p>For example, the following XML will be converted as shown:</p>
<pre>&lt;p class="tag"&gt;Hello World&lt;/p&gt;</pre>
<pre>{
"p": {
"$": {
"class": "tag"
},
"_": "Hello World"
}
}</pre>
</script>
<script type="text/javascript">