Rename Node's body field to "text"

This commit is contained in:
Juno Takano 2025-12-10 10:25:32 -03:00
commit 32ea0f93c3
5 changed files with 23 additions and 22 deletions

View file

@ -97,7 +97,7 @@ async fn node_view(Path(id): Path<String>) -> impl IntoResponse {
context.insert("id", &id); context.insert("id", &id);
context.insert("title", &node.title); context.insert("title", &node.title);
context.insert("body", &node.body); context.insert("text", &node.text);
context.insert("connections", &node.connections.clone()); context.insert("connections", &node.connections.clone());
context.insert("incoming", &graph.incoming.get(&id)); context.insert("incoming", &graph.incoming.get(&id));
@ -107,12 +107,12 @@ async fn node_view(Path(id): Path<String>) -> impl IntoResponse {
500, 500,
&format!( &format!(
r#"Failed to generate page for node {} (ID {}) with {} outgoing, r#"Failed to generate page for node {} (ID {}) with {} outgoing,
{} incoming connections and body "{}""#, {} incoming connections and text "{}""#,
node.title, node.title,
id, id,
node.connections.iter().len(), node.connections.iter().len(),
graph.incoming.get(&id).iter().len(), graph.incoming.get(&id).iter().len(),
node.body, node.text,
), ),
) )
} }

View file

