From 37e469641d279de2bbc9b6b811521f7a26f3f78b Mon Sep 17 00:00:00 2001 From: avitex Date: Thu, 4 Mar 2021 12:23:44 +1100 Subject: [PATCH] remove content feature --- book/macros.tera | 5 ----- book/observe/event.tera | 4 ---- book/react/action.tera | 4 ---- book/react/stage.tera | 4 ---- book/source/intelligence.tera | 4 ---- book/source/provider.tera | 6 ------ book/source/requirement.tera | 4 ---- registry/config.toml | 2 -- src/registry/mod.rs | 3 ++- src/render/mdbook.rs | 14 ++------------ 10 files changed, 4 insertions(+), 46 deletions(-) diff --git a/book/macros.tera b/book/macros.tera index 36c81b8..789367a 100644 --- a/book/macros.tera +++ b/book/macros.tera @@ -72,8 +72,3 @@ - [{{ item.name }}]({{ id_parts.domain ~ "/" ~ id_parts.model ~ "/" ~id_parts.instance ~ ".md" }}) {%- endfor -%} {% endmacro summary_list %} - -{% macro registry_content(key, default="") %} -{%- set content = global(key="registry") | get(key="content") %} -{%- if content is containing(key) %}{{ get(key=key) }}{% else %}{{ default }}{% endif -%} -{% endmacro registry_content %} diff --git a/book/observe/event.tera b/book/observe/event.tera index 4fe946f..f78f5c8 100644 --- a/book/observe/event.tera +++ b/book/observe/event.tera @@ -2,10 +2,6 @@ # {{ macros::model_title(domain="observe", model="event") }} -{% if content %} -{{ content }} -{% else %} Observable items use to detect and respond to threat actor behaviour. -{% endif %} {{ macros::summary_table(items=instances) }} diff --git a/book/react/action.tera b/book/react/action.tera index a34c923..1708941 100644 --- a/book/react/action.tera +++ b/book/react/action.tera @@ -2,10 +2,6 @@ # {{ macros::model_title(domain="react", model="action") }} -{% if content %} -{{ content }} -{% else %} An atomic human action assigned to an response stage. -{% endif %} {{ macros::summary_table(items=instances) }} diff --git a/book/react/stage.tera b/book/react/stage.tera index 90e1b2c..10662f4 100644 --- a/book/react/stage.tera +++ b/book/react/stage.tera @@ -2,10 +2,6 @@ # {{ macros::model_title(domain="react", model="stage") }} -{% if content %} -{{ content }} -{% else %} Phase of a response to observed threat behaviour. -{% endif %} {{ macros::summary_table(items=instances) }} diff --git a/book/source/intelligence.tera b/book/source/intelligence.tera index 98d271c..89c6bc7 100644 --- a/book/source/intelligence.tera +++ b/book/source/intelligence.tera @@ -2,10 +2,6 @@ # {{ macros::model_title(domain="source", model="intelligence") }} -{% if content %} -{{ content }} -{% else %} Feed or result of a query used to satisfy intelligence requirements. -{% endif %} {{ macros::summary_table(items=instances) }} diff --git a/book/source/provider.tera b/book/source/provider.tera index ae7cb91..5d1949a 100644 --- a/book/source/provider.tera +++ b/book/source/provider.tera @@ -2,12 +2,6 @@ # {{ macros::model_title(domain="source", model="provider") }} -{% if content %} -{{ content }} -{% else %} An internal or external supplier of intelligence. -{% endif %} - -{{ macros::registry_content(key="source-provider") }} {{ macros::summary_table(items=instances) }} diff --git a/book/source/requirement.tera b/book/source/requirement.tera index 2db0141..1eb3a3a 100644 --- a/book/source/requirement.tera +++ b/book/source/requirement.tera @@ -2,10 +2,6 @@ # {{ macros::model_title(domain="source", model="requirement") }} -{% if content %} -{{ content }} -{% else %} Collection of intelligence used by actions, detections and mitigations. -{% endif %} {{ macros::summary_table(items=instances) }} diff --git a/registry/config.toml b/registry/config.toml index 7b094ca..5f57a6a 100644 --- a/registry/config.toml +++ b/registry/config.toml @@ -1,5 +1,3 @@ [edit] page = "https://localhost/{{page}}.md" document = "https://localhost/registry/{{domain}}/{{model}}/{{instance}}.md" - -[content] diff --git a/src/registry/mod.rs b/src/registry/mod.rs index 2639478..ed2163a 100644 --- a/src/registry/mod.rs +++ b/src/registry/mod.rs @@ -44,7 +44,8 @@ pub struct EditLinks { #[serde(rename_all = "kebab-case")] pub struct RegistryConfig { pub edit: EditLinks, - pub content: HashMap, + #[serde(default)] + pub additional: HashMap, } fn build_edit_link( diff --git a/src/render/mdbook.rs b/src/render/mdbook.rs index 416420b..200668f 100644 --- a/src/render/mdbook.rs +++ b/src/render/mdbook.rs @@ -169,13 +169,8 @@ impl Engine for MDBookEngine { let summary = Arc::new(summary); let documents = Arc::new(documents); let registry_config = registry.get_config().await?; - register_filters( - &mut templates, - documents.clone(), - registry_config.clone(), - site_url, - ); - render_indexes(&templates, &src, &summary, registry_config).await?; + register_filters(&mut templates, documents.clone(), registry_config, site_url); + render_indexes(&templates, &src, &summary).await?; render_summary(&templates, &src, &summary).await?; render_documents(&templates, &src, documents).await?; } @@ -265,7 +260,6 @@ async fn render_indexes( templates: &Tera, src: &Path, summary: &[SummaryItem], - registry_config: Arc, ) -> Result<(), MDBookEngineError> { let mut last_i = 0; let mut last_item = if let Some(item) = summary.get(0) { @@ -287,11 +281,7 @@ async fn render_indexes( fs::create_dir(&model_dir).await?; } - let content = registry_config - .content - .get(&format!("{}-{}", domain, model)); let mut context = Context::new(); - context.insert("content", &content); context.insert("instances", &summary[last_i..i]); let model_index = model_dir.with_extension("md");