Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Greatly reduce page size #2218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions templates/about-base.html
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
{% extends "base.html" %}
{%- extends "base.html" -%}

{%- block body_classes -%}
centered
{%- endblock body_classes -%}

{% block header %}
<div class="docsrs-package-container">
<div class="container">
<div class="description-container">
<h1 id="crate-title" class="no-description">Docs.rs documentation</h1>
<div class="pure-menu pure-menu-horizontal">
<ul class="pure-menu-list">
{% set text = "circle-info" | fas(fw=true) %}
{% set text = text ~ ' <span class="title">About</span>' %}
{{ macros::active_link(expected="index", href="/about", text=text) }}
{%- block header -%}
<div class="docsrs-package-container"> {#- -#}
<div class="container"> {#- -#}
<div class="description-container"> {#- -#}
<h1 id="crate-title" class="no-description">Docs.rs documentation</h1> {#- -#}
<div class="pure-menu pure-menu-horizontal"> {#- -#}
<ul class="pure-menu-list"> {#- -#}
{%- set text = "circle-info" | fas(fw=true) -%}
{%- set text = text ~ ' <span class="title">About</span>' -%}
{{- macros::active_link(expected="index", href="/about", text=text) -}}

{% set text = "fonticons" | fab(fw=true) %}
{% set text = text ~ ' <span class="title">Badges</span>' %}
{{ macros::active_link(expected="badges", href="/about/badges", text=text) }}
{%- set text = "fonticons" | fab(fw=true) -%}
{%- set text = text ~ ' <span class="title">Badges</span>' -%}
{{- macros::active_link(expected="badges", href="/about/badges", text=text) -}}

{% set text = "gears" | fas(fw=true) %}
{% set text = text ~ ' <span class="title">Builds</span>' %}
{{ macros::active_link(expected="builds", href="/about/builds", text=text) }}
{%- set text = "gears" | fas(fw=true) -%}
{%- set text = text ~ ' <span class="title">Builds</span>' -%}
{{- macros::active_link(expected="builds", href="/about/builds", text=text) -}}

{% set text = "table" | fas(fw=true) %}
{% set text = text ~ ' <span class="title">Metadata</span>' %}
{{ macros::active_link(expected="metadata", href="/about/metadata", text=text) }}
{%- set text = "table" | fas(fw=true) -%}
{%- set text = text ~ ' <span class="title">Metadata</span>' -%}
{{- macros::active_link(expected="metadata", href="/about/metadata", text=text) -}}

{% set text = "road" | fas(fw=true) %}
{% set text = text ~ ' <span class="title">Shorthand URLs</span>' %}
{{ macros::active_link(expected="redirections", href="/about/redirections", text=text) }}
{%- set text = "road" | fas(fw=true) -%}
{%- set text = text ~ ' <span class="title">Shorthand URLs</span>' -%}
{{- macros::active_link(expected="redirections", href="/about/redirections", text=text) -}}

{% set text = "download" | fas(fw=true) %}
{% set text = text ~ ' <span class="title">Download</span>' %}
{{ macros::active_link(expected="download", href="/about/download", text=text) }}
</ul>
</div>
</div>
</div>
</div>
{% endblock %}
{%- set text = "download" | fas(fw=true) -%}
{%- set text = text ~ ' <span class="title">Download</span>' -%}
{{- macros::active_link(expected="download", href="/about/download", text=text) -}}
</ul> {#- -#}
</div> {#- -#}
</div> {#- -#}
</div> {#- -#}
</div> {#- -#}
{%- endblock -%}
34 changes: 17 additions & 17 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{%- import "macros.html" as macros -%}

<!DOCTYPE html>
<html lang="en">
<!DOCTYPE html> {#- -#}
<html lang="en"> {#- -#}

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="docs.rs {{ docsrs_version() }}">
<head> {#- -#}
<meta charset="UTF-8"> {#- -#}
<meta name="viewport" content="width=device-width, initial-scale=1"> {#- -#}
<meta name="generator" content="docs.rs {{ docsrs_version() }}"> {#- #}
{%- block meta -%}{%- endblock meta -%}

{# Docs.rs styles #}
<link rel="stylesheet" href="/-/static/vendored.css?{{ docsrs_version() | slugify }}" media="all" />
<link rel="stylesheet" href="/-/static/style.css?{{ docsrs_version() | slugify }}" media="all" />
{# Docs.rs styles -#}
<link rel="stylesheet" href="/-/static/vendored.css?{{ docsrs_version() | slugify }}" media="all" /> {#- -#}
<link rel="stylesheet" href="/-/static/style.css?{{ docsrs_version() | slugify }}" media="all" /> {#- -#}

<link rel="search" href="/-/static/opensearch.xml" type="application/opensearchdescription+xml" title="Docs.rs" />
<link rel="search" href="/-/static/opensearch.xml" type="application/opensearchdescription+xml" title="Docs.rs" /> {#- -#}

<title>{%- block title -%} Docs.rs {%- endblock title -%}</title>
<title>{%- block title -%} Docs.rs {%- endblock title -%}</title> {#- -#}

<script nonce="{{ csp_nonce }}">{%- include "theme.js" -%}</script>
<script nonce="{{ csp_nonce }}">{%- include "theme.js" -%}</script> {#- #}
{%- block css -%}{%- endblock css -%}

<script defer type="text/javascript" nonce="{{ csp_nonce }}" src="/-/static/menu.js?{{ docsrs_version() | slugify }}"></script>
<script defer type="text/javascript" nonce="{{ csp_nonce }}" src="/-/static/index.js?{{ docsrs_version() | slugify }}"></script>
</head>
<script defer type="text/javascript" nonce="{{ csp_nonce }}" src="/-/static/menu.js?{{ docsrs_version() | slugify }}"></script> {#- -#}
<script defer type="text/javascript" nonce="{{ csp_nonce }}" src="/-/static/index.js?{{ docsrs_version() | slugify }}"></script> {#- -#}
</head> {#- -#}

<body class="{% block body_classes %}{% endblock body_classes %}">
<body class="{% block body_classes %}{% endblock body_classes %}"> {#- -#}
{%- block topbar -%}
{%- include "header/topbar.html" -%}
{%- endblock topbar -%}
Expand All @@ -34,5 +34,5 @@
{%- block body -%}{%- endblock body -%}

{%- block javascript -%}{%- endblock javascript -%}
</body>
</body> {#- -#}
</html>
10 changes: 5 additions & 5 deletions templates/core/about/badges.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% extends "about-base.html" -%}
{%- extends "about-base.html" -%}

{%- block title -%} Badges {%- endblock title -%}

{%- block body -%}
<h1>Badges</h1>
<h1>Badges</h1> {#- -#}

<div class="container pure-u-5-6 about">
<p>Docs.rs no longer has its own badges. Consider using <a href="https://shields.io">shields.io</a> instead.</p>
<div class="container pure-u-5-6 about"> {#- -#}
<p>Docs.rs no longer has its own badges. Consider using <a href="https://shields.io">shields.io</a> instead.</p> {#- -#}
</div>
{%- endblock body %}
{%- endblock body -%}
170 changes: 85 additions & 85 deletions templates/core/about/builds.html
Original file line number Diff line number Diff line change
@@ -1,109 +1,109 @@
{% extends "about-base.html" -%}
{%- extends "about-base.html" -%}

{%- block title -%} Builds {%- endblock title -%}

{%- block body -%}
{%- set docsrs_repo = "https://github.com/rust-lang/docs.rs" -%}
<h1>Builds</h1>
<div class="about-page">
<div class="container pure-u-5-6 about">
<p>
Docs.rs automatically builds documentation for crates released on <a href="https://crates.io/">crates.io</a>.

It may take a while to build your crate, depending on how many crates are in <a href="/releases/queue">the queue</a>.
</p>

<p>
All crates are built in a sandbox using the nightly release of the Rust compiler.
{%- if rustc_version %}
<h1>Builds</h1> {#- -#}
<div class="about-page"> {#- -#}
<div class="container pure-u-5-6 about"> {#- -#}
<p> {#- -#}
Docs.rs automatically builds documentation for crates released on <a href="https://crates.io/">crates.io</a>. {# -#}

It may take a while to build your crate, depending on how many crates are in <a href="/releases/queue">the queue</a>. {#- -#}
</p> {#- -#}

<p> {#- -#}
All crates are built in a sandbox using the nightly release of the Rust compiler. {# -#}
{%- if rustc_version -%}
The current version in use is <code>{{ rustc_version }}</code>.
{%- endif -%}
</p>
</p> {#- -#}

<h3 id="notes-on-docsrs"> <a href="#notes-on-docsrs">Notes on using Docs.rs</a> </h3>
<h3 id="notes-on-docsrs"> <a href="#notes-on-docsrs">Notes on using Docs.rs</a> </h3> {#- -#}

<h4 id="setting-a-readme"> <a href="#setting-a-readme">Setting a README</a> </h4>
<p>
The README of a crate is taken from the <code>readme</code> field defined in
<code>Cargo.toml</code>. If this field is not set, no README will be displayed.
</p>
<h4 id="setting-a-readme"> <a href="#setting-a-readme">Setting a README</a> </h4> {#- -#}
<p> {#- -#}
The README of a crate is taken from the <code>readme</code> field defined in {# -#}
<code>Cargo.toml</code>. If this field is not set, no README will be displayed. {#- -#}
</p> {#- -#}

<h4 id="detecting-docsrs"> <a href="#detecting-docsrs">Detecting Docs.rs</a> </h4>
<p>
To recognize Docs.rs from <code>build.rs</code> files, you can test for the environment variable <code>DOCS_RS</code>, e.g.:
{% filter highlight(lang="rust") %}{% filter dedent(levels=3) -%}
<h4 id="detecting-docsrs"> <a href="#detecting-docsrs">Detecting Docs.rs</a> </h4> {#- -#}
<p> {#- -#}
To recognize Docs.rs from <code>build.rs</code> files, you can test for the environment variable <code>DOCS_RS</code>, e.g.: {# -#}
{%- filter highlight(lang="rust") %}{% filter dedent(levels=3) -%}
if std::env::var("DOCS_RS").is_ok() {
// ... your code here ...
}
{%- endfilter %}{% endfilter %}
This approach can be helpful if you need dependencies for building the library, but not for building the documentation.
</p>
{%- endfilter %}{% endfilter -%}
This approach can be helpful if you need dependencies for building the library, but not for building the documentation. {#- -#}
</p> {#- -#}

<h4 id="cross-compiling"> <a href="#cross-compiling">Cross-compiling</a> </h4>
<p>
All targets other than <code>x86_64-unknown-linux-gnu</code> are cross-compiled. For implementation reasons, this is unlikely to change for the foreseeable future.
</p>
<h4 id="cross-compiling"> <a href="#cross-compiling">Cross-compiling</a> </h4> {#- -#}
<p> {#- -#}
All targets other than <code>x86_64-unknown-linux-gnu</code> are cross-compiled. For implementation reasons, this is unlikely to change for the foreseeable future. {#- -#}
</p> {#- -#}

<p>
<p> {#- -#}
You can configure how your crate is built by adding <a href="metadata">package metadata</a> to your <code>Cargo.toml</code>, e.g.:
{% filter highlight(lang="toml") %}{% filter dedent -%}
{%- filter highlight(lang="toml") %}{% filter dedent -%}
[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
{%- endfilter %}{% endfilter %}
Here, the compiler arguments are set so that <code>#[cfg(docsrs)]</code> (not to be confused with <code>#[cfg(doc)]</code>) can be used for conditional compilation.
This approach is also useful for setting <a href="https://doc.rust-lang.org/cargo/reference/features.html">cargo features</a>.
</p>
{%- endfilter %}{% endfilter -%}
Here, the compiler arguments are set so that <code>#[cfg(docsrs)]</code> (not to be confused with <code>#[cfg(doc)]</code>) can be used for conditional compilation. {# -#}
This approach is also useful for setting <a href="https://doc.rust-lang.org/cargo/reference/features.html">cargo features</a>. {#- -#}
</p> {#- -#}

<h4 id="testing-builds-locally"> <a href="#testing-builds-locally">Testing documentation builds locally</a> </h4>
{%- set build_subcommand = docsrs_repo ~ "/blob/master/README.md#build-subcommand" -%}
<p>
The Docs.rs <a href="{{ build_subcommand | safe }}">README</a> describes how to build
unpublished crate documentation locally using the same build environment as the Docs.rs build agent.
</p>

<h3 id="diagnosing-failed-builds"> <a href="#diagnosing-failed-builds">Diagnosing failed builds</a> </h3>

<h4 id="missing-dependencies"> <a href="#missing-dependencies">Missing dependencies</a> </h4>
<p>
Missing dependencies are a common reason for failed builds.
Docs.rs dependencies are managed through
<a href="https://github.com/rust-lang/crates-build-env">crates-build-env</a>.
See <a href="https://forge.rust-lang.org/docs-rs/add-dependencies.html">Forge</a> for how to add a dependency.
</p>

<h4 id="read-only-directories"> <a href="#read-only-directories">Write attempt on read-only directories</a> </h4>
<p>
Most of the sandbox is a read-only file system, including the source directory of your crate and its dependencies.
If your <code>build.rs</code> generates files that are relevant for documentation, consider writing to the
<a href="https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates">cargo output directory</a>,
passed in the environment variable <code>OUT_DIR</code>.
</p>

<h4 id="hitting-resource-limits"> <a href="#hitting-resource-limits">Hitting resource limits</a> </h4>
<p>
All the builds are executed inside a sandbox with limited resources. The current limits are:
<p> {#- -#}
The Docs.rs <a href="{{ build_subcommand | safe }}">README</a> describes how to build {# -#}
unpublished crate documentation locally using the same build environment as the Docs.rs build agent. {#- -#}
</p> {#- -#}

<h3 id="diagnosing-failed-builds"> <a href="#diagnosing-failed-builds">Diagnosing failed builds</a> </h3> {#- -#}

<h4 id="missing-dependencies"> <a href="#missing-dependencies">Missing dependencies</a> </h4> {#- -#}
<p> {#- -#}
Missing dependencies are a common reason for failed builds. {# -#}
Docs.rs dependencies are managed through {# -#}
<a href="https://github.com/rust-lang/crates-build-env">crates-build-env</a>. {# -#}
See <a href="https://forge.rust-lang.org/docs-rs/add-dependencies.html">Forge</a> for how to add a dependency. {#- -#}
</p> {#- -#}

<h4 id="read-only-directories"> <a href="#read-only-directories">Write attempt on read-only directories</a> </h4> {#- -#}
<p> {#- -#}
Most of the sandbox is a read-only file system, including the source directory of your crate and its dependencies. {# -#}
If your <code>build.rs</code> generates files that are relevant for documentation, consider writing to the {# -#}
<a href="https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates">cargo output directory</a>, {# -#}
passed in the environment variable <code>OUT_DIR</code>. {#- -#}
</p> {#- -#}

<h4 id="hitting-resource-limits"> <a href="#hitting-resource-limits">Hitting resource limits</a> </h4> {#- -#}
<p> {#- -#}
All the builds are executed inside a sandbox with limited resources. The current limits are: {#- -#}
</p>

{{ macros::crate_limits(limits=limits) }}

<p>
If your build fails because it hit one of these limits, please
<a href="{{ docsrs_repo | safe }}/issues/new/choose">open an issue</a>
to get them increased for your crate.
Since our build agent has finite resources, we have to consider each case individually. However, there are a few general policies:
<ul>
<li>Network access will not be enabled for any crate.</li>
<li>Any crate that requests a time extension will be limited to one target.</li>
</ul>
</p>

<h4 id="failures-and-rebuilds"> <a href="#failures-and-rebuilds">Other failures and requesting rebuilds</a> </h4>
<p>
If your crate fails to build for a reason not listed here, please <a href="{{ docsrs_repo | safe }}/issues">file an issue</a>.
Some build failures can be fixed by Docs.rs, e.g., by issuing a rebuild after a bug in Docs.rs has been fixed.
</p>

</div>
<br />
{{- macros::crate_limits(limits=limits) -}}

<p> {#- -#}
If your build fails because it hit one of these limits, please {# -#}
<a href="{{ docsrs_repo | safe }}/issues/new/choose">open an issue</a> {# -#}
to get them increased for your crate. {# -#}
Since our build agent has finite resources, we have to consider each case individually. However, there are a few general policies: {#- -#}
<ul> {#- -#}
<li>Network access will not be enabled for any crate.</li> {#- -#}
<li>Any crate that requests a time extension will be limited to one target.</li> {#- -#}
</ul> {#- -#}
</p> {#- -#}

<h4 id="failures-and-rebuilds"> <a href="#failures-and-rebuilds">Other failures and requesting rebuilds</a> </h4> {#- -#}
<p> {#- -#}
If your crate fails to build for a reason not listed here, please <a href="{{ docsrs_repo | safe }}/issues">file an issue</a>. {# -#}
Some build failures can be fixed by Docs.rs, e.g., by issuing a rebuild after a bug in Docs.rs has been fixed. {# -#}
</p> {#- -#}

</div> {#- -#}
<br> {#- -#}
</div>
{%- endblock body %}
{%- endblock body -%}
Loading