LEFT | RIGHT |
1 // Copyright (C) 2007 Google Inc. | 1 // Copyright (C) 2007 Google Inc. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } catch (UriCallbackException ex) { | 217 } catch (UriCallbackException ex) { |
218 return null; | 218 return null; |
219 } | 219 } |
220 } | 220 } |
221 }); | 221 }); |
222 meta.setDebugMode(debugMode); | 222 meta.setDebugMode(debugMode); |
223 meta.setValijaMode(valijaMode); | 223 meta.setValijaMode(valijaMode); |
224 | 224 |
225 PluginCompiler compiler = createPluginCompiler(meta, mq); | 225 PluginCompiler compiler = createPluginCompiler(meta, mq); |
226 | 226 |
227 compiler.addInput(new AncestorChain<Dom>(new Dom(content))); | 227 compiler.addInput(AncestorChain.instance(new Dom(content))); |
228 | 228 |
229 if (!compiler.run()) { | 229 if (!compiler.run()) { |
230 throw new GadgetRewriteException("Gadget has compile errors"); | 230 throw new GadgetRewriteException("Gadget has compile errors"); |
231 } | 231 } |
232 | 232 |
233 return compiler; | 233 return compiler; |
234 } | 234 } |
235 | 235 |
236 private CharProducer readReadable(Readable input, InputSource src) | 236 private CharProducer readReadable(Readable input, InputSource src) |
237 throws IOException { | 237 throws IOException { |
238 return CharProducer.Factory.create(new ReadableReader(input), src); | 238 return CharProducer.Factory.create(new ReadableReader(input), src); |
239 } | 239 } |
240 | 240 |
241 protected RenderContext createRenderContext(TokenConsumer tc) { | 241 protected RenderContext createRenderContext(TokenConsumer tc) { |
242 return new RenderContext(tc).withAsciiOnly(true).withEmbeddable(true); | 242 return new RenderContext(tc).withAsciiOnly(true).withEmbeddable(true); |
243 } | 243 } |
244 | 244 |
245 protected PluginCompiler createPluginCompiler( | 245 protected PluginCompiler createPluginCompiler( |
246 PluginMeta meta, MessageQueue mq) { | 246 PluginMeta meta, MessageQueue mq) { |
247 PluginCompiler compiler = new PluginCompiler(buildInfo, meta, mq); | 247 PluginCompiler compiler = new PluginCompiler(buildInfo, meta, mq); |
248 if (cssSchema != null) { compiler.setCssSchema(cssSchema); } | 248 if (cssSchema != null) { compiler.setCssSchema(cssSchema); } |
249 if (htmlSchema != null) { compiler.setHtmlSchema(htmlSchema); } | 249 if (htmlSchema != null) { compiler.setHtmlSchema(htmlSchema); } |
250 return compiler; | 250 return compiler; |
251 } | 251 } |
252 } | 252 } |
LEFT | RIGHT |