Encoding accented characters for readable URL path

Open
#1,048 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active

Research direction

Read the Verso literate-programming documentation for the url module setting and inspect the example Goedel1.lean module declaration. Trace how titles and configured URLs become path components, then determine whether authors can manually override the slug. Done means the URL-generation behavior and configuration path are clear, with the relevant documentation or source location identified.

Written by the indexing model from the issue text.

Description

This is only an idea/suggestion that came to mind.

There is a website at FormalizedFormalLogic/Catalogue (source) that uses verso and one of the pages has the following link.

https://formalizedformallogic.org/Catalogue/Arithmetic/G___del___s-First-Incompleteness-Theorem/

The page title is Gödel's First Incompleteness Theorem.

I thought it'd be more user-friendly if that accented character ö was converted to oe instead, for the link to have a human-readable path.

Goedel___s-First-Incompleteness-Theorem

Perhaps there are too many language variations for how these special characters can be converted and pronounced. There is no standard algorithm/table for normalizing them, I suppose.

ICAO Doc 9303, which governs machine-readable travel documents like passports. Because passports must use a limited set of Latin characters, ICAO (International Civil Aviation Organization) defines a standard way to transliterate accented characters.

For German, this follows the convention of replacing umlauts with their corresponding vowel-e combinations.

Right, the rules are specific to each language, that makes sense.


Maybe it's possible to provide the author/user with a way to define the page "slug" manually, to override the default automatic encoding. Seems this feature may already exist.

https://verso.lean-lang.org/doc/latest/Literate-Programming/#literate-per-module

[modules."MyLib.Core.Basic"]
title = "Getting Started"
url = "getting-started"

A similar section in the source of the example site:

#doc (Manual) "Gödel's First Incompleteness Theorem" =>
%%%
tag := "goedel-1"
%%%

https://github.com/FormalizedFormalLogic/Catalogue/blob/4b74770dd0b3a61c2ddc08ae869b70435688562f/Catalogue/Arithmetic/Goedel1.lean#L13-L16


A related idea is to use URL-component encoding like %20.

https://en.wikipedia.org/wiki/Percent-encoding

Then the example path would become:

G%C3%B6del's-First-Incompleteness-Theorem

That's not any better or aesthetic than using _ (underscore), other than it's a more common way to encode the page title.

An advantage could be, when saving the link as a bookmark, or exporting the page as PDF file. Though I think the browser uses the <title> tag in the HTML document for that, not from the URL.


Edit: Found a related issue:

  • #960

And the current logic to slugify page titles.

https://github.com/leanprover/verso/blob/d0a5f92ee585a92d2cd4c4904469c123f5ae5f10/src/verso-blog/VersoBlog/Basic.lean#L211-L217

Dominant language
Lean
Stars
420
Forks
134
Avg merge
1d 9m
Merged PRs (30d)
46

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from leanprover/verso

All issues in leanprover/verso

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.