You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Colbert Philippe (JIRA)" <ji...@apache.org> on 2006/07/08 00:55:29 UTC

[jira] Created: (VELOCITY-448) Can't define macro in separate file and use it in another file.

Can't define macro in separate file and use it in another file.
---------------------------------------------------------------

         Key: VELOCITY-448
         URL: http://issues.apache.org/jira/browse/VELOCITY-448
     Project: Velocity
        Type: Bug

 Environment: WindowsXP
    Reporter: Colbert Philippe


I my first file called  "myDefinition.vm" , I difined a trivial macro
#macro ( myMycro $p1 $p2)
$p1 $p2
#end

In my second file, I parse and call my macro:

#parse( myDefinition.vm")
#myMacro( "apple" "orange)

The result is always a single line:

#myMacro( "apple" "orange)

Velocity does not recognize the definition of my macro.  I tried putting the macro is the same file and that works.  But when the definition from another file does not seem to work.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


[jira] Commented: (VELOCITY-448) Can't define macro in separate file and use it in another file.

Posted by "Henning Schmiedehausen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-448?page=comments#action_12419864 ] 

Henning Schmiedehausen commented on VELOCITY-448:
-------------------------------------------------

Velocity is not a Macro Processor period.

What you want to achieve is done not by loading the Macro files through #parse() but by defining them in the velocity.properties. You add velocimacro.library properties to your config file and off you go. You don't even have to parse/include the macro files in your templates anymore. 

Macros are no tag libraries. Velocity is not JSP. Velocity Templates are not Java Server Pages. Don't try to transfer these concepts to Velocity. They don't fit most of the times. Not because one this is better or worse. But because Velocity is not JSP.

Nathan pointed you at this. Please read and understand the difference beween the run-time and the parse-time of a template. 

As Will wrote, this is something that we should improve on. It is not trivial though and we must be careful not to break older pages that rely on that behaviour.




> Can't define macro in separate file and use it in another file.
> ---------------------------------------------------------------
>
>          Key: VELOCITY-448
>          URL: http://issues.apache.org/jira/browse/VELOCITY-448
>      Project: Velocity
>         Type: Improvement

>  Environment: WindowsXP
>     Reporter: Colbert Philippe
>      Fix For: 1.6

>
> I my first file called  "myDefinition.vm" , I difined a trivial macro
> #macro ( myMycro $p1 $p2)
> $p1 $p2
> #end
> In my second file, I parse and call my macro:
> #parse( myDefinition.vm")
> #myMacro( "apple" "orange)
> The result is always a single line:
> #myMacro( "apple" "orange)
> Velocity does not recognize the definition of my macro.  I tried putting the macro is the same file and that works.  But when the definition from another file does not seem to work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


[jira] Resolved: (VELOCITY-448) Can't define macro in separate file and use it in another file.

Posted by "Nathan Bubna (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELOCITY-448?page=all ]
     
Nathan Bubna resolved VELOCITY-448:
-----------------------------------

    Resolution: Duplicate

> Can't define macro in separate file and use it in another file.
> ---------------------------------------------------------------
>
>          Key: VELOCITY-448
>          URL: http://issues.apache.org/jira/browse/VELOCITY-448
>      Project: Velocity
>         Type: Improvement

>  Environment: WindowsXP
>     Reporter: Colbert Philippe
>      Fix For: 1.6

>
> I my first file called  "myDefinition.vm" , I difined a trivial macro
> #macro ( myMycro $p1 $p2)
> $p1 $p2
> #end
> In my second file, I parse and call my macro:
> #parse( myDefinition.vm")
> #myMacro( "apple" "orange)
> The result is always a single line:
> #myMacro( "apple" "orange)
> Velocity does not recognize the definition of my macro.  I tried putting the macro is the same file and that works.  But when the definition from another file does not seem to work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


[jira] Commented: (VELOCITY-448) Can't define macro in separate file and use it in another file.

Posted by "Colbert Philippe (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-448?page=comments#action_12419843 ] 

Colbert Philippe commented on VELOCITY-448:
-------------------------------------------

Without the capability to define macros in many separate files, one can't build modular systems with Velocity.   In short Velocity is not yet an macro processor that is scalable and can be used in a big software projects.



> Can't define macro in separate file and use it in another file.
> ---------------------------------------------------------------
>
>          Key: VELOCITY-448
>          URL: http://issues.apache.org/jira/browse/VELOCITY-448
>      Project: Velocity
>         Type: Improvement

>  Environment: WindowsXP
>     Reporter: Colbert Philippe
>      Fix For: 1.6

