Compare commits
2 Commits
b4a8898f9b
...
403620396b
| Author | SHA1 | Date | |
|---|---|---|---|
| 403620396b | |||
| d6052a624e |
15
src/lib.rs
15
src/lib.rs
@@ -77,6 +77,21 @@ impl Parse for BaseElement {
|
||||
}
|
||||
}
|
||||
|
||||
/// # HTML Paragraph element
|
||||
/// # Usage:
|
||||
/// ```rust
|
||||
/// use web_macro::paragraph;
|
||||
/// let single_line = paragraph!("This is my lovely text to be displayed", id="title", class="small blue");
|
||||
/// let multi_line = paragraph!(
|
||||
/// "This is my lovely text to be displayed",
|
||||
/// "This is another line that constitutes my paragraph",
|
||||
/// id="title",
|
||||
/// class="small blue"
|
||||
/// );
|
||||
/// ```
|
||||
/// # Notes:
|
||||
/// - This element supports child insertions, see usage.
|
||||
/// - Adding multiple children will **not** insert _\<br\>_
|
||||
#[proc_macro]
|
||||
pub fn paragraph(input: TokenStream) -> TokenStream {
|
||||
base("p", input)
|
||||
|
||||
@@ -19,7 +19,11 @@ mod tests {
|
||||
fn test_multiple_elements_with_options() {
|
||||
assert_eq!(
|
||||
"<div id=\"division_id\">\n<h1>one</h1>\n<h1 class=\"tiny\">two</h1>\n</div>",
|
||||
division!(heading1!("one"), heading1!("two", class="tiny"), id="division_id")
|
||||
division!(
|
||||
heading1!("one"),
|
||||
heading1!("two", class = "tiny"),
|
||||
id = "division_id"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user