Skip to content

Commit

Permalink
Ignore new <span class="button-group"> elements
Browse files Browse the repository at this point in the history
These use "link" and "i" emoticons that...

(a) render as \nnn byte strings, because we're using
insert-file-contents-literally, and I don't have time now to figure
out why we use that instead of insert-file-contents, and how to use
the latter for encoding while avoiding whatever other behavior we
wanted to avoid.

(b) in a browser only show when the user hovers with the mouse, but in
our case would appear always, after every main section heading, which
is nosiy.

Someday/maybe we should figure out a way to present the hidden
information -- a "link here" URL, as well as the scribble source doc
URL on GitHub -- that's appropriate for our UX. And then deal with the
various ways this has been presented in Scribble HTML over time.
  • Loading branch information
greghendershott committed Nov 15, 2023
1 parent 216d297 commit a745a92
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions racket-scribble.el
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,18 @@ In some cases we resort to returning custom elements for
(`(a ((name . ,name)) . ,xs)
`(racket-anchor ((name . ,name)) . ,xs))

;; Ignore new <span class="button-group"> elements.
(`(span ((class . "button-group")) . ,_)
`(span))

;; Replace <a> with <racket-doc-link> or <racket-ext-link>. The
;; former are links to follow using racket-describe-mode, the
;; latter using browse-url (a general-purpose, probably external
;; web browser).
(`(a ,_ . ,xs)
(pcase (dom-attr dom 'href)
;; No href.
(`() `(span () ,@(mapcar #'racket--walk-dom xs)))
;; Handle "local-redirect" links. Scribble writes these as
;; external links, and generates doc/local-redirect.js to
;; adjust these on page load. Partially mimic that js here.
Expand Down

2 comments on commit a745a92

@sorawee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry, should have let you know when I made the change.

@greghendershott
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries; that comes with the territory of doing what is essentially web scraping, and not always doing it super well.

It was weird timing tho:

  • I had just wiped Ubuntu and installed Debian on my laptop.
  • Realized I needed to rebuild Racket from source, due to shared library version change. That build fetched an updated package with your change.
  • I was getting used to some changes in Emacs 28.2.
  • I was investigating a bug report about line-number modes affecting the Racket Describe buffer, despite having taken measures to prevent this.

So it was a perfect storm of me wondering for N minutes, what even is happening. Where N was double digits. :)

Please sign in to comment.