>
> I my first file called  "myDefinition.vm" , I difined a trivial macro
> #macro ( myMycro $p1 $p2)
> $p1 $p2
> #end
> In my second file, I parse and call my macro:
> #parse( myDefinition.vm")
> #myMacro( "apple" "orange)
> The result is always a single line:
> #myMacro( "apple" "orange)
> Velocity does not recognize the definition of my macro.  I tried putting the macro is the same file and that works.  But when the definition from another file does not seem to work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


[jira] Closed: (VELOCITY-448) Can't define macro in separate file and use it in another file.

Posted by "Henning Schmiedehausen (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-448?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henning Schmiedehausen closed VELOCITY-448.
-------------------------------------------


> Can't define macro in separate file and use it in another file.
> ---------------------------------------------------------------
>
>                 Key: VELOCITY-448
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-448
>             Project: Velocity
>          Issue Type: Improvement
>         Environment: WindowsXP
>            Reporter: Colbert Philippe
>             Fix For: 1.6
>
>
> I my first file called  "myDefinition.vm" , I difined a trivial macro
> #macro ( myMycro $p1 $p2)
> $p1 $p2
> #end
> In my second file, I parse and call my macro:
> #parse( myDefinition.vm")
> #myMacro( "apple" "orange)
> The result is always a single line:
> #myMacro( "apple" "orange)
> Velocity does not recognize the definition of my macro.  I tried putting the macro is the same file and that works.  But when the definition from another file does not seem to work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Updated: (VELOCITY-448) Can't define macro in separate file and use it in another file.

Posted by "Nathan Bubna (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELOCITY-448?page=all ]

Nathan Bubna updated VELOCITY-448:
----------------------------------

           type: Improvement  (was: Bug)
    Fix Version: 1.6

> Can't define macro in separate file and use it in another file.
> ---------------------------------------------------------------
>
>          Key: VELOCITY-448
>          URL: http://issues.apache.org/jira/browse/VELOCITY-448
>      Project: Velocity
>         Type: Improvement

>  Environment: WindowsXP
>     Reporter: Colbert Philippe
>      Fix For: 1.6

>
> I my first file called  "myDefinition.vm" , I difined a trivial macro
> #macro ( myMycro $p1 $p2)
> $p1 $p2
> #end
> In my second file, I parse and call my macro:
> #parse( myDefinition.vm")
> #myMacro( "apple" "orange)
> The result is always a single line:
> #myMacro( "apple" "orange)
> Velocity does not recognize the definition of my macro.  I tried putting the macro is the same file and that works.  But when the definition from another file does not seem to work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


[jira] Commented: (VELOCITY-448) Can't define macro in separate file and use it in another file.

Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-448?page=comments#action_12419828 ] 

Will Glass-Husain commented on VELOCITY-448:
--------------------------------------------

yes, we need to address this, though its not trivial.  see this note:

http://wiki.apache.org/jakarta-velocity/MacroIssues

> Can't define macro in separate file and use it in another file.
> ---------------------------------------------------------------
>
>          Key: VELOCITY-448
>          URL: http://issues.apache.org/jira/browse/VELOCITY-448
>      Project: Velocity
>         Type: Improvement

>  Environment: WindowsXP
>     Reporter: Colbert Philippe
>      Fix For: 1.6

>
> I my first file called  "myDefinition.vm" , I difined a trivial macro
> #macro ( myMycro $p1 $p2)
> $p1 $p2
> #end
> In my second file, I parse and call my macro:
> #parse( myDefinition.vm")
> #myMacro( "apple" "orange)
> The result is always a single line:
> #myMacro( "apple" "orange)
> Velocity does not recognize the definition of my macro.  I tried putting the macro is the same file and that works.  But when the definition from another file does not seem to work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


[jira] Commented: (VELOCITY-448) Can't define macro in separate file and use it in another file.

Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-448?page=comments#action_12448752 ] 
            
Will Glass-Husain commented on VELOCITY-448:
--------------------------------------------

As discussed on the dev list, I see this as an important "todo" for 1.6.  I've reopened Velocity-362 as a reminder of this.

> Can't define macro in separate file and use it in another file.
> ---------------------------------------------------------------
>
>                 Key: VELOCITY-448
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-448
>             Project: Velocity
>          Issue Type: Improvement
>         Environment: WindowsXP
>            Reporter: Colbert Philippe
>             Fix For: 1.6
>
>
> I my first file called  "myDefinition.vm" , I difined a trivial macro
> #macro ( myMycro $p1 $p2)
> $p1 $p2
> #end
> In my second file, I parse and call my macro:
> #parse( myDefinition.vm")
> #myMacro( "apple" "orange)
> The result is always a single line:
> #myMacro( "apple" "orange)
> Velocity does not recognize the definition of my macro.  I tried putting the macro is the same file and that works.  But when the definition from another file does not seem to work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org