Skip to content

Commit 32e82c4

Browse files
committed
Keep the example template near the top of docs.
1 parent 87967c0 commit 32e82c4

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

src/lib.rs

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,33 @@
1212
//! Templates (and static assets) are included in the compiled
1313
//! program, which can be a single binary.
1414
//!
15+
//! The template syntax, which is inspired by [Twirl], the Scala-based
16+
//! template engine in [Play framework], is documented in
17+
//! the [Template_syntax] module.
18+
//! A sample template may look like this:
19+
//!
20+
//! ```html
21+
//! @use any::rust::Type;
22+
//!
23+
//! @(name: &str, items: &[Type])
24+
//!
25+
//! <html>
26+
//! <head><title>@name</title></head>
27+
//! <body>
28+
//! @if items.is_empty() {
29+
//! <p>There are no items.</p>
30+
//! } else {
31+
//! <p>There are @items.len() items.</p>
32+
//! <ul>
33+
//! @for item in items {
34+
//! <li>@item</li>
35+
//! }
36+
//! </ul>
37+
//! }
38+
//! <body>
39+
//! </html>
40+
//! ```
41+
//!
1542
//! # Getting started
1643
//!
1744
//! The aim of ructe is to have your templates and static files accessible to
@@ -64,35 +91,6 @@
6491
//! assert_eq!(buf, b"<h1>Hello World!</h1>\n");
6592
//! ```
6693
//!
67-
//! # Template syntax
68-
//!
69-
//! The template syntax, which is inspired by [Twirl], the Scala-based
70-
//! template engine in [Play framework], is documented in
71-
//! the [Template_syntax] module.
72-
//! A sample template may look like this:
73-
//!
74-
//! ```html
75-
//! @use any::rust::Type;
76-
//!
77-
//! @(name: &str, items: &[Type])
78-
//!
79-
//! <html>
80-
//! <head><title>@name</title></head>
81-
//! <body>
82-
//! @if items.is_empty() {
83-
//! <p>There are no items.</p>
84-
//! } else {
85-
//! <p>There are @items.len() items.</p>
86-
//! <ul>
87-
//! @for item in items {
88-
//! <li>@item</li>
89-
//! }
90-
//! </ul>
91-
//! }
92-
//! <body>
93-
//! </html>
94-
//! ```
95-
//!
9694
//! There are some [examples in the repository].
9795
//! There is also a separate example of
9896
//! [using ructe with warp and diesel].

0 commit comments

Comments
 (0)