rolfedh-doc-utils 0.1.4__py3-none-any.whl → 0.1.41__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. archive_unused_files.py +18 -5
  2. archive_unused_images.py +9 -2
  3. callout_lib/__init__.py +22 -0
  4. callout_lib/converter_bullets.py +103 -0
  5. callout_lib/converter_comments.py +295 -0
  6. callout_lib/converter_deflist.py +134 -0
  7. callout_lib/detector.py +364 -0
  8. callout_lib/table_parser.py +804 -0
  9. check_published_links.py +1083 -0
  10. check_scannability.py +6 -0
  11. check_source_directives.py +101 -0
  12. convert_callouts_interactive.py +567 -0
  13. convert_callouts_to_deflist.py +628 -0
  14. convert_freemarker_to_asciidoc.py +288 -0
  15. convert_tables_to_deflists.py +479 -0
  16. doc_utils/convert_freemarker_to_asciidoc.py +708 -0
  17. doc_utils/duplicate_content.py +409 -0
  18. doc_utils/duplicate_includes.py +347 -0
  19. doc_utils/extract_link_attributes.py +618 -0
  20. doc_utils/format_asciidoc_spacing.py +285 -0
  21. doc_utils/insert_abstract_role.py +220 -0
  22. doc_utils/inventory_conditionals.py +164 -0
  23. doc_utils/missing_source_directive.py +211 -0
  24. doc_utils/replace_link_attributes.py +187 -0
  25. doc_utils/spinner.py +119 -0
  26. doc_utils/unused_adoc.py +150 -22
  27. doc_utils/unused_attributes.py +218 -6
  28. doc_utils/unused_images.py +81 -9
  29. doc_utils/validate_links.py +576 -0
  30. doc_utils/version.py +8 -0
  31. doc_utils/version_check.py +243 -0
  32. doc_utils/warnings_report.py +237 -0
  33. doc_utils_cli.py +158 -0
  34. extract_link_attributes.py +120 -0
  35. find_duplicate_content.py +209 -0
  36. find_duplicate_includes.py +198 -0
  37. find_unused_attributes.py +84 -6
  38. format_asciidoc_spacing.py +134 -0
  39. insert_abstract_role.py +163 -0
  40. inventory_conditionals.py +53 -0
  41. replace_link_attributes.py +214 -0
  42. rolfedh_doc_utils-0.1.41.dist-info/METADATA +246 -0
  43. rolfedh_doc_utils-0.1.41.dist-info/RECORD +52 -0
  44. {rolfedh_doc_utils-0.1.4.dist-info → rolfedh_doc_utils-0.1.41.dist-info}/WHEEL +1 -1
  45. rolfedh_doc_utils-0.1.41.dist-info/entry_points.txt +20 -0
  46. rolfedh_doc_utils-0.1.41.dist-info/top_level.txt +21 -0
  47. validate_links.py +213 -0
  48. rolfedh_doc_utils-0.1.4.dist-info/METADATA +0 -285
  49. rolfedh_doc_utils-0.1.4.dist-info/RECORD +0 -17
  50. rolfedh_doc_utils-0.1.4.dist-info/entry_points.txt +0 -5
  51. rolfedh_doc_utils-0.1.4.dist-info/top_level.txt +0 -5
  52. {rolfedh_doc_utils-0.1.4.dist-info → rolfedh_doc_utils-0.1.41.dist-info}/licenses/LICENSE +0 -0
