source: branches/New_Config_Format-branch/gsdl/src/recpt/htmlutils.cpp@ 1279

Last change on this file since 1279 was 1279, checked in by sjboddie, 24 years ago

merged changes to trunk into New_Config_Format branch

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1/**********************************************************************
2 *
3 * htmlutils.cpp --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 * $Id: htmlutils.cpp 1279 2000-07-12 22:21:53Z sjboddie $
25 *
26 *********************************************************************/
27
28/*
29 $Log$
30 Revision 1.5.4.1 2000/07/12 22:21:39 sjboddie
31 merged changes to trunk into New_Config_Format branch
32
33 Revision 1.6 2000/05/04 05:17:46 sjboddie
34 moved dm_safe from htmlutils to gsdltools
35
36 Revision 1.5 2000/02/13 20:38:59 sjboddie
37 added dm_safe function
38
39 Revision 1.4 1999/09/07 04:56:56 sjboddie
40 added GPL notice
41
42 Revision 1.3 1999/06/09 00:09:30 sjboddie
43 Added a fairly minimal html_safe function
44
45 Revision 1.2 1999/02/08 01:28:02 rjmcnab
46
47 Got the receptionist producing something using the statusaction.
48
49 Revision 1.1 1999/01/08 08:40:58 rjmcnab
50
51 Moved from lib directory.
52
53 Revision 1.1 1999/01/08 03:57:47 rjmcnab
54
55 Initial revision
56
57 */
58
59
60#include "htmlutils.h"
61
62text_t html_safe (const text_t &instring) {
63
64 text_t outstring;
65 text_t::const_iterator here = instring.begin();
66 text_t::const_iterator end = instring.end();
67 while (here != end) {
68 if (*here == '"') outstring += """;
69 else if (*here == '&') outstring += "&";
70 else if (*here == '<') outstring += "&lt;";
71 else if (*here == '>') outstring += "&gt;";
72 else outstring.push_back(*here);
73 here ++;
74 }
75 return outstring;
76}
Note: See TracBrowser for help on using the repository browser.