Add URL: support for links - gopher-lawn - The gopher lawn gopher directory project.
HTML git clone git://bitreich.org/gopher-lawn/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/gopher-lawn/
DIR Log
DIR Files
DIR Refs
DIR Tags
---
DIR commit 974f98c767fdd17fc8ede63a867f5c29061f9ec2
DIR parent c61ce3f78fe333bfb20aa2cd94a427743be571a7
HTML Author: Christoph Lohmann <20h@r-36.net>
Date: Fri, 28 Aug 2020 12:56:10 +0200
Add URL: support for links
Diffstat:
M index.gph | 5 +++++
M lawn-mower/lawn-mower.py | 7 +++++--
2 files changed, 10 insertions(+), 2 deletions(-)
---
DIR diff --git a/index.gph b/index.gph
@@ -82,6 +82,11 @@ You want to propose a link or your own website? Either go on
[1|Proposal menu.|/lawn/submit.dcgi|server|port]
+If you want to save the moderators time, check out
+[h|git://bitreich.org/gopher-lawn|URL:git://bitreich.org/gopher-lawn|server|port]
+and add a file with categories and keywords to the »db« directory. There
+are many example files in there for how the format looks like.
+
[1|<< back to bitreich.org|/|server|port]
DIR diff --git a/lawn-mower/lawn-mower.py b/lawn-mower/lawn-mower.py
@@ -160,8 +160,11 @@ def main(args):
print("'%s' has no keywords defined." \
% (obj["linkname"]))
- def linktype2gopher(linktype):
+ def linktype2gopher(link):
+ linktype = link["type"]
if linktype == "link":
+ if link["selector"].startswith("URL:"):
+ return "h"
return "1"
elif linktype == "text":
return "0"
@@ -203,7 +206,7 @@ def main(args):
def printlink(link):
rtext = "[%s|%s|%s|%s|%s]\n" \
- % (linktype2gopher(link["type"]),\
+ % (linktype2gopher(link),\
link["linkname"],\
link["selector"],\
link["host"],\