Browse code

Deal with CDATAs

Julio Biason authored on 21/03/2019 06:03:50
Showing 1 changed files

... ...
@@ -122,7 +122,7 @@ fn dump_resource(current_state: &State) -> () {
122 122
 fn dump_note_contents(current_state: &State) -> () {
123 123
     let filename = Path::new("data")
124 124
         .join(current_state.title.as_ref().unwrap())
125
-        .join("content.md");
125
+        .join("content.html");
126 126
     let mut target = File::create(filename).unwrap();
127 127
     target.write_all(&current_state.content).unwrap();
128 128
 }
... ...
@@ -160,6 +160,11 @@ fn parse_element(element:Event, state: State) -> State {
160 160
                 _ => state,
161 161
             }
162 162
         }
163
+        Event::CDATA(data) => {
164
+            let new_state = state.with_content(data.into_bytes());
165
+            dump_note_contents(&new_state);
166
+            new_state
167
+        }
163 168
         _ => state,
164 169
     }
165 170
 }