awips2/components/context-free-parser/context-free-parser.html
2016-04-03 22:04:09 -05:00

49 lines
1.4 KiB
HTML

<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<script src="context-free-parser.js"></script>
<link rel="import" href="../core-ajax/core-ajax.html">
<!--
Scrapes source documentation data from input text or url.
@class context-free-parser
-->
<polymer-element name="context-free-parser" attributes="url text data">
<template>
<core-ajax url="{{url}}" response="{{text}}" auto></core-ajax>
</template>
<script>
Polymer('context-free-parser', {
text: null,
textChanged: function() {
if (this.text) {
var entities = ContextFreeParser.parse(this.text);
if (!entities || entities.length === 0) {
entities = [
{name: this.url.split('/').pop(), description: '**Undocumented**'}
];
}
this.data = { classes: entities };
}
},
dataChanged: function() {
this.fire('data-ready');
}
});
</script>
</polymer-element>