rolfedh-doc-utils 0.1.27__py3-none-any.whl → 0.1.29__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.
- callout_lib/converter_bullets.py +2 -2
- callout_lib/converter_deflist.py +2 -2
- callout_lib/detector.py +16 -7
- callout_lib/table_parser.py +11 -0
- doc_utils/format_asciidoc_spacing.py +16 -5
- doc_utils/version.py +1 -1
- doc_utils/version_check.py +16 -5
- doc_utils_cli.py +6 -1
- {rolfedh_doc_utils-0.1.27.dist-info → rolfedh_doc_utils-0.1.29.dist-info}/METADATA +1 -1
- {rolfedh_doc_utils-0.1.27.dist-info → rolfedh_doc_utils-0.1.29.dist-info}/RECORD +14 -14
- {rolfedh_doc_utils-0.1.27.dist-info → rolfedh_doc_utils-0.1.29.dist-info}/WHEEL +0 -0
- {rolfedh_doc_utils-0.1.27.dist-info → rolfedh_doc_utils-0.1.29.dist-info}/entry_points.txt +0 -0
- {rolfedh_doc_utils-0.1.27.dist-info → rolfedh_doc_utils-0.1.29.dist-info}/licenses/LICENSE +0 -0
- {rolfedh_doc_utils-0.1.27.dist-info → rolfedh_doc_utils-0.1.29.dist-info}/top_level.txt +0 -0
callout_lib/converter_bullets.py
CHANGED
|
@@ -59,8 +59,8 @@ class BulletListConverter:
|
|
|
59
59
|
user_value = f'{user_value}>'
|
|
60
60
|
term = f'`{user_value}`'
|
|
61
61
|
else:
|
|
62
|
-
# This is a code line -
|
|
63
|
-
term = f'`{code_line}`'
|
|
62
|
+
# This is a code line - strip whitespace before wrapping in backticks
|
|
63
|
+
term = f'`{code_line.strip()}`'
|
|
64
64
|
|
|
65
65
|
# Collect all explanations for this group
|
|
66
66
|
all_explanation_lines = []
|
callout_lib/converter_deflist.py
CHANGED
|
@@ -54,8 +54,8 @@ class DefListConverter:
|
|
|
54
54
|
user_value = f'{user_value}>'
|
|
55
55
|
term = f'`{user_value}`'
|
|
56
56
|
else:
|
|
57
|
-
# This is a code line -
|
|
58
|
-
term = f'`{code_line}`'
|
|
57
|
+
# This is a code line - strip whitespace before wrapping in backticks
|
|
58
|
+
term = f'`{code_line.strip()}`'
|
|
59
59
|
|
|
60
60
|
# Add blank line before each term
|
|
61
61
|
lines.append('')
|
callout_lib/detector.py
CHANGED
|
@@ -45,6 +45,11 @@ class CalloutDetector:
|
|
|
45
45
|
# Pattern for callout number in code block (can appear multiple times per line)
|
|
46
46
|
CALLOUT_IN_CODE = re.compile(r'<(\d+)>')
|
|
47
47
|
|
|
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+>')
|
|
52
|
+
|
|
48
53
|
# Pattern for callout explanation line: <1> Explanation text
|
|
49
54
|
CALLOUT_EXPLANATION = re.compile(r'^<(\d+)>\s+(.+)$')
|
|
50
55
|
|
|
@@ -130,8 +135,9 @@ class CalloutDetector:
|
|
|
130
135
|
# Look for all callout numbers on this line
|
|
131
136
|
callout_matches = list(self.CALLOUT_IN_CODE.finditer(line))
|
|
132
137
|
if callout_matches:
|
|
133
|
-
# Remove
|
|
134
|
-
|
|
138
|
+
# Remove callouts AND preceding comment syntax from the line
|
|
139
|
+
# Use CALLOUT_WITH_COMMENT to remove both comment syntax and callout
|
|
140
|
+
line_without_callouts = self.CALLOUT_WITH_COMMENT.sub('', line).rstrip()
|
|
135
141
|
|
|
136
142
|
# Find all angle-bracket enclosed values
|
|
137
143
|
user_values = self.USER_VALUE_PATTERN.findall(line_without_callouts)
|
|
@@ -216,11 +222,11 @@ class CalloutDetector:
|
|
|
216
222
|
|
|
217
223
|
# Add value lines with context
|
|
218
224
|
if value_lines:
|
|
219
|
-
# Format: "
|
|
225
|
+
# Format: "`value`:"
|
|
220
226
|
value_text = value_lines[0] if value_lines else ""
|
|
221
227
|
# If value is code-like (contains backticks or special chars), keep it formatted
|
|
222
228
|
if value_text:
|
|
223
|
-
all_lines.append(f"
|
|
229
|
+
all_lines.append(f"{value_text}:")
|
|
224
230
|
|
|
225
231
|
# Add additional value lines if multi-line
|
|
226
232
|
for line in value_lines[1:]:
|
|
@@ -290,11 +296,14 @@ class CalloutDetector:
|
|
|
290
296
|
return explanations, i - 1
|
|
291
297
|
|
|
292
298
|
def remove_callouts_from_code(self, content: List[str]) -> List[str]:
|
|
293
|
-
"""
|
|
299
|
+
"""
|
|
300
|
+
Remove callout numbers and preceding comment syntax from code block content.
|
|
301
|
+
Handles multiple callouts per line and various comment styles (//, #, --, ;).
|
|
302
|
+
"""
|
|
294
303
|
cleaned = []
|
|
295
304
|
for line in content:
|
|
296
|
-
# Remove all callout numbers
|
|
297
|
-
cleaned.append(self.
|
|
305
|
+
# Remove all callout numbers with their preceding comment syntax
|
|
306
|
+
cleaned.append(self.CALLOUT_WITH_COMMENT.sub('', line).rstrip())
|
|
298
307
|
return cleaned
|
|
299
308
|
|
|
300
309
|
def validate_callouts(self, callout_groups: List[CalloutGroup], explanations: Dict[int, Callout]) -> Tuple[bool, set, set]:
|
callout_lib/table_parser.py
CHANGED
|
@@ -200,6 +200,17 @@ class TableParser:
|
|
|
200
200
|
content=[part],
|
|
201
201
|
conditionals=[]
|
|
202
202
|
))
|
|
203
|
+
|
|
204
|
+
# Multi-cell line completes a row - finalize it
|
|
205
|
+
if current_row_cells:
|
|
206
|
+
rows.append(TableRow(
|
|
207
|
+
cells=current_row_cells.copy(),
|
|
208
|
+
conditionals_before=conditionals_before_row.copy(),
|
|
209
|
+
conditionals_after=conditionals_after_row.copy()
|
|
210
|
+
))
|
|
211
|
+
current_row_cells = []
|
|
212
|
+
conditionals_before_row = []
|
|
213
|
+
conditionals_after_row = []
|
|
203
214
|
else:
|
|
204
215
|
# Single cell on this line
|
|
205
216
|
if cell_content:
|
|
@@ -65,9 +65,16 @@ def process_file(file_path: Path, dry_run: bool = False, verbose: bool = False)
|
|
|
65
65
|
new_lines.append(current_line)
|
|
66
66
|
in_conditional = False
|
|
67
67
|
# Add blank line after conditional if needed
|
|
68
|
+
# Don't add if next line is:
|
|
69
|
+
# - a list item (starts with *, -, ., .., or numbered)
|
|
70
|
+
# - list continuation (+)
|
|
71
|
+
# - another conditional
|
|
72
|
+
# - blank
|
|
68
73
|
if (next_line and
|
|
69
74
|
not re.match(r'^\s*$', next_line) and
|
|
70
|
-
not re.match(r'^(ifdef::|ifndef::|endif::)', next_line)
|
|
75
|
+
not re.match(r'^(ifdef::|ifndef::|endif::)', next_line) and
|
|
76
|
+
not re.match(r'^(\*|\-|\.|\.\.|\d+\.)\s', next_line) and # List items
|
|
77
|
+
not re.match(r'^\+\s*$', next_line)): # List continuation
|
|
71
78
|
new_lines.append("")
|
|
72
79
|
changes_made = True
|
|
73
80
|
if verbose:
|
|
@@ -102,10 +109,13 @@ def process_file(file_path: Path, dry_run: bool = False, verbose: bool = False)
|
|
|
102
109
|
# Check for block titles (.Title)
|
|
103
110
|
elif not in_block and not in_comment_block and re.match(r'^\.[A-Z]', current_line):
|
|
104
111
|
# Add blank line before block title if needed
|
|
105
|
-
if
|
|
112
|
+
# Don't add if inside a conditional block or if previous line is a conditional directive
|
|
113
|
+
if (not in_conditional and
|
|
114
|
+
prev_line and
|
|
106
115
|
not re.match(r'^\s*$', prev_line) and
|
|
107
116
|
not re.match(r'^=+\s+', prev_line) and
|
|
108
|
-
not re.match(r'^\[role=', prev_line)
|
|
117
|
+
not re.match(r'^\[role=', prev_line) and
|
|
118
|
+
not re.match(r'^(ifdef::|ifndef::|endif::)', prev_line)): # Don't add if previous is conditional
|
|
109
119
|
new_lines.append("")
|
|
110
120
|
changes_made = True
|
|
111
121
|
if verbose:
|
|
@@ -117,11 +127,12 @@ def process_file(file_path: Path, dry_run: bool = False, verbose: bool = False)
|
|
|
117
127
|
elif not in_block and re.match(r'^=+\s+', current_line):
|
|
118
128
|
new_lines.append(current_line)
|
|
119
129
|
|
|
120
|
-
# Check if next line is not empty, not another heading,
|
|
130
|
+
# Check if next line is not empty, not another heading, not a comment block, and not a conditional
|
|
121
131
|
if (next_line and
|
|
122
132
|
not re.match(r'^=+\s+', next_line) and
|
|
123
133
|
not re.match(r'^\s*$', next_line) and
|
|
124
|
-
not re.match(r'^////+$', next_line)
|
|
134
|
+
not re.match(r'^////+$', next_line) and # Don't add if next is comment block
|
|
135
|
+
not re.match(r'^(ifdef::|ifndef::|endif::)', next_line)): # Don't add if next is conditional
|
|
125
136
|
new_lines.append("")
|
|
126
137
|
changes_made = True
|
|
127
138
|
if verbose:
|
doc_utils/version.py
CHANGED
doc_utils/version_check.py
CHANGED
|
@@ -141,10 +141,12 @@ def detect_install_method() -> str:
|
|
|
141
141
|
Detect how the package was installed.
|
|
142
142
|
|
|
143
143
|
Returns:
|
|
144
|
-
'pipx'
|
|
144
|
+
'pipx' or 'pip'
|
|
145
|
+
|
|
146
|
+
Note: Defaults to 'pipx' as the recommended installation method.
|
|
145
147
|
"""
|
|
146
|
-
# Check if running from pipx venv
|
|
147
|
-
if 'pipx' in sys.prefix:
|
|
148
|
+
# Check if running from pipx venv (standard pipx install)
|
|
149
|
+
if 'pipx' in sys.prefix.lower():
|
|
148
150
|
return 'pipx'
|
|
149
151
|
|
|
150
152
|
# Check PIPX_HOME environment variable
|
|
@@ -152,8 +154,17 @@ def detect_install_method() -> str:
|
|
|
152
154
|
if pipx_home and str(Path(sys.prefix)).startswith(str(Path(pipx_home))):
|
|
153
155
|
return 'pipx'
|
|
154
156
|
|
|
155
|
-
#
|
|
156
|
-
|
|
157
|
+
# Check if executable is in typical pipx bin location
|
|
158
|
+
try:
|
|
159
|
+
exe_path = Path(sys.executable)
|
|
160
|
+
if '.local/pipx' in str(exe_path):
|
|
161
|
+
return 'pipx'
|
|
162
|
+
except Exception:
|
|
163
|
+
pass
|
|
164
|
+
|
|
165
|
+
# Default to pipx as the recommended method (per CLAUDE.md guidelines)
|
|
166
|
+
# This ensures users see the recommended upgrade command even for editable installs
|
|
167
|
+
return 'pipx'
|
|
157
168
|
|
|
158
169
|
|
|
159
170
|
def show_update_notification(latest_version: str, current_version: str = None):
|
doc_utils_cli.py
CHANGED
|
@@ -55,9 +55,14 @@ TOOLS = [
|
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
'name': 'convert-callouts-to-deflist',
|
|
58
|
-
'description': 'Converts
|
|
58
|
+
'description': 'Converts callouts to definition lists (batch mode)',
|
|
59
59
|
'example': 'convert-callouts-to-deflist --dry-run modules/'
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
'name': 'convert-callouts-interactive',
|
|
63
|
+
'description': 'Interactively converts callouts with per-block format selection',
|
|
64
|
+
'example': 'convert-callouts-interactive modules/'
|
|
65
|
+
},
|
|
61
66
|
]
|
|
62
67
|
|
|
63
68
|
|
|
@@ -3,22 +3,22 @@ archive_unused_images.py,sha256=fZeyEZtTd72Gbd3YBXTy5xoshAAM9qb4qFPMjhHL1Fg,1864
|
|
|
3
3
|
check_scannability.py,sha256=O6ROr-e624jVPvPpASpsWo0gTfuCFpA2mTSX61BjAEI,5478
|
|
4
4
|
convert_callouts_interactive.py,sha256=hoDKff3jqyJiGZ3IqjcWF7AXM4XUQE-vVg2NpJYECs4,21066
|
|
5
5
|
convert_callouts_to_deflist.py,sha256=MfNbbTzaODFIK6jdPdCoMCe27KqMjJFjdoIiGazm978,17852
|
|
6
|
-
doc_utils_cli.py,sha256=
|
|
6
|
+
doc_utils_cli.py,sha256=J3CE7cTDDCRGkhAknYejNWHhk5t9YFGt27WDVfR98Xk,5111
|
|
7
7
|
extract_link_attributes.py,sha256=wR2SmR2la-jR6DzDbas2PoNONgRZ4dZ6aqwzkwEv8Gs,3516
|
|
8
8
|
find_unused_attributes.py,sha256=77CxFdm72wj6SO81w-auMdDjnvF83jWy_qaM7DsAtBw,4263
|
|
9
9
|
format_asciidoc_spacing.py,sha256=nmWpw2dgwhd81LXyznq0rT8w6Z7cNRyGtPJGRyKFRdc,4212
|
|
10
10
|
replace_link_attributes.py,sha256=Cpc4E-j9j-4_y0LOstAKYOPl02Ln_2bGNIeqp3ZVCdA,7624
|
|
11
11
|
validate_links.py,sha256=lWuK8sgfiFdfcUdSVAt_5U9JHVde_oa6peSUlBQtsac,6145
|
|
12
12
|
callout_lib/__init__.py,sha256=8B82N_z4D1LaZVYgd5jZR53QAabtgPzADOyGlnvihj0,665
|
|
13
|
-
callout_lib/converter_bullets.py,sha256=
|
|
13
|
+
callout_lib/converter_bullets.py,sha256=ZYQIddaouEouPkrDRGIt8f35a1rO5M92Ry5Fi5ZL_2g,3926
|
|
14
14
|
callout_lib/converter_comments.py,sha256=do0dH8uOyNFpn5CDEzR0jYYCMIPP3oPFM8cEB-Fp22c,9767
|
|
15
|
-
callout_lib/converter_deflist.py,sha256=
|
|
16
|
-
callout_lib/detector.py,sha256=
|
|
17
|
-
callout_lib/table_parser.py,sha256=
|
|
15
|
+
callout_lib/converter_deflist.py,sha256=ghXX04L1QRNfsSKGXZsL839IoC-bd8PiNdrSSw_clwI,3145
|
|
16
|
+
callout_lib/detector.py,sha256=TYYcQjx77-aZe8A4MK5w_CTojGrOUb8qYjiwyXeJqCk,13699
|
|
17
|
+
callout_lib/table_parser.py,sha256=_e-viN7ijrL2gFdjem5hYirJv_8HH9f67yWUDkiQflQ,21672
|
|
18
18
|
doc_utils/__init__.py,sha256=qqZR3lohzkP63soymrEZPBGzzk6-nFzi4_tSffjmu_0,74
|
|
19
19
|
doc_utils/extract_link_attributes.py,sha256=U0EvPZReJQigNfbT-icBsVT6Li64hYki5W7MQz6qqbc,22743
|
|
20
20
|
doc_utils/file_utils.py,sha256=fpTh3xx759sF8sNocdn_arsP3KAv8XA6cTQTAVIZiZg,4247
|
|
21
|
-
doc_utils/format_asciidoc_spacing.py,sha256=
|
|
21
|
+
doc_utils/format_asciidoc_spacing.py,sha256=RL2WU_dG_UfGL01LnevcyJfKsvYy_ogNyeoVX-Fyqks,13579
|
|
22
22
|
doc_utils/replace_link_attributes.py,sha256=gmAs68_njBqEz-Qni-UGgeYEDTMxlTWk_IOm76FONNE,7279
|
|
23
23
|
doc_utils/scannability.py,sha256=XwlmHqDs69p_V36X7DLjPTy0DUoLszSGqYjJ9wE-3hg,982
|
|
24
24
|
doc_utils/spinner.py,sha256=lJg15qzODiKoR0G6uFIk2BdVNgn9jFexoTRUMrjiWvk,3554
|
|
@@ -27,11 +27,11 @@ 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=
|
|
31
|
-
doc_utils/version_check.py,sha256
|
|
32
|
-
rolfedh_doc_utils-0.1.
|
|
33
|
-
rolfedh_doc_utils-0.1.
|
|
34
|
-
rolfedh_doc_utils-0.1.
|
|
35
|
-
rolfedh_doc_utils-0.1.
|
|
36
|
-
rolfedh_doc_utils-0.1.
|
|
37
|
-
rolfedh_doc_utils-0.1.
|
|
30
|
+
doc_utils/version.py,sha256=PtAQCWVDHYtUFsUMZHC3w-EKng1J_Gz6pROJlMpmBeI,203
|
|
31
|
+
doc_utils/version_check.py,sha256=-31Y6AN0KGi_CUCAVOOhf6bPO3r7SQIXPxxeffLAF0w,7535
|
|
32
|
+
rolfedh_doc_utils-0.1.29.dist-info/licenses/LICENSE,sha256=vLxtwMVOJA_hEy8b77niTkdmQI9kNJskXHq0dBS36e0,1075
|
|
33
|
+
rolfedh_doc_utils-0.1.29.dist-info/METADATA,sha256=JWxEIXukWyk9q0pr4TeEMdeCCNSyvdgLpc28H3-oya4,8325
|
|
34
|
+
rolfedh_doc_utils-0.1.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
35
|
+
rolfedh_doc_utils-0.1.29.dist-info/entry_points.txt,sha256=vL_LlLKOiurRzchrq8iRUQG19Xi9lSAFVZGjO-xyErk,577
|
|
36
|
+
rolfedh_doc_utils-0.1.29.dist-info/top_level.txt,sha256=J4xtr3zoyCip27b3GnticFVZoyz5HHtgGqHQ-SZONCA,265
|
|
37
|
+
rolfedh_doc_utils-0.1.29.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|