Wiki Discussion: Unification

It would be nice if we could do something like for lpn. I understood as a hosted discourse site we are limited to (a subset of) the official Discourse plugins though :frowning: Another nice-to-have would be if name/arity for a known SWI-Prolog predicate would directly link to the docs.

1 Like

Can you elaborate on this a bit more or point me to what can an can not be done with the Discourse for SWI-Prolog. While I am aware that plugins can be made, (Ruby on Rails ?) I would prefer not to go that route if possible.

Gets my vote. :heart:

AFAIK we can only use plugins that can simply be activated through the admin interface. We cannot write and upload plugins. If we want that we must self-host the Discourse server, but I’m glad that is all taken care of. I can imagine they do not want user plugins for security and maintenance reasons.


Is there a way we can inject javascript though? The predicate links at least should be doable without having to do anything on the server-side here.

When I first read this I thought it was referring to the old tried and true Learn Prolog Now! site. Then I clicked on the link (lpn) and looked at the example page some more. When I clicked on the gear button in the upper right of a source code example noticed SWISH expanding into the same space with the same code. Now I see what you mean and why you added the note after I noted that iframes work on Discourse.

For others reading this, click on both links to compare the differences then on the newer one, click on the gear icon in the upper right of a source code example; WOW!

The reason I didn’t leave the ability to drop SWISH into Discourse as an iframe active was that the size of the frame was limited by the constraints imposed by Discourse. The timeline on the right eats a good portion of the user space and because they try to cater to people on phones, try to keep the width more narrow.

Definitely like the idea and will purpose it at meta discourse to allow for options to drop iframes that can span the full width of a page. Also checked out installing more plug-ins for this site; to even add one more requires an upgrade ($$$) to business level. The clearly prunes away doing and custom plug-ins. Really didn’t want to have to learn Ruby.

Since this topic can be read by everyone, the ability to modify the JavaScript for the site can only be used by site admins.

Looks like its done via modifying a theme.

See: Beginner’s guide to using Discourse themes

About a half way down it states.

The interface for adding html / css / js looks like this (once you click on #3 above)

After looking into this some more might be able to add plug-ins without an account upgrade, but I can’t tell as I don’t have the access needed, nor do I want it.

See: Install Plugins in Discourse

The plug-in Iframe Lightboxes might be the solution.

AFAIK, we do not have shell access to the server/container.

1 Like


Now knowing that we don’t have access to the server/container looked for another way to see if Iframe Lightboxes could be installed. In checking the source at GitHub noticed in the JSON it is a component, or in Discourse terminology a Theme Component, and it appears we do have the ability to install components and how JavaScript and CSS are added as desired by @jamesnvc. Never would have guessed that theme is the keyword to use for finding out how to modify Discourse without low level access.

While I would like to test the Iframe lightboxes theme component here I am hesitant as this is a live site and I don’t want to make this change without first checking with you as it would require more than just changing an option. An alternative path for me to check this would be to download and install Discourse as a Docker container and try it, but wouldn’t be able to get to it for some time.

In looking further found a site for developing Discourse theme-components that also lets you install existing ones including Iframe lightboxes.


From: Tokenize_atom equivalent that forces everything to lowercase atoms?

SWI-Prolog’s native Unicode handling is incomplete. It can merely pass on Unicode code points (on Windows limited to 16 bits) and do simple one-character classification and case folding. The SWI-Prolog Unicode library provides more advanced features.

This might be of use.

An example related to this topic might be of use.

Need to consider if meta_predicate/1 needs to be added to this topic, e.g. unify_meta_argument