rolfedh-doc-utils 0.1.31__tar.gz → 0.1.33__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 (63) hide show
  1. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/PKG-INFO +1 -1
  2. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/callout_lib/converter_deflist.py +23 -16
  3. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/callout_lib/detector.py +21 -13
  4. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/convert_callouts_interactive.py +42 -22
  5. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/convert_callouts_to_deflist.py +8 -0
  6. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/version.py +1 -1
  7. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/pyproject.toml +1 -1
  8. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/rolfedh_doc_utils.egg-info/PKG-INFO +1 -1
  9. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/LICENSE +0 -0
  10. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/README.md +0 -0
  11. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/archive_unused_files.py +0 -0
  12. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/archive_unused_images.py +0 -0
  13. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/callout_lib/__init__.py +0 -0
  14. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/callout_lib/converter_bullets.py +0 -0
  15. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/callout_lib/converter_comments.py +0 -0
  16. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/callout_lib/table_parser.py +0 -0
  17. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/check_scannability.py +0 -0
  18. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/__init__.py +0 -0
  19. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/extract_link_attributes.py +0 -0
  20. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/file_utils.py +0 -0
  21. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/format_asciidoc_spacing.py +0 -0
  22. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/replace_link_attributes.py +0 -0
  23. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/scannability.py +0 -0
  24. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/spinner.py +0 -0
  25. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/topic_map_parser.py +0 -0
  26. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/unused_adoc.py +0 -0
  27. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/unused_attributes.py +0 -0
  28. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/unused_images.py +0 -0
  29. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/validate_links.py +0 -0
  30. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/version_check.py +0 -0
  31. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils/warnings_report.py +0 -0
  32. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/doc_utils_cli.py +0 -0
  33. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/extract_link_attributes.py +0 -0
  34. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/find_unused_attributes.py +0 -0
  35. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/format_asciidoc_spacing.py +0 -0
  36. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/replace_link_attributes.py +0 -0
  37. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/rolfedh_doc_utils.egg-info/SOURCES.txt +0 -0
  38. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/rolfedh_doc_utils.egg-info/dependency_links.txt +0 -0
  39. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/rolfedh_doc_utils.egg-info/entry_points.txt +0 -0
  40. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/rolfedh_doc_utils.egg-info/requires.txt +0 -0
  41. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/rolfedh_doc_utils.egg-info/top_level.txt +0 -0
  42. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/setup.cfg +0 -0
  43. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/setup.py +0 -0
  44. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_archive_unused_files.py +0 -0
  45. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_archive_unused_images.py +0 -0
  46. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_auto_discovery.py +0 -0
  47. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_check_scannability.py +0 -0
  48. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_cli_entry_points.py +0 -0
  49. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_extract_link_attributes.py +0 -0
  50. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_file_utils.py +0 -0
  51. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_fixture_archive_unused_files.py +0 -0
  52. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_fixture_archive_unused_images.py +0 -0
  53. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_fixture_check_scannability.py +0 -0
  54. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_parse_exclude_list.py +0 -0
  55. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_replace_link_attributes.py +0 -0
  56. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_symlink_handling.py +0 -0
  57. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_table_callout_conversion.py +0 -0
  58. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_table_parser.py +0 -0
  59. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_topic_map_parser.py +0 -0
  60. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_unused_attributes.py +0 -0
  61. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_validate_links.py +0 -0
  62. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/tests/test_version_check.py +0 -0
  63. {rolfedh_doc_utils-0.1.31 → rolfedh_doc_utils-0.1.33}/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.31
3
+ Version: 0.1.33
4
4
  Summary: CLI tools for AsciiDoc documentation projects
5
5
  Author: Rolfe Dlugy-Hegwer
6
6
  License: MIT License
@@ -48,22 +48,29 @@ class DefListConverter:
48
48
  code_line = group.code_line
49
49
  callout_nums = group.callout_numbers
50
50
 
