diff --git a/Makefile b/Makefile
index 7f3742e..697017e 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,9 @@ MACHINE=`uname -m`
DATE=`date -r _build/default/cli/txt.exe +%Y%m%d`
COMMIT=`git rev-parse --short HEAD`
+CC=cc
+LD=cc
+
all:
dune build
@@ -16,7 +19,6 @@ clean:
dune clean
dist:
- dune subst
dune build
cp _build/default/cli/txt.exe txt.exe
strip txt.exe
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b6bc181
--- /dev/null
+++ b/README.md
@@ -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)
diff --git a/cli/html.ml b/cli/html.ml
index 19050e8..580d438 100644
--- a/cli/html.ml
+++ b/cli/html.ml
@@ -27,13 +27,12 @@ let wrap conv htm text_title body =
then "feed.atom" else "" in
let header = match htm.templates.header with
| Some x -> replace x
- | None -> Printf.(sprintf "" site_title
- (if feed <> "" then sprintf "feed " feed else ""))
+ | None -> Printf.(sprintf "%s %s" site_title
+ (if feed <> "" then sprintf "feed " feed else ""))
in
let footer = match htm.templates.footer with None -> "" | Some x -> replace x in
- Printf.sprintf "
%s%s \n%s\n%s\
- \
- \n%s%s%s"
+ Printf.sprintf "%s%s \n%s\n%s\
+ \n%s%s%s"
text_title (if site_title <> "" then (" • " ^ site_title) else "")
htm.style
(if feed <> "" then Printf.sprintf " " feed else "")
@@ -62,7 +61,7 @@ let page htm conversion text =
(* let author acc auth = sep_append acc Person.(auth.name ^ " ") in*)
let authors = Person.Set.to_string text.authors in
let header =
- let time x = Printf.sprintf {|%s |}
+ let time x = Printf.sprintf {|%s |}
(Date.rfc_string x) (Date.pretty_date x) in
let topic_links x =
let to_linked t a =
@@ -79,7 +78,7 @@ let page htm conversion text =
with Not_found -> Rel.empty in
ref_links ref_set, ref_links rep_set
in
- ""
+ ""
^ opt_kv "Title:" text.title
^ opt_kv "Authors:" authors
^ 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 "Referred by:" references
^ opt_kv "Replies:" replies
- ^ {| |} in
- wrap conversion htm text.title ((T.of_string text.body header) ^ " ")
+ ^ {||} in
+ wrap conversion htm text.title ((T.of_string text.body header) ^ " ")
let to_dated_links ?(limit) meta_list =
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 list_item root t = "" ^ topic_link root t in
- "Main topics "
+ "Main topics "
^ List.fold_left (fun a x -> a ^ list_item x x) "" (List.rev topic_roots)
- ^ " "
+ ^ ""
let fold_topics topic_map topic_roots metas =
let open Logarion in
@@ -134,14 +133,14 @@ let fold_topics topic_map topic_roots metas =
in
" " ^ item ^ sub_items root t
in
- "Topics "
+ "Topics "
^ List.fold_left (fun a x -> a ^ list_item x x) "" (List.rev topic_roots)
- ^ " "
+ ^ ""
let text_item path meta =
let open Logarion in
- "" ^ Date.(pretty_date (listing meta.Text.date))
- ^ {| |} ^ meta.Text.title
+ "" ^ Date.(pretty_date (listing meta.Text.date))
+ ^ {| |} ^ meta.Text.title
^ " "
let listing_index topic_map topic_roots path metas =
@@ -161,12 +160,12 @@ let listing_index topic_map topic_roots path metas =
| "" -> ""
| x -> {||} ^ String.capitalize_ascii topic ^ " " ^ x
in
- "Texts " ^ item_group topic_roots ^ " "
+ "Texts " ^ item_group topic_roots ^ ""
let topic_main_index conv htm topic_roots metas =
wrap conv htm "Topics"
(fold_topic_roots topic_roots
- ^ "Latest " ^ to_dated_links ~limit:8 metas
+ ^ "Latest " ^ to_dated_links ~limit:8 metas
^ {| More by date |}
^ let peers = try Logarion.Store.KV.find "Peers" conv.kv with Not_found -> "" in
(if peers = "" then "" else
diff --git a/cli/txt.ml b/cli/txt.ml
index 2f5f863..25a7a37 100644
--- a/cli/txt.ml
+++ b/cli/txt.ml
@@ -1,4 +1,4 @@
-let version = "9333d0e-dirty"
+let version = "1.2"
open Cmdliner
let default_cmd =
diff --git a/dune-project b/dune-project
index faa1e52..05a9b12 100644
--- a/dune-project
+++ b/dune-project
@@ -1,8 +1,8 @@
(lang dune 2.0)
(name logarion)
-(version 9333d0e-dirty)
+(version 1.3)
(license EUPL-1.2)
-(maintainers "Izuru Yakumo ")
+(maintainers "Izuru Yakumo ")
(homepage "https://logarion.chaotic.ninja")
(source (uri git+https://git.chaotic.ninja/yakumo.izuru/logarion.git))
diff --git a/install b/install
deleted file mode 100644
index 5261fd0..0000000
--- a/install
+++ /dev/null
@@ -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
diff --git a/logarion.opam b/logarion.opam
index 4aa0cc0..cf6224f 100644
--- a/logarion.opam
+++ b/logarion.opam
@@ -1,8 +1,8 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
-version: "9333d0e-dirty"
+version: "1.2"
synopsis: "Texts archival and exchange"
-maintainer: ["Izuru Yakumo "]
+maintainer: ["Izuru Yakumo "]
license: "EUPL-1.2"
homepage: "https://logarion.chaotic.ninja"
depends: [
diff --git a/readme.txt b/readme.txt
deleted file mode 100644
index 5d4a290..0000000
--- a/readme.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-ID: ka4wtj
-Title: Logarion
-
-## Guides
-
-Exploring & pulling texts from Logarion repositories.
-
-
-Creating texts & publishing on the net.
-
-
-Txt uniform resource names
-
-
-Building from source
-
-
-## Contacts
-Mailing list (anonymous): 📧
-
-
-## References
-* Source
-* Header format
-
-## Maintainers
-* orbifx (formerly)
-* Izuru Yakumo (current)
diff --git a/header b/txt/d41e68.txt
similarity index 84%
rename from header
rename to txt/d41e68.txt
index 255d72a..27b5ba1 100644
--- a/header
+++ b/txt/d41e68.txt
@@ -1,3 +1,9 @@
+ID: d41e68
+Date: 2023-10-18T18:45:33+00:00
+Title: Header format
+Authors: orbifx
+
+
ID: Unique identifier
Date: ISO8601 date of creation
Topics: Comma seperated list of topic names & phrases
diff --git a/txt/footer.html b/txt/footer.html
new file mode 100644
index 0000000..be190a3
--- /dev/null
+++ b/txt/footer.html
@@ -0,0 +1,4 @@
+
+
+Source code
+
diff --git a/txt/header.html b/txt/header.html
new file mode 100644
index 0000000..74e4f15
--- /dev/null
+++ b/txt/header.html
@@ -0,0 +1,2 @@
+Logarion
+discover, collect & exchange plain text files
diff --git a/txt/htm/3sqd84.txt b/txt/htm/3sqd84.txt
new file mode 100644
index 0000000..b6a1bf6
--- /dev/null
+++ b/txt/htm/3sqd84.txt
@@ -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 `, where 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.
diff --git a/txt/htm/9egbae.txt b/txt/htm/9egbae.txt
new file mode 100644
index 0000000..74208f5
--- /dev/null
+++ b/txt/htm/9egbae.txt
@@ -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
diff --git a/txt/htm/d41e68.txt b/txt/htm/d41e68.txt
new file mode 100644
index 0000000..27b5ba1
--- /dev/null
+++ b/txt/htm/d41e68.txt
@@ -0,0 +1,26 @@
+ID: d41e68
+Date: 2023-10-18T18:45:33+00:00
+Title: Header format
+Authors: orbifx
+
+
+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
+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
+Date: 1970-11-06T12:29:50-00:00
+Topic: Logarion, examples
+
+Hello world!
diff --git a/txt/htm/h1a9tg.txt b/txt/htm/h1a9tg.txt
new file mode 100644
index 0000000..25eaf12
--- /dev/null
+++ b/txt/htm/h1a9tg.txt
@@ -0,0 +1,16 @@
+ID: h1a9tg
+Date: 2022-11-20T13:28:57Z
+Authors: orbifx
+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)
+- Identifier (URI)
+- Name (URN)
+
+
+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.
diff --git a/txt/htm/hvhhwf.txt b/txt/htm/hvhhwf.txt
new file mode 100644
index 0000000..8323058
--- /dev/null
+++ b/txt/htm/hvhhwf.txt
@@ -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
diff --git a/txt/htm/main.css b/txt/htm/main.css
new file mode 100644
index 0000000..b1ccb62
--- /dev/null
+++ b/txt/htm/main.css
@@ -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}
diff --git a/txt/index.pck b/txt/index.pck
new file mode 100644
index 0000000..b415b81
Binary files /dev/null and b/txt/index.pck differ
diff --git a/txt/txt.conf b/txt/txt.conf
new file mode 100644
index 0000000..dbf2ede
--- /dev/null
+++ b/txt/txt.conf
@@ -0,0 +1,6 @@
+Id: 17f4e3
+Title: Logarion
+Authors: orbifx , Izuru Yakumo
+HTM-style: main.css
+HTM-header: header.html
+HTM-footer: footer.html