mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
started on docs to markup to html
This commit is contained in:
parent
168c511988
commit
28cf11a1d9
11 changed files with 75 additions and 70 deletions
|
@ -1,47 +1,12 @@
|
|||
use crate::html::ToHtml;
|
||||
use roc_parse::ast::Def;
|
||||
use roc_code_markup::{markup::nodes::{MarkupNode}};
|
||||
|
||||
impl<'a> ToHtml<'a> for Def<'a> {
|
||||
impl<'a> ToHtml<'a> for MarkupNode {
|
||||
fn css_class(&self) -> Option<&'a str> {
|
||||
match self {
|
||||
// Def::Annotation(_, _) => {}
|
||||
// Def::Alias { .. } => {}
|
||||
Def::Body(_, _) => None,
|
||||
// Def::AnnotatedBody { .. } => {}
|
||||
// Def::Expect(_) => {}
|
||||
Def::SpaceBefore(_, _) => None,
|
||||
Def::SpaceAfter(_, _) => None,
|
||||
// Def::NotYetImplemented(_) => {}
|
||||
_ => None,
|
||||
}
|
||||
Some("operator")
|
||||
}
|
||||
|
||||
fn html_body(&self, buf: &mut bumpalo::collections::String<'a>) {
|
||||
match self {
|
||||
// Def::Annotation(_, _) => {}
|
||||
// Def::Alias { .. } => {}
|
||||
Def::Body(pattern, expr) => {
|
||||
pattern.html(buf);
|
||||
EqualSign.html(buf);
|
||||
expr.html(buf);
|
||||
}
|
||||
// Def::AnnotatedBody { .. } => {}
|
||||
// Def::Expect(_) => {}
|
||||
Def::SpaceBefore(sub_def, spaces) => {
|
||||
for space in spaces.iter() {
|
||||
space.html(buf);
|
||||
}
|
||||
sub_def.html(buf);
|
||||
}
|
||||
Def::SpaceAfter(sub_def, spaces) => {
|
||||
sub_def.html(buf);
|
||||
for space in spaces.iter() {
|
||||
space.html(buf);
|
||||
}
|
||||
}
|
||||
// Def::NotYetImplemented(_) => {}
|
||||
_ => {}
|
||||
}
|
||||
buf.push_str("MarkupNode")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue