rolfedh-doc-utils 0.1.32__py3-none-any.whl → 0.1.33__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.
@@ -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('')
callout_lib/detector.py CHANGED
@@ -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]
@@ -127,24 +127,30 @@ class InteractiveCalloutConverter:
127
127
  print(" [d] Use Definition list format instead")
128
128
  print(" [b] Use Bulleted list format instead")
129
129
  print(" [k] Skip this block")
130
- print(" [q] Quit")
130
+ print(" [q] Skip current file")
131
+ print(" [Q] Quit script entirely (Ctrl+C)")
131
132
 
132
133
  while True:
133
134
  try:
134
- choice = input("\nYour choice [s/d/b/k/q]: ").strip().lower()
135
-
136
- 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
137
143
  return None
138
- elif choice in ['s', 'shorten', 'short']:
144
+ elif choice.lower() in ['s', 'shorten', 'short']:
139
145
  return 'shorten'
140
- elif choice in ['d', 'deflist']:
146
+ elif choice.lower() in ['d', 'deflist']:
141
147
  return 'deflist'
142
- elif choice in ['b', 'bullets', 'bullet']:
148
+ elif choice.lower() in ['b', 'bullets', 'bullet']:
143
149
  return 'bullets'
144
- elif choice in ['k', 'skip']:
150
+ elif choice.lower() in ['k', 'skip']:
145
151
  return 'skip'
146
152
  else:
147
- 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)
148
154
 
149
155
  except (KeyboardInterrupt, EOFError):
150
156
  print()
@@ -168,23 +174,29 @@ class InteractiveCalloutConverter:
168
174
  print(" [c] Inline comments")
169
175
  print(" [s] Skip this block")
170
176
  print(" [a] Apply choice to All remaining blocks")
171
- print(" [q] Quit")
177
+ print(" [q] Skip current file")
178
+ print(" [Q] Quit script entirely (Ctrl+C)")
172
179
 
173
180
  while True:
174
181
  try:
175
- choice = input("\nYour choice [d/b/c/s/a/q]: ").strip().lower()
176
-
177
- 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
178
190
  return None
179
- elif choice in ['s', 'skip']:
191
+ elif choice.lower() in ['s', 'skip']:
180
192
  return 'skip'
181
- elif choice in ['d', 'deflist']:
193
+ elif choice.lower() in ['d', 'deflist']:
182
194
  return 'deflist'
183
- elif choice in ['b', 'bullets', 'bullet']:
195
+ elif choice.lower() in ['b', 'bullets', 'bullet']:
184
196
  return 'bullets'
185
- elif choice in ['c', 'comments', 'comment']:
197
+ elif choice.lower() in ['c', 'comments', 'comment']:
186
198
  return 'comments'
187
- elif choice in ['a', 'all']:
199
+ elif choice.lower() in ['a', 'all']:
188
200
  # Ask for the format to apply to all
189
201
  print("\nWhat format should be applied to all remaining blocks?")
190
202
  print(" [d] Definition list")
@@ -257,7 +269,7 @@ class InteractiveCalloutConverter:
257
269
  choice = self.get_user_choice(idx, total_blocks)
258
270
 
259
271
  if choice is None:
260
- print_colored("\nConversion cancelled by user.", Colors.YELLOW)
272
+ print_colored("\nSkipping remaining blocks in this file.", Colors.YELLOW)
261
273
  return 0, False
262
274
  elif choice == 'skip':
263
275
  print_colored("Skipping this block.\n", Colors.YELLOW)
@@ -279,7 +291,7 @@ class InteractiveCalloutConverter:
279
291
  long_choice = self.get_user_choice_for_long_comments(block, long_warnings)
280
292
 
281
293
  if long_choice is None:
282
- print_colored("\nConversion cancelled by user.", Colors.YELLOW)
294
+ print_colored("\nSkipping remaining blocks in this file.", Colors.YELLOW)
283
295
  return 0, False
284
296
  elif long_choice == 'skip':
285
297
  print_colored("Skipping this block.\n", Colors.YELLOW)
@@ -518,8 +530,8 @@ Examples:
518
530
  total_conversions += conversions
519
531
 
520
532
  except KeyboardInterrupt:
521
- print_colored("\n\nOperation cancelled by user", Colors.YELLOW)
522
- break
533
+ print_colored("\n\nScript interrupted by user (Ctrl+C)", Colors.YELLOW)
534
+ sys.exit(0)
523
535
  except Exception as e:
524
536
  print_colored(f"\nUnexpected error processing {file_path}: {e}", Colors.RED)
525
537
  import traceback
doc_utils/version.py CHANGED
@@ -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.32"
4
+ __version__ = "0.1.33"
5
5
 
6
6
  def get_version():
