Changeset 4393

Show
Ignore:
Timestamp:
Wed Jan 25 15:04:39 2006
Author:
mugur
Message:

fixed ticket:1672 - Allow the setting of HTML encoding from the template

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/campsite/implementation/parser/parser/actions.h

    r4392 r4393  
    513 513 };  
    514 514  
      515 // CActHTMLEncoding: HTMLEncoding action - corresponding to HTMLEncoding statement (see manual)  
      516 class CActHTMLEncoding : public CAction  
      517 {  
      518     protected:  
      519         CParameter param;       // parameter  
      520  
      521     public:  
      522     // constructor  
      523     // Parameters:  
      524     //      const CParameter& p - parameter  
      525         CActHTMLEncoding(const CParameter& p) : param(p) {}  
      526      
      527     // copy-constructor  
      528         CActHTMLEncoding(const CActHTMLEncoding& s) : param("") { *this = s; }  
      529  
      530     // destructor  
      531         virtual ~CActHTMLEncoding() {}  
      532  
      533     // assign operator  
      534         const CActHTMLEncoding& operator =(const CActHTMLEncoding& o)  
      535         {  
      536             param = o.param;  
      537             return *this;  
      538         }  
      539      
      540     // action: return action identifier  
      541         virtual TAction action() const { return CMS_ACT_HTMLENCODING; }  
      542  
      543     // clone this object  
      544         virtual CAction* clone() const { return new CActHTMLEncoding(*this); }  
      545  
      546     // takeAction: performs the action  
      547     // Parametes:  
      548     //      CContext& c - current context (modified by action)  
      549     //      sockstream& fs - output stream (not used)  
      550         virtual int takeAction(CContext& c, sockstream& fs);  
      551 };  
      552  
    515 553 class CListModifiers : public set<int>  
    516 554 {  
  • trunk/campsite/implementation/parser/parser/parser.cpp

    r4345 r4393  
    815 815 }  
    816 816  
      817 // HHTMLEncoding: parse HTMLEncoding statement; add CActHTMLEncoding action to actions list  
      818 // Parameters:  
      819 //      CActionList& al - reference to actions list  
      820 //      int level - current level  
      821 //      int sublevel - current sublevel  
      822 inline int CParser::HHTMLEncoding(CActionList& al, int level, int sublevel)  
      823 {  
      824     RequireAtom(l);  
      825     attr = st->findAttr(l->atom()->identifier(), CMS_CT_DEFAULT);  
      826     al.insert(al.end(), new CActHTMLEncoding(CParameter(attr->attribute(), "", NULL)));  
      827     WaitForStatementEnd(true);  
      828     return 0;  
      829 }  
      830  
    817 831 // HURLParameters: parse include statement; add CActURLParameters action to actions list (al)  
    818 832 // Parameters:  
    2116 2130             HTopic(al, level, sublevel);  
    2117 2131             break;  
      2132         case CMS_ST_HTMLENCODING:  
      2133             HHTMLEncoding(al, level, sublevel);  
      2134             break;  
    2118 2135         case CMS_ST_LIST:  
    2119 2136             if ((res = HList(al, level, sublevel)))  
  • trunk/campsite/implementation/parser/parser/parser.h

    r2662 r4393  
    265 265     int HTopic(CActionList& al, int level, int sublevel);  
    266 266      
      267     // HHTMLEncoding: parse HTMLEncoding statement; add CActHTMLEncoding action to actions list  
      268     // Parameters:  
      269     //      CActionList& al - reference to actions list  
      270     //      int level - current level  
      271     //      int sublevel - current sublevel  
      272     int HHTMLEncoding(CActionList& al, int level, int sublevel);  
      273      
    267 274     // HURLParameters: parse URLParameters statement; add CActURLParameters action to  
    268 275     // actions list (al)  
  • trunk/campsite/implementation/parser/parser/lex.cpp

    r4303 r4393  
    400 400     this->insert(pcoSt);  
    401 401  
      402     pcoSt = new CStatement(CMS_ST_HTMLENCODING, ST_HTMLENCODING);  
      403  
      404     pcoCtx = new CStatementContext(CMS_CT_DEFAULT);  
      405     pcoCtx->insertAttr(new CAttribute("on"));  
      406     pcoCtx->insertAttr(new CAttribute("off"));  
      407     pcoSt->insertCtx(pcoCtx);  
      408  
      409     this->insert(pcoSt);  
      410  
    402 411     // list statement  
    403 412     pcoSt = new CStatement(CMS_ST_LIST, ST_LIST);  
  • trunk/campsite/implementation/parser/parser/actions.cpp

    r4392 r4393  
    611 611 }  
    612 612  
      613 // takeAction: performs the action  
      614 // Parametes:  
      615 //      CContext& c - current context (modified by action)  
      616 //      sockstream& fs - output stream (not used)  
      617 int CActHTMLEncoding::takeAction(CContext& c, sockstream& fs)  
      618 {  
      619     if (case_comp(param.attribute(), "on") == 0)  
      620     {  
      621         c.SetEncodeHTML(true);  
      622         return RES_OK;  
      623     }  
      624     if (case_comp(param.attribute(), "off") == 0)  
      625     {  
      626         c.SetEncodeHTML(false);  
      627         return RES_OK;  
      628     }  
      629     return RES_OK;  
      630 }  
      631  
    613 632 CListModifiers::CListModifiers()  
    614 633 {  
  • trunk/campsite/implementation/parser/parser/cms_types.h

    r3905 r4393  
    121 121     CMS_ACT_TOPIC = 0x0016,  
    122 122     CMS_ACT_URIPATH = 0x0017,  
    123       CMS_ACT_URI = 0x0018  
      123     CMS_ACT_URI = 0x0018,  
      124     CMS_ACT_HTMLENCODING = 0x0019  
    124 125 } TAction;  
    125 126  
  • trunk/campsite/implementation/parser/parser/lex.h

    r4143 r4393  
    92 92 #define CMS_ST_SUBTOPIC 45  
    93 93 #define CMS_ST_ARTICLEATTACHMENT 46  
      94 #define CMS_ST_HTMLENCODING 47  
    94 95  
    95 96 // statement names  
    140 141 #define ST_SUBTOPIC "Subtopic"  
    141 142 #define ST_ARTICLEATTACHMENT "ArticleAttachment"  
      143 #define ST_HTMLENCODING "HTMLEncoding"  
    142 144  
    143 145 // The lexem returned by lex class