From 7effd171218fff68f051671f1373cee467a8f921 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 21 Jun 2022 16:15:39 +0200 Subject: Refactor to move protocols to constants --- src/compiler.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/compiler.rs') diff --git a/src/compiler.rs b/src/compiler.rs index 9bc2488..4359942 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -1,4 +1,5 @@ //! Turn events into a string of HTML. +use crate::constant::SAFE_PROTOCOL_HREF; use crate::construct::character_reference::Kind as CharacterReferenceKind; use crate::tokenizer::{Code, Event, EventType, TokenType}; use crate::util::{ @@ -125,14 +126,9 @@ pub fn compile(events: &[Event], codes: &[Code], options: &Options) -> String { let protocol_href = if options.allow_dangerous_protocol { None } else { - Some(vec!["http", "https", "irc", "ircs", "mailto", "xmpp"]) + Some(SAFE_PROTOCOL_HREF.to_vec()) }; let mut line_ending_inferred: Option = None; - // let protocol_src = if options.allow_dangerous_protocol { - // None - // } else { - // Some(vec!["http", "https"]) - // }; // let mut slurp_all_line_endings = false; while index < events.len() { -- cgit