7
7
  """Return the current version string."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rolfedh-doc-utils
3
- Version: 0.1.32
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
@@ -1,7 +1,7 @@
1
1
  archive_unused_files.py,sha256=OJZrkqn70hiOXED218jMYPFNFWnsDpjsCYOmBRxYnHU,2274
2
2
  archive_unused_images.py,sha256=fZeyEZtTd72Gbd3YBXTy5xoshAAM9qb4qFPMjhHL1Fg,1864
3
3
  check_scannability.py,sha256=O6ROr-e624jVPvPpASpsWo0gTfuCFpA2mTSX61BjAEI,5478
4
- convert_callouts_interactive.py,sha256=9mmXEIbJo8G2Drj0uMWHFsF59zwJtNPgR2MNsisELLE,22160
4
+ convert_callouts_interactive.py,sha256=4PjiVIOWxNJiJLQuBHT3x6rE46-hgfFHSaoo5quYIs8,22889
5
5
  convert_callouts_to_deflist.py,sha256=zbQeig2d69gHJPVEiV9jPUg2IzYFPjVzj1GIUacRk7Q,24895
6
6
  doc_utils_cli.py,sha256=J3CE7cTDDCRGkhAknYejNWHhk5t9YFGt27WDVfR98Xk,5111
7
7
  extract_link_attributes.py,sha256=wR2SmR2la-jR6DzDbas2PoNONgRZ4dZ6aqwzkwEv8Gs,3516
@@ -12,8 +12,8 @@ validate_links.py,sha256=lWuK8sgfiFdfcUdSVAt_5U9JHVde_oa6peSUlBQtsac,6145
12
12
  callout_lib/__init__.py,sha256=8B82N_z4D1LaZVYgd5jZR53QAabtgPzADOyGlnvihj0,665
13
13
  callout_lib/converter_bullets.py,sha256=nfH0hz4p8qNM2F-MhtBjwH-lUYcNf2m1sdJebRlCxoo,4405
14
14
  callout_lib/converter_comments.py,sha256=do0dH8uOyNFpn5CDEzR0jYYCMIPP3oPFM8cEB-Fp22c,9767
15
- callout_lib/converter_deflist.py,sha256=LphSVdvCAcH1k7ysiBRQcrfaXRs48lmygSijYXVpu40,4942
16
- callout_lib/detector.py,sha256=oU36eaSz-damdylPuOftTwNU5ZjVf8GMJ44txcFAFOM,15474
15
+ callout_lib/converter_deflist.py,sha256=WRjCc7My_G6s-IJkapiH-fSzaODECK4E-8eC4mxKJw4,5388
16
+ callout_lib/detector.py,sha256=S0vZDa4zhTSn6Kv0hWfG56W-5srGxUc-nvpLe_gIx-A,15971
17
17
  callout_lib/table_parser.py,sha256=ZucisADE8RDAk5HtIrttaPgBi6Hf8ZUpw7KzfbcmEjc,31450
18
18
  doc_utils/__init__.py,sha256=qqZR3lohzkP63soymrEZPBGzzk6-nFzi4_tSffjmu_0,74
19
19
  doc_utils/extract_link_attributes.py,sha256=U0EvPZReJQigNfbT-icBsVT6Li64hYki5W7MQz6qqbc,22743
@@ -27,12 +27,12 @@ doc_utils/unused_adoc.py,sha256=2cbqcYr1os2EhETUU928BlPRlsZVSdI00qaMhqjSIqQ,5263
27
27
  doc_utils/unused_attributes.py,sha256=OHyAdaBD7aNo357B0SLBN5NC_jNY5TWXMwgtfJNh3X8,7621
28
28
  doc_utils/unused_images.py,sha256=nqn36Bbrmon2KlGlcaruNjJJvTQ8_9H0WU9GvCW7rW8,1456
29
29
  doc_utils/validate_links.py,sha256=iBGXnwdeLlgIT3fo3v01ApT5k0X2FtctsvkrE6E3VMk,19610
30
- doc_utils/version.py,sha256=0NJYwHS5xU9zjMDJzmJazrS_NbnmIeQhFMCZS7ZUNvQ,203
30
+ doc_utils/version.py,sha256=JLQGHawSu5HP0DrmGYLTvKdG3Vewba36SOJmqL2INc4,203
31
31
  doc_utils/version_check.py,sha256=-31Y6AN0KGi_CUCAVOOhf6bPO3r7SQIXPxxeffLAF0w,7535
32
32
  doc_utils/warnings_report.py,sha256=20yfwqBjOprfFhQwCujbcsvjJCbHHhmH84uAujm-y-o,8877
33
- rolfedh_doc_utils-0.1.32.dist-info/licenses/LICENSE,sha256=vLxtwMVOJA_hEy8b77niTkdmQI9kNJskXHq0dBS36e0,1075
34
- rolfedh_doc_utils-0.1.32.dist-info/METADATA,sha256=PVHT2JPkbSx-8AY7xGOYqI-RHT-2I2YTmS41EZmsma8,8325
35
- rolfedh_doc_utils-0.1.32.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
- rolfedh_doc_utils-0.1.32.dist-info/entry_points.txt,sha256=vL_LlLKOiurRzchrq8iRUQG19Xi9lSAFVZGjO-xyErk,577
37
- rolfedh_doc_utils-0.1.32.dist-info/top_level.txt,sha256=J4xtr3zoyCip27b3GnticFVZoyz5HHtgGqHQ-SZONCA,265
38
- rolfedh_doc_utils-0.1.32.dist-info/RECORD,,
33
+ rolfedh_doc_utils-0.1.33.dist-info/licenses/LICENSE,sha256=vLxtwMVOJA_hEy8b77niTkdmQI9kNJskXHq0dBS36e0,1075
34
+ rolfedh_doc_utils-0.1.33.dist-info/METADATA,sha256=Vy25n71NbHOPR1rYoBvnAGd8k0KwtPM0XLLAMvJTd74,8325
35
+ rolfedh_doc_utils-0.1.33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ rolfedh_doc_utils-0.1.33.dist-info/entry_points.txt,sha256=vL_LlLKOiurRzchrq8iRUQG19Xi9lSAFVZGjO-xyErk,577
37
+ rolfedh_doc_utils-0.1.33.dist-info/top_level.txt,sha256=J4xtr3zoyCip27b3GnticFVZoyz5HHtgGqHQ-SZONCA,265
38
+ rolfedh_doc_utils-0.1.33.dist-info/RECORD,,