WebCard specification and design

Now that I entered the RetroChallenge 2024 the next step is to flesh out the scope and details of my WebCard project, a NoteCards extension for visiting websites. What will WebCard do? How will it work?

Specification

In NoteCards the area of a card or filebox that makes up a link icon, when clicked, displays a destination card or filebox. Links typically look like outlined rectangles that contain a bitmap and the title of the destination.

The destination of a WebCard link is a page on the World-Wide Web designated by a URL.

Clicking on a WebCard link icon, which has a custom bitmap, will launch the web browser of the host operating system, if not already running, and direct the browser to visit the URL associated with the WebCard link. WebCard will also display a stand in NoteCards card that shows the URL and title of the web page, advising to view the page itself in the browser. No text, links, or media can be inserted in the stand in card.

Clicking on the same WebCard link more than once will notify that the associated web page may already be displayed in the browser, offering to direct the browser to visit the page again.

Other than that WebCard and NoteCards will have no control over the browser and its tabs and windows, which the user may close or change at any time. Since WebCard is not a WebView it won't render web pages or HTML either.

To add a web link to a hypertext the user will create a card of type Web. WebCard will ask for the destination URL and an optional title and create a stand in card that displays the information. The user will then insert NoteCards links to Web cards with the usual link creation commands and specify an appropriate stand in card as the destination.

WebCard will come with basic documentation and sample notefiles that demonstrate web links.

Design

To implement this functionality WebCard needs a way of opening web pages in a browser and adding clickable web links to a hypertext.

Opening web pages

Opening web pages from Lisp is easy.

As part of the modernization effort the Medley Interlisp team implemented UNIXUTILS, a library of utilities for running Unix programs and controlling processes. The UNIXUTILS function ShellBrowse does exactly what I want: it executes the xdg-open command of the host operating system and passes it a URL to open in the system browser.

As a consequence of this decision the host operating system must support the relevant XDG specification.

As for inserting clickable web links, the design of NoteCards funnels to a natural solution.

In NoteCards, the destination of a link must be a card or filebox. Therefore, for a link to lead to a web site, the link can have as its destination a special card that stands for the associated web URL. Traversing that link triggers the activation of the web browser.

The NoteCards API supports defining new types of cards with custom behavior implemented as a set of standard operations. Since card types are arranged in an inheritance hierarchy, defining a new type often involves overriding just a few operations and letting the system invoke the default behavior of the parent types for the others.

WebCard will define the new card type Web that inherits from the Text card. I expect to override a handful of operations, mostly for card creation and editing.

WebCard needs to activate the browser when a Web card is opened or displayed as a result of traversing a link. But since the API doesn't support overriding or hooking into these operations I'll have to come up with something different, such as advising the default behavior. The advice will direct the browser to visit the URL and pass control to the default behavior to open or display the stand in Web card in NoteCards.

The NoteCards API does allow to override the operation of traversing links to cards. I may augment such a behavior to also control the browser for Web card destinations, which may be easier and cleaner than adivising other operations.

As for editing, WebCard will allow changing only the URL and title of a card but not the content. Aside from that, I hope to get away with skipping the default editing behavior without having to interact with TEdit. It's an indirect way of making the Web card content read only.

Discussion

Along with the supporting functions and data, implementing this functionality should be achievable in one month or less.

WebCard will have little control over a web browser. In addition, web pages will be displayed only in a browser outside of NoteCards. Despite the limitations, I expect WebCard to provide genuinely useful functionality and allow integrating hypertexts with external content.

The design of WebCard is similar to traditional NoteCards extensions. When the system was in active use in the 1980s, some extensions invoked external functionality such as controlling laserdiscs or playing media, or connecting to dial-up databases to perform queries and populate cards with the results.

#WebCard #Interlisp #Lisp

Discuss... Email | Reply @amoroso@fosstodon.org