Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Expose Index & Indexed #82

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ramhorns/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ pub use content::Content;
pub use error::Error;
pub use template::{Section, Template};

#[cfg(feature = "indexes")]
pub use template::{Index, Indexed};

#[cfg(feature = "export_derive")]
pub use ramhorns_derive::Content;

Expand Down
6 changes: 3 additions & 3 deletions ramhorns/src/template/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mod section;
#[cfg(not(feature = "indexes"))]
pub use parse::Tag;
#[cfg(feature = "indexes")]
pub use parse::{Index::Last, Indexed, Tag};
pub use parse::{Index, Indexed, Tag};
pub use section::Section;

/// A preprocessed form of the plain text template, ready to be rendered
Expand Down Expand Up @@ -252,10 +252,10 @@ mod test {
&tpl.blocks,
&[
Block::new("", "person", Tag::Section).children(7),
Block::new("", "-last", Tag::Indexed(Indexed::Exclude(Last))).children(2),
Block::new("", "-last", Tag::Indexed(Indexed::Exclude(Index::Last))).children(2),
Block::new("", "name", Tag::Unescaped),
Block::nameless("", Tag::Closing),
Block::new("", "-last", Tag::Indexed(Indexed::Include(Last))).children(2),
Block::new("", "-last", Tag::Indexed(Indexed::Include(Index::Last))).children(2),
Block::new("", "name", Tag::Unescaped),
Block::nameless("", Tag::Closing),
Block::nameless("", Tag::Closing),
Expand Down
Loading