All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.pmd.lang.vm.directive.BlockMacro Maven / Gradle / Ivy

There is a newer version: 7.0.0-rc4
Show newest version
package net.sourceforge.pmd.lang.vm.directive;

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.    
 */


/**
 * BlockMacro directive is used to invoke Velocity macros with normal parameters and a macro body.
 * 

* The macro can then refer to the passed body AST. This directive can be used as a * "decorator". Body AST can contain any valid Velocity syntax. * * An example: *

 * #set($foobar = "yeah!")
 * 
 * #macro(strong $txt)
 * <strong>$bodyContent</strong> $txt
 * #end
 *
 * #@strong($foobar)
 * <u>This text is underlined and bold</u>
 * #end
 * 
* Will print: *
 * <strong><u>This text is underlined and bold<u></strong> yeah!
 * 
* * bodyContent reference name is configurable (see velocity.properties). * * @author Jarkko Viinamaki * @since 1.7 * @version $Id$ */ public class BlockMacro extends Block { private String name; public BlockMacro(String name) { this.name = name; } public String getName() { return key; } /** * Override to use the macro name, since it is within an * #@myMacro() ... #end block that the scope in question * would be used. */ public String getScopeName() { return name; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy