Properly HTML escape docs for Type

This commit is contained in:
Steven Fackler
2016-02-21 13:45:31 -08:00
parent c185bcf43f
commit 49bbe0373d
6 changed files with 99 additions and 90 deletions

View File

@@ -1,5 +1,6 @@
extern crate phf_codegen;
extern crate regex;
extern crate marksman_escape;
use std::ascii::AsciiExt;
use std::path::Path;

View File

@@ -74,6 +74,7 @@ fn make_header(file: &mut BufWriter<File>) {
write!(file,
"// Autogenerated file - DO NOT EDIT
use phf;
"
).unwrap();
}

View File

@@ -4,6 +4,7 @@ use std::collections::BTreeMap;
use std::fs::File;
use std::io::{Write, BufWriter};
use std::path::Path;
use marksman_escape::Escape;
use snake_to_camel;
@@ -99,6 +100,8 @@ fn parse_types(ranges: &BTreeMap<u32, u32>) -> BTreeMap<u32, Type> {
doc.push_str(" - ");
doc.push_str(descr);
}
let doc = Escape::new(doc.as_bytes().iter().cloned()).collect();
let doc = String::from_utf8(doc).unwrap();
let type_ = Type {
name: name,
@@ -120,6 +123,7 @@ fn make_header(w: &mut BufWriter<File>) {
use std::fmt;
use types::{{Oid, Kind, Other}};
"
).unwrap();
}