-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a mdbook #concept
macro
#884
Add a mdbook #concept
macro
#884
Conversation
Example of the generated concept index: [
{
"name": "acyclic undirected graph",
"text": "acyclic undirected graph",
"wikidata": "Q3115453",
"link": "graph-theory.acyclic-undirected-graphs.html#Q3115453"
},
{
"name": "circuit",
"text": "circuit",
"wikidata": "Q245595",
"link": "graph-theory.circuits-undirected-graphs.html#Q245595"
},
{
"name": "cocone under a span",
"text": "cocone under a [span](foundation.spans.md)"
}
] |
Can you make it so that “NA” is an accepted wikidata identifier? This way we can record somewhere that we checked for it and didn’t find any suitable identifier. Perhaps in some cases we also want to provide secondary identifiers. |
Sure |
Why write |
Is this PR ready to be merged, or did you want to work on it some more? |
Oh right - I'd like to also generate the link in |
Alright! Take your time. I won’t be able to put much work in today, because I’m getting ready for my trip to Pittsburgh. I’m flying at 6am tomorrow. |
d5a7a37
to
1afe75c
Compare
I'd like to bikeshed the way we should present the information - I included everything I can do in the attached screenshot: the source page starts with A {{#concept "circuit" Agda=circuit-Undirected-Graph WD="Cycle" WDID=Q245595}} in an ... The metadata represent:
It produces the following entry in {
"name": "circuit",
"text": "circuit",
"wikidata": "Q245595",
"link": "graph-theory.circuits-undirected-graphs.html#Q245595",
"definition": "graph-theory.circuits-undirected-graphs.html#1010"
}, and automatically generates
I personally think that we shouldn't show everything; I'd keep only the |
To record the discussion from the Discord - the The current implementation accepts |
With the latest revision, all concepts get an identifier, and it's assigned in a way to maximize stability across changes; however it's still expected that the id of an entry will change from time to time. The current index looks like this: [
{
"name": "acyclic undirected graph",
"text": "acyclic undirected graph",
"wikidata": "Q3115453",
"link": "graph-theory.acyclic-undirected-graphs.html#Q3115453",
"id": "graph-theory.acyclic-undirected-graphs.html#Q3115453"
},
{
"name": "circuit",
"text": "circuit",
"wikidata": "Q245595",
"definition": "graph-theory.circuits-undirected-graphs.html#1010",
"link": "graph-theory.circuits-undirected-graphs.html#concept-circuit-Undirected-Graph",
"id": "graph-theory.circuits-undirected-graphs.html#concept-circuit-Undirected-Graph"
},
{
"name": "cocone under a span",
"text": "cocone under a [span](foundation.spans.md)",
"link": "synthetic-homotopy-theory.cocones-under-spans.html#concept-cocone-under-a-span",
"id": "synthetic-homotopy-theory.cocones-under-spans.html#concept-cocone-under-a-span"
}
] The fields |
I suspect the |
This might be a misunderstanding - the |
@andrejbauer is there anything else I can do at the moment? I think we can merge this implementation and come back if it turns out that we need to change something. I won't be adding docs since it's still an experiment. |
7eac543
to
3df8e29
Compare
This is a pretty low-impact PR, so if there aren't any immediate objections from @EgbertRijke or @fredrik-bakke I'll merge it so that Katja has something to work with. |
Should I begin using this macro in my contributions? If so, how? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a quick look, and I don't have any objections.
That wasn't my intention for now, the two examples included in this PR are apparently enough. I'd say the macro is still experimental and subject to change, since it's not completely clear what information we want to provide. That's also why I didn't add anything to the contributors guide. |
Usage:
The {{#concept "concept name" Agda=concept-definition WDID=wikidata-id WD="Foobar"}} is a foobar over quxs.
; the Agda, WDID and WD fields are optional.OLD INFORMATION, see #884 (comment) for latest implementation.
Currently it generates an invisible anchor so that we can get a link to that part of the webpage by appending
#wikidata-id
to the URL, and makes the text bold. The text isn't a link to anything and we don't want it to be, because it can itself contain a link (e.g. cocones over spans, where spans is a link), and nested links aren't valid HTML.The anchor is only generated when a wikidata ID is provided.
Scrapers can get all concepts defined on the webpage by querying for the
a.wikidata
selector.Additionally the preprocessor also generates a
concept_index.json
file, which contains information about all concepts in the library. It's an array of objects which look like this:The
wikidata
andlink
fields are optional, since we want to be able to use this macro also for concepts without a WD id, for consistency.