Reformatting
This commit is contained in:
parent
126c719d23
commit
7349b15ab8
|
@ -1,5 +1,5 @@
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{Read, Write, stderr};
|
use std::io::{Read, stderr, Write};
|
||||||
|
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use phf::Map;
|
use phf::Map;
|
||||||
|
|
||||||
use crate::proc::Processor;
|
use crate::proc::Processor;
|
||||||
|
|
||||||
pub struct SinglePattern {
|
pub struct SinglePattern {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use ::phf::{phf_set, Set};
|
use phf::{phf_set, Set};
|
||||||
|
|
||||||
pub static CONTENT_TAGS: Set<&'static [u8]> = phf_set! {
|
pub static CONTENT_TAGS: Set<&'static [u8]> = phf_set! {
|
||||||
b"address",
|
b"address",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use ::phf::{phf_set, Set};
|
use phf::{phf_set, Set};
|
||||||
|
|
||||||
pub static CONTENT_FIRST_TAGS: Set<&'static [u8]> = phf_set! {
|
pub static CONTENT_FIRST_TAGS: Set<&'static [u8]> = phf_set! {
|
||||||
b"dd",
|
b"dd",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use ::phf::{phf_set, Set};
|
use phf::{phf_set, Set};
|
||||||
|
|
||||||
// Sourced from https://developer.mozilla.org/en-US/docs/Web/HTML/Element#Inline_text_semantics.
|
// Sourced from https://developer.mozilla.org/en-US/docs/Web/HTML/Element#Inline_text_semantics.
|
||||||
// Differences to tags listed in table at above URL: -br, +del, +ins.
|
// Differences to tags listed in table at above URL: -br, +del, +ins.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use ::phf::{phf_set, Set};
|
use phf::{phf_set, Set};
|
||||||
|
|
||||||
pub static LAYOUT_TAGS: Set<&'static [u8]> = phf_set! {
|
pub static LAYOUT_TAGS: Set<&'static [u8]> = phf_set! {
|
||||||
b"article",
|
b"article",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use ::phf::{phf_set, Set};
|
use phf::{phf_set, Set};
|
||||||
|
|
||||||
pub static VOID_TAGS: Set<&'static [u8]> = phf_set! {
|
pub static VOID_TAGS: Set<&'static [u8]> = phf_set! {
|
||||||
b"area",
|
b"area",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use ::phf::{phf_set, Set};
|
use phf::{phf_set, Set};
|
||||||
|
|
||||||
// "WSS" stands for whitespace-sensitive.
|
// "WSS" stands for whitespace-sensitive.
|
||||||
pub static WSS_TAGS: Set<&'static [u8]> = phf_set! {
|
pub static WSS_TAGS: Set<&'static [u8]> = phf_set! {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::proc::Processor;
|
|
||||||
use crate::err::ProcessingResult;
|
use crate::err::ProcessingResult;
|
||||||
|
use crate::proc::Processor;
|
||||||
|
|
||||||
pub fn process_bang(proc: &mut Processor) -> ProcessingResult<()> {
|
pub fn process_bang(proc: &mut Processor) -> ProcessingResult<()> {
|
||||||
chain!(proc.match_seq(b"<!").require()?.keep());
|
chain!(proc.match_seq(b"<!").require()?.keep());
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::proc::Processor;
|
|
||||||
use crate::err::ProcessingResult;
|
use crate::err::ProcessingResult;
|
||||||
use crate::pattern;
|
use crate::pattern;
|
||||||
|
use crate::proc::Processor;
|
||||||
|
|
||||||
pub fn process_comment(proc: &mut Processor) -> ProcessingResult<()> {
|
pub fn process_comment(proc: &mut Processor) -> ProcessingResult<()> {
|
||||||
chain!(proc.match_seq(b"<!--").expect().discard());
|
chain!(proc.match_seq(b"<!--").expect().discard());
|
||||||
|
|
|
@ -2,13 +2,13 @@ use crate::err::ProcessingResult;
|
||||||
use crate::proc::{Checkpoint, Processor, ProcessorRange};
|
use crate::proc::{Checkpoint, Processor, ProcessorRange};
|
||||||
use crate::spec::codepoint::is_whitespace;
|
use crate::spec::codepoint::is_whitespace;
|
||||||
use crate::spec::tag::content::CONTENT_TAGS;
|
use crate::spec::tag::content::CONTENT_TAGS;
|
||||||
|
use crate::spec::tag::contentfirst::CONTENT_FIRST_TAGS;
|
||||||
use crate::spec::tag::formatting::FORMATTING_TAGS;
|
use crate::spec::tag::formatting::FORMATTING_TAGS;
|
||||||
use crate::spec::tag::wss::WSS_TAGS;
|
use crate::spec::tag::wss::WSS_TAGS;
|
||||||
use crate::unit::bang::process_bang;
|
use crate::unit::bang::process_bang;
|
||||||
use crate::unit::comment::process_comment;
|
use crate::unit::comment::process_comment;
|
||||||
use crate::unit::entity::{EntityType, parse_entity};
|
use crate::unit::entity::{EntityType, parse_entity};
|
||||||
use crate::unit::tag::process_tag;
|
use crate::unit::tag::process_tag;
|
||||||
use crate::spec::tag::contentfirst::CONTENT_FIRST_TAGS;
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
enum ContentType {
|
enum ContentType {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
use phf::phf_map;
|
||||||
|
|
||||||
use crate::err::ProcessingResult;
|
use crate::err::ProcessingResult;
|
||||||
|
use crate::pattern::TrieNode;
|
||||||
use crate::proc::{Processor, ProcessorRange};
|
use crate::proc::{Processor, ProcessorRange};
|
||||||
use crate::spec::codepoint::{is_digit, is_hex_digit, is_lower_hex_digit, is_upper_hex_digit};
|
use crate::spec::codepoint::{is_digit, is_hex_digit, is_lower_hex_digit, is_upper_hex_digit};
|
||||||
use phf::phf_map;
|
|
||||||
use crate::pattern::TrieNode;
|
|
||||||
|
|
||||||
// The minimum length of any entity is 3, which is a character entity reference
|
// The minimum length of any entity is 3, which is a character entity reference
|
||||||
// with a single character name. The longest UTF-8 representation of a Unicode
|
// with a single character name. The longest UTF-8 representation of a Unicode
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::err::{ProcessingResult, ErrorType};
|
use crate::err::{ErrorType, ProcessingResult};
|
||||||
use crate::proc::{Processor};
|
use crate::proc::Processor;
|
||||||
|
|
||||||
fn is_string_delimiter(c: u8) -> bool {
|
fn is_string_delimiter(c: u8) -> bool {
|
||||||
c == b'"' || c == b'\''
|
c == b'"' || c == b'\''
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::proc::Processor;
|
|
||||||
use crate::err::ProcessingResult;
|
use crate::err::ProcessingResult;
|
||||||
|
use crate::proc::Processor;
|
||||||
|
|
||||||
pub fn process_text_script(proc: &mut Processor) -> ProcessingResult<()> {
|
pub fn process_text_script(proc: &mut Processor) -> ProcessingResult<()> {
|
||||||
// NOTE: See "notes/Text script content.md".
|
// NOTE: See "notes/Text script content.md".
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
use crate::err::{ErrorType, ProcessingResult};
|
||||||
use crate::proc::Processor;
|
use crate::proc::Processor;
|
||||||
use crate::err::{ProcessingResult, ErrorType};
|
|
||||||
|
|
||||||
fn is_string_delimiter(c: u8) -> bool {
|
fn is_string_delimiter(c: u8) -> bool {
|
||||||
match c {
|
match c {
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
|
use phf::{phf_set, Set};
|
||||||
|
|
||||||
use crate::err::{ErrorType, ProcessingResult};
|
use crate::err::{ErrorType, ProcessingResult};
|
||||||
use crate::proc::{Processor, ProcessorRange};
|
use crate::proc::{Processor, ProcessorRange};
|
||||||
use crate::spec::codepoint::{is_alphanumeric, is_whitespace};
|
use crate::spec::codepoint::{is_alphanumeric, is_whitespace};
|
||||||
use crate::spec::tag::void::VOID_TAGS;
|
use crate::spec::tag::void::VOID_TAGS;
|
||||||
use crate::unit::attr::{AttrType, process_attr, ProcessedAttr};
|
use crate::unit::attr::{AttrType, process_attr, ProcessedAttr};
|
||||||
use crate::unit::content::process_content;
|
use crate::unit::content::process_content;
|
||||||
use crate::unit::style::process_style;
|
|
||||||
use phf::{Set, phf_set};
|
|
||||||
use crate::unit::script::text::process_text_script;
|
|
||||||
use crate::unit::script::js::process_js_script;
|
use crate::unit::script::js::process_js_script;
|
||||||
|
use crate::unit::script::text::process_text_script;
|
||||||
|
use crate::unit::style::process_style;
|
||||||
|
|
||||||
pub static JAVASCRIPT_MIME_TYPES: Set<&'static [u8]> = phf_set! {
|
pub static JAVASCRIPT_MIME_TYPES: Set<&'static [u8]> = phf_set! {
|
||||||
b"application/ecmascript",
|
b"application/ecmascript",
|
||||||
|
@ -89,7 +90,7 @@ pub fn process_tag(proc: &mut Processor) -> ProcessingResult<()> {
|
||||||
let ProcessedAttr { name, typ, value } = process_attr(proc)?;
|
let ProcessedAttr { name, typ, value } = process_attr(proc)?;
|
||||||
match &proc[name] {
|
match &proc[name] {
|
||||||
b"type" => attr_type_value = value,
|
b"type" => attr_type_value = value,
|
||||||
_ => {},
|
_ => {}
|
||||||
};
|
};
|
||||||
last_attr_type = Some(typ);
|
last_attr_type = Some(typ);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue