Re: Can't Insert A Single Hash Character
Tim Arnold <[email protected]> Mon, 14 Sep 2015 13:05:29 -0400
| Newsgroups | gmane.comp.python.cheetah |
|---|---|
| Message-ID | <CA+O6OTD88U9k3Y85EvQweqCP=HtLOe+tWqd_gkoBU6pphSot1g@mail.gmail.com> |
--===============4848050445061344485== Content-Type: multipart/alternative; boundary=e89a8f3ba55f8bd4b4051fb812af --e89a8f3ba55f8bd4b4051fb812af Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I set this as a preamble to switch the start token to an exclamation point: #compiler-settings cheetahVarStartToken =3D ! #end compiler-settings I'm not sure it will work in your situation though. I have Cheetah templates inside LaTeX files and the hash has a different meaning in LaTeX. So I chose a character that doesn't occur in the templates. It has its drawbacks; I can never have an exclamation mark in a template, and the logic in the template looks weird. Good luck, --Tim On Mon, Sep 14, 2015 at 12:23 PM, Williams, James P2 < [email protected]> wrote: > How do I write a template that inserts only a hash character on a line by > itself in the filled result? A lone hash seems to work like #slurp. > > > > template: > > a > > # > > b > > > > result: > > a > > b > > > > Escaping the hash doesn=E2=80=99t change its behavior. > > > > template: > > a > > \# > > b > > > > result: > > a > > \b > > > > Adding this at the beginning doesn=E2=80=99t seem to help. > > > > #compiler-settings > > commentStartToken =3D // > > directiveStartToken =3D % > > #end compiler-settings > > > > The best I can do is to sneak it through a variable. This works, for > example. > > > > template: > > #set hash=3D=E2=80=9D#=E2=80=9D > > a > > $hash > > b > > > > result: > > a > > # > > b > > > > Thanks. > > > > Jim > > > -------------------------------------------------------------------------= ----- > > _______________________________________________ > Cheetahtemplate-discuss mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss > > --e89a8f3ba55f8bd4b4051fb812af Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">I set this as a preamble to switch the start token to an e= xclamation point:<div>#compiler-settings</div><div>cheetahVarStartToken =3D= !</div><div>#end compiler-settings<br></div><div><br></div><div>I'm no= t sure it will work in your situation though. I have Cheetah templates insi= de LaTeX files and the hash has a different meaning in LaTeX. So I chose a = character that doesn't occur in the templates.=C2=A0</div><div><br></di= v><div>It has its drawbacks; I can never have an exclamation mark in a temp= late, and the logic in the template looks weird.</div><div><br></div><div>G= ood luck,</div><div>--Tim</div><div><br></div></div><div class=3D"gmail_ext= ra"><br><div class=3D"gmail_quote">On Mon, Sep 14, 2015 at 12:23 PM, Willia= ms, James P2 <span dir=3D"ltr"><<a href=3D"mailto:james.p2.williams@lmco= .com" target=3D"_blank">[email protected]</a>></span> wrote:<br= ><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1= px #ccc solid;padding-left:1ex"> <div lang=3D"EN-US" link=3D"#0563C1" vlink=3D"#954F72"> <div> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">How do I write a template that inserts only a hash character = on a line by itself in the filled result?=C2=A0 A lone hash seems to work l= ike #slurp.<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060"><u></u>=C2=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0 template:<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 a<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 b<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060"><u></u>=C2=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0 result:<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 a<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 b<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060"><u></u>=C2=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">Escaping the hash doesn=E2=80=99t change its behavior.<u></u>= <u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060"><u></u>=C2=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0 template:<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 a<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \#<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 b<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060"><u></u>=C2=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0 result:<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 a<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \b<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060"><u></u>=C2=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">Adding this at the beginning doesn=E2=80=99t seem to help.<u>= </u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060"><u></u>=C2=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0 #compiler-settings<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0 commentStartToken =3D //<u></u><u></u></span></p= > <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0 directiveStartToken =3D %<u></u><u></u></span></= p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0 #end compiler-settings<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060"><u></u>=C2=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">The best I can do is to sneak it through a variable.=C2=A0 Th= is works, for example.<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060"><u></u>=C2=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0 template:<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0#set hash=3D=E2=80=9D#=E2=80= =9D<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 a<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $hash<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 b<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060"><u></u>=C2=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0 result:<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 a<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 b<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060"><u></u>=C2=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">Thanks.<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060"><u></u>=C2=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#002060">Jim<u></u><u></u></span></p> </div> </div> <br>-----------------------------------------------------------------------= -------<br> <br>_______________________________________________<br> Cheetahtemplate-discuss mailing list<br> <a href=3D"mailto:[email protected]">Cheetahtem= [email protected]</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-dis= cuss" rel=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/li= sts/listinfo/cheetahtemplate-discuss</a><br> <br></blockquote></div><br></div> --e89a8f3ba55f8bd4b4051fb812af-- --===============4848050445061344485== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ --===============4848050445061344485== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Cheetahtemplate-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss --===============4848050445061344485==--