{"id":23326213,"url":"https://github.com/nirokay/docchanger","last_synced_at":"2025-04-07T06:44:04.666Z","repository":{"id":203255621,"uuid":"709183331","full_name":"nirokay/DocChanger","owner":"nirokay","description":"Changes substrings in .docx files. This program has a very specific and niche purpose.","archived":false,"fork":false,"pushed_at":"2023-11-02T13:06:20.000Z","size":57,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-13T10:50:01.744Z","etag":null,"topics":["document-generator","document-management","docx","meeting-summarization"],"latest_commit_sha":null,"homepage":"https://nirokay.github.io/nim-docs/docchanger/docchanger","language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nirokay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-24T07:37:54.000Z","updated_at":"2023-11-02T18:52:24.000Z","dependencies_parsed_at":"2023-10-27T13:28:46.788Z","dependency_job_id":"cdfcab54-890b-4862-a9a3-f66b11292a7c","html_url":"https://github.com/nirokay/DocChanger","commit_stats":null,"previous_names":["nirokay/docchanger"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirokay%2FDocChanger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirokay%2FDocChanger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirokay%2FDocChanger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirokay%2FDocChanger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nirokay","download_url":"https://codeload.github.com/nirokay/DocChanger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608163,"owners_count":20965950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["document-generator","document-management","docx","meeting-summarization"],"created_at":"2024-12-20T19:15:05.810Z","updated_at":"2025-04-07T06:44:04.647Z","avatar_url":"https://github.com/nirokay.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DocChanger\n\nA highly specific tool developed for a single, niche purpose - change specific\nsubstrings in `.docx` files.\n\nThe original intent for this tool is to generate ~50 documents (for\nevery week) for meetings with the only thing changing between them being\nthe date and participants.\n\n## How does it work?\n\nEvery `.docx` file is just a renamed `.zip` archive. This program unzips\nthe document to a temporary directory (Linux: `/tmp/temp-topicdocchanger-files`)\nand modifies the `word/document.xml` file. After this is completed, the file is\nzipped up and the file extention is changed to `.docx` again.\n\nThis tool is pretty flexible, you can modify the substrings it replaces in\nthe `document_data.json` config file. This file needs to be located in the\ncurrent directory (most of the times: right next to the executable).\n\nIf this file is not found, the program generates a template json file\n(template can be found at `./templates/document_data.json.template`).\n\n## Installation\n\n* Pre-build binaries are available for Linux (elf64) Micro$hit Windows (exe64)\n  in the releases tab (compiled on x86-64, they may or may not work for you)\n\n* Nimble: `nimble install docchanger` (`*[1]`)\n\n* Manual: `git clone https://github.com/nirokay/docchanger \u0026\u0026 cd docchanger \u0026\u0026 nimble install` (`*[1]`)\n\n\u003e `*[1]` requires Nim toolchain (compiler and nimble)\n\n## Default behaviour\n\nBy default the json will make the program search for the following substrings:\n\n* `${INSERT_DATE}` to insert the (weekly) date (hard coded to Thursday,\n  **soon also configurable with json**)\n\n* `${PARTICIPANTS_FEMALE}` female participants\n\n* `${PARTICIPANTS_MALE}` male participants\n\n* `${PARTICIPANTS_DIVERSE}` i have officially gone WOKE!!!! (sorry mom and dad)\n\n* `${PARTICIPANTS_INTERN}` interns (the fourth gender)\n\nThe `${}` can be changed in the json with the `.search_strings.starting` and\n`.search_strings.ending` fields.\n\n`PARTICIPANT_` can be changed with `.search_strings.participants_prefix` and\n`FEMALE`, `MALE`, `DIVERSE`, `INTERN` are the table values in the\n`.participants` table/array.\n\n## JSON config file data types\n\nFor documentation see the [json file structure document](./templates/README.md).\n\nFor an example, see `./templates/document_data.json.template`\n\n## Dependencies\n\nThe binary should not have any external dependencies, as everything\nis implemented in pure Nim and is fully portable.\n\n## Compiling from source\n\n**Dependencies:**\n\n* Nim (version 2.0 or higher`*[2]`) and Nimble\n\n* bash (Optional: only used for automatic building)\n\n\u003e `*[2]` source code should be backwards-compatible to at minimum `1.6.x`\n\u003e Nim versions by modifying the `.nimble` file to accept older Nim versions\n\n## Troubleshooting\n\nDocument editors are weird. Sometimes a string is randomly interrupted and\nsplit into multiple parts in the xml-file. There is probably a performance\nreason for it or something, but it is bad for us in our case...\n\n### Program fails to replace a specific substring\n\n1. Unzip the source `.docx` file.\n\n2. Navigate to `./$DOCUMENT/word/document.xml`\n\n3. Open this file and search for a part of the substring, that failed to be\n4. replaced. The raw xml is horrible, as it is most likely all one big line.\n5. Using an editor, that can format xml is recommended.\n\n6. Place all broken-up substrings together, so they form the correct\n7. replacement string again.\n\n8. Optional: Delete empty xml blocks (if you cut out and pasted from one block\n9. to another)\n\n10. Re-zip the items and change the `.zip` to a `.docx`.\n\n   **Important:** Only zip the file contents directly, not the extracted\n   directory itself. That would make most applications handle it as a\n   corrupted/incorrect file.\n\n### Program fails to parse the config json file\n\nMake sure the json is formatted correctly, common mistakes may include:\n\n* Trailing or missing commas - commas separate array/table values\n\n* Unquoted values - all values must be inside quotes (like this:\n  `\"index\": \"value\"`), unless it is a number (-\u003e `\"index\": 5`).\n\nTo ensure correct format, see the [json config file format document](#json-config-file-data-types)\nor look at the example at `./templates/document_data.json.template`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirokay%2Fdocchanger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnirokay%2Fdocchanger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirokay%2Fdocchanger/lists"}