Add URL: support for links - gopher-lawn - The gopher lawn gopher directory pro… | |
git clone git://bitreich.org/gopher-lawn/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhf… | |
Log | |
Files | |
Refs | |
Tags | |
--- | |
commit 974f98c767fdd17fc8ede63a867f5c29061f9ec2 | |
parent c61ce3f78fe333bfb20aa2cd94a427743be571a7 | |
Author: Christoph Lohmann <[email protected]> | |
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(-) | |
--- | |
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|po… | |
+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] | |
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"],\ |