aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--README.md3
-rw-r--r--src/lib.rs14
3 files changed, 17 insertions, 2 deletions
diff --git a/Cargo.toml b/Cargo.toml
index d32b406..9331152 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@ edition = "2018"
readme = "README.md"
keywords = ["html", "html5", "whatwg", "parser", "tokenizer"]
license = "MIT"
-repository = "https://git.push-f.com/html5tokenizer/"
+repository = "https://git.push-f.com/html5tokenizer"
version = "0.4.0"
include = ["src/**/*", "LICENSE", "README.md"]
diff --git a/README.md b/README.md
index 9700826..ccb2757 100644
--- a/README.md
+++ b/README.md
@@ -65,7 +65,7 @@ This allows you to:
## License
-Licensed under the MIT license, see [`./LICENSE`](./LICENSE).
+Licensed under the MIT license, see [the LICENSE file].
[html5gum]: https://crates.io/crates/html5gum
@@ -73,3 +73,4 @@ Licensed under the MIT license, see [`./LICENSE`](./LICENSE).
[html5lib's tokenizer test suite]: https://github.com/html5lib/html5lib-tests/tree/master/tokenizer
[charset detection]: https://html.spec.whatwg.org/multipage/parsing.html#determining-the-character-encoding
[misnested tags]: https://html.spec.whatwg.org/multipage/parsing.html#an-introduction-to-error-handling-and-strange-cases-in-the-parser
+[the LICENSE file]: ./LICENSE
diff --git a/src/lib.rs b/src/lib.rs
index cbaf94d..c2a1019 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,7 @@
#![warn(missing_docs)]
// This is an HTML parser. HTML can be untrusted input from the internet.
#![forbid(unsafe_code)]
+#![doc = concat!("[the LICENSE file]: ", file_url!("LICENSE"))]
#![doc = include_str!("../README.md")]
pub mod attr;
@@ -19,3 +20,16 @@ pub use utils::State as InternalState;
pub use emitter::{Comment, DefaultEmitter, Doctype, Emitter, EndTag, StartTag, Token};
pub use error::Error;
pub use tokenizer::{State, Tokenizer};
+
+/// Relative links in the README.md don't work in rustdoc, so we have to override them.
+macro_rules! file_url {
+ ($path:literal) => {
+ concat!(
+ env!("CARGO_PKG_REPOSITORY"),
+ "/tree/",
+ $path,
+ "?h=v",
+ env!("CARGO_PKG_VERSION")
+ )
+ };
+}