=> Re: "I have a Gemini capsule as well as a gopherhole that run on..." | In: s/Gemini
sounds like you need to write a little shell script
grep out lines that start with =>
technically you should ignore links inside a ``` blockquote, but that is pretty unusual
Now splice the type -- usually zero, tab-separating description, path and server. You will need to parse the gemini link line, which contains a URL and a description, splitting the URL into path and server.
This is easy to do in a crappy way, for yourself, especially if you know the links are good etc. Hard to do it right, so it never screws up.
keep in mind that gemini links may be relative so you may have to insert your server, or not have a text description.
=> ๐ stack
11 hours ago
Here's an overly simple, but maybe functional for what you need, example using grep and awk:
grep '^=>' your_gem_file.gmi | awk '{print 0"\t"substr($0, index($0,$3))"\t"$2}'
I had to try it remotely typing from my phone, so I didn't do many tests, but:
$ cat file.gmi
$ grep '^=>' file.gmi | awk '{print 0"\t"subst
r($0, index($0,$3))"\t"$2}'
0 this is a link /blog/text.gmi
it will need more tweaking, but I hope it gives you a starting point :)
well, my bad: after the line starting with "cat", the line with the link you'll probably see should be showing:
=> /blog/text.gmi this is a link
(I accidentally created a Gemini link by copying and pasting without using a ``` block)
For converting absolute links to other servers to gopher format, you will have to do it differently depending on the scheme (due to historical reasons). If it is "gopher" then it must be parsed and converted to a gopher menu item. If it is "telnet" then it should be converted to a type "8" menu item. Otherwise, use a type "h" menu item, put your own host/port, and the selector string is "URL:" followed by the URL. If your server receives such a request, it should return a HTML file containing a link and/or redirect to the target URL (but clients that understand this convention will not need to request the HTML file from your server, so it is OK if the client doesn't implement HTML).
=> ๐ clseibold ยท 3 hours ago:
This may not be exactly relevant for your question, but I'll talk about trying to proxy a gemini server to gopher. I've tried dealing with converting gemtext documents to gophermaps in SIS when proxying gemini to gopher, and it's actually pretty awful for a couple of reasons:
So here's what SIS does when it converts/proxies gemtext documents to gophermaps:
First, if the resource ends in a "/", it's going to get converted into a gophermap by the proxy, so all links that end in "/" will be itemtype 1.
Second, look at the extension at the end of the URL, and convert the extension to its proper gopher itemtype. If no extension is provided, then you have to assume it's a text document because there's no other way of knowing without making a request to that resource on the server.
Lastly, if it's a link to a static file on your own server (that you are proxying), then look at the file (or route) to get the filetype.
If you add in zzo38's method above as well, then you'll get very close to having something that works at least 75% of the time, lol.
If people know of other better tricks for this, I'd definitely be happy to hear them.
I have a Gemini capsule as well as a gopherhole that run on separate servers, and I don't use a proxy. I like to keep the content on both the same, which is fairly easy to do for the most part as converting from gemtext to plaintext is very simple. The issue I have is with the gophermaps. In the past I have taken the links on my Gemini index pages and manually typed out the Gopher versions into gophermaps, but this is incredibly tedious to do. Is there some way to more easily and simply convert...
=> ๐ฌ Arkholt ยท 5 comments ยท 19 hours ago This content has been proxied by September (ba2dc).Proxy Information
text/gemini; charset=utf-8