1 API

The API reference for lenkesamler: 15 modules and 48 exported names, generated from the source and the docstrings in it. They are 29 procedures, 15 macros, 3 record types and 1 variable. Every module has a section of its own and every name links to its definition; the index filters all of them.

How to read this reference

  1. Every module has a section of its own; open it in the index, or with the menu button on a phone.
  2. A module section opens with its exported names and a one-line summary of each. Follow a name to its definition, where its signature, its category and the docstring sit together.
  3. To find a name across the whole API, press / and type in the index filter.

A generated chapter

This chapter is generated from the source and the docstrings beside it. To correct a definition, change the source or its docstring and rebuild the manual; an edit to this page is lost.


1.1 (lenkesamler checker)

1.1.1 Overview

  • check-detail — An undocumented macro.
  • check-status — An undocumented macro.
  • check-url — An undocumented macro.
  • link-check? — An undocumented macro.
  • check-bookmarks — A reading of every link BOOKMARKS holds, each address read once.
  • check-link — The reading of URL, as the check PROBE makes of it.
  • check-report — CHECKS as the report of a run, one line per link and a count of them.
  • checks-failed? — Whether a run of these CHECKS is a failure: a refusal or no answer at all.
  • http-probe — The status URL answers with, and the address it leads to instead, if any.
  • web-address? — Whether ADDRESS is one a web server answers, which only http and https are.
  • link-check — A record type.

1.1.2 Macros

Macro: check-detail x

Undocumented macro.

Macro: check-status x

Undocumented macro.

Macro: check-url x

Undocumented macro.

Undocumented macro.

1.1.3 Procedures

Procedure: check-bookmarks bookmarks KEY: #:probe

A reading of every link BOOKMARKS holds, each address read once.

The reading is in the order the file holds the links, and an address written twice – two folders holding the same page, which is how a bookmarks file of a person’s usually goes – is read once and reported once.

The reading of URL, as the check PROBE makes of it.

Procedure: check-report checks

CHECKS as the report of a run, one line per link and a count of them.

Procedure: checks-failed? checks

Whether a run of these CHECKS is a failure: a refusal or no answer at all.

Procedure: http-probe url

The status URL answers with, and the address it leads to instead, if any.

A HEAD request is asked first; a server that answers 405 or 501 does not know that request and is asked for the page itself. The answer is ‘(CODE . LOCATION)’ with LOCATION ‘#f’ when the answer was not a redirect. A server that cannot be reached at all raises, which ‘check-link’ reports as no answer.

Procedure: web-address? address

Whether ADDRESS is one a web server answers, which only http and https are.

An address written without a scheme is read as one, because that is how ‘url-string-with-protocol’ hands it over: ‘codeberg.org/jjba23’ is a page.

1.1.4 Record Types

This record type has 3 fields: url, status, detail.


1.2 (lenkesamler html)

1.2.1 Overview

1.2.2 Procedures

Procedure: string->escaped-xml str port

Undocumented procedure.

Procedure: sxml->string sxml

Detag an sxml tree sxml into a string. Does not perform any formatting.

Procedure: sxml->xml tree OPT: port escape?

Serialize the sxml tree tree as XML. The output will be written to the current output port, unless the optional argument port is present.


1.3 (lenkesamler importer)

1.3.1 Overview

1.3.2 Procedures

Procedure: bookmarks-of-import-text text

TEXT, a bookmarks file that came from somewhere else, as the bookmarks it holds.

A JSON document of this project’s own is read as JSON, and anything else is read as the file a browser exports.


1.4 (lenkesamler importer json)

1.4.1 Overview

  • parse-json-bookmarks — TEXT, a bookmarks document of this project’s JSON, as the bookmarks it holds.

1.4.2 Procedures

Procedure: parse-json-bookmarks text

TEXT, a bookmarks document of this project’s JSON, as the bookmarks it holds.


1.5 (lenkesamler importer netscape)

1.5.1 Overview

1.5.2 Procedures

Procedure: parse-netscape-bookmarks text

TEXT, the bookmarks file a browser wrote, as the bookmarks it holds.

The answer is a list of ‘dir’ and ‘url’ records – the same records a bookmarks file is written in – so a file a browser wrote can be rendered in every mode this program has, a bookmarks file included.

A file that ends in the middle of a folder – a download that stopped, a file somebody edited – is read as far as it goes: the lists still open at the end of the text are closed there, so the folders that were written are the folders that come out.


1.6 (lenkesamler main)

What one run of lenkesamler does.

