tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

build.rs (1446B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
      4 
      5 extern crate phf_codegen;
      6 
      7 use std::env;
      8 use std::fs::File;
      9 use std::io::{BufWriter, Write};
     10 use std::path::Path;
     11 
     12 fn main() {
     13    let path = Path::new(&env::var_os("OUT_DIR").unwrap())
     14        .join("ascii_case_insensitive_html_attributes.rs");
     15    let mut file = BufWriter::new(File::create(&path).unwrap());
     16 
     17    let mut set = phf_codegen::Set::new();
     18    for name in ASCII_CASE_INSENSITIVE_HTML_ATTRIBUTES.split_whitespace() {
     19        set.entry(name);
     20    }
     21    write!(
     22        &mut file,
     23        "{{ static SET: ::phf::Set<&'static str> = {}; &SET }}",
     24        set.build(),
     25    )
     26    .unwrap();
     27 }
     28 
     29 /// <https://html.spec.whatwg.org/multipage/#selectors>
     30 static ASCII_CASE_INSENSITIVE_HTML_ATTRIBUTES: &str = r#"
     31    accept
     32    accept-charset
     33    align
     34    alink
     35    axis
     36    bgcolor
     37    charset
     38    checked
     39    clear
     40    codetype
     41    color
     42    compact
     43    declare
     44    defer
     45    dir
     46    direction
     47    disabled
     48    enctype
     49    face
     50    frame
     51    hreflang
     52    http-equiv
     53    lang
     54    language
     55    link
     56    media
     57    method
     58    multiple
     59    nohref
     60    noresize
     61    noshade
     62    nowrap
     63    readonly
     64    rel
     65    rev
     66    rules
     67    scope
     68    scrolling
     69    selected
     70    shape
     71    target
     72    text
     73    type
     74    valign
     75    valuetype
     76    vlink
     77 "#;