1 package net.sourceforge.pmd.lang.vm.directive; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 23 /** 24 * Pluggable directive that handles the <code>#parse()</code> 25 * statement in VTL. 26 * 27 * <pre> 28 * Notes: 29 * ----- 30 * 1) The parsed source material can only come from somewhere in 31 * the TemplateRoot tree for security reasons. There is no way 32 * around this. If you want to include content from elsewhere on 33 * your disk, use a link from somwhere under Template Root to that 34 * content. 35 * 36 * 2) There is a limited parse depth. It is set as a property 37 * "directive.parse.max.depth = 10" by default. This 10 deep 38 * limit is a safety feature to prevent infinite loops. 39 * </pre> 40 * 41 * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a> 42 * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> 43 * @author <a href="mailto:Christoph.Reck@dlr.de">Christoph Reck</a> 44 * @version $Id: Parse.java 928253 2010-03-27 19:39:04Z nbubna $ 45 */ 46 public class Parse extends InputBase 47 { 48 49 /** 50 * Return name of this directive. 51 * @return The name of this directive. 52 */ 53 public String getName() 54 { 55 return "parse"; 56 } 57 58 /** 59 * Overrides the default to use "template", so that all templates 60 * can use the same scope reference, whether rendered via #parse 61 * or direct merge. 62 */ 63 public String getScopeName() 64 { 65 return "template"; 66 } 67 68 /** 69 * Return type of this directive. 70 * @return The type of this directive. 71 */ 72 public int getType() 73 { 74 return LINE; 75 } 76 } 77