remove content feature

This commit is contained in:
avitex 2021-03-04 12:23:44 +11:00
parent 3bc02dcb02
commit 37e469641d
Signed by: avitex
GPG Key ID: 38C76CBF3749D62C
10 changed files with 4 additions and 46 deletions

View File

@ -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 %}

View File

@ -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) }}

View File

@ -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) }}

View File

@ -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) }}

View File

@ -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) }}

View File

@ -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) }}

View File

@ -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) }}

View File

@ -1,5 +1,3 @@
[edit]
page = "https://localhost/{{page}}.md"
document = "https://localhost/registry/{{domain}}/{{model}}/{{instance}}.md"
[content]

View File

@ -44,7 +44,8 @@ pub struct EditLinks {
#[serde(rename_all = "kebab-case")]
pub struct RegistryConfig {
pub edit: EditLinks,
pub content: HashMap<String, String>,
#[serde(default)]
pub additional: HashMap<String, String>,
}
fn build_edit_link(

View File

@ -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<RegistryConfig>,
) -> 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");