Make description and notes fields optional

This commit is contained in:
Nico Burns 2022-11-08 12:42:07 +00:00
parent aea07eac67
commit 4ca4ed0a88
4 changed files with 29 additions and 43 deletions

View file

@ -203,8 +203,7 @@
{ {
"name": "Safe type casts", "name": "Safe type casts",
"crates": [{ "crates": [{
"name": "bytemuck", "name": "bytemuck"
"notes": ""
}] }]
}, },
{ {
@ -259,33 +258,33 @@
"name": "Password Hashing", "name": "Password Hashing",
"notes": "For more algorithms, see <a href=\"https://github.com/RustCrypto/password-hashes#rustcrypto-password-hashes\">Rust Crypto Password Hashes</a>.", "notes": "For more algorithms, see <a href=\"https://github.com/RustCrypto/password-hashes#rustcrypto-password-hashes\">Rust Crypto Password Hashes</a>.",
"crates": [ "crates": [
{ "name": "argon2", "notes": "" }, { "name": "argon2" },
{ "name": "scrypt", "notes": "" }, { "name": "scrypt" },
{ "name": "bcrypt", "notes": "" } { "name": "bcrypt" }
] ]
}, },
{ {
"name": "General Purpose Hashing", "name": "General Purpose Hashing",
"notes": "For more algorithms, see <a href=\"https://github.com/RustCrypto/hashes#rustcrypto-hashes\">Rust Crypto Hashes</a>.", "notes": "For more algorithms, see <a href=\"https://github.com/RustCrypto/hashes#rustcrypto-hashes\">Rust Crypto Hashes</a>.",
"crates": [ "crates": [
{ "name": "sha2", "notes": "" }, { "name": "sha2" },
{ "name": "sha1", "notes": "" }, { "name": "sha1" },
{ "name": "md-5", "notes": "" } { "name": "md-5" }
] ]
}, },
{ {
"name": "AEAD Encryption", "name": "AEAD Encryption",
"notes": "For more algorithms, see <a href=\"https://github.com/RustCrypto/AEADs#rustcrypto-authenticated-encryption-with-associated-data-aead-algorithms\">Rust Crypto AEADs</a>.", "notes": "For more algorithms, see <a href=\"https://github.com/RustCrypto/AEADs#rustcrypto-authenticated-encryption-with-associated-data-aead-algorithms\">Rust Crypto AEADs</a>.",
"crates": [ "crates": [
{ "name": "aes-gcm-siv", "notes": "" }, { "name": "aes-gcm-siv" },
{ "name": "aes-gcm", "notes": "" }, { "name": "aes-gcm" },
{ "name": "chacha20poly1305", "notes": "" } { "name": "chacha20poly1305" }
] ]
}, },
{ {
"name": "RSA", "name": "RSA",
"crates": [ "crates": [
{ "name": "rsa", "notes": "" } { "name": "rsa" }
] ]
}, },
{ {
@ -293,18 +292,18 @@
"notes": "For more algorithms, see <a href=\"https://github.com/RustCrypto/signatures#rustcrypto-signatures--\">Rust Crypto Signatures</a>.", "notes": "For more algorithms, see <a href=\"https://github.com/RustCrypto/signatures#rustcrypto-signatures--\">Rust Crypto Signatures</a>.",
"crates": [ "crates": [
{ "name": "ed25519", "notes": "Use in conjunction with the ed25519-dalek crate." }, { "name": "ed25519", "notes": "Use in conjunction with the ed25519-dalek crate." },
{ "name": "ecdsa", "notes": "" }, { "name": "ecdsa" },
{ "name": "dsa", "notes": "" } { "name": "dsa" }
] ]
}, },
{ {
"name": "Certificate Formats", "name": "Certificate Formats",
"notes": "For more formats, see <a href=\"https://github.com/RustCrypto/formats#rustcrypto-formats--\">Rust Crypto Formats</a>.", "notes": "For more formats, see <a href=\"https://github.com/RustCrypto/formats#rustcrypto-formats--\">Rust Crypto Formats</a>.",
"crates": [ "crates": [
{ "name": "der", "notes": "" }, { "name": "der" },
{ "name": "pemrfc7468 ", "notes": "" }, { "name": "pemrfc7468" },
{ "name": "pkcs8", "notes": "" }, { "name": "pkcs8" },
{ "name": "x509-cert", "notes": "" } { "name": "x509-cert" }
] ]
}, },
{ {
@ -456,7 +455,6 @@
{ {
"slug": "grpc", "slug": "grpc",
"name": "gRPC", "name": "gRPC",
"description": "",
"purposes": [ "purposes": [
{ {
"name": "General Purpose", "name": "General Purpose",
@ -472,12 +470,10 @@
{ {
"slug": "databases", "slug": "databases",
"name": "Databases", "name": "Databases",
"description": "",
"subgroups": [ "subgroups": [
{ {
"slug": "sql-databases", "slug": "sql-databases",
"name": "SQL Databases", "name": "SQL Databases",
"description": "",
"purposes": [ "purposes": [
{ {
"name": "Multi Database", "name": "Multi Database",
@ -499,8 +495,7 @@
{ {
"name": "Postgres", "name": "Postgres",
"crates": [{ "crates": [{
"name": "sqlx", "name": "sqlx"
"notes": ""
}, { }, {
"name": "tokio-postgres", "name": "tokio-postgres",
"notes": "Postgres-specific library. Performs better than SQLx" "notes": "Postgres-specific library. Performs better than SQLx"
@ -509,8 +504,7 @@
{ {
"name": "MySQL", "name": "MySQL",
"crates": [{ "crates": [{
"name": "sqlx", "name": "sqlx"
"notes": ""
}, { }, {
"name": "mysql_async", "name": "mysql_async",
"notes": "Has a poorly designed API. Prefer SQLx for MySQL" "notes": "Has a poorly designed API. Prefer SQLx for MySQL"
@ -519,8 +513,7 @@
{ {
"name": "SQLite", "name": "SQLite",
"crates": [{ "crates": [{
"name": "sqlx", "name": "sqlx"
"notes": ""
}, { }, {
"name": "rustqlite", "name": "rustqlite",
"notes": "Provides a sync API to SQLite + provides access to advanced sqlite features." "notes": "Provides a sync API to SQLite + provides access to advanced sqlite features."
@ -529,8 +522,7 @@
{ {
"name": "MS SQL", "name": "MS SQL",
"crates": [{ "crates": [{
"name": "sqlx", "name": "sqlx"
"notes": ""
}, { }, {
"name": "tiberius", "name": "tiberius",
"notes": "MS SQL specific library. Has better support for advanced column types than SQLx." "notes": "MS SQL specific library. Has better support for advanced column types than SQLx."
@ -548,20 +540,17 @@
{ {
"slug": "other-databases", "slug": "other-databases",
"name": "Other Databases", "name": "Other Databases",
"description": "",
"purposes": [ "purposes": [
{ {
"name": "Redis", "name": "Redis",
"crates": [{ "crates": [{
"name": "redis", "name": "redis"
"notes": ""
}] }]
}, },
{ {
"name": "MongoDB", "name": "MongoDB",
"crates": [{ "crates": [{
"name": "mongodb", "name": "mongodb"
"notes": ""
}] }]
} }
] ]
@ -571,7 +560,6 @@
{ {
"slug": "cli-tools", "slug": "cli-tools",
"name": "CLIs", "name": "CLIs",
"description": "",
"subgroups": [ "subgroups": [
{ {
"slug": "argument-parsing", "slug": "argument-parsing",
@ -668,12 +656,10 @@
{ {
"slug": "concurrency", "slug": "concurrency",
"name": "Concurrency", "name": "Concurrency",
"description": "",
"subgroups": [ "subgroups": [
{ {
"slug": "data-structures", "slug": "data-structures",
"name": "Data Structures", "name": "Data Structures",
"description": "",
"purposes": [ "purposes": [
{ {
"name": "Mutex", "name": "Mutex",

View file

@ -52,7 +52,7 @@ pub(crate) async fn run() -> impl IntoResponse {
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
struct Crate { struct Crate {
name: String, name: String,
notes: String, notes: Option<String>,
link: Option<String>, link: Option<String>,
} }
@ -67,7 +67,7 @@ struct Purpose {
struct CrateSubGroup { struct CrateSubGroup {
slug: String, slug: String,
name: String, name: String,
description: String, description: Option<String>,
purposes: Vec<Purpose>, purposes: Vec<Purpose>,
} }
@ -75,7 +75,7 @@ struct CrateSubGroup {
struct CrateGroup { struct CrateGroup {
slug: String, slug: String,
name: String, name: String,
description: String, description: Option<String>,
subgroups: Vec<CrateSubGroup>, subgroups: Vec<CrateSubGroup>,
purposes: Option<Vec<Purpose>>, purposes: Option<Vec<Purpose>>,
} }

View file

@ -32,7 +32,7 @@
<a style="margin-left: 3px;opacity: 0.7;color: #333;text-decoration: none" href="https://docs.rs/{{ crate.name }}"> [docs]</a> <a style="margin-left: 3px;opacity: 0.7;color: #333;text-decoration: none" href="https://docs.rs/{{ crate.name }}"> [docs]</a>
{% endif %} {% endif %}
<br /> <br />
{{ crate.notes | safe }} {% if crate.notes %}{{ crate.notes | safe }}{% endif %}
</p> </p>
{% endfor %} {% endfor %}
<!-- </ul> --> <!-- </ul> -->

View file

@ -37,7 +37,7 @@
{% for group in crate_groups %} {% for group in crate_groups %}
<section data-toc-section id="section-{{ group.slug }}"> <section data-toc-section id="section-{{ group.slug }}">
<h3>{{ group.name }}</h3> <h3>{{ group.name }}</h3>
<p class="group-description">{{ group.description | safe }}</p> <p class="group-description">{% if group.description %}{{ group.description | safe }}{% endif %}</p>
{% if group.purposes %} {% if group.purposes %}
{{ crate_table::crate_table(purposes=group.purposes) }} {{ crate_table::crate_table(purposes=group.purposes) }}
@ -46,7 +46,7 @@
{% for subgroup in group.subgroups %} {% for subgroup in group.subgroups %}
<section data-toc-section id="section-{{ group.slug }}-subsection-{{ subgroup.slug }}"> <section data-toc-section id="section-{{ group.slug }}-subsection-{{ subgroup.slug }}">
<h4>{{ subgroup.name }}</h4> <h4>{{ subgroup.name }}</h4>
<p class="group-description">{{ subgroup.description | safe }}</p> <p class="group-description">{% if subgroup.description %}{{ subgroup.description | safe }}{% endif %}</p>
{{ crate_table::crate_table(purposes=subgroup.purposes) }} {{ crate_table::crate_table(purposes=subgroup.purposes) }}
</section> </section>
{% endfor %} {% endfor %}