,
type: StructureType
) {
- const assumption_string = get_assumption_string(implication, properties_dict)
+ const assumption_string = get_assumption_string(implication, properties_dict, type)
const conclusion_string = get_conclusion_string(implication, properties_dict)
const ref = `by this result`
+
return `Since it ${assumption_string}, it ${conclusion_string} (${ref}).`
}
@@ -57,7 +61,12 @@ export function get_contradiction_string(
property: string,
type: StructureType
) {
- const assumption_string = get_assumption_string(implication, properties_dict, true)
+ const assumption_string = get_assumption_string(
+ implication,
+ properties_dict,
+ type,
+ true
+ )
const conclusion_string = get_conclusion_string(implication, properties_dict, true)
const has_multiple_assumptions =
diff --git a/src/lib/server/fetchers/content.ts b/src/lib/server/fetchers/content.ts
index 5b233684a..ae8204919 100644
--- a/src/lib/server/fetchers/content.ts
+++ b/src/lib/server/fetchers/content.ts
@@ -1,7 +1,9 @@
import type { PropertyShort, StructureShort } from '$lib/commons/types'
import { db } from '$lib/server/db'
-export function fetch_category_references(content_id: string) {
+export function fetch_content_references(content_id: string) {
+ // TODO: make this more systematic
+
const categories = db
.prepare<[string], StructureShort>(
`SELECT DISTINCT s.id, s.name
@@ -12,6 +14,16 @@ export function fetch_category_references(content_id: string) {
)
.all(content_id)
+ const functors = db
+ .prepare<[string], StructureShort>(
+ `SELECT DISTINCT s.id, s.name
+ FROM property_assignments pa
+ INNER JOIN structures s ON s.id = pa.structure_id
+ WHERE pa.type = 'functor'
+ AND pa.proof LIKE '%/content/' || ? || '%'`
+ )
+ .all(content_id)
+
const category_properties = db
.prepare<[string], PropertyShort>(
`SELECT id, relation FROM properties
@@ -28,5 +40,5 @@ export function fetch_category_references(content_id: string) {
)
.all(content_id)
- return { categories, category_properties, category_implications }
+ return { categories, category_properties, category_implications, functors }
}
diff --git a/src/pages/ImplicationPage.svelte b/src/pages/ImplicationPage.svelte
index 57eed8c06..e6c4711d0 100644
--- a/src/pages/ImplicationPage.svelte
+++ b/src/pages/ImplicationPage.svelte
@@ -53,7 +53,7 @@
{/each},
{#if implication.is_equivalence}
it
- {:else}
+ {:else if implication.assumptions.length > 0}
if it
{/if}
{:else if implication.is_equivalence}
@@ -70,7 +70,7 @@
{/each}{#if implication.is_equivalence}
if and only if it
{:else}
- , then it
+ {#if implication.assumptions.length},{/if} then it
{/if}
{#each implication.conclusions as property, index}
{property_relation_dict[type][property]}
diff --git a/src/routes/content/[id]/+page.server.ts b/src/routes/content/[id]/+page.server.ts
index a2c04ead0..76dce2d9c 100644
--- a/src/routes/content/[id]/+page.server.ts
+++ b/src/routes/content/[id]/+page.server.ts
@@ -1,6 +1,6 @@
import { get_rendered_content } from '$lib/server/markdown'
import { error } from '@sveltejs/kit'
-import { fetch_category_references } from '$lib/server/fetchers/content'
+import { fetch_content_references } from '$lib/server/fetchers/content'
export const load = (event) => {
const id = event.params.id
@@ -8,7 +8,7 @@ export const load = (event) => {
const content = get_rendered_content(id)
if (!content) error(404, 'Not Found')
- const category_references = fetch_category_references(id)
+ const references = fetch_content_references(id)
- return { ...content, ...category_references }
+ return { ...content, ...references }
}
diff --git a/src/routes/content/[id]/+page.svelte b/src/routes/content/[id]/+page.svelte
index 3a91d9135..daacc7256 100644
--- a/src/routes/content/[id]/+page.svelte
+++ b/src/routes/content/[id]/+page.svelte
@@ -19,7 +19,9 @@
Authors: {data.meta_data.authors.join(', ')}
{/if}
-{#if data.categories.length > 0 || data.category_properties.length > 0 || data.category_implications.length > 0}
+
+
+{#if data.categories.length > 0 || data.category_properties.length > 0 || data.category_implications.length > 0 || data.functors.length > 0}
Context
{#if data.categories.length > 0}
@@ -47,6 +49,12 @@
{/each}
{/if}
+
+ {#if data.functors.length > 0}
+ This page is referenced by the following functors.
+
+
+ {/if}
{/if}