diff --git a/README.md b/README.md index ee0ca40..fd98dfd 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Fluffle is a familiar Markdown pastebin-y site :) Once you've cloned the repository, cd into the `app` directory and run `cargo run -r`. -After you start the server the first time, a `fluffle.toml`file will be created in the current directory. You'll need to edit that file to configure your PostgreSQL connection, instance name/theme color, etc. +After you start the server the first time, a `fluffle.toml` file will be created in the current directory. You'll need to edit that file to configure your PostgreSQL connection, instance name/theme color, etc. ## Customization diff --git a/app/templates_src/root.lisp b/app/templates_src/root.lisp index cee0fa2..7e985b8 100644 --- a/app/templates_src/root.lisp +++ b/app/templates_src/root.lisp @@ -6,7 +6,7 @@ (meta ("name" "viewport") ("content" "width=device-width, initial-scale=1.0")) (meta ("http-equiv" "X-UA-Compatible") ("content" "ie=edge")) - (link ("rel" "stylesheet") ("href" "{{ tetratto }}/css/utility.css?v={{ build_code }}")) + (link ("rel" "stylesheet") ("href" "https://repodelivery.tetratto.com/tetratto/crates/app/src/public/css/utility.css")) (link ("rel" "stylesheet") ("href" "/public/style.css?v={{ build_code }}")) (style (text ":root { --color-primary: {{ theme_color }}; }")) diff --git a/src/model.rs b/src/model.rs index d7645ed..7dbbe2e 100644 --- a/src/model.rs +++ b/src/model.rs @@ -600,6 +600,40 @@ impl EntryMetadata { input.replace("}", "").replace(";", "").replace("/*", "") } + /// Split the given input string by the given character while skipping over + /// CSS colors. + pub fn css_color_split(c: char, input: &str) -> Vec { + let mut out = Vec::new(); + let mut buffer = String::new(); + let mut in_function = false; + + for x in input.chars() { + if x == c && !in_function { + out.push(buffer.clone()); + buffer.clear(); + continue; + } + + match x { + '(' => { + in_function = true; + buffer.push(x); + } + ')' => { + in_function = false; + buffer.push(x); + } + _ => buffer.push(x), + } + } + + if !buffer.is_empty() { + out.push(buffer); + } + + out + } + pub fn css(&self) -> String { let mut output = "