51
- # Check if this is a user-replaceable value (contains angle brackets but not heredoc)
52
- # User values are single words/phrases in angle brackets like <my-value>
53
- user_values = DefListConverter.USER_VALUE_PATTERN.findall(code_line)
54
-
55
- if user_values and len(user_values) == 1 and len(code_line) < 100:
56
- # This looks like a user-replaceable value placeholder
57
- # Format the value (ensure it has angle brackets)
58
- user_value = user_values[0]
59
- if not user_value.startswith('<'):
60
- user_value = f'<{user_value}>'
61
- if not user_value.endswith('>'):
62
- user_value = f'{user_value}>'
63
- term = f'`{user_value}`'
64
- else:
65
- # This is a code line - strip whitespace before wrapping in backticks
66
- term = f'`{code_line.strip()}`'
51
+ # COMMENTED OUT: User-replaceable value detection causes false positives
52
+ # with Java generics (e.g., <MyEntity, Integer>) and other valid syntax
53
+ # that uses angle brackets. Always use the full code line as the term.
54
+ #
55
+ # # Check if this is a user-replaceable value (contains angle brackets but not heredoc)
56
+ # # User values are single words/phrases in angle brackets like <my-value>
57
+ # user_values = DefListConverter.USER_VALUE_PATTERN.findall(code_line)
58
+ #
59
+ # if user_values and len(user_values) == 1 and len(code_line) < 100:
60
+ # # This looks like a user-replaceable value placeholder
61
+ # # Format the value (ensure it has angle brackets)
62
+ # user_value = user_values[0]
63
+ # if not user_value.startswith('<'):
64
+ # user_value = f'<{user_value}>'
65
+ # if not user_value.endswith('>'):
66
+ # user_value = f'{user_value}>'
67
+ # term = f'`{user_value}`'
68
+ # else:
69
+ # # This is a code line - strip whitespace before wrapping in backticks
70
+ # term = f'`{code_line.strip()}`'
71
+
72
+ # Always use the full code line - strip whitespace before wrapping in backticks
73
+ term = f'`{code_line.strip()}`'
67
74
 
68
75
  # Add blank line before each term
69
76
  lines.append('')
@@ -46,9 +46,10 @@ class CalloutDetector:
46
46
  CALLOUT_IN_CODE = re.compile(r'<(\d+)>')
47
47
 
48
48
  # Pattern for callout with optional preceding comment syntax
49
- # Matches common comment styles: //, #, --, ;, followed by optional whitespace and <number>
50
- # The comment syntax must be preceded by whitespace to avoid matching code operators
51
- CALLOUT_WITH_COMMENT = re.compile(r'\s*(?://|#|--|;)\s*<\d+>|\s*<\d+>')
49
+ # Matches common comment styles: //, #, --, followed by optional whitespace and <number>
50
+ # Note: Semicolon (;) removed because it's a statement terminator in Java/C/C++/JavaScript
51
+ # and causes false positives (e.g., "name; <1>" would incorrectly remove the semicolon)
52
+ CALLOUT_WITH_COMMENT = re.compile(r'\s*(?://|#|--)\s*<\d+>|\s*<\d+>')
52
53
 
53
54
  # Pattern for callout explanation line: <1> Explanation text
54
55
  CALLOUT_EXPLANATION = re.compile(r'^<(\d+)>\s+(.+)$')
@@ -141,16 +142,23 @@ class CalloutDetector:
141
142
  # Use CALLOUT_WITH_COMMENT to remove both comment syntax and callout
142
143
  line_without_callouts = self.CALLOUT_WITH_COMMENT.sub('', line).rstrip()
143
144
 
144
- # Find all angle-bracket enclosed values
145
- user_values = self.USER_VALUE_PATTERN.findall(line_without_callouts)
146
-
147
- # Determine what to use as the code line term
148
- if user_values:
149
- # Use the rightmost (closest to the callout) user value
150
- code_line = user_values[-1]
151
- else:
152
- # No angle-bracket value found - use the actual code line
153
- code_line = line_without_callouts
145
+ # COMMENTED OUT: User-replaceable value detection causes false positives
146
+ # with Java generics (e.g., <MyEntity, Integer>) and other valid syntax
147
+ # that uses angle brackets. Always use the full code line.
148
+ #
149
+ # # Find all angle-bracket enclosed values
150
+ # user_values = self.USER_VALUE_PATTERN.findall(line_without_callouts)
151
+ #
152
+ # # Determine what to use as the code line term
153
+ # if user_values:
154
+ # # Use the rightmost (closest to the callout) user value
155
+ # code_line = user_values[-1]
156
+ # else:
157
+ # # No angle-bracket value found - use the actual code line
158
+ # code_line = line_without_callouts
159
+
160
+ # Always use the full code line
161
+ code_line = line_without_callouts
154
162
 
