From 7d064c526e0c854ab29b957457986fe50a01ed10 Mon Sep 17 00:00:00 2001 From: PoiScript Date: Wed, 6 Nov 2019 00:31:35 +0800 Subject: [PATCH] fix(docs): update functions name --- README.md | 12 ++++++------ src/export/html.rs | 2 +- src/lib.rs | 18 +++++++++--------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 6603903..cfd8c14 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,12 @@ use orgize::Org; Org::parse("* DONE Title :tag:"); ``` -or `Org::parse_with_config`: +or `Org::parse_custom`: ``` rust use orgize::{Org, ParseConfig}; -Org::parse_with_config( +Org::parse_custom( "* TASK Title 1", &ParseConfig { // custom todo keywords @@ -51,14 +51,14 @@ One as `Event::Start(element)`, one as `Event::End(element)`. ## 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: ```rust use orgize::Org; 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!( String::from_utf8(writer).unwrap(), @@ -69,7 +69,7 @@ assert_eq!( ## Render html with custom `HtmlHandler` 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 own error type while rendering. @@ -139,7 +139,7 @@ impl HtmlHandler for MyHtmlHandler { fn main() -> Result<(), MyError> { let mut writer = Vec::new(); 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!( String::from_utf8(writer)?, diff --git a/src/export/html.rs b/src/export/html.rs index 5979745..92e7e30 100644 --- a/src/export/html.rs +++ b/src/export/html.rs @@ -275,7 +275,7 @@ mod syntect_handler { /// /// let mut vec = vec![]; /// - /// org.html_with_handler(&mut vec, &mut handler).unwrap(); + /// org.write_html_custom(&mut vec, &mut handler).unwrap(); /// ``` /// /// Customize: diff --git a/src/lib.rs b/src/lib.rs index 56c6971..ff77717 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,14 +14,14 @@ //! 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 //! use orgize::{Org, ParseConfig}; //! -//! Org::parse_with_config( +//! Org::parse_custom( //! "* TASK Title 1", //! &ParseConfig { //! // custom todo keywords @@ -56,17 +56,17 @@ //! //! # 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: //! -//! [`Org::html`]: struct.Org.html#method.html +//! [`Org::write_html`]: struct.Org.html#method.write_html //! [`DefaultHtmlHandler`]: export/struct.DefaultHtmlHandler.html //! //! ```rust //! use orgize::Org; //! //! 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!( //! String::from_utf8(writer).unwrap(), @@ -77,10 +77,10 @@ //! # Render html with custom `HtmlHandler` //! //! 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 -//! [`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 //! own error type while rendering. @@ -150,7 +150,7 @@ //! fn main() -> Result<(), MyError> { //! let mut writer = Vec::new(); //! 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!( //! String::from_utf8(writer)?,