forked from cadey/maj
Compare commits
1 Commits
main
...
preserve-c
Author | SHA1 | Date |
---|---|---|
Melody Horn | 290c2626d1 |
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,15 +1,5 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 0.6.2
|
|
||||||
|
|
||||||
Bump gemtext to 0.2.0
|
|
||||||
|
|
||||||
## 0.6.1
|
|
||||||
|
|
||||||
### FIXED
|
|
||||||
|
|
||||||
- [#9] Fixes from @boringcactus for gemtext rendering
|
|
||||||
|
|
||||||
## 0.6.0
|
## 0.6.0
|
||||||
|
|
||||||
### ADDED
|
### ADDED
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "maj"
|
name = "maj"
|
||||||
version = "0.6.2"
|
version = "0.6.0"
|
||||||
authors = ["Christine Dodrill <me@christine.website>"]
|
authors = ["Christine Dodrill <me@christine.website>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "0BSD"
|
license = "0BSD"
|
||||||
|
@ -11,7 +11,7 @@ repository = "https://tulpa.dev/cadey/maj"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-std = { version = "1.6", optional = true }
|
async-std = { version = "1.6", optional = true }
|
||||||
async-tls = { default-features = false, optional = true, version = "0" }
|
async-tls = { default-features = false, optional = true, version = "0", git = "https://github.com/FlorianUekermann/async-tls.git" }
|
||||||
async-trait = { version = "0", optional = true }
|
async-trait = { version = "0", optional = true }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
mime_guess = "2.0"
|
mime_guess = "2.0"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "gemtext"
|
name = "gemtext"
|
||||||
version = "0.2.0"
|
version = "0.1.0"
|
||||||
authors = ["Christine Dodrill <me@christine.website>"]
|
authors = ["Christine Dodrill <me@christine.website>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "0BSD"
|
license = "0BSD"
|
||||||
|
|
|
@ -60,13 +60,7 @@ pub fn render(nodes: Vec<Node>, out: &mut impl Write) -> io::Result<()> {
|
||||||
|
|
||||||
for node in nodes {
|
for node in nodes {
|
||||||
match node {
|
match node {
|
||||||
Text(body) => {
|
Text(body) => write!(out, "{}\n", body)?,
|
||||||
let special_prefixes = ["=>", "```", "#", "*", ">"];
|
|
||||||
if special_prefixes.iter().any(|prefix| body.starts_with(prefix)) {
|
|
||||||
write!(out, " ")?;
|
|
||||||
}
|
|
||||||
write!(out, "{}\n", body)?
|
|
||||||
},
|
|
||||||
Link { to, name } => match name {
|
Link { to, name } => match name {
|
||||||
Some(name) => write!(out, "=> {} {}\n", to, name)?,
|
Some(name) => write!(out, "=> {} {}\n", to, name)?,
|
||||||
None => write!(out, "=> {}\n", to)?,
|
None => write!(out, "=> {}\n", to)?,
|
||||||
|
@ -343,15 +337,4 @@ mod tests {
|
||||||
];
|
];
|
||||||
assert_eq!(expected, parse(msg));
|
assert_eq!(expected, parse(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn ambiguous_text() {
|
|
||||||
let _ = pretty_env_logger::try_init();
|
|
||||||
let original = Node::Text("#1 World's Best Coder".to_string());
|
|
||||||
let expected = " #1 World's Best Coder\n";
|
|
||||||
let mut rendered: Vec<u8> = vec![];
|
|
||||||
render(vec![original], &mut rendered).unwrap();
|
|
||||||
let rendered = String::from_utf8(rendered).unwrap();
|
|
||||||
assert_eq!(expected, rendered)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,10 +102,14 @@ async fn handle_request(
|
||||||
Err(RequestParsingError::InvalidScheme(url.scheme().to_string()))?
|
Err(RequestParsingError::InvalidScheme(url.scheme().to_string()))?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let certs = stream
|
||||||
|
.peer_certificates()
|
||||||
|
.map(|certs| certs.into_iter().map(Certificate).collect());
|
||||||
|
|
||||||
let req = Request {
|
let req = Request {
|
||||||
url: url,
|
url: url,
|
||||||
addr: addr,
|
addr: addr,
|
||||||
certs: None,
|
certs: certs,
|
||||||
};
|
};
|
||||||
handle(h, req, &mut stream, addr).await;
|
handle(h, req, &mut stream, addr).await;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue