fix: tangle.py write-once-then-append logic (was always-appending, triplicating files); confirm-dialog option plist comparison; mouse-event button type (or keyword null)

This commit is contained in:
Hermes Agent
2026-05-12 15:51:44 +00:00
parent a812955329
commit 5f07c1fd76
24 changed files with 9 additions and 4094 deletions

View File

@@ -18,6 +18,7 @@ def tangle_file(org_path):
)
count = 0
block_count = {}
for match in pattern.finditer(text):
lang = match.group(1)
header = match.group(2)
@@ -42,14 +43,18 @@ def tangle_file(org_path):
if tangle_path == 'no':
continue
# Write the content (append if same file already written)
# Write the content (write mode — each run produces clean files)
content = content.rstrip('\n') + '\n'
if os.path.exists(target):
if os.path.exists(target) and block_count.get(target, 0) == 0:
with open(target, 'w') as f:
f.write(content)
elif os.path.exists(target):
with open(target, 'a') as f:
f.write('\n' + content)
else:
with open(target, 'w') as f:
f.write(content)
block_count[target] = block_count.get(target, 0) + 1
print(f" {target} ({len(content)} bytes)")
count += 1