rolfedh-doc-utils 0.1.14__tar.gz → 0.1.15__tar.gz

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 (48) hide show
  1. {rolfedh_doc_utils-0.1.14/rolfedh_doc_utils.egg-info → rolfedh_doc_utils-0.1.15}/PKG-INFO +1 -1
  2. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/doc_utils/extract_link_attributes.py +23 -3
  3. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/pyproject.toml +1 -1
  4. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/replace_link_attributes.py +12 -2
  5. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15/rolfedh_doc_utils.egg-info}/PKG-INFO +1 -1
  6. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/LICENSE +0 -0
  7. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/README.md +0 -0
  8. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/archive_unused_files.py +0 -0
  9. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/archive_unused_images.py +0 -0
  10. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/check_scannability.py +0 -0
  11. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/doc_utils/__init__.py +0 -0
  12. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/doc_utils/file_utils.py +0 -0
  13. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/doc_utils/format_asciidoc_spacing.py +0 -0
  14. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/doc_utils/replace_link_attributes.py +0 -0
  15. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/doc_utils/scannability.py +0 -0
  16. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/doc_utils/spinner.py +0 -0
  17. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/doc_utils/topic_map_parser.py +0 -0
  18. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/doc_utils/unused_adoc.py +0 -0
  19. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/doc_utils/unused_attributes.py +0 -0
  20. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/doc_utils/unused_images.py +0 -0
  21. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/doc_utils/validate_links.py +0 -0
  22. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/extract_link_attributes.py +0 -0
  23. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/find_unused_attributes.py +0 -0
  24. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/format_asciidoc_spacing.py +0 -0
  25. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/rolfedh_doc_utils.egg-info/SOURCES.txt +0 -0
  26. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/rolfedh_doc_utils.egg-info/dependency_links.txt +0 -0
  27. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/rolfedh_doc_utils.egg-info/entry_points.txt +0 -0
  28. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/rolfedh_doc_utils.egg-info/requires.txt +0 -0
  29. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/rolfedh_doc_utils.egg-info/top_level.txt +0 -0
  30. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/setup.cfg +0 -0
  31. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/setup.py +0 -0
  32. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_archive_unused_files.py +0 -0
  33. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_archive_unused_images.py +0 -0
  34. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_auto_discovery.py +0 -0
  35. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_check_scannability.py +0 -0
  36. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_cli_entry_points.py +0 -0
  37. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_extract_link_attributes.py +0 -0
  38. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_file_utils.py +0 -0
  39. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_fixture_archive_unused_files.py +0 -0
  40. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_fixture_archive_unused_images.py +0 -0
  41. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_fixture_check_scannability.py +0 -0
  42. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_parse_exclude_list.py +0 -0
  43. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_replace_link_attributes.py +0 -0
  44. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_symlink_handling.py +0 -0
  45. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_topic_map_parser.py +0 -0
  46. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_unused_attributes.py +0 -0
  47. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/tests/test_validate_links.py +0 -0
  48. {rolfedh_doc_utils-0.1.14 → rolfedh_doc_utils-0.1.15}/validate_links.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rolfedh-doc-utils
3
- Version: 0.1.14
3
+ Version: 0.1.15
4
4
  Summary: CLI tools for AsciiDoc documentation projects
5
5
  Author: Rolfe Dlugy-Hegwer
6
6
  License: MIT License
