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("title", &node.title);
context.insert("body", &node.body);
context.insert("text", &node.text);
context.insert("connections", &node.connections.clone());
context.insert("incoming", &graph.incoming.get(&id));
@ -107,12 +107,12 @@ async fn node_view(Path(id): Path<String>) -> impl IntoResponse {
500,
&format!(
r#"Failed to generate page for node {} (ID {}) with {} outgoing,
{} incoming connections and body "{}""#,
{} incoming connections and text "{}""#,
node.title,
id,
node.connections.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)]
pub struct Node {
pub body: String,
pub text: String,
#[serde(default)] pub title: String,
#[serde(default)] pub links: Vec<String>,
#[serde(default)] pub id: String,
@ -52,7 +52,7 @@ impl Node {
Self {
id: "VoidNode".to_string(),
title: "Pure Void".to_string(),
body: match message {
text: match message {
Some(s) => s,
None => "Node is empty, missing or wasn't found.".to_string()
},

View file

@ -1,33 +1,33 @@
root_node = "Interface"
[nodes.Interface]
body = """
text = """
An interface is a point of contact between the inside and the outside of something. Contrast with intraface.
"""
links = ["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.
"""
links = ["Thinking", "Interface"]
[nodes.Thinking]
body = """
text = """
Thinking is a process by which some beings create and manipulate mental constructs.
"""
[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.
"""
links = [ "Principle", "Belief", "Method", "Position", "Praxis" ]
[nodes.Principle]
body = """
text = """
A principle is a belief that implies commitment and necessity.
Principles change, but to change one's principles too constantly defeats its purpose.
@ -44,7 +44,7 @@ anchor = "identifying"
to = "Identity"
[nodes.Religion]
body = """
text = """
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.
@ -72,7 +72,7 @@ links = [
]
[nodes.Identity]
body = """
text = """
Identity is how individuals construe their sameness and otherness from each other and from nothingness.
"""
@ -83,14 +83,14 @@ anchor = "nothingness"
to = "Emptiness"
[nodes.Emptiness]
body = """
text = """
Emptiness is the vacuous base in which entities exist.
"""
links = [ "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.
"""

View file

@ -6,7 +6,7 @@
<section>
<h1>{{ title }}</h1>
<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 %}
{% endfor %}
</section>

View file

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