rolfedh-doc-utils 0.1.23__tar.gz → 0.1.24__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 (53) hide show
  1. {rolfedh_doc_utils-0.1.23/rolfedh_doc_utils.egg-info → rolfedh_doc_utils-0.1.24}/PKG-INFO +1 -1
  2. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/convert_callouts_to_deflist.py +86 -5
  3. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/pyproject.toml +1 -1
  4. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24/rolfedh_doc_utils.egg-info}/PKG-INFO +1 -1
  5. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/LICENSE +0 -0
  6. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/README.md +0 -0
  7. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/archive_unused_files.py +0 -0
  8. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/archive_unused_images.py +0 -0
  9. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/check_scannability.py +0 -0
  10. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/__init__.py +0 -0
  11. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/extract_link_attributes.py +0 -0
  12. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/file_utils.py +0 -0
  13. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/format_asciidoc_spacing.py +0 -0
  14. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/replace_link_attributes.py +0 -0
  15. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/scannability.py +0 -0
  16. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/spinner.py +0 -0
  17. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/topic_map_parser.py +0 -0
  18. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/unused_adoc.py +0 -0
  19. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/unused_attributes.py +0 -0
  20. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/unused_images.py +0 -0
  21. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/validate_links.py +0 -0
  22. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/version.py +0 -0
  23. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils/version_check.py +0 -0
  24. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/doc_utils_cli.py +0 -0
  25. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/extract_link_attributes.py +0 -0
  26. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/find_unused_attributes.py +0 -0
  27. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/format_asciidoc_spacing.py +0 -0
  28. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/replace_link_attributes.py +0 -0
  29. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/rolfedh_doc_utils.egg-info/SOURCES.txt +0 -0
  30. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/rolfedh_doc_utils.egg-info/dependency_links.txt +0 -0
  31. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/rolfedh_doc_utils.egg-info/entry_points.txt +0 -0
  32. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/rolfedh_doc_utils.egg-info/requires.txt +0 -0
  33. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/rolfedh_doc_utils.egg-info/top_level.txt +0 -0
  34. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/setup.cfg +0 -0
  35. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/setup.py +0 -0
  36. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_archive_unused_files.py +0 -0
  37. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_archive_unused_images.py +0 -0
  38. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_auto_discovery.py +0 -0
  39. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_check_scannability.py +0 -0
  40. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_cli_entry_points.py +0 -0
  41. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_extract_link_attributes.py +0 -0
  42. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_file_utils.py +0 -0
  43. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_fixture_archive_unused_files.py +0 -0
  44. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_fixture_archive_unused_images.py +0 -0
  45. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_fixture_check_scannability.py +0 -0
  46. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_parse_exclude_list.py +0 -0
  47. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_replace_link_attributes.py +0 -0
  48. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_symlink_handling.py +0 -0
  49. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_topic_map_parser.py +0 -0
  50. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_unused_attributes.py +0 -0
  51. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_validate_links.py +0 -0
  52. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/tests/test_version_check.py +0 -0
  53. {rolfedh_doc_utils-0.1.23 → rolfedh_doc_utils-0.1.24}/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.23
3
+ Version: 0.1.24
4
4
  Summary: CLI tools for AsciiDoc documentation projects
5
5
  Author: Rolfe Dlugy-Hegwer
6
6
  License: MIT License
@@ -72,9 +72,10 @@ class CalloutConverter:
72
72
  # Excludes heredoc syntax (<<) and comparison operators
73
73
  USER_VALUE_PATTERN = re.compile(r'(?<!<)<([a-zA-Z][^>]*)>')
74
74
 
75
- def __init__(self, dry_run: bool = False, verbose: bool = False):
75
+ def __init__(self, dry_run: bool = False, verbose: bool = False, output_format: str = 'deflist'):
76
76
  self.dry_run = dry_run
77
77
  self.verbose = verbose
78
+ self.output_format = output_format # 'deflist' or 'bullets'
78
79
  self.changes_made = 0
79
80
  self.warnings = [] # Collect warnings for summary
80
81
 
@@ -323,6 +324,77 @@ class CalloutConverter:
323
324
 
324
325
  return lines
325
326
 
