Update dependencies
This commit is contained in:
parent
c2678219d8
commit
47552a638a
4 changed files with 813 additions and 702 deletions
1475
Cargo.lock
generated
1475
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -10,7 +10,7 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
argh = "0.1"
|
argh = "0.1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pretty_env_logger = "0.4"
|
pretty_env_logger = "0.5"
|
||||||
linked-hash-map = "0.5"
|
linked-hash-map = "0.5"
|
||||||
once_cell = "1.14"
|
once_cell = "1.14"
|
||||||
parking_lot = "0.12"
|
parking_lot = "0.12"
|
||||||
|
@ -21,9 +21,9 @@ gpw = "0.1"
|
||||||
actix = "0.13"
|
actix = "0.13"
|
||||||
actix-web = "4.0"
|
actix-web = "4.0"
|
||||||
htmlescape = "0.3"
|
htmlescape = "0.3"
|
||||||
askama = "0.11"
|
askama = "0.12"
|
||||||
bat = "0.20"
|
bat = "0.24"
|
||||||
syntect = "4.6"
|
syntect = "5.1"
|
||||||
tokio = { version = "1.20", features = ["sync"] }
|
tokio = { version = "1.20", features = ["sync"] }
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
|
|
||||||
|
|
|
@ -14,16 +14,20 @@ thread_local!(pub static BAT_ASSETS: HighlightingAssets = HighlightingAssets::fr
|
||||||
pub fn highlight(content: &str, ext: &str) -> Option<String> {
|
pub fn highlight(content: &str, ext: &str) -> Option<String> {
|
||||||
static SS: Lazy<SyntaxSet> = Lazy::new(SyntaxSet::load_defaults_newlines);
|
static SS: Lazy<SyntaxSet> = Lazy::new(SyntaxSet::load_defaults_newlines);
|
||||||
|
|
||||||
BAT_ASSETS.with(|f| {
|
BAT_ASSETS
|
||||||
let ss = f.get_syntax_set().ok().unwrap_or(&SS);
|
.with(|f| {
|
||||||
let syntax = ss.find_syntax_by_extension(ext)?;
|
let ss = f.get_syntax_set().ok().unwrap_or(&SS);
|
||||||
let mut html_generator =
|
let Some(syntax) = ss.find_syntax_by_extension(ext) else {
|
||||||
ClassedHTMLGenerator::new_with_class_style(syntax, ss, ClassStyle::Spaced);
|
return Ok(None);
|
||||||
for line in LinesWithEndings(content.trim()) {
|
};
|
||||||
html_generator.parse_html_for_line_which_includes_newline(line);
|
let mut html_generator =
|
||||||
}
|
ClassedHTMLGenerator::new_with_class_style(syntax, ss, ClassStyle::Spaced);
|
||||||
Some(html_generator.finalize())
|
for line in LinesWithEndings(content.trim()) {
|
||||||
})
|
html_generator.parse_html_for_line_which_includes_newline(line)?;
|
||||||
|
}
|
||||||
|
Ok::<_, syntect::Error>(Some(html_generator.finalize()))
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|_| Some(content.to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct LinesWithEndings<'a>(&'a str);
|
pub struct LinesWithEndings<'a>(&'a str);
|
||||||
|
|
|
@ -170,10 +170,10 @@ async fn show_paste(
|
||||||
async fn highlight_css() -> HttpResponse {
|
async fn highlight_css() -> HttpResponse {
|
||||||
static CSS: Lazy<Bytes> = Lazy::new(|| {
|
static CSS: Lazy<Bytes> = Lazy::new(|| {
|
||||||
highlight::BAT_ASSETS.with(|s| {
|
highlight::BAT_ASSETS.with(|s| {
|
||||||
Bytes::from(css_for_theme_with_class_style(
|
Bytes::from(
|
||||||
s.get_theme("OneHalfDark"),
|
css_for_theme_with_class_style(s.get_theme("OneHalfDark"), ClassStyle::Spaced)
|
||||||
ClassStyle::Spaced,
|
.unwrap(),
|
||||||
))
|
)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue