tag:help-archives.hannonhill.com,2010-02-09:/discussions/velocity-formats/9224-imported-macro-causes-error-if-it-calls-a-macro-as-a-stringCascade CMS: Discussion 2014-02-18T13:25:32Ztag:help-archives.hannonhill.com,2010-02-09:Comment/315855742014-02-12T20:02:32Z2014-02-12T20:06:53Z#imported macro causes error if it calls a macro as a string?<div><p>I'm importing a group of macros like this:<br></p>
<pre>
<code>#import('/Site Name/formats/getCamelCaseTitle')</code>
</pre>
<p>If the contents of getCamelCaseTitle is:<br></p>
<pre>
<code>#macro (getTitle $n)
#if ($n.getChild('title'))
#set ($title = $n.getChild('title'))
#else
#set ($title = $n.getChild('display-name'))
#end
$_EscapeTool.xml($title.value)#end
#macro (camelCase $t)
#set ($t = $t.substring(0,1).toLowerCase() + $t.replace(' ', '').substring(1))
$t#end</code>
</pre>
<p>I can #import without error. If I add the macro I actually want
in getCamelCaseTitle:<br></p>
<pre>
<code>#macro (getCamelCaseTitle, $n)
#camelCase("#getTitle($n)")
#end</code>
</pre>
<p>submitting getCamelCaseTitle causes no error, but, I get this
error from the page using the #import statement when it is edited
and submitted (it would be nicer to see this error in view
mode):<br>
Velocity content invalid: Parser Error: null</p>
<p>This version of macro getCamelCaseTitle works fine (note no
quotes):<br></p>
<pre>
<code>#macro (getCamelCaseTitle, $n)
#getTitle($n)
#end</code>
</pre>
<p>This version does not:<br></p>
<pre>
<code>#macro (getCamelCaseTitle, $n)
#set ($t = "#getTitle($n)")
#end</code>
</pre>
<p>Is there anything I can do syntactically or structurally that
can make this work?<br>
Otherwise I'll need to repeat the macros that can't be #imported
which would be disappointing since that was the reason for adding
#import — so you wouldn't have to repeat macros.<br>
Thanks for your help.</p></div>rayschwartztag:help-archives.hannonhill.com,2010-02-09:Comment/315855742014-02-12T21:27:53Z2014-02-12T21:27:53Z#imported macro causes error if it calls a macro as a string?<div><p>Hi,</p>
<p>Based on your description, it sounds like you are running into
<a href="https://hannonhill.jira.com/browse/CSI-723">this known
defect</a> in which submitting a Format that imports another Format
that contains a macro that calls another macro within a string
throws a <strong>Parse Error: null</strong> error message.</p>
<p>Feel free to use this link to track the progress of this issue
or keep an eye out for it on our <a href=
"http://www.hannonhill.com/kb/Release-Notes">Release Notes
site</a>.</p>
<p>Unfortunately, the only workaround would be what you mentioned
until the issue is resolved. The good news; however, is that we
believe we may have narrowed down a possible solution to the
issue.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffith