Modifica InContext por PageContext y PageOp

This commit is contained in:
Manuel Cillero 2022-07-30 06:11:30 +02:00
parent de0785c29f
commit 31daf11faa
30 changed files with 149 additions and 133 deletions

View file

@ -41,7 +41,7 @@ pub async fn summary() -> ResultPage<Markup, FatalError> {
.with_item(MenuItem::label("Opción 4"));
Page::new()
.with_context(InContextOp::SetTheme("Bootsier"))
.with_context(PageOp::SetTheme("Bootsier"))
.with_title("Admin")
.add_to("top-menu", top_menu)
.add_to(

View file

@ -57,11 +57,11 @@ impl ComponentTrait for Anchor {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn default_render(&self, context: &mut InContext) -> Markup {
fn default_render(&self, context: &mut PageContext) -> Markup {
let target = match &self.target() {
AnchorTarget::Blank => Some("_blank"),
AnchorTarget::Context(name) => Some(name.as_str()),

View file

@ -35,15 +35,15 @@ impl ComponentTrait for Block {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn before_render(&mut self, context: &mut InContext) {
fn before_render(&mut self, context: &mut PageContext) {
before_render_inline(self, context);
}
fn default_render(&self, context: &mut InContext) -> Markup {
fn default_render(&self, context: &mut PageContext) -> Markup {
let id = context.required_id::<Block>(self.id());
html! {
div id=(id) class=[self.classes().get()] {

View file

@ -45,15 +45,15 @@ impl ComponentTrait for Container {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn before_render(&mut self, context: &mut InContext) {
fn before_render(&mut self, context: &mut PageContext) {
before_render_inline(self, context);
}
fn default_render(&self, context: &mut InContext) -> Markup {
fn default_render(&self, context: &mut PageContext) -> Markup {
match self.container_type() {
ContainerType::Header => html! {
header id=[self.id().get()] class=[self.classes().get()] {

View file

@ -44,11 +44,11 @@ impl ComponentTrait for Button {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn default_render(&self, _: &mut InContext) -> Markup {
fn default_render(&self, _: &mut PageContext) -> Markup {
let button_type = match self.button_type() {
ButtonType::Button => "button",
ButtonType::Reset => "reset",

View file

@ -48,11 +48,11 @@ impl ComponentTrait for Date {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn default_render(&self, _: &mut InContext) -> Markup {
fn default_render(&self, _: &mut PageContext) -> Markup {
let id = self.name().get().map(|name| concat_string!("edit-", name));
html! {
div class=[self.classes().get()] {

View file

@ -44,15 +44,15 @@ impl ComponentTrait for Form {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn before_render(&mut self, context: &mut InContext) {
fn before_render(&mut self, context: &mut PageContext) {
before_render_inline(self, context);
}
fn default_render(&self, context: &mut InContext) -> Markup {
fn default_render(&self, context: &mut PageContext) -> Markup {
let method = match self.method() {
FormMethod::Get => None,
FormMethod::Post => Some("post".to_owned()),

View file

@ -25,7 +25,7 @@ impl ComponentTrait for Hidden {
self.weight
}
fn default_render(&self, _: &mut InContext) -> Markup {
fn default_render(&self, _: &mut PageContext) -> Markup {
let id = self.name().get().map(|name| concat_string!("value-", name));
html! {
input type="hidden" id=[id] name=[self.name().get()] value=[self.value().get()];

View file

@ -65,11 +65,11 @@ impl ComponentTrait for Input {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn default_render(&self, _: &mut InContext) -> Markup {
fn default_render(&self, _: &mut PageContext) -> Markup {
let type_input = match self.input_type() {
InputType::Email => "email",
InputType::Password => "password",

View file

@ -64,15 +64,15 @@ impl ComponentTrait for Column {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn before_render(&mut self, context: &mut InContext) {
fn before_render(&mut self, context: &mut PageContext) {
before_render_inline(self, context);
}
fn default_render(&self, context: &mut InContext) -> Markup {
fn default_render(&self, context: &mut PageContext) -> Markup {
html! {
div id=[self.id().get()] class=[self.classes().get()] {
(self.components().render(context))

View file

@ -33,15 +33,15 @@ impl ComponentTrait for Row {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn before_render(&mut self, context: &mut InContext) {
fn before_render(&mut self, context: &mut PageContext) {
before_render_inline(self, context);
}
fn default_render(&self, context: &mut InContext) -> Markup {
fn default_render(&self, context: &mut PageContext) -> Markup {
html! {
div id=[self.id().get()] class=[self.classes().get()] {
(self.columns().render(context))

View file

@ -54,11 +54,11 @@ impl ComponentTrait for Heading {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn default_render(&self, _: &mut InContext) -> Markup {
fn default_render(&self, _: &mut PageContext) -> Markup {
let id = self.id().get();
let classes = self.classes().get();
html! { @match &self.heading_type() {

View file

@ -27,11 +27,11 @@ impl ComponentTrait for Html {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn default_render(&self, _: &mut InContext) -> Markup {
fn default_render(&self, _: &mut PageContext) -> Markup {
html! { (*self.html()) }
}

View file

@ -27,17 +27,17 @@ impl ComponentTrait for Icon {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn before_render(&mut self, context: &mut InContext) {
context.alter(InContextOp::AddStyleSheet(
fn before_render(&mut self, context: &mut PageContext) {
context.alter(PageOp::AddStyleSheet(
StyleSheet::located("/theme/icons/bootstrap-icons.css").with_version("1.8.2"),
));
}
fn default_render(&self, _: &mut InContext) -> Markup {
fn default_render(&self, _: &mut PageContext) -> Markup {
html! { i class=[self.classes().get()] {}; }
}

View file

@ -31,11 +31,11 @@ impl ComponentTrait for Image {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn default_render(&self, _: &mut InContext) -> Markup {
fn default_render(&self, _: &mut PageContext) -> Markup {
html! {
img
src=[self.source().get()]

View file

@ -37,11 +37,11 @@ impl ComponentTrait for MenuItem {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn default_render(&self, context: &mut InContext) -> Markup {
fn default_render(&self, context: &mut PageContext) -> Markup {
match self.item_type() {
MenuItemType::Label(label) => html! {
li class="label" { a href="#" { (label) } }
@ -196,26 +196,26 @@ impl ComponentTrait for Menu {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn before_render(&mut self, context: &mut InContext) {
fn before_render(&mut self, context: &mut PageContext) {
before_render_inline(self, context);
}
fn default_render(&self, context: &mut InContext) -> Markup {
fn default_render(&self, context: &mut PageContext) -> Markup {
context
.alter(InContextOp::AddStyleSheet(
.alter(PageOp::AddStyleSheet(
StyleSheet::located("/theme/menu/css/menu.css").with_version("1.1.1"),
))
.alter(InContextOp::AddStyleSheet(
.alter(PageOp::AddStyleSheet(
StyleSheet::located("/theme/menu/css/menu-clean.css").with_version("1.1.1"),
))
.alter(InContextOp::AddJavaScript(
.alter(PageOp::AddJavaScript(
JavaScript::located("/theme/menu/js/menu.min.js").with_version("1.1.1"),
))
.alter(InContextOp::AddJQuery);
.alter(PageOp::AddJQuery);
let id = context.required_id::<Menu>(self.id());

View file

@ -42,11 +42,11 @@ impl ComponentTrait for Paragraph {
self.weight
}
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
(self.renderable)(context)
}
fn default_render(&self, _: &mut InContext) -> Markup {
fn default_render(&self, _: &mut PageContext) -> Markup {
html! {
p id=[self.id().get()] class=[self.classes().get()] { (*self.html()) }
}

View file

@ -27,7 +27,7 @@ impl ModuleTrait for DefaultHomePage {
async fn demo() -> ResultPage<Markup, FatalError> {
Page::new()
.with_title(l("page_title").as_str())
.with_context(InContextOp::AddStyleSheet(
.with_context(PageOp::AddStyleSheet(
StyleSheet::located("/theme/module/homepage/styles.css"
)))
.add_to("region-content", hello_world())

View file

@ -17,10 +17,10 @@ impl ThemeTrait for Aliner {
fn before_render_page(&self, page: &mut Page) {
page
.alter_context(InContextOp::AddFavicon(
.alter_context(PageOp::AddFavicon(
Favicon::new().with_icon("/theme/favicon.png"),
))
.alter_context(InContextOp::AddStyleSheet(
.alter_context(PageOp::AddStyleSheet(
StyleSheet::located("/aliner/css/styles.css").with_weight(-99),
));
}

View file

@ -19,20 +19,20 @@ impl ThemeTrait for Bootsier {
fn before_render_page(&self, page: &mut Page) {
page
.alter_context(InContextOp::AddFavicon(
.alter_context(PageOp::AddFavicon(
Favicon::new().with_icon("/theme/favicon.png"),
))
.alter_context(InContextOp::AddStyleSheet(
.alter_context(PageOp::AddStyleSheet(
StyleSheet::located("/bootsier/css/bootstrap.min.css")
.with_version("5.1.3")
.with_weight(-99),
))
.alter_context(InContextOp::AddJavaScript(
.alter_context(PageOp::AddJavaScript(
JavaScript::located("/bootsier/js/bootstrap.bundle.min.js")
.with_version("5.1.3")
.with_weight(-99),
))
.alter_context(InContextOp::AddJQuery);
.alter_context(PageOp::AddJQuery);
}
fn error_404_not_found(&self) -> Container {

View file

@ -17,21 +17,21 @@ impl ThemeTrait for Bulmix {
fn before_render_page(&self, page: &mut Page) {
page
.alter_context(InContextOp::AddFavicon(
.alter_context(PageOp::AddFavicon(
Favicon::new().with_icon("/theme/favicon.png"),
))
.alter_context(InContextOp::AddStyleSheet(
.alter_context(PageOp::AddStyleSheet(
StyleSheet::located("/bulmix/css/bulma.min.css")
.with_version("0.9.4")
.with_weight(-99),
))
.alter_context(InContextOp::AddJQuery);
.alter_context(PageOp::AddJQuery);
}
fn before_render_component(
&self,
component: &mut dyn ComponentTrait,
_context: &mut InContext,
_context: &mut PageContext,
) {
match component.handler() {
COMPONENT_ANCHOR => {
@ -110,7 +110,7 @@ impl ThemeTrait for Bulmix {
fn render_component(
&self,
component: &dyn ComponentTrait,
_context: &mut InContext,
_context: &mut PageContext,
) -> Option<Markup> {
match component.handler() {
COMPONENT_ICON => {

View file

@ -1,6 +1,3 @@
mod context;
pub use context::{InContext, InContextOp};
mod definition;
pub use definition::{component_mut, component_ref, AnyComponent, BaseComponent, ComponentTrait};
@ -11,12 +8,14 @@ mod all;
pub use all::add_component_to;
pub(crate) use all::common_components;
pub type Renderable = fn(_: &InContext) -> bool;
use crate::response::page::PageContext;
pub fn render_always(_: &InContext) -> bool {
pub type Renderable = fn(_: &PageContext) -> bool;
pub fn render_always(_: &PageContext) -> bool {
true
}
pub fn render_never(_: &InContext) -> bool {
pub fn render_never(_: &PageContext) -> bool {
false
}

View file

@ -1,5 +1,6 @@
use super::{ComponentTrait, InContext};
use super::ComponentTrait;
use crate::html::{html, Markup};
use crate::response::page::PageContext;
use std::sync::{Arc, RwLock};
@ -25,7 +26,7 @@ impl ComponentsBundle {
self.0.clear();
}
pub fn render(&self, context: &mut InContext) -> Markup {
pub fn render(&self, context: &mut PageContext) -> Markup {
let mut components = self.0.clone();
components.sort_by_key(|c| c.read().unwrap().weight());
html! {

View file

@ -1,11 +1,11 @@
use super::InContext;
use crate::html::{html, Markup};
use crate::response::page::PageContext;
use crate::util::{single_type_name, Handler};
pub use std::any::Any as AnyComponent;
pub trait BaseComponent {
fn render(&mut self, context: &mut InContext) -> Markup;
fn render(&mut self, context: &mut PageContext) -> Markup;
}
pub trait ComponentTrait: AnyComponent + BaseComponent + Send + Sync {
@ -28,15 +28,15 @@ pub trait ComponentTrait: AnyComponent + BaseComponent + Send + Sync {
}
#[allow(unused_variables)]
fn is_renderable(&self, context: &InContext) -> bool {
fn is_renderable(&self, context: &PageContext) -> bool {
true
}
#[allow(unused_variables)]
fn before_render(&mut self, context: &mut InContext) {}
fn before_render(&mut self, context: &mut PageContext) {}
#[allow(unused_variables)]
fn default_render(&self, context: &mut InContext) -> Markup {
fn default_render(&self, context: &mut PageContext) -> Markup {
html! {}
}
@ -46,7 +46,7 @@ pub trait ComponentTrait: AnyComponent + BaseComponent + Send + Sync {
}
impl<C: ComponentTrait> BaseComponent for C {
fn render(&mut self, context: &mut InContext) -> Markup {
fn render(&mut self, context: &mut PageContext) -> Markup {
// Acciones del componente antes de renderizar.
self.before_render(context);
@ -77,7 +77,7 @@ macro_rules! hook_before_render_component {
paste::paste! {
$crate::pub_const_handler!($ACTION_HANDLER);
type Action = fn(&$Component, &mut InContext);
type Action = fn(&$Component, &mut PageContext);
pub struct [< BeforeRender $Component >] {
action: Option<Action>,
@ -118,7 +118,7 @@ macro_rules! hook_before_render_component {
self
}
pub fn run(&self, component: &mut $Component, context: &mut InContext) {
pub fn run(&self, component: &mut $Component, context: &mut PageContext) {
if let Some(action) = self.action {
action(component, context)
}
@ -126,7 +126,7 @@ macro_rules! hook_before_render_component {
}
#[inline(always)]
fn before_render_inline(component: &mut $Component, context: &mut InContext) {
fn before_render_inline(component: &mut $Component, context: &mut PageContext) {
run_actions(
$ACTION_HANDLER,
|action| action_ref::<[< BeforeRender $Component >]>(&**action).run(component, context)

View file

@ -2,9 +2,9 @@ use crate::app;
use crate::base::component::{Container, Html};
use crate::concat_string;
use crate::config::SETTINGS;
use crate::core::component::{ComponentTrait, InContext, InContextOp};
use crate::core::component::ComponentTrait;
use crate::html::{html, Favicon, Markup};
use crate::response::page::Page;
use crate::response::page::{Page, PageContext, PageOp};
use crate::util::{single_type_name, Handler};
pub trait BaseTheme {
@ -28,7 +28,7 @@ pub trait ThemeTrait: BaseTheme + Send + Sync {
#[allow(unused_variables)]
fn before_render_page(&self, page: &mut Page) {
page.alter_context(InContextOp::AddFavicon(
page.alter_context(PageOp::AddFavicon(
Favicon::new().with_icon("/theme/favicon.png"),
));
}
@ -83,7 +83,11 @@ pub trait ThemeTrait: BaseTheme + Send + Sync {
}
#[allow(unused_variables)]
fn before_render_component(&self, component: &mut dyn ComponentTrait, context: &mut InContext) {
fn before_render_component(
&self,
component: &mut dyn ComponentTrait,
context: &mut PageContext,
) {
/*
Cómo usarlo:
@ -101,7 +105,7 @@ pub trait ThemeTrait: BaseTheme + Send + Sync {
fn render_component(
&self,
component: &dyn ComponentTrait,
context: &mut InContext,
context: &mut PageContext,
) -> Option<Markup> {
None
/*

View file

@ -1,7 +1,7 @@
pub use maud::{html, Markup, PreEscaped, DOCTYPE};
mod assets;
pub use assets::javascript::{JSMode, JavaScript};
pub use assets::javascript::{JavaScript, JSMode};
pub use assets::stylesheet::{StyleSheet, TargetMedia};
pub use assets::Assets;

View file

@ -1,5 +1,27 @@
use crate::html::{Favicon, StyleSheet, JavaScript};
pub use actix_web::Result as ResultPage;
pub enum PageOp {
SetTheme(&'static str),
AddFavicon(Favicon),
RemoveFavicon,
AddMetadata(&'static str, &'static str),
AddProperty(&'static str, &'static str),
AddStyleSheet(StyleSheet),
RemoveStyleSheet(&'static str),
AddJavaScript(JavaScript),
RemoveJavaScript(&'static str),
AddJQuery,
}
mod context;
pub use context::PageContext;
mod hook;
pub use hook::{BeforeRenderPageHook, HOOK_BEFORE_RENDER_PAGE};

View file

@ -1,7 +1,8 @@
use super::PageOp;
use crate::config::SETTINGS;
use crate::core::theme::all::theme_by_single_name;
use crate::core::theme::ThemeTrait;
use crate::html::*;
use crate::html::{html, Assets, Favicon, StyleSheet, JavaScript, JSMode, Markup, IdentifierValue};
use crate::{base, concat_string, util, LazyStatic};
static DEFAULT_THEME: LazyStatic<&dyn ThemeTrait> = LazyStatic::new(||
@ -11,24 +12,7 @@ static DEFAULT_THEME: LazyStatic<&dyn ThemeTrait> = LazyStatic::new(||
}
);
pub enum InContextOp {
SetTheme(&'static str),
AddFavicon(Favicon),
RemoveFavicon,
AddMetadata(&'static str, &'static str),
AddProperty(&'static str, &'static str),
AddStyleSheet(StyleSheet),
RemoveStyleSheet(&'static str),
AddJavaScript(JavaScript),
RemoveJavaScript(&'static str),
AddJQuery,
}
pub struct InContext {
pub struct PageContext {
theme : &'static dyn ThemeTrait,
favicon : Option<Favicon>,
metadata : Vec<(&'static str, &'static str)>,
@ -39,9 +23,9 @@ pub struct InContext {
id_counter : usize,
}
impl InContext {
impl PageContext {
pub fn new() -> Self {
InContext {
PageContext {
theme : *DEFAULT_THEME,
favicon : None,
metadata : Vec::new(),
@ -53,40 +37,40 @@ impl InContext {
}
}
pub fn alter(&mut self, op: InContextOp) -> &mut Self {
pub fn alter(&mut self, op: PageOp) -> &mut Self {
match op {
InContextOp::SetTheme(theme_name) => {
PageOp::SetTheme(theme_name) => {
self.theme = theme_by_single_name(theme_name).unwrap_or(*DEFAULT_THEME);
}
InContextOp::AddFavicon(favicon) => {
PageOp::AddFavicon(favicon) => {
self.favicon = Some(favicon);
}
InContextOp::RemoveFavicon => {
PageOp::RemoveFavicon => {
self.favicon = None;
}
InContextOp::AddMetadata(name, content) => {
PageOp::AddMetadata(name, content) => {
self.metadata.push((name, content));
}
InContextOp::AddProperty(property, content) => {
PageOp::AddProperty(property, content) => {
self.properties.push((property, content));
}
InContextOp::AddStyleSheet(css) => {
PageOp::AddStyleSheet(css) => {
self.stylesheets.add(css);
}
InContextOp::RemoveStyleSheet(source) => {
PageOp::RemoveStyleSheet(source) => {
self.stylesheets.remove(source);
}
InContextOp::AddJavaScript(js) => {
PageOp::AddJavaScript(js) => {
self.javascripts.add(js);
}
InContextOp::RemoveJavaScript(source) => {
PageOp::RemoveJavaScript(source) => {
self.javascripts.remove(source);
}
InContextOp::AddJQuery => {
PageOp::AddJQuery => {
if !self.with_jquery {
self.javascripts.add(
JavaScript::located("/theme/js/jquery.min.js")
@ -101,13 +85,13 @@ impl InContext {
self
}
/// InContext GETTERS.
/// PageContext GETTERS.
pub(crate) fn theme(&mut self) -> &'static dyn ThemeTrait {
self.theme
}
/// InContext RENDER.
/// PageContext RENDER.
pub fn render(&mut self) -> Markup {
html! {
@ -126,7 +110,7 @@ impl InContext {
}
}
// InContext EXTRAS.
// PageContext EXTRAS.
pub fn required_id<T>(&mut self, id: &IdentifierValue) -> String {
match id.get() {

View file

@ -1,9 +1,15 @@
use super::{BeforeRenderPageHook, ResultPage, HOOK_BEFORE_RENDER_PAGE};
use super::{
BeforeRenderPageHook,
PageContext,
PageOp,
ResultPage,
HOOK_BEFORE_RENDER_PAGE,
};
use crate::app::fatal_error::FatalError;
use crate::config::SETTINGS;
use crate::core::component::*;
use crate::core::hook::{action_ref, run_actions};
use crate::html::*;
use crate::html::{html, AttributeValue, Classes, ClassesOp, Markup, DOCTYPE};
use crate::{trace, LazyStatic};
use std::collections::HashMap;
@ -42,7 +48,7 @@ pub enum TextDirection {
}
pub struct Page {
context : InContext,
context : PageContext,
language : AttributeValue,
direction : AttributeValue,
title : AttributeValue,
@ -55,7 +61,7 @@ pub struct Page {
impl Page {
pub fn new() -> Self {
Page {
context : InContext::new(),
context : PageContext::new(),
language : match &*DEFAULT_LANGUAGE {
Some(language) => AttributeValue::new_with_value(language),
_ => AttributeValue::new(),
@ -74,7 +80,7 @@ impl Page {
// Page BUILDER.
pub fn with_context(mut self, op: InContextOp) -> Self {
pub fn with_context(mut self, op: PageOp) -> Self {
self.alter_context(op);
self
}
@ -121,7 +127,7 @@ impl Page {
// Page ALTER.
pub fn alter_context(&mut self, op: InContextOp) -> &mut Self {
pub fn alter_context(&mut self, op: PageOp) -> &mut Self {
self.context.alter(op);
self
}
@ -162,7 +168,7 @@ impl Page {
// Page GETTERS.
pub fn context(&mut self) -> &mut InContext {
pub fn context(&mut self) -> &mut PageContext {
&mut self.context
}

View file

@ -59,32 +59,32 @@ async fn mdbook_page(request: app::HttpRequest) -> ResultPage<Markup, FatalError
Page::new()
.with_title(title)
.with_context(InContextOp::AddMetadata("theme-color", "#ffffff"))
.with_context(InContextOp::AddStyleSheet(
.with_context(PageOp::AddMetadata("theme-color", "#ffffff"))
.with_context(PageOp::AddStyleSheet(
StyleSheet::located("/doc/css/variables.css")
))
.with_context(InContextOp::AddStyleSheet(
.with_context(PageOp::AddStyleSheet(
StyleSheet::located("/doc/css/general.css")
))
.with_context(InContextOp::AddStyleSheet(
.with_context(PageOp::AddStyleSheet(
StyleSheet::located("/doc/css/chrome.css")
))
.with_context(InContextOp::AddStyleSheet(
.with_context(PageOp::AddStyleSheet(
StyleSheet::located("/doc/css/print.css").for_media(TargetMedia::Print)
))
.with_context(InContextOp::AddStyleSheet(
.with_context(PageOp::AddStyleSheet(
StyleSheet::located("/doc/FontAwesome/css/font-awesome.css")
))
.with_context(InContextOp::AddStyleSheet(
.with_context(PageOp::AddStyleSheet(
StyleSheet::located("/doc/fonts/fonts.css")
))
.with_context(InContextOp::AddStyleSheet(
.with_context(PageOp::AddStyleSheet(
StyleSheet::located("/doc/highlight.css")
))
.with_context(InContextOp::AddStyleSheet(
.with_context(PageOp::AddStyleSheet(
StyleSheet::located("/doc/tomorrow-night.css")
))
.with_context(InContextOp::AddStyleSheet(
.with_context(PageOp::AddStyleSheet(
StyleSheet::located("/doc/ayu-highlight.css")
))
.add_to(