mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Adjust wording
This commit is contained in:
parent
fa08605c02
commit
e91db758c8
3 changed files with 13 additions and 17 deletions
|
@ -561,4 +561,5 @@ This release was yanked because it accidentally [breaks backwards compatibility]
|
||||||
## 0.1.0 - 2020-02-19
|
## 0.1.0 - 2020-02-19
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- This project.
|
- This project.
|
|
@ -5,8 +5,8 @@ use teloxide_core::types::Message;
|
||||||
|
|
||||||
use super::Render;
|
use super::Render;
|
||||||
|
|
||||||
/// The [`RenderMessageTextHelper`] trait provides methods to generate HTML and
|
/// Generates HTML and Markdown representations of text and captions in a
|
||||||
/// Markdown representations of the text and captions in a Telegram message.
|
/// Telegram message.
|
||||||
pub trait RenderMessageTextHelper {
|
pub trait RenderMessageTextHelper {
|
||||||
/// Returns the HTML representation of the message text, if the message
|
/// Returns the HTML representation of the message text, if the message
|
||||||
/// contains text. This method will parse the text and any entities
|
/// contains text. This method will parse the text and any entities
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! Utilities for rendering texts and message entities to HTML and Markdown.
|
//! Utils for rendering HTML and Markdown output.
|
||||||
|
|
||||||
use teloxide_core::types::{MessageEntity, MessageEntityKind as MEK};
|
use teloxide_core::types::{MessageEntity, MessageEntityKind as MEK};
|
||||||
|
|
||||||
|
@ -11,8 +11,7 @@ mod html;
|
||||||
mod markdown;
|
mod markdown;
|
||||||
mod tag;
|
mod tag;
|
||||||
|
|
||||||
/// The [`Render`] struct is responsible for parsing the text and entities to
|
/// Parses text and message entities to produce the final formatted output.
|
||||||
/// produce the final formatted output.
|
|
||||||
#[derive(Clone, Eq, PartialEq)]
|
#[derive(Clone, Eq, PartialEq)]
|
||||||
pub struct Render<'a> {
|
pub struct Render<'a> {
|
||||||
text: &'a str,
|
text: &'a str,
|
||||||
|
@ -20,11 +19,7 @@ pub struct Render<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Render<'a> {
|
impl<'a> Render<'a> {
|
||||||
/// Creates a new `Render` instance with the given text and entities.
|
/// Creates a new [`Render`] instance with given text and message entities.
|
||||||
///
|
|
||||||
/// The `Render` is responsible for parsing the text and entities to
|
|
||||||
/// produce the final formatted output. This constructor sets up the
|
|
||||||
/// initial state needed for the parsing process.
|
|
||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
///
|
///
|
||||||
|
@ -84,11 +79,11 @@ impl<'a> Render<'a> {
|
||||||
Self { text, tags }
|
Self { text, tags }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Renders the text with the given [`TagWriter`].
|
/// Renders text with a given [`TagWriter`].
|
||||||
///
|
///
|
||||||
/// This method iterates through the text and the associated position tags,
|
/// This method iterates through the text and the associated position tags
|
||||||
/// and writes the text with the appropriate tags to a buffer. The
|
/// and writes the text with the appropriate tags to a buffer, which is then
|
||||||
/// resulting buffer is then returned as a `String`.
|
/// returned as a `String`.
|
||||||
///
|
///
|
||||||
/// If input have no tags we just return the original text as-is.
|
/// If input have no tags we just return the original text as-is.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
@ -137,14 +132,14 @@ impl<'a> Render<'a> {
|
||||||
buffer
|
buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Render and return the text as an **HTML-formatted** string.
|
/// Renders and returns the text as an **HTML-formatted** string.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn as_html(&self) -> String {
|
pub fn as_html(&self) -> String {
|
||||||
self.format(&html::HTML)
|
self.format(&html::HTML)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Render and return the text as a **Markdown-formatted** string.
|
/// Renders and returns the text as a **Markdown-formatted** string.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn as_markdown(&self) -> String {
|
pub fn as_markdown(&self) -> String {
|
||||||
|
|
Loading…
Reference in a new issue