@@ -235,13 +235,14 @@ def select_link_text(url: str, variations: List[Tuple[str, str, str, int]], inte
235
235
  return most_common[0]
236
236
 
237
237
 
238
- def collect_all_macros(scan_dirs: List[str] = None, macro_type: str = 'both') -> List[Tuple[str, str, str, str, int]]:
238
+ def collect_all_macros(scan_dirs: List[str] = None, macro_type: str = 'both', exclude_files: List[str] = None) -> List[Tuple[str, str, str, str, int]]:
239
239
  """
240
240
  Collect all link/xref macros with attributes from all .adoc files.
241
241
 
242
242
  Args:
243
243
  scan_dirs: Directories to scan (default: current directory)
244
244
  macro_type: Type of macros to find - 'link', 'xref', or 'both' (default: 'both')
245
+ exclude_files: List of file paths to exclude from scanning (typically all attributes files)
245
246
 
246
247
  Returns: List[(file_path, full_macro, url, link_text, line_number)]
247
248
  """
@@ -250,6 +251,13 @@ def collect_all_macros(scan_dirs: List[str] = None, macro_type: str = 'both') ->
250
251
 
251
252
  all_macros = []
252
253
 
254
+ # Normalize all exclude file paths
255
+ exclude_paths = set()
256
+ if exclude_files:
257
+ for file in exclude_files:
258
+ if file: # Check for None or empty string
259
+ exclude_paths.add(os.path.abspath(file))
260
+
253
261
  for scan_dir in scan_dirs:
254
262
  for root, _, files in os.walk(scan_dir):
255
263
  # Skip hidden directories and .archive
@@ -259,6 +267,9 @@ def collect_all_macros(scan_dirs: List[str] = None, macro_type: str = 'both') ->
259
267
  for file in files:
260
268
  if file.endswith('.adoc'):
261
269
  file_path = os.path.join(root, file)
270
+ # Skip any attributes files to prevent self-referencing
271
+ if exclude_paths and os.path.abspath(file_path) in exclude_paths:
272
+ continue
262
273
  macros = find_link_macros(file_path, macro_type)
263
274
  for full_macro, url, link_text, line_num in macros:
264
275
  all_macros.append((file_path, full_macro, url, link_text, line_num))
@@ -510,11 +521,20 @@ def extract_link_attributes(attributes_file: str = None,
510
521
  existing_attrs = load_existing_attributes(attributes_file)
511
522
  spinner.stop(f"Loaded {len(existing_attrs)} existing attributes")
512
523
 
513
- # Collect all macros
524
+ # Find all attributes files to exclude from processing
525
+ all_attribute_files = find_attribute_files()
526
+
527
+ # Notify user about excluded files if there are multiple
528
+ if len(all_attribute_files) > 1:
529
+ print(f"Excluding {len(all_attribute_files)} attributes files from processing:")
530
+ for f in all_attribute_files:
531
+ print(f" - {f}")
532
+
533
+ # Collect all macros, excluding ALL attributes files
514
534
  macro_desc = {'link': 'link', 'xref': 'xref', 'both': 'link and xref'}[macro_type]
515
535
  spinner = Spinner(f"Scanning for {macro_desc} macros with attributes")
516
536
  spinner.start()
517
- all_macros = collect_all_macros(scan_dirs, macro_type)
537
+ all_macros = collect_all_macros(scan_dirs, macro_type, exclude_files=all_attribute_files)
518
538
  spinner.stop()
519
539
 
520
540
  if not all_macros:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rolfedh-doc-utils"
7
- version = "0.1.14"
7
+ version = "0.1.15"
8
8
  description = "CLI tools for AsciiDoc documentation projects"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -155,8 +155,18 @@ def main():
155
155
  adoc_files = find_adoc_files(repo_root)
156
156
  spinner.stop()
157
157
 
158
- # Exclude the attributes file itself
159
- adoc_files = [f for f in adoc_files if f != attributes_file]
158
+ # Find ALL attributes files to exclude from processing
159
+ all_attribute_files = find_attributes_files(repo_root)
160
+ exclude_paths = {f.resolve() for f in all_attribute_files}
161
+
162
+ # Notify user about excluded files if there are multiple
163
+ if len(all_attribute_files) > 1:
164
+ print(f"Excluding {len(all_attribute_files)} attributes files from processing:")
165
+ for f in all_attribute_files:
166
+ print(f" - {f.relative_to(repo_root)}")
167
+
168
+ # Exclude ALL attributes files, not just the selected one
169
+ adoc_files = [f for f in adoc_files if f.resolve() not in exclude_paths]
160
170
 
161
171
  print(f"Found {len(adoc_files)} AsciiDoc files to process")
162
172
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rolfedh-doc-utils
3
- Version: 0.1.14
3
+ Version: 0.1.15
4
4
  Summary: CLI tools for AsciiDoc documentation projects
5
5
  Author: Rolfe Dlugy-Hegwer
6
6
  License: MIT License