327
+ def create_bulleted_list(self, callout_groups: List[CalloutGroup], explanations: Dict[int, Callout]) -> List[str]:
328
+ """
329
+ Create bulleted list from callout groups and explanations.
330
+
331
+ Follows Red Hat style guide format:
332
+ - Each bullet starts with `*` followed by backticked code element
333
+ - Colon separates element from explanation
334
+ - Blank line between each bullet point
335
+
336
+ For callouts with user-replaceable values in angle brackets, uses those.
337
+ For callouts without values, uses the actual code line as the term.
338
+
339
+ When multiple callouts share the same code line (same group), their
340
+ explanations are merged with line breaks.
341
+ """
342
+ lines = [''] # Start with blank line before list
343
+
344
+ # Process each group (which may contain one or more callouts)
345
+ for group in callout_groups:
346
+ code_line = group.code_line
347
+ callout_nums = group.callout_numbers
348
+
349
+ # Check if this is a user-replaceable value (contains angle brackets but not heredoc)
350
+ # User values are single words/phrases in angle brackets like <my-value>
351
+ user_values = self.USER_VALUE_PATTERN.findall(code_line)
352
+
353
+ if user_values and len(user_values) == 1 and len(code_line) < 100:
354
+ # This looks like a user-replaceable value placeholder
355
+ # Format the value (ensure it has angle brackets)
356
+ user_value = user_values[0]
357
+ if not user_value.startswith('<'):
358
+ user_value = f'<{user_value}>'
359
+ if not user_value.endswith('>'):
360
+ user_value = f'{user_value}>'
361
+ term = f'`{user_value}`'
362
+ else:
363
+ # This is a code line - use it as-is in backticks
364
+ term = f'`{code_line}`'
365
+
366
+ # Collect all explanations for this group
367
+ all_explanation_lines = []
368
+ for idx, callout_num in enumerate(callout_nums):
369
+ explanation = explanations[callout_num]
370
+
371
+ # Add explanation lines, prepending "Optional. " to first line if needed
372
+ for line_idx, line in enumerate(explanation.lines):
373
+ if line_idx == 0 and explanation.is_optional:
374
+ all_explanation_lines.append(f'Optional. {line}')
375
+ else:
376
+ all_explanation_lines.append(line)
377
+
378
+ # If there are more callouts in this group, add a line break
379
+ if idx < len(callout_nums) - 1:
380
+ all_explanation_lines.append('')
381
+
382
+ # Format as bullet point: * `term`: explanation
383
+ # First line uses the bullet marker
384
+ lines.append(f'* {term}: {all_explanation_lines[0]}')
385
+
386
+ # Continuation lines (if any) are indented to align with first line
387
+ for continuation_line in all_explanation_lines[1:]:
388
+ if continuation_line: # Skip empty lines for now
389
+ lines.append(f' {continuation_line}')
390
+ else:
391
+ lines.append('')
392
+
393
+ # Add blank line after each bullet point
394
+ lines.append('')
395
+
396
+ return lines
397
+
326
398
  def convert_file(self, input_file: Path) -> Tuple[int, bool]:
327
399
  """
328
400
  Convert callouts in a file to definition list format.
@@ -380,8 +452,11 @@ class CalloutConverter:
380
452
  # Remove callouts from code
381
453
  cleaned_content = self.remove_callouts_from_code(block.content)
382
454
 
383
- # Create definition list
384
- def_list = self.create_definition_list(callout_groups, explanations)
455
+ # Create output list (definition list or bulleted list based on format option)
456
+ if self.output_format == 'bullets':
457
+ output_list = self.create_bulleted_list(callout_groups, explanations)
458
+ else: # default to 'deflist'
459
+ output_list = self.create_definition_list(callout_groups, explanations)
385
460
 
386
461
  # Replace in document
387
462
  # 1. Update code block content
@@ -403,7 +478,7 @@ class CalloutConverter:
403
478
  new_lines[:content_start] +
404
479
  cleaned_content +
405
480
  [new_lines[content_end]] + # Keep closing delimiter
406
- def_list +
481
+ output_list +
407
482
  new_lines[explanation_end + 1:]
408
483
  )
409
484
 
@@ -556,6 +631,12 @@ Example transformation:
556
631
  action='store_true',
557
632
  help='Enable verbose output'
558
633
  )
634
+ parser.add_argument(
635
+ '-f', '--format',
636
+ choices=['deflist', 'bullets'],
637
+ default='deflist',
638
+ help='Output format: "deflist" for definition list with "where:" (default), "bullets" for bulleted list'
639
+ )
559
640
  parser.add_argument(
560
641
  '--exclude-dir',
561
642
  action='append',
@@ -613,7 +694,7 @@ Example transformation:
613
694
  print(f"Found {len(adoc_files)} AsciiDoc file(s) to process")
614
695
 
615
696
  # Create converter
616
- converter = CalloutConverter(dry_run=args.dry_run, verbose=args.verbose)
697
+ converter = CalloutConverter(dry_run=args.dry_run, verbose=args.verbose, output_format=args.format)
617
698
 
618
699
  # Process each file
619
700
  files_processed = 0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rolfedh-doc-utils"
7
- version = "0.1.23"
7
+ version = "0.1.24"
8
8
  description = "CLI tools for AsciiDoc documentation projects"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rolfedh-doc-utils
3
- Version: 0.1.23
3
+ Version: 0.1.24
4
4
  Summary: CLI tools for AsciiDoc documentation projects
5
5
  Author: Rolfe Dlugy-Hegwer
6
6
  License: MIT License