@@ -1,285 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: rolfedh-doc-utils
3
- Version: 0.1.4
4
- Summary: CLI tools for AsciiDoc documentation projects
5
- Author: Rolfe Dlugy-Hegwer
6
- License: MIT License
7
-
8
- Copyright (c) 2025 Rolfe Dlugy-Hegwer
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
28
- Requires-Python: >=3.8
29
- Description-Content-Type: text/markdown
30
- License-File: LICENSE
31
- Requires-Dist: PyYAML>=6.0
32
- Dynamic: license-file
33
-
34
- # doc-utils
35
-
36
- A set of Python utilities and CLI tools to help technical writers maintain AsciiDoc documentation repositories.
37
-
38
- > ⚠️ **IMPORTANT: Safety First**
39
- >
40
- > These tools can modify or delete files in your documentation repository. Always:
41
- > - **Work in a git branch** - Never run these tools on the main/master branch
42
- > - **Review all changes carefully** - Use `git diff` or a pull request to verify modifications
43
- > - **Check your preview builds** - Ensure no documentation errors were introduced
44
-
45
- ## Resources
46
-
47
- - [PyPI: rolfedh-doc-utils](https://pypi.org/project/rolfedh-doc-utils/)
48
- - [GitHub repository](https://github.com/rolfedh/doc-utils)
49
-
50
- ## Installation
51
-
52
- ### From PyPI
53
-
54
- On modern Linux distributions, you may encounter an "externally-managed-environment" error. Use one of these methods:
55
-
56
- **Option 1: pipx (Recommended for CLI tools)**
57
- ```sh
58
- pipx install rolfedh-doc-utils
59
- ```
60
-
61
- **Option 2: pip with --user flag**
62
- ```sh
63
- pip install --user rolfedh-doc-utils
64
- ```
65
-
66
- **Option 3: Traditional pip (may require virtual environment)**
67
- ```sh
68
- pip install rolfedh-doc-utils
69
- ```
70
-
71
- ### Upgrading
72
-
73
- To upgrade to the latest version:
74
-
75
- ```sh
76
- # If installed with pipx:
77
- pipx upgrade rolfedh-doc-utils
78
-
79
- # If installed with pip:
80
- pip install --upgrade rolfedh-doc-utils # or --user flag if needed
81
- ```
82
-
83
- ### For Development
84
-
85
- If you're developing or testing locally, install the package in editable mode:
86
-
87
- ```sh
88
- # Clone the repository
89
- git clone https://github.com/rolfedh/doc-utils.git
90
- cd doc-utils
91
-
92
- # Install in editable mode
93
- pip install -e .
94
- ```
95
-
96
- The following CLI tools are installed:
97
-
98
- * `check-scannability`
99
- * `archive-unused-files`
100
- * `archive-unused-images`
101
- * `find-unused-attributes`
102
-
103
- These tools can be run from any directory.
104
-
105
- ### Add to PATH (if needed)
106
-
107
- By default, CLI tools install to:
108
-
109
- ```sh
110
- $HOME/.local/bin
111
- ```
112
-
113
- If this directory isn’t in your `PATH`, commands may not run. Append it to your shell configuration:
114
-
115
- ```sh
116
- echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc # or ~/.zshrc
117
- ```
118
-
119
- Then reload your shell:
120
-
121
- ```sh
122
- source ~/.bashrc # or ~/.zshrc
123
- ```
124
-
125
- ## CLI Tools Overview
126
-
127
- ### `check-scannability`
128
-
129
- Scans `.adoc` files in the current directory to report:
130
-
131
- * Sentences that exceed a length limit (default: 22 words)
132
- * Paragraphs with too many sentences (default: 3 sentences)
133
- * Supports exclusion of files and directories
134
-
135
- ➡️ See [`check_scannability.md`](https://github.com/rolfedh/doc-utils/blob/main/check_scannability.md) for details.
136
-
137
- ---
138
-
139
- ### `archive-unused-files`
140
-
141
- Scans the `./modules` and `./assemblies` directories for `.adoc` files that are not referenced. Optionally archives and deletes them.
142
-
143
- Works with both:
144
- - **OpenShift-docs style** repositories (uses `_topic_maps/*.yml` files)
145
- - **Traditional AsciiDoc** repositories (uses `master.adoc` files)
146
-
147
- ➡️ See [`archive_unused_files.md`](https://github.com/rolfedh/doc-utils/blob/main/archive_unused_files.md).
148
-
149
- ---
150
-
151
- ### `archive-unused-images`
152
-
153
- Finds unused image files (e.g., `.png`, `.jpg`, `.jpeg`, `.gif`, `.svg`) in the current directory and optionally archives and deletes them.
154
-
155
- ➡️ See [`archive_unused_images.md`](https://github.com/rolfedh/doc-utils/blob/main/archive_unused_images.md).
156
-
157
- ---
158
-
159
- ### `find-unused-attributes`
160
-
161
- Scans an attributes file (e.g., `attributes.adoc`) for unused attribute definitions across all `.adoc` files in the current directory.
162
-
163
- ➡️ See [`find_unused_attributes.md`](https://github.com/rolfedh/doc-utils/blob/main/find_unused_attributes.md).
164
-
165
- ## Best Practices for Safe Usage
166
-
167
- ### Before Running Any Tool:
168
-
169
- - **Create a feature branch:**
170
- ```sh
171
- git checkout -b doc-cleanup-$(date +%Y%m%d)
172
- ```
173
-
174
- - **Commit any pending changes:**
175
- ```sh
176
- git add -A && git commit -m "Save work before cleanup"
177
- ```
178
-
179
- - **Run tools in preview mode first:**
180
- - For archive tools: Run without `--archive` to see what would be affected
181
-
182
- - **Review all changes and preview builds**
183
-
184
- - **Only merge after verification:**
185
-
186
- ## Usage
187
-
188
- To run the tools after installation:
189
-
190
- ```sh
191
- check-scannability --help
192
- archive-unused-files --help
193
- find-unused-attributes attributes.adoc
194
- ```
195
-
196
- Or run them directly from source:
197
-
198
- ```sh
199
- python3 check_scannability.py
200
- python3 archive_unused_files.py
201
- python3 find_unused_attributes.py attributes.adoc
202
- ```
203
-
204
- ### Directory/File Exclusion
205
-
206
- All tools support excluding specific directories and files from scanning. You can use these options:
207
-
208
- 1. **`--exclude-dir`** - Exclude specific directories (can be used multiple times):
209
- ```sh
210
- archive-unused-files --exclude-dir ./modules/temp --exclude-dir ./modules/old
211
- ```
212
-
213
- 2. **`--exclude-file`** - Exclude specific files (can be used multiple times):
214
- ```sh
215
- check-scannability --exclude-file ./README.adoc --exclude-file ./test.adoc
216
- ```
217
-
218
- 3. **`--exclude-list`** - Point to a text file containing exclusions:
219
- ```sh
220
- archive-unused-images --exclude-list .docutils-ignore
221
- ```
222
-
223
- The exclusion file format:
224
- ```
225
- # Comments are supported
226
- ./modules/deprecated/
227
- ./assemblies/archive/
228
- ./images/temp/
229
- specific-file.adoc
230
- ```
231
-
232
- **Note:** When you exclude a parent directory, all its subdirectories are automatically excluded. Symbolic links are never followed during scanning.
233
-
234
- ## Troubleshooting
235
-
236
- ### ModuleNotFoundError
237
-
238
- If you see an error like `ModuleNotFoundError: No module named 'find_unused_attributes'`, this typically means:
239
-
240
- 1. The package isn't installed. Run:
241
- ```sh
242
- pipx install rolfedh-doc-utils # or pip install --user rolfedh-doc-utils
243
- ```
244
-
245
- 2. You're trying to run the script directly without installation. Either:
246
- - Install the package first (see Installation section)
247
- - Run the script using Python directly:
248
- ```sh
249
- python3 find_unused_attributes.py attributes.adoc
250
- ```
251
-
252
- ### Command not found
253
-
254
- If the command isn't found after installation, ensure `$HOME/.local/bin` is in your PATH (see "Add to PATH" section above).
255
-
256
- ## Development
257
-
258
- ### Running Tests
259
-
260
- The project includes a comprehensive test suite. To run tests:
261
-
262
- ```sh
263
- # Install development dependencies
264
- pip install -r requirements-dev.txt
265
-
266
- # Run all tests
267
- python -m pytest tests/
268
-
269
- # Run with verbose output
270
- python -m pytest tests/ -v
271
- ```
272
-
273
- ### Contributing
274
-
275
- Contributions are welcome! Please ensure:
276
- - All tests pass before submitting a PR
277
- - New features include appropriate tests
278
- - Code follows PEP 8 style guidelines
279
- - Documentation is updated as needed
280
-
281
- See [CONTRIBUTING.md](https://github.com/rolfedh/doc-utils/blob/main/CONTRIBUTING.md) for more details.
282
-
283
- ## License
284
-
285
- This project is licensed under the terms of the [LICENSE](https://github.com/rolfedh/doc-utils/blob/main/LICENSE).
@@ -1,17 +0,0 @@
1
- archive_unused_files.py,sha256=MFdAtE8CDthida5H5FhvtEHZWrQAZZoAB-DQkTOc6gs,1537
2
- archive_unused_images.py,sha256=PG2o3haovYckgfhoPhl6KRG_a9czyZuqlLkzkupKTCY,1526
3
- check_scannability.py,sha256=gcM-vFXKHGP_yFBz7-V5xbXWhIMmtMzBYIGwP9CFbzI,5140
4
- find_unused_attributes.py,sha256=fk-K32eoCVHxoj7RiBNgSmX1arBLuwYfdSAOMc-wIx0,1677
5
- doc_utils/__init__.py,sha256=qqZR3lohzkP63soymrEZPBGzzk6-nFzi4_tSffjmu_0,74
6
- doc_utils/file_utils.py,sha256=fpTh3xx759sF8sNocdn_arsP3KAv8XA6cTQTAVIZiZg,4247
7
- doc_utils/scannability.py,sha256=XwlmHqDs69p_V36X7DLjPTy0DUoLszSGqYjJ9wE-3hg,982
8
- doc_utils/topic_map_parser.py,sha256=tKcIO1m9r2K6dvPRGue58zqMr0O2zKU1gnZMzEE3U6o,4571
9
- doc_utils/unused_adoc.py,sha256=Bx8TH7twhtuDfxzrPLOWOzTLc5YBhIqrCNaKJJR_V38,2312
10
- doc_utils/unused_attributes.py,sha256=HBgmHelqearfWl3TTC2bZGiJytjLADIgiGQUNKqXXPg,1847
11
- doc_utils/unused_images.py,sha256=nqn36Bbrmon2KlGlcaruNjJJvTQ8_9H0WU9GvCW7rW8,1456
12
- rolfedh_doc_utils-0.1.4.dist-info/licenses/LICENSE,sha256=vLxtwMVOJA_hEy8b77niTkdmQI9kNJskXHq0dBS36e0,1075
13
- rolfedh_doc_utils-0.1.4.dist-info/METADATA,sha256=lPNDY0Lu9pBKxxzCXZp5TqSe3DuBqvBHYPVFyLWpP14,8152
14
- rolfedh_doc_utils-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- rolfedh_doc_utils-0.1.4.dist-info/entry_points.txt,sha256=i8LqEsp0KD4YyVI_7wQ1TMgCuag32D7gQes6bLufmtM,216
16
- rolfedh_doc_utils-0.1.4.dist-info/top_level.txt,sha256=BkaYN3KbtNvLQjs-QGBKCJb5UAtjEbC_IqxSSIN9P-w,95
17
- rolfedh_doc_utils-0.1.4.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- [console_scripts]
2
- archive-unused-files = archive_unused_files:main
3
- archive-unused-images = archive_unused_images:main
4
- check-scannability = check_scannability:main
5
- find-unused-attributes = find_unused_attributes:main
@@ -1,5 +0,0 @@
1
- archive_unused_files
2
- archive_unused_images
3
- check_scannability
4
- doc_utils
5
- find_unused_attributes