155
163
  # Collect all callout numbers on this line
156
164
  callout_nums = [int(m.group(1)) for m in callout_matches]
@@ -20,6 +20,9 @@ from callout_lib import (
20
20
  CodeBlock,
21
21
  )
22
22
 
23
+ # Import version
24
+ from doc_utils.version import __version__
25
+
23
26
 
24
27
  # Colors for output
25
28
  class Colors:
@@ -124,24 +127,30 @@ class InteractiveCalloutConverter:
124
127
  print(" [d] Use Definition list format instead")
125
128
  print(" [b] Use Bulleted list format instead")
126
129
  print(" [k] Skip this block")
127
- print(" [q] Quit")
130
+ print(" [q] Skip current file")
131
+ print(" [Q] Quit script entirely (Ctrl+C)")
128
132
 
129
133
  while True:
130
134
  try:
131
- choice = input("\nYour choice [s/d/b/k/q]: ").strip().lower()
132
-
133
- if choice in ['q', 'quit', 'exit']:
135
+ choice = input("\nYour choice [s/d/b/k/q/Q]: ").strip()
136
+
137
+ if choice in ['Q', 'QUIT', 'EXIT']:
138
+ # Quit script entirely
139
+ print_colored("\nQuitting script...", Colors.YELLOW)
140
+ sys.exit(0)
141
+ elif choice.lower() in ['q', 'quit', 'exit']:
142
+ # Skip current file
134
143
  return None
135
- elif choice in ['s', 'shorten', 'short']:
144
+ elif choice.lower() in ['s', 'shorten', 'short']:
136
145
  return 'shorten'
137
- elif choice in ['d', 'deflist']:
146
+ elif choice.lower() in ['d', 'deflist']:
138
147
  return 'deflist'
139
- elif choice in ['b', 'bullets', 'bullet']:
148
+ elif choice.lower() in ['b', 'bullets', 'bullet']:
140
149
  return 'bullets'
141
- elif choice in ['k', 'skip']:
150
+ elif choice.lower() in ['k', 'skip']:
142
151
  return 'skip'
143
152
  else:
144
- print_colored("Invalid choice. Please enter s, d, b, k, or q.", Colors.RED)
153
+ print_colored("Invalid choice. Please enter s, d, b, k, q, or Q.", Colors.RED)
145
154
 
146
155
  except (KeyboardInterrupt, EOFError):
147
156
  print()
@@ -165,23 +174,29 @@ class InteractiveCalloutConverter:
165
174
  print(" [c] Inline comments")
166
175
  print(" [s] Skip this block")
167
176
  print(" [a] Apply choice to All remaining blocks")
168
- print(" [q] Quit")
177
+ print(" [q] Skip current file")
178
+ print(" [Q] Quit script entirely (Ctrl+C)")
169
179
 
170
180
  while True:
171
181
  try:
172
- choice = input("\nYour choice [d/b/c/s/a/q]: ").strip().lower()
173
-
174
- if choice in ['q', 'quit', 'exit']:
182
+ choice = input("\nYour choice [d/b/c/s/a/q/Q]: ").strip()
183
+
184
+ if choice in ['Q', 'QUIT', 'EXIT']:
185
+ # Quit script entirely
186
+ print_colored("\nQuitting script...", Colors.YELLOW)
187
+ sys.exit(0)
188
+ elif choice.lower() in ['q', 'quit', 'exit']:
189
+ # Skip current file
175
190
  return None
