refactor: rename field names to align with org-elements-api

This commit is contained in:
PoiScript 2019-01-13 02:20:34 +08:00
parent f35c2d7bab
commit 93ed18602a
12 changed files with 278 additions and 298 deletions

View file

@ -13,7 +13,7 @@ impl<'a> Cookie<'a> {
let num1 = until_while!(src, 1, |c| c == b'%' || c == b'/', |c: u8| c
.is_ascii_digit());
if src.len() > num1 && src.as_bytes()[num1 + 1] == b']' {
if src.as_bytes()[num1] == b'%' && *src.as_bytes().get(num1 + 1)? == b']' {
Some((
Cookie {
value: &src[0..num1 + 2],

View file

@ -11,10 +11,7 @@ impl<'a> Link<'a> {
starts_with!(src, "[[");
}
let path = until_while!(src, 2, b']', |c| c != b']'
&& c != b'<'
&& c != b'>'
&& c != b'\n');
let path = until_while!(src, 2, b']', |c| c != b'<' && c != b'>' && c != b'\n');
if cond_eq!(src, path + 1, b']') {
Some((
@ -25,10 +22,7 @@ impl<'a> Link<'a> {
path + 2,
))
} else if src.as_bytes()[path + 1] == b'[' {
let desc = until_while!(src, path + 2, b']', |c| c != b']'
&& c != b'['
&& c != b'\n');
let desc = until_while!(src, path + 2, b']', |c| c != b'[');
expect!(src, desc + 1, b']')?;
Some((