OLD | NEW |
| (Empty) |
1 <!-- | |
2 @license | |
3 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | |
4 This code may only be used under the BSD style license found at http://polym
er.github.io/LICENSE.txt | |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS
.txt | |
6 The complete set of contributors may be found at http://polymer.github.io/CO
NTRIBUTORS.txt | |
7 Code distributed by Google as part of the polymer project is also | |
8 subject to an additional IP rights grant found at http://polymer.github.io/P
ATENTS.txt | |
9 --> | |
10 <script src="context-free-parser.js"></script> | |
11 <link rel="import" href="../core-ajax/core-ajax.html"> | |
12 | |
13 <!-- | |
14 Scrapes source documentation data from input text or url. | |
15 | |
16 @class context-free-parser | |
17 --> | |
18 <polymer-element name="context-free-parser" attributes="url text data"> | |
19 <template> | |
20 | |
21 <core-ajax url="{{url}}" response="{{text}}" auto></core-ajax> | |
22 | |
23 </template> | |
24 <script> | |
25 | |
26 Polymer('context-free-parser', { | |
27 | |
28 text: null, | |
29 | |
30 textChanged: function() { | |
31 if (this.text) { | |
32 var entities = ContextFreeParser.parse(this.text); | |
33 if (!entities || entities.length === 0) { | |
34 entities = [ | |
35 {name: this.url.split('/').pop(), description: '**Undocumented**'} | |
36 ]; | |
37 } | |
38 this.data = { classes: entities }; | |
39 } | |
40 }, | |
41 | |
42 dataChanged: function() { | |
43 this.fire('data-ready'); | |
44 } | |
45 | |
46 }); | |
47 | |
48 </script> | |
49 </polymer-element> | |
OLD | NEW |