Switch HTML doctype to 4.01 Transitional, update documentation

Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@48 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
yakumo.izuru 2023-10-18 21:49:13 +00:00
parent 74cba5ef91
commit 491c581d56
19 changed files with 208 additions and 57 deletions

View File

@ -3,6 +3,9 @@ MACHINE=`uname -m`
DATE=`date -r _build/default/cli/txt.exe +%Y%m%d` DATE=`date -r _build/default/cli/txt.exe +%Y%m%d`
COMMIT=`git rev-parse --short HEAD` COMMIT=`git rev-parse --short HEAD`
CC=cc
LD=cc
all: all:
dune build dune build
@ -16,7 +19,6 @@ clean:
dune clean dune clean
dist: dist:
dune subst
dune build dune build
cp _build/default/cli/txt.exe txt.exe cp _build/default/cli/txt.exe txt.exe
strip txt.exe strip txt.exe

16
README.md Normal file
View File

@ -0,0 +1,16 @@
# Logarion
Text archival and exchange.
## Contact
* [Mailing list](https://lists.tildeverse.org/postorius/lists/logarion.lists.tildeverse.org/)
## References
* [Building from source](https://logarion.chaotic.ninja/9egbae.htm)
* [Creating texts & publishing on the net](https://logarion.chaotic.ninja/hvhhwf.htm)
* [Exploring & pulling texts from Logarion repositories](https://logarion.chaotic.ninja/3sqd84.htm)
* [Header format](https://logarion.chaotic.ninja/d41e68.htm)
* [Txt uniform resource names](https://logarion.chaotic.ninja/h1a9tg.htm)
## Maintainers
* orbifx (original author, former maintainer)
* Izuru Yakumo (contributor, current maintainer)

View File

@ -27,13 +27,12 @@ let wrap conv htm text_title body =
then "feed.atom" else "" in then "feed.atom" else "" in
let header = match htm.templates.header with let header = match htm.templates.header with
| Some x -> replace x | Some x -> replace x
| None -> Printf.(sprintf "<header><a href='.'>%s</a>%s</header>" site_title | None -> Printf.(sprintf "<a href='.'>%s</a>%s" site_title
(if feed <> "" then sprintf "<nav><a href='%s' id='feed'>feed</a></nav>" feed else "")) (if feed <> "" then sprintf "<a href='%s' id='feed'>feed</a>" feed else ""))
in in
let footer = match htm.templates.footer with None -> "" | Some x -> replace x in let footer = match htm.templates.footer with None -> "" | Some x -> replace x in
Printf.sprintf "<!DOCTYPE HTML><html><head><title>%s%s</title>\n%s\n%s\ Printf.sprintf "<!DOCTYPE HTML PUBLIC \"//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><title>%s%s</title>\n%s\n%s\
<meta charset='utf-8'/><meta name='viewport' content='width=device-width, initial-scale=1.0'>\ <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\"></head><body>\n%s%s%s</body></html>"
</head><body>\n%s%s%s</body></html>"
text_title (if site_title <> "" then ("" ^ site_title) else "") text_title (if site_title <> "" then ("" ^ site_title) else "")
htm.style htm.style
(if feed <> "" then Printf.sprintf "<link rel='alternate' href='%s' type='application/atom+xml'>" feed else "") (if feed <> "" then Printf.sprintf "<link rel='alternate' href='%s' type='application/atom+xml'>" feed else "")
@ -62,7 +61,7 @@ let page htm conversion text =
(* let author acc auth = sep_append acc Person.(auth.name ^ " ") in*) (* let author acc auth = sep_append acc Person.(auth.name ^ " ") in*)
let authors = Person.Set.to_string text.authors in let authors = Person.Set.to_string text.authors in
let header = let header =
let time x = Printf.sprintf {|<time datetime="%s">%s</time>|} let time x = Printf.sprintf {|<span class="%s">%s</span>|}
(Date.rfc_string x) (Date.pretty_date x) in (Date.rfc_string x) (Date.pretty_date x) in
let topic_links x = let topic_links x =
let to_linked t a = let to_linked t a =
@ -79,7 +78,7 @@ let page htm conversion text =
with Not_found -> Rel.empty in with Not_found -> Rel.empty in
ref_links ref_set, ref_links rep_set ref_links ref_set, ref_links rep_set
in in
"<article><header><dl>" "<dl>"
^ opt_kv "Title:" text.title ^ opt_kv "Title:" text.title
^ opt_kv "Authors:" authors ^ opt_kv "Authors:" authors
^ opt_kv "Date:" (time (Date.listing text.date)) ^ opt_kv "Date:" (time (Date.listing text.date))
@ -90,8 +89,8 @@ let page htm conversion text =
^ opt_kv "In reply to:" (ref_links (set "in-reply-to" text)) ^ opt_kv "In reply to:" (ref_links (set "in-reply-to" text))
^ opt_kv "Referred by:" references ^ opt_kv "Referred by:" references
^ opt_kv "Replies:" replies ^ opt_kv "Replies:" replies
^ {|</dl></header><pre style="white-space:pre-wrap">|} in ^ {|</dl><pre style="white-space:pre-wrap">|} in
wrap conversion htm text.title ((T.of_string text.body header) ^ "</pre></article>") wrap conversion htm text.title ((T.of_string text.body header) ^ "</pre>")
let to_dated_links ?(limit) meta_list = let to_dated_links ?(limit) meta_list =
let meta_list = match limit with let meta_list = match limit with
@ -115,9 +114,9 @@ let date_index ?(limit) conv htm meta_list =
let fold_topic_roots topic_roots = let fold_topic_roots topic_roots =
let list_item root t = "<li>" ^ topic_link root t in let list_item root t = "<li>" ^ topic_link root t in
"<nav><h2>Main topics</h2>" "<h2>Main topics</h2>"
^ List.fold_left (fun a x -> a ^ list_item x x) "<ul>" (List.rev topic_roots) ^ List.fold_left (fun a x -> a ^ list_item x x) "<ul>" (List.rev topic_roots)
^ "</ul></nav>" ^ "</ul>"
let fold_topics topic_map topic_roots metas = let fold_topics topic_map topic_roots metas =
let open Logarion in let open Logarion in
@ -134,14 +133,14 @@ let fold_topics topic_map topic_roots metas =
in in
"<li>" ^ item ^ sub_items root t "<li>" ^ item ^ sub_items root t
in in
"<nav><h2>Topics</h2>" "<h2>Topics</h2>"
^ List.fold_left (fun a x -> a ^ list_item x x) "<ul>" (List.rev topic_roots) ^ List.fold_left (fun a x -> a ^ list_item x x) "<ul>" (List.rev topic_roots)
^ "</ul></nav>" ^ "</ul>"
let text_item path meta = let text_item path meta =
let open Logarion in let open Logarion in
"<time>" ^ Date.(pretty_date (listing meta.Text.date)) "<span>" ^ Date.(pretty_date (listing meta.Text.date))
^ {|</time> <a href="|} ^ path ^ Text.short_id meta ^ {|.htm">|} ^ meta.Text.title ^ {|</span> <a href="|} ^ path ^ Text.short_id meta ^ {|.htm">|} ^ meta.Text.title
^ "</a><br>" ^ "</a><br>"
let listing_index topic_map topic_roots path metas = let listing_index topic_map topic_roots path metas =
@ -161,12 +160,12 @@ let listing_index topic_map topic_roots path metas =
| "" -> "" | "" -> ""
| x -> {|<h2 id="|} ^ topic ^ {|">|} ^ String.capitalize_ascii topic ^ "</h2>" ^ x | x -> {|<h2 id="|} ^ topic ^ {|">|} ^ String.capitalize_ascii topic ^ "</h2>" ^ x
in in
"<nav><h1>Texts</h1>" ^ item_group topic_roots ^ "</nav>" "<h1>Texts</h1>" ^ item_group topic_roots ^ ""
let topic_main_index conv htm topic_roots metas = let topic_main_index conv htm topic_roots metas =
wrap conv htm "Topics" wrap conv htm "Topics"
(fold_topic_roots topic_roots (fold_topic_roots topic_roots
^ "<nav><h1>Latest</h1><ul>" ^ to_dated_links ~limit:8 metas ^ "<h1>Latest</h1><ul>" ^ to_dated_links ~limit:8 metas
^ {|</ul><a href="index.date.htm">More by date</a>|} ^ {|</ul><a href="index.date.htm">More by date</a>|}
^ let peers = try Logarion.Store.KV.find "Peers" conv.kv with Not_found -> "" in ^ let peers = try Logarion.Store.KV.find "Peers" conv.kv with Not_found -> "" in
(if peers = "" then "" else (if peers = "" then "" else

View File

@ -1,4 +1,4 @@
let version = "9333d0e-dirty" let version = "1.2"
open Cmdliner open Cmdliner
let default_cmd = let default_cmd =

View File

@ -1,8 +1,8 @@
(lang dune 2.0) (lang dune 2.0)
(name logarion) (name logarion)
(version 9333d0e-dirty) (version 1.3)
(license EUPL-1.2) (license EUPL-1.2)
(maintainers "Izuru Yakumo <yakumo.izuru@chaotic.ninja>") (maintainers "Izuru Yakumo <novaburst@envs.net>")
(homepage "https://logarion.chaotic.ninja") (homepage "https://logarion.chaotic.ninja")
(source (uri git+https://git.chaotic.ninja/yakumo.izuru/logarion.git)) (source (uri git+https://git.chaotic.ninja/yakumo.izuru/logarion.git))

View File

@ -1,6 +0,0 @@
Install development version
Requirements are ocaml (the compiler) and opam (the package manager). Then run:
opam pin add logarion https://git.disroot.org/orbifx/logarion.git
opam install logarion

View File

@ -1,8 +1,8 @@
# This file is generated by dune, edit dune-project instead # This file is generated by dune, edit dune-project instead
opam-version: "2.0" opam-version: "2.0"
version: "9333d0e-dirty" version: "1.2"
synopsis: "Texts archival and exchange" synopsis: "Texts archival and exchange"
maintainer: ["Izuru Yakumo <yakumo.izuru@chaotic.ninja>"] maintainer: ["Izuru Yakumo <novaburst@envs.net>"]
license: "EUPL-1.2" license: "EUPL-1.2"
homepage: "https://logarion.chaotic.ninja" homepage: "https://logarion.chaotic.ninja"
depends: [ depends: [

View File

@ -1,28 +0,0 @@
ID: ka4wtj
Title: Logarion
## Guides
Exploring & pulling texts from Logarion repositories.
<urn:txtid:3sqd84>
Creating texts & publishing on the net.
<urn:txtid:hvhhwf>
Txt uniform resource names
<urn:txtid:h1a9tg>
Building from source
<urn:txtid:9egbae>
## Contacts
Mailing list (anonymous): 📧
<https://lists.tildeverse.org/postorius/lists/logarion.lists.tildeverse.org/>
## References
* Source <http://git.chaotic.ninja/yakumo.izuru/logarion>
* Header format <http://git.chaotic.ninja/yakumo.izuru/logarion/raw/branch/master/header>
## Maintainers
* orbifx (formerly)
* Izuru Yakumo (current)

View File

@ -1,3 +1,9 @@
ID: d41e68
Date: 2023-10-18T18:45:33+00:00
Title: Header format
Authors: orbifx <fox@orbitalfox.eu>
ID: Unique identifier ID: Unique identifier
Date: ISO8601 date of creation Date: ISO8601 date of creation
Topics: Comma seperated list of topic names & phrases Topics: Comma seperated list of topic names & phrases

4
txt/footer.html Normal file
View File

@ -0,0 +1,4 @@
<hr>
<p>
<a href="https://git.chaotic.ninja/yakumo.izuru/logarion">Source code</a>
</p>

2
txt/header.html Normal file
View File

@ -0,0 +1,2 @@
<h1>Logarion</h1>
<p>discover, collect &amp; exchange plain text files</p>

10
txt/htm/3sqd84.txt Normal file
View File

@ -0,0 +1,10 @@
ID: 3sqd84
Date: 2022-11-06T13:01:19Z
Title: Exploring & pulling texts from Logarion repositories
Authors: orbifx
Logarion repositories are collections of text files, accompanied by a special index file. These collections can exist on any server and accessed by any transport protocol. Logarion's client currently supports a plethora of protocols, HTTP, FTP, Gopher to name a few examples.
A remote repository can be registered and texts copied locally. To add a new remote run: `txt pull <url>`, where <url> is the address of the remote repository. The program will connect to the server, copy the `index.pck` file and use it to download each text file. It will not redownload previous texts, unless their Date or Date-Edited dates are newer than the previous ones.
The text files are by default downloaded to `.local/share/texts/peers/`. A new directory is created for each peer's unique id and the index & texts are stored in it. Running `txt pull` with no URL, will refetch indices from all previously pulled repositories, and new text files will be downloaded automatically.

14
txt/htm/9egbae.txt Normal file
View File

@ -0,0 +1,14 @@
ID: 9egbae
Date: 2023-06-17T23:27:44Z
Title: Building from source
Authors: yakumo_izuru
Requirements:
* git
* ocaml (>=4.13)
1. git clone https://git.chaotic.ninja/yakumo.izuru/logarion.git
2. cd logarion
3. git submodule update --init
4. make deps
5. make tgz

26
txt/htm/d41e68.txt Normal file
View File

@ -0,0 +1,26 @@
ID: d41e68
Date: 2023-10-18T18:45:33+00:00
Title: Header format
Authors: orbifx <fox@orbitalfox.eu>
ID: Unique identifier
Date: ISO8601 date of creation
Topics: Comma seperated list of topic names & phrases
Title: A title for the text, ideally less than 70 characters
Authors: List of name with optional set of <address>
Date-edited: ISO8601, use only when text edited
References: list of text ID links
A blank line must follow the last header field.
Example
ID: 11bcd
Title: A Logarion exemplar header
Authors: John Doe <http://example.com> <jd@example.com>
Date: 1970-11-06T12:29:50-00:00
Topic: Logarion, examples
Hello world!

16
txt/htm/h1a9tg.txt Normal file
View File

@ -0,0 +1,16 @@
ID: h1a9tg
Date: 2022-11-20T13:28:57Z
Authors: orbifx <orbifx@orbifx.indy>
Title: Txt uniform resource names
Logarion texts are transport agnostic. URIs should therefore avoid using URLs and use URNs instead. Some definitions of Uniform Resource:
- Locator (URL) <http://en.wikipedia.org/wiki/Url>
- Identifier (URI) <http://en.wikipedia.org/wiki/Uniform_Resource_Identifier>
- Name (URN) <http://en.wikipedia.org/wiki/Uniform_Resource_Name>
Links enclosed in angled brackets <> of the format:
urn:txtid:abcdef
where `abcdef` is the id of the text are understood by `txt` and handled accordingly. For example when converting to HTML or Gemini, the URNs are converted to relative URLs which browsers can understand.

76
txt/htm/hvhhwf.txt Normal file
View File

@ -0,0 +1,76 @@
ID: hvhhwf
Date: 2022-11-06T13:19:57Z
Title: Creating texts & publishing on the net
Authors: orbifx
# New
To create new text files, use "txt new". For example:
txt new "Hello world"
It's important to enclose the title with quotation marks if it contains spaces. The command will return the filename of the new text. The filename starts with a part of the ID and the title of the text. Use the file name to open it with your text editor.
Alternatively add the -i flag to have the text editor launched to edit the newly created file:
txt new -i "Some title"
Text files will be stored in either:
1. The directory pointed at by txtdir if defined
2. $HOME/.local/share/texts, if directory exists
3. The current working directory, if all else fails
The simplest approach is to put all texts in the local-share directory and override that on occasion with
$txtdir. For example:
txtdir=. txt new "Hello world"
# Publish
Texts created with "new" are treated as personal until published. To publish a text, use `txt publish [id]` where [id] is the text of the text to publish. Publication requires a `txt.conf` file which must exist in either:
1. The current working directory
2. $HOME/.config/txt/txt.conf
With the above in place, `txt publish [id]` will add the text file with [id] in the publication-directory and reproduce the `index.pck` in that directory. If Pubdir is not defined in `txt.conf` then the environmental variable `txtpubdir` is used. If that is also undefined, the current working directory is used as a publication directory.
Logarion is protocol agnostic, so publish looks for the existence of directories to copy the files, ready for publication. At the time of writing the three directories are `public_html`, `public_gemini` and `public_gopher`. For each of these directories, `txt publish [id]` will copy the text file, revise the `index.pck` and also convert produce converted files, such .htm for public_html.
## txt.conf keys
Id:
A random, unique, alphanumeric string for distinguishing the repository (atleast 6 characters of Crockford's Base32 recommended)
Title:
a human-friendly title
Authors:
comma seperated list of names and, optionally, addresses
Topics:
topics the repository aims to cover
Locations:
list of URIs the repositories can be accessed
Peers:
list of peer URIs
Pubdir:
(optional) the directory that contains publication subdirectories
## HTML
There are some special settings for HTML publication:
HTM-style:
path to a CSS style. It will be inserted in every .htm file. To link to a single CSS consider using `@import`
HTM-header:
path to a file, inserted in every .htm file, right after the body tag
HTM-footer:
path to a file, inserted in every .htm file, right before the body tag
HTM-index:
if defined, determines the filename for the index files. Left undefined, defaults to `index.html`
HTM-feed:
if defined, this will overrite the feed URI used in HTML files. If left undefined the default `feed.atom` is used

8
txt/htm/main.css Normal file
View File

@ -0,0 +1,8 @@
body{color:#111;background:#faeed6;margin:auto;padding:1ch;max-width:80ch}
@media(min-resolution:130dpi){body{font-size:1.5em}}
article>header{margin:auto;padding:1ch}
dt{float:left;text-align:right;padding-right:1ch;min-width:8ch;opacity:0.4;clear:left}
:target::before{content:"☞"}
body>h1{font-family:cursive}
h1,h2{color:#ff6600}
h3,h4{color:#333}

BIN
txt/index.pck Normal file

Binary file not shown.

6
txt/txt.conf Normal file
View File

@ -0,0 +1,6 @@
Id: 17f4e3
Title: Logarion
Authors: orbifx <fox@orbifalfox.eu>, Izuru Yakumo <yakumo.izuru@chaotic.ninja>
HTM-style: main.css
HTM-header: header.html
HTM-footer: footer.html