summaryrefslogtreecommitdiffstats
path: root/libimagentrymarkdown
diff options
context:
space:
mode:
Diffstat (limited to 'libimagentrymarkdown')
-rw-r--r--libimagentrymarkdown/src/html.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/libimagentrymarkdown/src/html.rs b/libimagentrymarkdown/src/html.rs
index 09038751..f9d251a8 100644
--- a/libimagentrymarkdown/src/html.rs
+++ b/libimagentrymarkdown/src/html.rs
@@ -53,4 +53,30 @@ pub mod iter {
}
+
+ /// Iterate over `(Entry, Result<HTML>)` tuples
+ pub struct WithHtmlIterator<I: Iterator<Item = Entry>> {
+ i: I
+ }
+
+ impl<I: Iterator<Item = Entry>> WithHtmlIterator<I> {
+
+ fn new(i: I) -> WithHtmlIterator<I> {
+ WithHtmlIterator { i: i }
+ }
+
+ }
+
+ impl<I: Iterator<Item = Entry>> Iterator for WithHtmlIterator<I> {
+ type Item = (Entry, Result<HTML>);
+
+ fn next(&mut self) -> Option<Self::Item> {
+ self.i.next().map(|entry| {
+ let html = to_html(&entry.get_content()[..]);
+ (entry, html)
+ })
+ }
+
+ }
+
}