Last change
on this file since 59 was 3, checked in by fox, 3 years ago |
Format
Index
- New option: txt index --print
- Move scheme to peers
- Replace peer.*.conf files with index packed locations
Instead of adding a URL to peers.*.conf, run
txt pull <url>
Conversion
- Rewritten converters
- txt-convert looks for a .convert.conf containing
key: value lines.
- Specifiable topic-roots from .convert.conf.
- Added
Topics: key, with comma seperated topics.
If set only those topics will appear in the main index and used as topic roots.
Other topics will have sub-indices generated, but won't be listed in the main index.
- HTML converter header & footer options
- HTML-index renamed to HTM-index
Internal
- Change types: uuid:Uuid -> id:string
- File_store merges identical texts
- Use peer ID for store path, store peers' texts in .local/share/texts
- Simple URN resolution for converter
Continue to next feed if parsing one fails
- Phasing-out Archive, replaced by improved packs
- Eliminate Bos, Cohttp, lwt, uri, tls, Re, Ptime, dependencies
- Lock version for Cmdliner, fix dune-project
- Optional resursive store
- Improve header_pack
- Fix recursive mkdir
|
File size:
1.2 KB
|
Rev | Line | |
---|
[3] | 1 | let of_string x = Str.(split (regexp " *> *")) (String.trim x)
|
---|
[2] | 2 |
|
---|
| 3 | let topic x =
|
---|
| 4 | let path = of_string x in
|
---|
| 5 | try List.nth path (List.length path - 1) with _ -> ""
|
---|
| 6 |
|
---|
| 7 | module Map = Map.Make(String)
|
---|
| 8 |
|
---|
| 9 | let edges x map = try Map.find x map with Not_found -> (String_set.empty, String_set.empty)
|
---|
| 10 |
|
---|
| 11 | let edges_with_context context (contexts, subtopics) = (String_set.add context contexts, subtopics)
|
---|
| 12 | let edges_with_subtopic subtopic (contexts, subtopics) = (contexts, String_set.add subtopic subtopics)
|
---|
| 13 |
|
---|
| 14 | let rec list_to_map map = function
|
---|
| 15 | | [] -> map
|
---|
| 16 | | [topic] ->
|
---|
| 17 | let edges = edges topic map in
|
---|
| 18 | Map.add topic edges map
|
---|
| 19 | | context :: topic :: tail ->
|
---|
| 20 | let context_edges = edges context map in
|
---|
| 21 | let topic_edges = edges topic map in
|
---|
| 22 | let map =
|
---|
| 23 | map
|
---|
| 24 | |> Map.add context (edges_with_subtopic topic context_edges)
|
---|
| 25 | |> Map.add topic (edges_with_context context topic_edges)
|
---|
| 26 | in
|
---|
| 27 | list_to_map map (topic :: tail)
|
---|
| 28 |
|
---|
| 29 | let to_map map set =
|
---|
| 30 | List.fold_left (fun acc elt -> list_to_map acc (of_string elt)) map @@ String_set.elements set
|
---|
| 31 |
|
---|
| 32 | let roots map =
|
---|
| 33 | let root_keys acc (key, (contexts, _topics)) = if String_set.is_empty contexts then key :: acc else acc in
|
---|
| 34 | List.fold_left root_keys [] @@ Map.bindings map
|
---|
| 35 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.