Last active
May 16, 2025 11:09
-
-
Save kindly/37dc160ebfd797e12af09a935ba404b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zipfile | |
from base64 import b64encode, b64decode | |
def convert_mmd_to_wiki_markup(mmd_content): | |
binary = mmd_content.encode("utf-8") | |
md5 = b64encode(binary).decode() | |
return "{{#widget:OwnershipTree|data=" + md5 + "}}" | |
def process_mmd_files(zip_path): | |
with zipfile.ZipFile(zip_path, 'r') as zip_ref: | |
for filename in zip_ref.namelist(): | |
if filename.endswith('.mmd'): | |
with zip_ref.open(filename) as mmd_file: | |
content = mmd_file.read().decode('utf-8') | |
# Process the MMD content here | |
print(f"Processing {filename}:") | |
print(convert_mmd_to_wiki_markup(content)) | |
if __name__ == '__main__': | |
# Replace with your zip file path | |
zip_file_path = 'data/output.zip' | |
process_mmd_files(zip_file_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment