mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-21 02:22:51 +00:00
Base: Use % for keys in templates
The previous character used, @, conflicted with CSS. % is used by other templating engines, and doesn't conflict with language features (e.g. media queries).
This commit is contained in:
parent
634f2f655b
commit
27f3305b87
Notes:
sideshowbarker
2024-07-17 04:01:41 +09:00
Author: https://github.com/jamierocks
Commit: 27f3305b87
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/494
Reviewed-by: https://github.com/tcl3
4 changed files with 17 additions and 17 deletions
|
@ -32,7 +32,7 @@ ErrorOr<String> load_error_page(URL::URL const& url, StringView error_message)
|
|||
// FIXME: Use an actual templating engine (our own one when it's built, preferably with a way to check these usages at compile time)
|
||||
auto template_file = TRY(Core::Resource::load_from_uri("resource://ladybird/templates/error.html"sv));
|
||||
StringBuilder builder;
|
||||
SourceGenerator generator { builder };
|
||||
SourceGenerator generator { builder, '%', '%' };
|
||||
generator.set("failed_url", url.to_byte_string());
|
||||
generator.set("error_message", escape_html_entities(error_message));
|
||||
generator.append(template_file->data());
|
||||
|
@ -72,7 +72,7 @@ ErrorOr<String> load_file_directory_page(URL::URL const& url)
|
|||
// FIXME: Use an actual templating engine (our own one when it's built, preferably with a way to check these usages at compile time)
|
||||
auto template_file = TRY(Core::Resource::load_from_uri("resource://ladybird/templates/directory.html"sv));
|
||||
StringBuilder builder;
|
||||
SourceGenerator generator { builder };
|
||||
SourceGenerator generator { builder, '%', '%' };
|
||||
generator.set("path", escape_html_entities(lexical_path.string()));
|
||||
generator.set("parent_url", TRY(String::formatted("file://{}", escape_html_entities(lexical_path.parent().string()))));
|
||||
generator.set("contents", contents.to_byte_string());
|
||||
|
@ -86,7 +86,7 @@ ErrorOr<String> load_about_version_page()
|
|||
// FIXME: Use an actual templating engine (our own one when it's built, preferably with a way to check these usages at compile time)
|
||||
auto template_file = TRY(Core::Resource::load_from_uri("resource://ladybird/templates/version.html"sv));
|
||||
StringBuilder builder;
|
||||
SourceGenerator generator { builder };
|
||||
SourceGenerator generator { builder, '%', '%' };
|
||||
generator.set("browser_name", BROWSER_NAME);
|
||||
generator.set("browser_version", BROWSER_VERSION);
|
||||
generator.set("arch_name", CPU_STRING);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue