Something of note as I am leaning about Discourse that might be of help, a curse, etc.
The text for a post is stored in a PostgreSQL database in a table named
posts. There are however two fields that hold the text for a post,
raw appears to hold the text as entered and
cooked also appears to hold all of the text with changes. Please don’t ask me why, when they are used, how they are created, what is the difference at this point.
The URL for a normal post such as Use Prolog References
but one can also get the raw using
Discourse API Documentation
$ curl https://www.swi-prolog.org/doc_link?for=<predicate_indicator>
What if you had two modules with the same predicate indicator? Would it return a json array with the two predicates?
That is not handled now (you get the first answer). It is needed for only a couple of cases, but should probably be added at some point. This was a quick hack in between that should be enough to play with the idea.
Okay! That was a little annoying, but I’ve made a little component theme that’s active now that should automatically format valid links; e.g. member/2, memberchk/2, integer//1, but not not_a_predicate/2.
EDIT: disabled while I try to figure out this issue
Hm…but looking at this now, there seem to be maybe a race condition, since the checking happens asynchronously; some more investigation will be required
Okay, did some refactoring, it seems to be somewhat working now…please let me know if you see any issues!
How can we set the theme? I looked in Profile -> interface but it doesn’t show a new theme.
It’s a component that’s been added to the existing themes. I think if you refresh, it should be active if you’re using the Light or Dark theme (Eric was saying that it doesn’t apply to the Default theme, so that might not work).
Okay, let’s see if member/2 works. I am using the light theme.
EDIT: I did a refresh before posting this, so I guess it is not working. SWI-Prolog works fine.
Shows up as a link for me
There are what I call two types of themes, primary themes that a user selects and component themes that can be included in a primary theme.
What James is doing is to take the exiting component theme and enhance it. Then the component theme is manually included in selected primary themes. If the component theme is included in all the themes then everyone gets the ability of the component theme by default.
As I write this I see that James did add the enhanced component theme to both the
Light and the
Neutral primary themes but the earlier component theme needs to be removed.
Give me a few to work with James on this.
Do you mean the member/2 in my post shows up as a link for you? It doesn’t on mine.
I see, I switched to the Neutral theme and it works. I’ll wait 'till you add it to the Light theme
I put a second pair of eyes on the change, the component theme (discourse-linkify-prolog-predicates) is included in
Default theme no longer exist as a primary theme that can be selected by users. When I did this the option to select
I just did a quick check and the component theme James added is working on multiple themes, retains the basic functionality of Linkify words in post now has the ablity to link to SWI-Prolog documentation when predicate indicators are used.
Nice job James.
I switched back to the Light theme and it doesn’t work; but it worked on the Dark theme (and also the Neutral).
I see it, checking it out.
I removed the older component theme that is no longer needed and expected to see three primary themes each with three component themes, but the
Light theme is only showing two, but in checking the settings it is showing three.
Can you also check to see if the Neutral has the same problem? I think Neutral was not really working. Definitely the Dark theme is working though. Good work James.
@EricGT, the Light is working now! Good job both of you. Thanks!
EDIT: I did have to refresh after changing the theme to light. But it is working great!
Not yet, we lost the ability to link for words in the link table like
I am creating a test page for all the things that should work so I don’t have to keep hunting around for test cases.
I created Post for testing installed component themes and had to include the component theme Linkify words in post to get all of the test to work. Does Auto linkify Prolog predicates extend Linkify words in post? If so then there may be a bug, it not then all works as expected.