A run reads exactly one file: this project’s own bookmarks DSL, or a file a browser exported, which is a migration rather than a rendering and yields the DSL’s own mode. The bookmarks that come out are either checked – every link asked for, and a dead one makes the run exit 1 so a pipeline hears about it – or rendered through the renderer the mode names. Either way the result is one document, written to the file a run named or to the standard output, and the report of the run goes to the error port so that a redirected output holds the document and nothing else.

Mermaid diagram, as source:

flowchart LR
  file["bookmarks file<br/>(the Scheme DSL)"] --> load["bookmarks-of-file"]
  browser["a browser's export"] --> import["bookmarks-of-import"]
  load --> bookmarks["bookmarks"]
  import --> bookmarks
  bookmarks --> check{"--check?"}
  check -- yes --> report["check-bookmarks<br/>and check-report"]
  check -- no --> render["render-bookmarks<br/>one renderer per mode"]
  report --> emit["emit"]
  render --> emit
  emit --> out["--destination file<br/>or standard output"]
%% dokgen-mermaid

1.6.1 Overview

1.6.2 Procedures

Procedure: main KEY: #:args

Undocumented procedure.

Procedure: render-bookmarks bookmarks mode

The document MODE asks for, rendered from BOOKMARKS.

The document is the whole output of a run, so it is also the whole of what a destination file holds: nothing is written to a port here.

Procedure: write-document document destination

Write DOCUMENT to the file DESTINATION, making its directory if needed.

1.6.3 Variables

Variable: bookmark-modes
(cli csv json org markdown md commonmark netscape browser web scheme scm xbel)

1.7 (lenkesamler prelude)

1.7.1 Overview

1.7.2 Macros

Macro: dir-items x

Undocumented macro.

Macro: dir-name x

Undocumented macro.

Macro: dir-record? x

Undocumented macro.

Macro: get-setting x

Get a setting for lenkesamler.

Macro: make-dir x

Undocumented macro.

Macro: make-url x

Undocumented macro.

Macro: url-added x

Undocumented macro.

Undocumented macro.

Macro: url-name x

Undocumented macro.

Macro: url-record? x

Undocumented macro.

Macro: url-tags x

Undocumented macro.

1.7.3 Procedures

Procedure: dir name . urls

Undocumented procedure.

Procedure: flatten x

Undocumented procedure.

Procedure: url link KEY: #:name #:added #:tags

Undocumented procedure.

Procedure: url-string-with-protocol x KEY: #:fallback-protocol

X as a URL a browser can follow.

A link written without a scheme – which is how most of a bookmarks file is written, ‘codeberg.org/jjba23’ – is reached over FALLBACK-PROTOCOL. A link that already names its own scheme keeps it, whatever the scheme is: a ‘mailto:’ address and an ‘ftp:’ archive are as much bookmarks as a web page.

Procedure: ymd-date-to-epoch date

Undocumented procedure.

Procedure: ~ . args

Undocumented procedure.

1.7.4 Record Types

Record type: dir-record

This record type has 2 fields: name, urls.

Record type: url-record

This record type has 4 fields: link, name, added, tags.


1.8 (lenkesamler renderer cli)

1.8.1 Overview

1.8.2 Procedures

Procedure: cli-bookmark-renderer xs KEY: #:indent

Undocumented procedure.


1.9 (lenkesamler renderer csv)

1.9.1 Overview

1.9.2 Procedures

Procedure: csv-bookmark-renderer xs

XS as a comma-separated document, one row per link, with a header row.


1.10 (lenkesamler renderer json)

1.10.1 Overview

1.10.2 Procedures

Procedure: json-bookmark-renderer xs

Undocumented procedure.


1.11 (lenkesamler renderer markdown)

1.11.1 Overview

1.11.2 Procedures

Procedure: markdown-bookmark-renderer xs KEY: #:indent

Undocumented procedure.


1.12 (lenkesamler renderer netscape)

1.12.1 Overview

1.12.2 Procedures

Procedure: netscape-bookmark-renderer xs

Undocumented procedure.


1.13 (lenkesamler renderer org)

1.13.1 Overview

1.13.2 Procedures

Procedure: org-bookmark-renderer xs KEY: #:indent

Undocumented procedure.


1.14 (lenkesamler renderer scheme)

1.14.1 Overview

1.14.2 Procedures

Procedure: scheme-bookmark-renderer xs

XS as the source of a bookmarks file: the module the README documents.

An empty file is still a file: it is written with an empty list, so reading it gives no bookmarks rather than an error.


1.15 (lenkesamler renderer xbel)

1.15.1 Overview

1.15.2 Procedures

Procedure: xbel-bookmark-renderer xs

XS as an XBEL document.