Show
Ignore:
Timestamp:
08/27/10 18:32:04 (21 months ago)
Author:
Antti-Juhani Kaijanaho <antti-juhani@…>
Children:
92c18c14e163e2ab3200ccad6c6c0e6ee5c3e1a6
Parents:
19a2630635324aeed23f74061133ba433a639cd4
git-committer:
Antti-Juhani Kaijanaho <antti-juhani@…> (08/27/10 18:32:04)
Message:

Allow templates access to literal special characters

The variable "_" refers by default now to a structured value having
the following members:

  • hash containing "#"
  • dollar containing "$"
  • obrace containing "{"
  • cbrace containing "}"

So, for example, $_.dollar$ in a template will, in general, expand to
the dollar sign.

Closes #75.

Signed-off-by: Antti-Juhani Kaijanaho <antti-juhani@…>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • tlate/tlate-test.cc

    r868b365 r28939ac  
    11/*  This file is part of Alue, the multiprotocol Internet discussion daemon 
    22 
    3     Copyright © 2009 Antti-Juhani Kaijanaho 
     3    Copyright © 2009, 2010 Antti-Juhani Kaijanaho 
    44 
    55    Alue is free software: you can redistribute it and/or modify it 
     
    185185                BOOST_CHECK_EQUAL("\n", tester("\n",am)); 
    186186        } 
     187 
     188        BOOST_AUTO_TEST_CASE(std_hash) 
     189        { 
     190                tlate::data_model::ptr am(new tlate::data_model); 
     191                BOOST_CHECK_EQUAL("#", tester("$_.hash$",am)); 
     192        } 
     193 
     194        BOOST_AUTO_TEST_CASE(std_dollar) 
     195        { 
     196                tlate::data_model::ptr am(new tlate::data_model); 
     197                BOOST_CHECK_EQUAL("$", tester("$_.dollar$",am)); 
     198        } 
     199 
     200        BOOST_AUTO_TEST_CASE(std_obrace) 
     201        { 
     202                tlate::data_model::ptr am(new tlate::data_model); 
     203                BOOST_CHECK_EQUAL("{", tester("$_.obrace$",am)); 
     204        } 
     205        BOOST_AUTO_TEST_CASE(std_cbrace) 
     206        { 
     207                tlate::data_model::ptr am(new tlate::data_model); 
     208                BOOST_CHECK_EQUAL("}", tester("$_.cbrace$",am)); 
     209        } 
    187210}