fix(elements): don't export element parse function
This commit is contained in:
parent
ce8c0b1c1c
commit
b847eb9285
|
@ -12,7 +12,7 @@ pub struct Block<'a> {
|
|||
impl Block<'_> {
|
||||
#[inline]
|
||||
// return (block, contents-begin, contents-end, end)
|
||||
pub fn parse(text: &str) -> Option<(Block<'_>, usize, usize, usize)> {
|
||||
pub(crate) fn parse(text: &str) -> Option<(Block<'_>, usize, usize, usize)> {
|
||||
debug_assert!(text.starts_with("#+"));
|
||||
|
||||
if text.len() <= 8 || text[2..8].to_uppercase() != "BEGIN_" {
|
||||
|
|
|
@ -2,7 +2,7 @@ use bytecount::count;
|
|||
use memchr::memchr;
|
||||
|
||||
#[inline]
|
||||
pub fn parse(text: &str, marker: u8) -> Option<usize> {
|
||||
pub(crate) fn parse(text: &str, marker: u8) -> Option<usize> {
|
||||
debug_assert!(text.len() >= 3);
|
||||
|
||||
let bytes = text.as_bytes();
|
||||
|
|
|
@ -9,7 +9,7 @@ pub struct FnDef<'a> {
|
|||
|
||||
impl FnDef<'_> {
|
||||
#[inline]
|
||||
pub fn parse(text: &str) -> Option<(FnDef<'_>, usize, usize)> {
|
||||
pub(crate) fn parse(text: &str) -> Option<(FnDef<'_>, usize, usize)> {
|
||||
if text.starts_with("[fn:") {
|
||||
let (label, off) = memchr(b']', text.as_bytes())
|
||||
.filter(|&i| {
|
||||
|
|
|
@ -13,7 +13,7 @@ pub struct FnRef<'a> {
|
|||
impl FnRef<'_> {
|
||||
#[inline]
|
||||
// return (fn_ref, offset)
|
||||
pub fn parse(text: &str) -> Option<(FnRef<'_>, usize)> {
|
||||
pub(crate) fn parse(text: &str) -> Option<(FnRef<'_>, usize)> {
|
||||
debug_assert!(text.starts_with("[fn:"));
|
||||
|
||||
let bytes = text.as_bytes();
|
||||
|
|
|
@ -69,7 +69,7 @@ pub struct ListItem<'a> {
|
|||
}
|
||||
|
||||
impl ListItem<'_> {
|
||||
pub fn parse(text: &str, indent: usize) -> (ListItem<'_>, usize, usize) {
|
||||
pub(crate) fn parse(text: &str, indent: usize) -> (ListItem<'_>, usize, usize) {
|
||||
debug_assert!(&text[0..indent].trim().is_empty());
|
||||
let off = &text[indent..].find(' ').unwrap() + 1 + indent;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ mod clock;
|
|||
mod cookie;
|
||||
mod drawer;
|
||||
mod dyn_block;
|
||||
mod emphasis;
|
||||
mod fn_def;
|
||||
mod fn_ref;
|
||||
mod headline;
|
||||
|
@ -21,7 +22,7 @@ mod snippet;
|
|||
mod target;
|
||||
mod timestamp;
|
||||
|
||||
pub(crate) mod emphasis;
|
||||
pub(crate) use emphasis::parse as parse_emphasis;
|
||||
|
||||
pub use self::{
|
||||
block::Block,
|
||||
|
|
12
src/org.rs
12
src/org.rs
|
@ -652,7 +652,7 @@ impl<'a> Org<'a> {
|
|||
})
|
||||
}
|
||||
}
|
||||
b'*' => emphasis::parse(text, b'*').map(|off| {
|
||||
b'*' => parse_emphasis(text, b'*').map(|off| {
|
||||
(
|
||||
Element::Bold {
|
||||
begin,
|
||||
|
@ -663,7 +663,7 @@ impl<'a> Org<'a> {
|
|||
off,
|
||||
)
|
||||
}),
|
||||
b'+' => emphasis::parse(text, b'+').map(|off| {
|
||||
b'+' => parse_emphasis(text, b'+').map(|off| {
|
||||
(
|
||||
Element::Strike {
|
||||
begin,
|
||||
|
@ -674,7 +674,7 @@ impl<'a> Org<'a> {
|
|||
off,
|
||||
)
|
||||
}),
|
||||
b'/' => emphasis::parse(text, b'/').map(|off| {
|
||||
b'/' => parse_emphasis(text, b'/').map(|off| {
|
||||
(
|
||||
Element::Italic {
|
||||
begin,
|
||||
|
@ -685,7 +685,7 @@ impl<'a> Org<'a> {
|
|||
off,
|
||||
)
|
||||
}),
|
||||
b'_' => emphasis::parse(text, b'_').map(|off| {
|
||||
b'_' => parse_emphasis(text, b'_').map(|off| {
|
||||
(
|
||||
Element::Underline {
|
||||
begin,
|
||||
|
@ -696,7 +696,7 @@ impl<'a> Org<'a> {
|
|||
off,
|
||||
)
|
||||
}),
|
||||
b'=' => emphasis::parse(text, b'=').map(|off| {
|
||||
b'=' => parse_emphasis(text, b'=').map(|off| {
|
||||
(
|
||||
Element::Verbatim {
|
||||
begin,
|
||||
|
@ -706,7 +706,7 @@ impl<'a> Org<'a> {
|
|||
off,
|
||||
)
|
||||
}),
|
||||
b'~' => emphasis::parse(text, b'~').map(|off| {
|
||||
b'~' => parse_emphasis(text, b'~').map(|off| {
|
||||
(
|
||||
Element::Code {
|
||||
begin,
|
||||
|
|
Loading…
Reference in a new issue