Update style
This commit is contained in:
parent
131d3b30ee
commit
12e15321a4
2 changed files with 67 additions and 21 deletions
|
@ -76,6 +76,32 @@ mod default_layouts {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Split;
|
||||
|
||||
impl LayoutType for Split {
|
||||
fn name(&self) -> &'static str { "Split" }
|
||||
|
||||
fn expects(&self) -> Range<usize> { 2..usize::MAX }
|
||||
|
||||
fn compile(
|
||||
&self,
|
||||
token: LayoutToken,
|
||||
_id: usize,
|
||||
compiler: &Compiler,
|
||||
_document: &dyn Document,
|
||||
) -> Result<String, String> {
|
||||
match compiler.target() {
|
||||
Target::HTML => match token {
|
||||
LayoutToken::BEGIN => Ok(r#"<div class="split-container"><div class="split">"#.to_string()),
|
||||
LayoutToken::NEXT => Ok(r#"</div><div class="split">"#.to_string()),
|
||||
LayoutToken::END => Ok(r#"</div></div>"#.to_string()),
|
||||
},
|
||||
_ => todo!(""),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -158,6 +184,8 @@ impl LayoutRule {
|
|||
let mut layouts: HashMap<String, Rc<dyn LayoutType>> = HashMap::new();
|
||||
let layout_centered = default_layouts::Centered {};
|
||||
layouts.insert(layout_centered.name().to_string(), Rc::new(layout_centered));
|
||||
let layout_split = default_layouts::Split {};
|
||||
layouts.insert(layout_split.name().to_string(), Rc::new(layout_split));
|
||||
|
||||
Self {
|
||||
re: [
|
||||
|
@ -328,7 +356,7 @@ impl RegexRule for LayoutRule {
|
|||
Some(last) => last,
|
||||
};
|
||||
|
||||
if layout_type.expects().end >= tokens.len()
|
||||
if layout_type.expects().end < tokens.len()
|
||||
// Too many blocks
|
||||
{
|
||||
reports.push(
|
||||
|
@ -372,7 +400,7 @@ impl RegexRule for LayoutRule {
|
|||
Some(last) => last,
|
||||
};
|
||||
|
||||
if layout_type.expects().start < tokens.len()
|
||||
if layout_type.expects().start > tokens.len()
|
||||
// Not enough blocks
|
||||
{
|
||||
reports.push(
|
||||
|
|
24
style.css
24
style.css
|
@ -17,6 +17,24 @@ body {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
/* Layouts */
|
||||
div.centered {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.split-container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.split-container > div.split {
|
||||
flex: 1;
|
||||
flex-shrink: 0;
|
||||
overflow-x: auto;
|
||||
|
||||
margin: 0.5em;
|
||||
}
|
||||
|
||||
/* Styles */
|
||||
em {
|
||||
padding-left: .1em;
|
||||
|
@ -126,11 +144,10 @@ div.code-block-title {
|
|||
}
|
||||
|
||||
div.code-block-content {
|
||||
max-height: 20em;
|
||||
max-height: 38em;
|
||||
margin-bottom: 0.2em;
|
||||
width: auto;
|
||||
|
||||
overflow: auto;
|
||||
overflow: scroll;
|
||||
|
||||
background-color: #0f141a;
|
||||
}
|
||||
|
@ -143,6 +160,7 @@ div.code-block-content td {
|
|||
div.code-block-content pre {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
tab-size: 4;
|
||||
}
|
||||
|
||||
div.code-block-content .code-block-gutter {
|
||||
|
|
Loading…
Reference in a new issue