fix(docs): update functions name
This commit is contained in:
parent
9445db822b
commit
7d064c526e
12
README.md
12
README.md
|
@ -18,12 +18,12 @@ use orgize::Org;
|
||||||
Org::parse("* DONE Title :tag:");
|
Org::parse("* DONE Title :tag:");
|
||||||
```
|
```
|
||||||
|
|
||||||
or `Org::parse_with_config`:
|
or `Org::parse_custom`:
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
use orgize::{Org, ParseConfig};
|
use orgize::{Org, ParseConfig};
|
||||||
|
|
||||||
Org::parse_with_config(
|
Org::parse_custom(
|
||||||
"* TASK Title 1",
|
"* TASK Title 1",
|
||||||
&ParseConfig {
|
&ParseConfig {
|
||||||
// custom todo keywords
|
// custom todo keywords
|
||||||
|
@ -51,14 +51,14 @@ One as `Event::Start(element)`, one as `Event::End(element)`.
|
||||||
|
|
||||||
## Render html
|
## Render html
|
||||||
|
|
||||||
You can call the `Org::html` function to generate html directly, which
|
You can call the `Org::write_html` function to generate html directly, which
|
||||||
uses the `DefaultHtmlHandler` internally:
|
uses the `DefaultHtmlHandler` internally:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use orgize::Org;
|
use orgize::Org;
|
||||||
|
|
||||||
let mut writer = Vec::new();
|
let mut writer = Vec::new();
|
||||||
Org::parse("* title\n*section*").html(&mut writer).unwrap();
|
Org::parse("* title\n*section*").write_html(&mut writer).unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
String::from_utf8(writer).unwrap(),
|
String::from_utf8(writer).unwrap(),
|
||||||
|
@ -69,7 +69,7 @@ assert_eq!(
|
||||||
## Render html with custom `HtmlHandler`
|
## Render html with custom `HtmlHandler`
|
||||||
|
|
||||||
To customize html rendering, simply implementing `HtmlHandler` trait and passing
|
To customize html rendering, simply implementing `HtmlHandler` trait and passing
|
||||||
it to the `Org::html_with_handler` function.
|
it to the `Org::wirte_html_custom` function.
|
||||||
|
|
||||||
The following code demonstrates how to add a id for every headline and return
|
The following code demonstrates how to add a id for every headline and return
|
||||||
own error type while rendering.
|
own error type while rendering.
|
||||||
|
@ -139,7 +139,7 @@ impl HtmlHandler<MyError> for MyHtmlHandler {
|
||||||
fn main() -> Result<(), MyError> {
|
fn main() -> Result<(), MyError> {
|
||||||
let mut writer = Vec::new();
|
let mut writer = Vec::new();
|
||||||
let mut handler = MyHtmlHandler::default();
|
let mut handler = MyHtmlHandler::default();
|
||||||
Org::parse("* title\n*section*").html_with_handler(&mut writer, &mut handler)?;
|
Org::parse("* title\n*section*").wirte_html_custom(&mut writer, &mut handler)?;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
String::from_utf8(writer)?,
|
String::from_utf8(writer)?,
|
||||||
|
|
|
@ -275,7 +275,7 @@ mod syntect_handler {
|
||||||
///
|
///
|
||||||
/// let mut vec = vec![];
|
/// let mut vec = vec![];
|
||||||
///
|
///
|
||||||
/// org.html_with_handler(&mut vec, &mut handler).unwrap();
|
/// org.write_html_custom(&mut vec, &mut handler).unwrap();
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Customize:
|
/// Customize:
|
||||||
|
|
18
src/lib.rs
18
src/lib.rs
|
@ -14,14 +14,14 @@
|
||||||
//! Org::parse("* DONE Title :tag:");
|
//! Org::parse("* DONE Title :tag:");
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! or [`Org::parse_with_config`]:
|
//! or [`Org::parse_custom`]:
|
||||||
//!
|
//!
|
||||||
//! [`Org::parse_with_config`]: struct.Org.html#method.parse_with_config
|
//! [`Org::parse_custom`]: struct.Org.html#method.parse_custom
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use orgize::{Org, ParseConfig};
|
//! use orgize::{Org, ParseConfig};
|
||||||
//!
|
//!
|
||||||
//! Org::parse_with_config(
|
//! Org::parse_custom(
|
||||||
//! "* TASK Title 1",
|
//! "* TASK Title 1",
|
||||||
//! &ParseConfig {
|
//! &ParseConfig {
|
||||||
//! // custom todo keywords
|
//! // custom todo keywords
|
||||||
|
@ -56,17 +56,17 @@
|
||||||
//!
|
//!
|
||||||
//! # Render html
|
//! # Render html
|
||||||
//!
|
//!
|
||||||
//! You can call the [`Org::html`] function to generate html directly, which
|
//! You can call the [`Org::write_html`] function to generate html directly, which
|
||||||
//! uses the [`DefaultHtmlHandler`] internally:
|
//! uses the [`DefaultHtmlHandler`] internally:
|
||||||
//!
|
//!
|
||||||
//! [`Org::html`]: struct.Org.html#method.html
|
//! [`Org::write_html`]: struct.Org.html#method.write_html
|
||||||
//! [`DefaultHtmlHandler`]: export/struct.DefaultHtmlHandler.html
|
//! [`DefaultHtmlHandler`]: export/struct.DefaultHtmlHandler.html
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use orgize::Org;
|
//! use orgize::Org;
|
||||||
//!
|
//!
|
||||||
//! let mut writer = Vec::new();
|
//! let mut writer = Vec::new();
|
||||||
//! Org::parse("* title\n*section*").html(&mut writer).unwrap();
|
//! Org::parse("* title\n*section*").write_html(&mut writer).unwrap();
|
||||||
//!
|
//!
|
||||||
//! assert_eq!(
|
//! assert_eq!(
|
||||||
//! String::from_utf8(writer).unwrap(),
|
//! String::from_utf8(writer).unwrap(),
|
||||||
|
@ -77,10 +77,10 @@
|
||||||
//! # Render html with custom `HtmlHandler`
|
//! # Render html with custom `HtmlHandler`
|
||||||
//!
|
//!
|
||||||
//! To customize html rendering, simply implementing [`HtmlHandler`] trait and passing
|
//! To customize html rendering, simply implementing [`HtmlHandler`] trait and passing
|
||||||
//! it to the [`Org::html_with_handler`] function.
|
//! it to the [`Org::write_html_custom`] function.
|
||||||
//!
|
//!
|
||||||
//! [`HtmlHandler`]: export/trait.HtmlHandler.html
|
//! [`HtmlHandler`]: export/trait.HtmlHandler.html
|
||||||
//! [`Org::html_with_handler`]: struct.Org.html#method.html_with_handler
|
//! [`Org::write_html_custom`]: struct.Org.html#method.write_html_custom
|
||||||
//!
|
//!
|
||||||
//! The following code demonstrates how to add a id for every headline and return
|
//! The following code demonstrates how to add a id for every headline and return
|
||||||
//! own error type while rendering.
|
//! own error type while rendering.
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
//! fn main() -> Result<(), MyError> {
|
//! fn main() -> Result<(), MyError> {
|
||||||
//! let mut writer = Vec::new();
|
//! let mut writer = Vec::new();
|
||||||
//! let mut handler = MyHtmlHandler::default();
|
//! let mut handler = MyHtmlHandler::default();
|
||||||
//! Org::parse("* title\n*section*").html_with_handler(&mut writer, &mut handler)?;
|
//! Org::parse("* title\n*section*").write_html_custom(&mut writer, &mut handler)?;
|
||||||
//!
|
//!
|
||||||
//! assert_eq!(
|
//! assert_eq!(
|
||||||
//! String::from_utf8(writer)?,
|
//! String::from_utf8(writer)?,
|
||||||
|
|
Loading…
Reference in a new issue