From 14e7c30d12708c3cac93d6710f90e289ebcc05fc Mon Sep 17 00:00:00 2001 From: Camelid Date: Sat, 20 Mar 2021 18:53:38 -0700 Subject: [PATCH 1/2] Better fix code blocks in `/about` This is a followup to #1315 to fix the extra blank line at the top and to fix the indentation. --- templates/core/about/builds.html | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/templates/core/about/builds.html b/templates/core/about/builds.html index cf0c70c65..b4163da67 100644 --- a/templates/core/about/builds.html +++ b/templates/core/about/builds.html @@ -31,12 +31,10 @@

Setting a README

Detecting Docs.rs

To recognize Docs.rs from build.rs files, you can test for the environment variable DOCS_RS, e.g.: - {% filter dedent(levels=4) -%} -


-            if let Ok(_) = std::env::var("DOCS_RS") {
+        {% filter dedent(levels=3) -%}
+        
if let Ok(_) = std::env::var("DOCS_RS") {
                 // ... your code here ...
-            }
-        
+ }
{%- endfilter %} This approach can be helpful if you need dependencies for building the library, but not for building the documentation.

@@ -49,10 +47,8 @@

Cross-compiling

You can configure how your crate is built by adding package metadata to your Cargo.toml, e.g.: {% filter dedent -%} -


-            [package.metadata.docs.rs]
-            rustc-args = ["--cfg", "docsrs"]
-        
+
[package.metadata.docs.rs]
+            rustc-args = ["--cfg", "docsrs"]
{%- endfilter %} Here, the compiler arguments are set so that #[cfg(docsrs)] (not to be confused with #[cfg(doc)]) can be used for conditional compilation. This approach is also useful for setting cargo features. From eea9807c2acdfc194c59e37f7d77886eddf2c7dc Mon Sep 17 00:00:00 2001 From: Camelid Date: Fri, 16 Apr 2021 14:17:40 -0700 Subject: [PATCH 2/2] Remove extraneous blank line in example `Cargo.toml` See [1] for more. [1]: https://handlebarsjs.com/guide/expressions.html#whitespace-control --- templates/core/Cargo.toml.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/core/Cargo.toml.example b/templates/core/Cargo.toml.example index 22bf5c74d..d9e2d6a6d 100644 --- a/templates/core/Cargo.toml.example +++ b/templates/core/Cargo.toml.example @@ -1,4 +1,4 @@ -{# The example Cargo.toml used in about.html #} +{~# The example Cargo.toml used in about.html #~} [package] name = "test"