Draft PR updated. Two noteworthy changes:
- .htaccess rules were simplified and cleaned up
- Clarify what FEP authors need to do to make use of the .htaccess rules
In cleaning up the .htaccess rules, some functional changes were made:
- URL hacking with
.html and content negotiation with Accept: text/html used to point to script-generated HTML files with RDFa markup preserved. This has been dropped; these requests now map to the site-generated HTML pages. Unfortunately, these site-generated HTML pages have a few issues that prevent proper RDFa parsing, but maybe these issues can be fixed in the future.
- FEP identifiers regex capture is now more tightly defined to only capture FEP slugs according to our current rules – 4 hexadecimal digits, not arbitrary-length alphanumeric sequences. This was done to fix a bug where the FEP subresource rule was capturing resources that aren’t FEP subresources; for example,
https://fediverse.codeberg.page/fep/final/ is not a FEP.
- The generic catch-all rule no longer points to repo/raw paths. It is now pointing to Codeberg Pages like all the other rules.
I want to discuss the FEP site’s HTML pages and the rendering behavior of the static site generation. Right now, people using make_definitions.py end up in a situation where there are two HTML pages they could be pointing to:
- https://fediverse.codeberg.page/fep/fep/888d/exampleB/ – generated by the static site generator, presumably from the README.md at https://codeberg.org/fediverse/fep/src/branch/main/fep/888d/exampleB/README.md
- https://fediverse.codeberg.page/fep/fep/888d/exampleB/exampleB.html – generated by the definitions script
I’d like to have a single HTML page being served gracefully, but currently the former has some issues. Looking at the source code makes it clear. This is the Markdown currently generated by the definitions script:
# exampleB
URI
: `https://w3id.org/fep/888d/exampleB`
Label
: has example relation B with
Comment
: A property that links to another node on the graph (for example, another object)
Domain
: [SomeType](https://w3id.org/fep/888d/SomeType)
Range
: An object (@id)
Required
: No
Functional
: No
Is defined by
: [FEP-888d](https://w3id.org/fep/888d)
## Examples
Example of a SomeType with properties exampleA, exampleB, exampleC
{
"@context": "https://w3id.org/fep/888d",
"@type": "SomeType",
"exampleA": true,
"exampleB": "https://example.com/some-object",
"exampleC": [1, 1]
}
Which generates this HTML:
<article class="md-content__inner md-typeset">
<h1 id="exampleb">exampleB<a class="headerlink" href="#exampleb" title="Permanent link">¶</a></h1>
<p>URI
: <code>https://w3id.org/fep/888d/exampleB</code></p>
<p>Label
: has example relation B with</p>
<p>Comment
: A property that links to another node on the graph (for example, another object)</p>
<p>Domain
: <a href="https://w3id.org/fep/888d/SomeType">SomeType</a></p>
<p>Range
: An object (@id)</p>
<p>Required
: No</p>
<p>Functional
: No</p>
<p>Is defined by
: <a href="https://w3id.org/fep/888d">FEP-888d</a></p>
<h2 id="examples">Examples<a class="headerlink" href="#examples" title="Permanent link">¶</a></h2>
<p>Example of a SomeType with properties exampleA, exampleB, exampleC</p>
<div class="highlight"><pre id="__code_0"><span></span><code>{
"@context": "https://w3id.org/fep/888d",
"@type": "SomeType",
"exampleA": true,
"exampleB": "https://example.com/some-object",
"exampleC": [1, 1]
}
</code></pre></div></article>
vs:
<!DOCTYPE html>
<html>
<head>
<title>exampleB</title>
</head>
<body>
<section id="exampleB" resource="https://w3id.org/fep/888d/exampleB" typeof="owl:ObjectProperty">
<h1>exampleB</h1>
<dl>
<dt>URI</dt>
<dd><code>https://w3id.org/fep/888d/exampleB</code></dd>
<dt>Label</dt>
<dd lang="en" property="rdfs:label">has example relation B with</dd>
<dt>Comment</dt>
<dd lang="en" property="rdfs:comment">A property that links to another node on the graph (for example, another object)</dd>
<dt>Domain</dt>
<dd><a href="https://w3id.org/fep/888d/SomeType" property="rdfs:domain">SomeType</a></dd>
<dt>Range</dt>
<dd property="rdfs:range" resource="rdfs:Resource">An object (@id)</dd>
<dt>Required</dt>
<dd content="0" datatype="xsd:nonNegativeInteger" property="owl:minCardinality">No</dd>
<dt>Functional</dt>
<dd>No</dd>
<dt>Is defined by</dt>
<dd><a href="https://w3id.org/fep/888d" property="rdfs:isDefinedBy">FEP-888d</a></dd>
</dl>
<pre title="Example of a SomeType with properties exampleA, exampleB, exampleC">
<code>
{
"@context": "https://w3id.org/fep/888d",
"@type": "SomeType",
"exampleA": true,
"exampleB": "https://example.com/some-object",
"exampleC": [1, 1]
}
</code>
</pre>
</section>
</body>
</html>
We note that:
- The
id is forcibly lowercased instead of preserving the case
- The dt/dd structure is lost entirely, indicating that there is no support for the Markdown definition lists extension
I think on my end I can do the following:
- Make
make_definitions.py stop outputting README.md – this was always a hack to make the Codeberg repo viewer show useful information without having to click into a specific term definition format.
- Make
make_definitions.py start outputting HTML that gets served on the FEP site a bit more “natively”… but I’m not sure what exactly needs to go into this. The alternative is to output the “plain-looking” HTML as index.html so something gets served correctly, but it would be nice to have some way of hooking into the themed/generated site so that the headers/navigation/etc are visible.
Question to @silverpill I guess: are you aware of a way to have the static site generator take HTML content as input instead of Markdown content? Otherwise, if there’s no good answer here, I guess we can just live with “plain” HTML term definitions like the ones currently live on pages like https://fediverse.codeberg.page/fep/fep/888d/exampleB/exampleB.html.