Skip to content

Commit

Permalink
Merge pull request #35 from kkinder/fix-long-refs
Browse files Browse the repository at this point in the history
Reduce the number of unnecessary underscores in ref generation.
  • Loading branch information
kkinder authored Aug 3, 2024
2 parents f7c245c + d679ce2 commit 7533dfe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions puepy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,10 @@ def generate_tag(self, tag_name, *children, **kwargs):
raise Exception("t.generate_tag called without a context")

# Determine ref value
ref_part = f"__{parent.ref}.{tag_name}{len(parent.children) + 1}_" + binascii.hexlify(
hashlib.sha256(str(kwargs).encode()).digest()
)[:8].decode("utf8")
ref_part = "__" + (
f"{parent.ref}.{tag_name}{len(parent.children) + 1}_"
+ (binascii.hexlify(hashlib.sha256(str(kwargs).encode()).digest()))[:8].decode("utf8")
).lstrip("_")

ref = kwargs.pop("ref", ref_part)

Expand Down

0 comments on commit 7533dfe

Please sign in to comment.