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/var.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 
     
    1818 */ 
    1919 
     20#include "std_value.hh" 
    2021#include "var.hh" 
    2122 
     
    3233                if (!rv || rv->is_missing()) 
    3334                { 
    34                         logger::logline ll; 
    35                         ll << pos()  
    36                            << ": access of a missing variable '" << name << "'"; 
     35                        if (name == "_") 
     36                                rv = std_value::singleton; 
     37                        else 
     38                        { 
     39                                logger::logline ll; 
     40                                ll << pos()  
     41                                   << ": access of a missing variable '" 
     42                                   << name << "'"; 
     43                        } 
    3744                } 
    3845                return rv;