Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create ryanc.yml #59

Closed
wants to merge 4 commits into from
Closed

Create ryanc.yml #59

wants to merge 4 commits into from

Conversation

saizai
Copy link
Contributor

@saizai saizai commented Feb 4, 2023

Added config for @ryancdotorg

Added config for @ryancdotorg
@netlify
Copy link

netlify bot commented Feb 4, 2023

Deploy Preview for namehackclub ready!

Name Link
🔨 Latest commit 545baf9
🔍 Latest deploy log https://app.netlify.com/sites/namehackclub/deploys/63de4f3253c51300083bbcc3
😎 Deploy Preview https://deploy-preview-59--namehackclub.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@saizai saizai mentioned this pull request Feb 4, 2023
@saizai
Copy link
Contributor Author

saizai commented Feb 4, 2023

Error is AttributeError: 'str' object has no attribute 'keys' at

namehack.club/build.py

Lines 29 to 32 in 61c168e

for name in listdir(NAMES_DIR):
with open(NAMES_DIR / name, "r") as f:
fields = yaml.load(f.read(), Loader=yaml.Loader)
field_set = set(fields.keys())

Maybe fix whitespace?
@saizai
Copy link
Contributor Author

saizai commented Feb 4, 2023

Apparently it was some sort of whitespace issue when copying from another yml using Chrome on Android.

@ryancdotorg
Copy link

The code all assumes the domain hack covers exactly the first or last name, which mine does not (check the deploy preview), and isn't possible because .an is no longer a TLD and .ci doesn't allow registration directly under it.

A nickname feature would have to be added.

@ryancdotorg
Copy link

I'm annoyed about being nerd-sniped into implementing this despite it not being clear that the person who runs the site even considers this case to qualify.

diff --git a/build.py b/build.py
index 3fc2b53..f5e2cb6 100644
--- a/build.py
+++ b/build.py
@@ -1,3 +1,4 @@
+import re
 import yaml
 
 from jinja2 import Environment, PackageLoader, select_autoescape
@@ -17,6 +18,9 @@ OPTIONAL_FIELDS = set(["url", "title", "email", "github", "candidate"])
 
 TEMPLATES = ["index.html"]
 
+PREFIX_SUBST = {'"': '“', "'": "‘"}
+SUFFIX_SUBST = {'"': '”', "'": "’"}
+
 # copy static files
 if not BUILD_DIR.exists():
     mkdir(BUILD_DIR)
@@ -49,12 +53,25 @@ def render_link(value, classes):
     name = unidecode(value["name"]).lower().split(" ")
     domain = unidecode(value["domain"]).replace(".", "")
     res = []
+    matched = False
+
+    def link():
+        url = value.get("url") or "https://" + value.get("domain")
+        return f'<a href="{url}" class="{classes}">{value["domain"]}</a>'
+
     for part in name:
         if part == domain:
-            url = value.get("url") or "https://" + value.get("domain")
-            res.append(f'<a href="{url}" class="{classes}">{value["domain"]}</a>')
+            res.append(link())
+            matched = True
         else:
-            res.append(part)
+            m = re.fullmatch(r'(.*)\b'+re.escape(domain)+r'\b(.*)', part)
+            if m is not None:
+                prefix = PREFIX_SUBST.get(m.group(1), m.group(1))
+                suffix = SUFFIX_SUBST.get(m.group(2), m.group(2))
+                res.append(f'{prefix}{link()}{suffix}')
+                matched = True
+            else:
+                res.append(part)
     return " ".join(res)
 
 
diff --git a/names/ryanc.yml b/names/ryanc.yml
index 38c435e..aa5a767 100644
--- a/names/ryanc.yml
+++ b/names/ryanc.yml
@@ -1,6 +1,4 @@
 domain: rya.nc
-name: Ryan Castellucci
+name: Ryan "ryanc" Castellucci
 github: ryancdotorg
-title: I hack binaries. Security researcher, cryptography geek, ex-sysadmin, expat (US to UK), queer, enby, polyam, etc.  
-url: https://rya.nc/#they/them
-email: hi+namecheck.club@ryanc.org
+title: Security researcher, cryptography geek, ex-sysadmin, etc.

@ryancdotorg
Copy link

Use the code from my patch or not, I don't particularly care, but please don't ask me questions about it.

@yuvadm
Copy link
Owner

yuvadm commented Feb 5, 2023

Thanks for the patch @ryancdotorg! As you correctly mentioned, the current club criteria assume any complete part of the name for the domain, and adding a nickname bends those criteria in a way that might miss the point. While I very much appreciate the work put in, I'm afraid I have to close this PR.

@yuvadm yuvadm closed this Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants