Skip to content
This repository has been archived by the owner on Apr 1, 2019. It is now read-only.

longshorej/rust-tags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-tags

Crates.io Crates.io Travis

This project is abandoned. Use typed-html instead.

This is an HTML templating library for the Rust Programming Language. It's strongly inspired by Scalatags.

It differs from other templating libraries in that your documents are simply defined as plain function calls. This, among other things, allows you to safely construct documents that are free from XSS vulerabilities.

One other advantage to this approach is that features such as partial templates, etc. are easily expressed using Rust, having all of its power available.

Example

extern crate rust_tags;

use rust_tags::tags::*;
use rust_tags::tags::title;
use rust_tags::attributes::*;

fn main() {
    let frag = html(&[
        head(&[title(&["My Blog".into()])]),
        body(&[
            div(&[
                "Jason Longshore".into(),

                hr(&[]),

                // note that the hello world is escaped

                a(&[href("#"), "My Blog <hello world />".into()]),

                br(),
                br()
            ])
        ])
    ]);

    println!("{}", frag.data);
}

Projects That Use rust-tags

Release Notes

0.3.1 2018-02-18

Fix a bug in attribute value escaping.

0.3.0 2018-02-18

Initial usable release.

Releasing

  1. Upgrade version in Cargo.toml
  2. Update the Release Notes in README.md
  3. Commit changes
  4. Create and push a tag: git tag v<version>; git push origin v<version>
  5. Release on crates.io: cargo publish

Author

Jason Longshore hello@jasonlongshore.com

License

Copyright (C) 2018 Jason Longshore (https://longshore.info/).

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

HTML templating library for Rust

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages