Añade módulo autónomo para integrar [mdbook]
This commit is contained in:
parent
3e16b0f805
commit
348ca88290
102 changed files with 5063 additions and 248 deletions
|
|
@ -4,7 +4,7 @@ pub mod stylesheet;
|
|||
use crate::html::{html, Markup};
|
||||
|
||||
pub trait AssetsTrait {
|
||||
fn source(&self) -> &'static str;
|
||||
fn source(&self) -> &str;
|
||||
|
||||
fn weight(&self) -> isize;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pub enum ModeJS {
|
|||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct JavaScript {
|
||||
source : &'static str,
|
||||
source : String,
|
||||
prefix : &'static str,
|
||||
version: &'static str,
|
||||
weight : isize,
|
||||
|
|
@ -20,8 +20,8 @@ pub struct JavaScript {
|
|||
}
|
||||
|
||||
impl AssetsTrait for JavaScript {
|
||||
fn source(&self) -> &'static str {
|
||||
self.source
|
||||
fn source(&self) -> &str {
|
||||
self.source.as_str()
|
||||
}
|
||||
|
||||
fn weight(&self) -> isize {
|
||||
|
|
@ -40,9 +40,12 @@ impl AssetsTrait for JavaScript {
|
|||
}
|
||||
|
||||
impl JavaScript {
|
||||
pub fn located(source: &'static str) -> Self {
|
||||
pub fn located<S>(source: S) -> Self
|
||||
where
|
||||
S: Into<String>
|
||||
{
|
||||
JavaScript {
|
||||
source,
|
||||
source: source.into(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub enum TargetMedia {
|
|||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct StyleSheet {
|
||||
source : &'static str,
|
||||
source : String,
|
||||
prefix : &'static str,
|
||||
version: &'static str,
|
||||
media : Option<&'static str>,
|
||||
|
|
@ -19,8 +19,8 @@ pub struct StyleSheet {
|
|||
}
|
||||
|
||||
impl AssetsTrait for StyleSheet {
|
||||
fn source(&self) -> &'static str {
|
||||
self.source
|
||||
fn source(&self) -> &str {
|
||||
self.source.as_str()
|
||||
}
|
||||
|
||||
fn weight(&self) -> isize {
|
||||
|
|
@ -38,9 +38,12 @@ impl AssetsTrait for StyleSheet {
|
|||
}
|
||||
|
||||
impl StyleSheet {
|
||||
pub fn located(source: &'static str) -> Self {
|
||||
pub fn located<S>(source: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
StyleSheet {
|
||||
source,
|
||||
source: source.into(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue