ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Iffy/Iffy.cpp
(Generate patch)

Comparing Iffy/Iffy.cpp (file contents):
Revision 281 by Douglas Thrift, 2004-11-14T14:41:47-08:00 vs.
Revision 284 by Douglas Thrift, 2004-11-18T16:37:13-08:00

# Line 4 | Line 4
4   //
5   // $Id$
6  
7 < #include "Tag.hpp"
7 > #include "Cleaner.hpp"
8   #include "Matcher.hpp"
9  
10   #include <menes-api/exename.hpp>
# Line 82 | Line 82 | bool Iffy::debug(false);
82  
83   void Iffy::iffy(ios::Reader& in, ios::Writer& out)
84   {
85        ios::FormatWriter fout(out);
86
87        fout << "<html>";
88
85          ext::String segment;
86          bool text(false);
87 <        ext::Stack<ext::String> opens;
87 >        Cleaner cleaner;
88  
89          while (read(in, segment, (text = !text))) if (text)
90          {
91 <                fout << segment;
91 >                cleaner.insert(segment);
92          }
93          else
94          {
# Line 100 | Line 96 | void Iffy::iffy(ios::Reader& in, ios::Wr
96  
97                  if (segment == matcher("^!--( \\(\\d{1,2}:\\d{2}:\\d{2} [AP]M\\))--$"))
98                  {
99 <                        fout << matcher[1];
99 >                        cleaner.insert(matcher[1]);
100  
101                          continue;
102                  }
# Line 109 | Line 105 | void Iffy::iffy(ios::Reader& in, ios::Wr
105  
106                  if (tag == "br") tag = STANDALONE;
107  
108 <                switch (tag)
109 <                {
114 <                case OPEN:
115 <                        opens.Push(tag);
108 >                cleaner.insert(tag);
109 >        }
110  
111 <                        break;
118 <                case CLOSE:
119 <                        if (tag != opens.Top()) tag = opens.Top();
120 <
121 <                        opens.Pop();
122 <
123 <                        break;
124 <                default:
125 <                        break;
126 <                }
111 >        cleaner.clean();
112  
113 <                fout << tag;
129 <        }
113 >        ios::FormatWriter fout(out);
114  
115 <        fout << "</html>\n";
115 >        fout << cleaner;
116   }
117  
118   bool Iffy::read(ios::Reader& in, ext::String& segment, bool text)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines