1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! [](https://crates.io/crates/commented)
//! [](https://docs.rs/commented)
//! 
//! 
//! [](https://github.com/nik-rev/commented)
//!
//! This crate contains the [`comment`](comment) function, which turns the passed input
//! into a comment for the given file type
//!
//! ```toml
//! commented = "0.2.0"
//! ```
//!
//! # Usage
//!
//! ```rust
//! use commented::comment;
//!
//! assert_eq!(comment("hello, world!", "index.html"), "<!-- hello, world! -->");
//! assert_eq!(comment("hello, world!", "main.rs"), "/* hello, world! */");
//! assert_eq!(comment("hello, world!", "script.lua"), "--[[ hello, world! --]]");
//! // fallback to `#`, as that's the most common comment tokens for
//! // files without an extension
//! assert_eq!(comment("hello, world!", "123456789"), "# hello, world!");
//! ```
use Path;
/// Turn the given `content` into a comment for the given `path`
///
/// # Examples
///
/// ```
/// use commented::comment;
///
/// assert_eq!(comment("hello, world!", "index.html"), "<!-- hello, world! -->");
/// assert_eq!(comment("hello, world!", "main.rs"), "/* hello, world! */");
/// assert_eq!(comment("hello, world!", "script.lua"), "--[[ hello, world! --]]");
/// // fallback to `#`, as that's the most common comment tokens for
/// // files without an extension
/// assert_eq!(comment("hello, world!", "123456789"), "# hello, world!");
/// ```