176
- elif choice in ['s', 'skip']:
191
+ elif choice.lower() in ['s', 'skip']:
177
192
  return 'skip'
178
- elif choice in ['d', 'deflist']:
193
+ elif choice.lower() in ['d', 'deflist']:
179
194
  return 'deflist'
180
- elif choice in ['b', 'bullets', 'bullet']:
195
+ elif choice.lower() in ['b', 'bullets', 'bullet']:
181
196
  return 'bullets'
182
- elif choice in ['c', 'comments', 'comment']:
197
+ elif choice.lower() in ['c', 'comments', 'comment']:
183
198
  return 'comments'
184
- elif choice in ['a', 'all']:
199
+ elif choice.lower() in ['a', 'all']:
185
200
  # Ask for the format to apply to all
186
201
  print("\nWhat format should be applied to all remaining blocks?")
187
202
  print(" [d] Definition list")
@@ -254,7 +269,7 @@ class InteractiveCalloutConverter:
254
269
  choice = self.get_user_choice(idx, total_blocks)
255
270
 
256
271
  if choice is None:
257
- print_colored("\nConversion cancelled by user.", Colors.YELLOW)
272
+ print_colored("\nSkipping remaining blocks in this file.", Colors.YELLOW)
258
273
  return 0, False
259
274
  elif choice == 'skip':
260
275
  print_colored("Skipping this block.\n", Colors.YELLOW)
@@ -276,7 +291,7 @@ class InteractiveCalloutConverter:
276
291
  long_choice = self.get_user_choice_for_long_comments(block, long_warnings)
277
292
 
278
293
  if long_choice is None:
279
- print_colored("\nConversion cancelled by user.", Colors.YELLOW)
294
+ print_colored("\nSkipping remaining blocks in this file.", Colors.YELLOW)
280
295
  return 0, False
281
296
  elif long_choice == 'skip':
282
297
  print_colored("Skipping this block.\n", Colors.YELLOW)
@@ -444,6 +459,11 @@ Examples:
444
459
  """
445
460
  )
446
461
 
462
+ parser.add_argument(
463
+ '--version',
464
+ action='version',
465
+ version=f'%(prog)s {__version__}'
466
+ )
447
467
  parser.add_argument(
448
468
  'path',
449
469
  nargs='?',
@@ -510,8 +530,8 @@ Examples:
510
530
  total_conversions += conversions
511
531
 
512
532
  except KeyboardInterrupt:
513
- print_colored("\n\nOperation cancelled by user", Colors.YELLOW)
514
- break
533
+ print_colored("\n\nScript interrupted by user (Ctrl+C)", Colors.YELLOW)
534
+ sys.exit(0)
515
535
  except Exception as e:
516
536
  print_colored(f"\nUnexpected error processing {file_path}: {e}", Colors.RED)
517
537
  import traceback
@@ -25,6 +25,9 @@ from callout_lib import (
25
25
  # Import warnings report generator
26
26
  from doc_utils.warnings_report import generate_warnings_report
27
27
 
28
+ # Import version
29
+ from doc_utils.version import __version__
30
+
28
31
 
29
32
  # Colors for output
30
33
  class Colors:
@@ -395,6 +398,11 @@ Example transformation (deflist format):
395
398
  """
396
399
  )
397
400
 
401
+ parser.add_argument(
402
+ '--version',
403
+ action='version',
404
+ version=f'%(prog)s {__version__}'
405
+ )
398
406
  parser.add_argument(
399
407
  'path',
400
408
  nargs='?',
@@ -1,7 +1,7 @@
1
1
  """Version information for doc-utils."""
2
2
 
3
3
  # This should match the version in pyproject.toml
4
- __version__ = "0.1.30"
4
+ __version__ = "0.1.33"
5
5
 
6
6
  def get_version():
7
7
  """Return the current version string."""
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rolfedh-doc-utils"
7
- version = "0.1.31"
7
+ version = "0.1.33"
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.31
3
+ Version: 0.1.33
4
4
  Summary: CLI tools for AsciiDoc documentation projects
5
5
  Author: Rolfe Dlugy-Hegwer
6
6
  License: MIT License