Re: List contents not loaded
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Wednesday, March 26, 2008, 12:38:07 AM, krishnan.1000 wrote:
> Hi,
>
> I am trying to generate a postscript file using a freemarker. The list is
> iterated as such
>
> 72 560 moveto
> /rule
> (____________________________________________________________________________)
> def
> /y 550 def /x 72 def
> y -20 20 { x exch moveto rule show } for
> (<#list comments as comment>${comment}</#list>) rule stringwidth pop {
> x y 1 add moveto show /y y 15 sub def
> } BreakIntoLines
>
> To set up data model.
> Map<String, Object> root = new HashMap<String, Object>();
> root.put("comments", this.comments);
>
> The file does not load the list content at all.
I should work, you overlook something that is outside the quoted
parts. Are you sure you look at the proper output file, and that
root.put is executed before *this* template?
> But if I were to
> write to the file directly,
>
> BufferedWriter bw = new BufferedWriter(new FileWriter("file.txt"));
> bw.write(writeComments().toString());
>
> where
>
> private StringBuffer generateComments() {
> StringBuffer buffer = new StringBuffer();
> buffer.append("/rule
> (___________________________________________________");
> buffer.append("_________________________) def\n");
> buffer.append("/y 550 def /x 72 def\n");
> buffer.append("y -20 20 { x exch moveto rule show } for\n");
> buffer.append("(");
> if (this.comments != null && !this.comments.isEmpty()) {
> for (String comment : this.comments) {
> if (StringUtils.isBlank(comment)) {
> continue;
> }
> comment = StringUtils.replace(comment, "(", "\\(");
> comment = StringUtils.replaceChars(comment, ")", "\\)");
> comment = StringUtils.replaceChars(comment, "\\", "\\\\");
> buffer.append(comment).append("\n");
> }
> }
> buffer.append(") rule stringwidth pop {\n");
> buffer.append("x y 1 add moveto show /y y 20 sub def\n");
> buffer.append("} BreakIntoLines\n").append("grestore\n");
> return buffer;
> }
>
> works. Is there anything that I am doing in the ftl file. Please help?
--
Best regards,
Daniel Dekany
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace