Added first gmi2map version
This commit is contained in:
+40
-1
@@ -44,7 +44,7 @@ This tool processes every line of text from the standard input to fit exactly th
|
||||
|
||||
As `phlow.sh` does not know anything about hyphenation rules and doesn't do any heuristics, it just breaks at whatever whitespace is the closest to the page's right edge.
|
||||
|
||||
Example - fitting the previous paragraph into 30-character width and prepend every line with 5 spaces (CR characters in the output are not shown):
|
||||
Example - fitting the previous paragraph into 30-character width and prepending every line with 5 spaces (CR characters in the output are not shown):
|
||||
```
|
||||
$ echo 'This tool processes every line of text from the standard input to fit exactly the given amount of characters, optionally adding some leading and/or trailing whitespaces **after** the reflow is done. It also replaces all LF line endings with CRLF in the output to achieve maximum compatibility with legacy clients.' | bash phlow.sh 30 5
|
||||
This tool processes every
|
||||
@@ -62,4 +62,43 @@ $ echo 'This tool processes every line of text from the standard input to fit ex
|
||||
legacy clients.
|
||||
```
|
||||
|
||||
## `gmi2map.sh`
|
||||
|
||||
This tool converts Gemtext documents into browsable Gophermaps. It basically combines the functionality of both previous tools and adds link processing and triple-backtick removal (because in Gopherspace, all text is supposed to be preformatted) on top of them. Unlike `gopherinfo.sh` though, it doesn't care about the maximum length of the source (if you need to, the reflow logic is there), but it **is** expecting the entire document from the standard input, and as such, **does** add the trailing dot at the end of the generated Gophermap. That's why, for the beginners, this sole script might actually be everything you need to get you started with Gopher publishing.
|
||||
|
||||
Note that by default, reflow logic in `gmi2map.sh` is optional and you have to specify the page width yourself if you need it. Actually, full usage syntax looks like this:
|
||||
```
|
||||
cat [file] | gmi2map.sh [page_width] [leading_spaces] [trailing_spaces] [placeholder_char]
|
||||
```
|
||||
|
||||
I.e. it looks like the `phlow.sh` and `gopherinfo.sh` options combined, but the spaces part only applies to the reflow, which is also off by default.
|
||||
|
||||
Example - imagine we have this rudimentary Gemtext document in the `example.gmi` file:
|
||||
```
|
||||
I write short Gemtext here.
|
||||
|
||||
I write a bit longer Gemtext here to showcase reflow capabilities of Bopher Tools' gmi2map.sh script, because it really is cool.
|
||||
|
||||
=> gopher://happynetbox.com:79/1luxferre Anyway, why not publish it on Gopher?
|
||||
=> https://chronovir.us Or read my blog on Web...
|
||||
|
||||
See ya!
|
||||
```
|
||||
|
||||
When running `cat example.gmi | bash gmi2map.sh 67`, this file translates to the following Gophermap:
|
||||
|
||||
```
|
||||
$ cat example.gmi | bash gmi2map.sh 67
|
||||
iI write short Gemtext here. ; ; 0
|
||||
i ; ; 0
|
||||
iI write a bit longer Gemtext here to showcase reflow capabilities ; ; 0
|
||||
iof Bopher Tools' gmi2map.sh script, because it really is cool. ; ; 0
|
||||
i ; ; 0
|
||||
1Anyway, why not publish it on Gopher? luxferre happynetbox.com 79
|
||||
hOr read my blog on Web... URL:https://chronovir.us ; 0
|
||||
i ; ; 0
|
||||
iSee ya! ; ; 0
|
||||
.
|
||||
```
|
||||
|
||||
Note that this tool hasn't been tested for all possible edge cases yet, so I recommend to always verify the generated maps yourself. But it definitely makes their creation a lot easier than doing it by hand.
|
||||
|
||||
Reference in New Issue
Block a user