@ -11,7 +11,7 @@ pub struct Graph {
#[derive(Serialize, Deserialize, Clone, Default, Debug)] #[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct Node { pub struct Node {
pub body: String, pub text: String,
#[serde(default)] pub title: String, #[serde(default)] pub title: String,
#[serde(default)] pub links: Vec<String>, #[serde(default)] pub links: Vec<String>,
#[serde(default)] pub id: String, #[serde(default)] pub id: String,
@ -52,7 +52,7 @@ impl Node {
Self { Self {
id: "VoidNode".to_string(), id: "VoidNode".to_string(),
title: "Pure Void".to_string(), title: "Pure Void".to_string(),
body: match message { text: match message {
Some(s) => s, Some(s) => s,
None => "Node is empty, missing or wasn't found.".to_string() None => "Node is empty, missing or wasn't found.".to_string()
}, },

View file

@ -1,33 +1,33 @@
root_node = "Interface" root_node = "Interface"
[nodes.Interface] [nodes.Interface]
body = """ text = """
An interface is a point of contact between the inside and the outside of something. Contrast with intraface. An interface is a point of contact between the inside and the outside of something. Contrast with intraface.
""" """
links = ["Intraface"] links = ["Intraface"]
[nodes.Intraface] [nodes.Intraface]
body = """ text = """
The intraface is the reflexive process of communicating, creating, thinking, that does not or cannot get shared with others. Contrast with interface. The intraface is the reflexive process of communicating, creating, thinking, that does not or cannot get shared with others. Contrast with interface.
""" """
links = ["Thinking", "Interface"] links = ["Thinking", "Interface"]
[nodes.Thinking] [nodes.Thinking]
body = """ text = """
Thinking is a process by which some beings create and manipulate mental constructs. Thinking is a process by which some beings create and manipulate mental constructs.
""" """
[nodes.Paradigm] [nodes.Paradigm]
body = """ text = """
A paradigm is a cohesive set of beliefs, methods and principles that serve both as justification for a given position and as guidance for how to pursue its praxis. A paradigm is a cohesive set of beliefs, methods and principles that serve both as justification for a given position and as guidance for how to pursue its praxis.
""" """
links = [ "Principle", "Belief", "Method", "Position", "Praxis" ] links = [ "Principle", "Belief", "Method", "Position", "Praxis" ]
[nodes.Principle] [nodes.Principle]
body = """ text = """
A principle is a belief that implies commitment and necessity. A principle is a belief that implies commitment and necessity.
Principles change, but to change one's principles too constantly defeats its purpose. Principles change, but to change one's principles too constantly defeats its purpose.
@ -44,7 +44,7 @@ anchor = "identifying"
to = "Identity" to = "Identity"
[nodes.Religion] [nodes.Religion]
body = """ text = """
A religion is a paradigm that involves unfalsifiable beliefs, particularly those in the domain of morality. A religion is a paradigm that involves unfalsifiable beliefs, particularly those in the domain of morality.
A reductive critique of religion dismisses it based on its dogmatic adherence to certain beliefs usually rooted in tradition. A reductive critique of religion dismisses it based on its dogmatic adherence to certain beliefs usually rooted in tradition.
@ -72,7 +72,7 @@ links = [
] ]
[nodes.Identity] [nodes.Identity]
body = """ text = """
Identity is how individuals construe their sameness and otherness from each other and from nothingness. Identity is how individuals construe their sameness and otherness from each other and from nothingness.
""" """
@ -83,14 +83,14 @@ anchor = "nothingness"
to = "Emptiness" to = "Emptiness"
[nodes.Emptiness] [nodes.Emptiness]
body = """ text = """
Emptiness is the vacuous base in which entities exist. Emptiness is the vacuous base in which entities exist.
""" """
links = [ "Entity" ] links = [ "Entity" ]
[nodes.Entity] [nodes.Entity]
body = """ text = """
An entity is anything except for actual emptiness. It does not have to be sentient, or physical. It can be an idea, a concept, a memory. The concept of emptiness is an entity, but emptiness itself is not. An entity is anything except for actual emptiness. It does not have to be sentient, or physical. It can be an idea, a concept, a memory. The concept of emptiness is an entity, but emptiness itself is not.
""" """

View file

@ -6,7 +6,7 @@
<section> <section>
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
<code style="display: inline;">ID: {{ id }}</code> <code style="display: inline;">ID: {{ id }}</code>
{% for line in body | split(pat="\n") %} {% for line in text | split(pat="\n") %}
{% if line %} <p>{{ line }}</p> {% endif %} {% if line %} <p>{{ line }}</p> {% endif %}
{% endfor %} {% endfor %}
</section> </section>

View file

@ -13,14 +13,14 @@
<li> <li>
<a href="/node/{{root_node.id}}">{{root_node.title}}</a> <a href="/node/{{root_node.id}}">{{root_node.title}}</a>
<ul> <ul>
<li><strong>Body:</strong> <li><strong>Text:</strong>
<ul style="display: inline; padding-left: 0;"> <ul style="display: inline; padding-left: 0;">
<li style="display: inline;"> <li style="display: inline;">
<details style="display: inline; cursor: pointer;"> <details style="display: inline; cursor: pointer;">
<summary style="display: inline;"> <summary style="display: inline;">
{{root_node.body | truncate(length=120)}} {{root_node.text | truncate(length=120)}}
</summary> </summary>
{{root_node.body}} {{root_node.text}}
</details> </details>
</li> </li>
</ul> </ul>
@ -36,8 +36,8 @@
</ul> </ul>
</li> </li>
</ul> </ul>
{% endif %} {% endif %}
{% if nodes %} {% if nodes %}
<h2>All nodes</h2> <h2>All nodes</h2>
<ul> <ul>
@ -45,14 +45,14 @@
<li> <li>
<a href="/node/{{node.id}}">{{node.title}}</a> <a href="/node/{{node.id}}">{{node.title}}</a>
<ul> <ul>
<li><strong>Body:</strong> <li><strong>Text:</strong>
<ul style="display: inline; padding-left: 0;"> <ul style="display: inline; padding-left: 0;">
<li style="display: inline;"> <li style="display: inline;">
<details style="display: inline; cursor: pointer;"> <details style="display: inline; cursor: pointer;">
<summary style="display: inline;"> <summary style="display: inline;">
{{node.body | truncate(length=30)}} {{node.text | truncate(length=30)}}
</summary> </summary>
{{node.body}} {{node.text}}
</details> </details>
</li> </li>
</ul> </ul>
@ -72,6 +72,7 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</ul> </ul>
{% else %} {% else %}
{% include "empty.html" %} {% include "empty.html" %}
{% endif %} {% endif %}