more mara tests
This commit is contained in:
parent
3b475b5ac3
commit
1dfd885ae3
|
@ -8,8 +8,9 @@ date: 2020-09-18
|
|||
[But if you do this thing, what about that other
|
||||
thing?](conversation://Mara/hmm)
|
||||
|
||||
[If you like using this, be sure to check out this other thing:
|
||||
https://h.christine.website](conversation://Mara/hacker)
|
||||
[If you like using this, be sure to check out <a
|
||||
href="https://h.christine.website">this other thing</a>, it is
|
||||
cool!](conversation://Mara/hacker)
|
||||
|
||||
[But, how does that make sense if you refrobnicated the bifrucated flopnax back
|
||||
there?](conversation://Mara/wat)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use color_eyre::eyre::{Result, WrapErr};
|
||||
use comrak::nodes::{Ast, AstNode, NodeValue};
|
||||
use comrak::{format_html, parse_document, Arena, ComrakOptions};
|
||||
use comrak::{format_html, parse_document, markdown_to_html, Arena, ComrakOptions};
|
||||
use std::cell::RefCell;
|
||||
use crate::templates::Html;
|
||||
use url::Url;
|
||||
|
||||
pub fn render(inp: &str) -> Result<String> {
|
||||
|
@ -31,13 +32,16 @@ pub fn render(inp: &str) -> Result<String> {
|
|||
let parent = node.parent().unwrap();
|
||||
node.detach();
|
||||
let mut message = vec![];
|
||||
format_html(node.first_child().unwrap(), &options, &mut message)?;
|
||||
for child in node.children() {
|
||||
format_html(child, &options, &mut message)?;
|
||||
}
|
||||
let message = std::str::from_utf8(&message)?;
|
||||
let message = markdown_to_html(message, &options);
|
||||
let mood = without_first(u.path());
|
||||
let name = u.host_str().unwrap_or("Mara");
|
||||
|
||||
let mut html = vec![];
|
||||
crate::templates::mara(&mut html, mood, name, message)?;
|
||||
crate::templates::mara(&mut html, mood, name, Html(message))?;
|
||||
|
||||
let new_node =
|
||||
arena.alloc(AstNode::new(RefCell::new(Ast::new(NodeValue::HtmlInline(html)))));
|
||||
|
|
|
@ -62,10 +62,11 @@
|
|||
<p>Tags: @for tag in post.front_matter.tags.as_ref().unwrap() { <code>@tag</code> }</p>
|
||||
}
|
||||
|
||||
<script>
|
||||
<p>The art for Mara was drawn by <a href="https://selic.re/">Selicre</a>.</p>
|
||||
|
||||
// The actual function. Set this as an onclick function for your "Share on Mastodon" button
|
||||
function share_on_mastodon() @{
|
||||
<script>
|
||||
// The actual function. Set this as an onclick function for your "Share on Mastodon" button
|
||||
function share_on_mastodon() @{
|
||||
// Prefill the form with the user's previously-specified Mastodon instance, if applicable
|
||||
var default_url = localStorage['mastodon_instance'];
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@(mood: &str, character: &str, message: &str)
|
||||
@(mood: &str, character: &str, message: Html<String>)
|
||||
<div class="grid conversation">
|
||||
<div class="cell -2of12">
|
||||
<div class="content">
|
||||
|
@ -9,6 +9,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="cell -10of12">
|
||||
<div class="content"><p><b>@character</b><br></p><blockquote>@message</blockquote></div>
|
||||
<div class="content"><p><b>@character</b><br></p>@message</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue