rolfedh-doc-utils 0.1.4__py3-none-any.whl → 0.1.41__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.
- archive_unused_files.py +18 -5
- archive_unused_images.py +9 -2
- callout_lib/__init__.py +22 -0
- callout_lib/converter_bullets.py +103 -0
- callout_lib/converter_comments.py +295 -0
- callout_lib/converter_deflist.py +134 -0
- callout_lib/detector.py +364 -0
- callout_lib/table_parser.py +804 -0
- check_published_links.py +1083 -0
- check_scannability.py +6 -0
- check_source_directives.py +101 -0
- convert_callouts_interactive.py +567 -0
- convert_callouts_to_deflist.py +628 -0
- convert_freemarker_to_asciidoc.py +288 -0
- convert_tables_to_deflists.py +479 -0
- doc_utils/convert_freemarker_to_asciidoc.py +708 -0
- doc_utils/duplicate_content.py +409 -0
- doc_utils/duplicate_includes.py +347 -0
- doc_utils/extract_link_attributes.py +618 -0
- doc_utils/format_asciidoc_spacing.py +285 -0
- doc_utils/insert_abstract_role.py +220 -0
- doc_utils/inventory_conditionals.py +164 -0
- doc_utils/missing_source_directive.py +211 -0
- doc_utils/replace_link_attributes.py +187 -0
- doc_utils/spinner.py +119 -0
- doc_utils/unused_adoc.py +150 -22
- doc_utils/unused_attributes.py +218 -6
- doc_utils/unused_images.py +81 -9
- doc_utils/validate_links.py +576 -0
- doc_utils/version.py +8 -0
- doc_utils/version_check.py +243 -0
- doc_utils/warnings_report.py +237 -0
- doc_utils_cli.py +158 -0
- extract_link_attributes.py +120 -0
- find_duplicate_content.py +209 -0
- find_duplicate_includes.py +198 -0
- find_unused_attributes.py +84 -6
- format_asciidoc_spacing.py +134 -0
- insert_abstract_role.py +163 -0
- inventory_conditionals.py +53 -0
- replace_link_attributes.py +214 -0
- rolfedh_doc_utils-0.1.41.dist-info/METADATA +246 -0
- rolfedh_doc_utils-0.1.41.dist-info/RECORD +52 -0
- {rolfedh_doc_utils-0.1.4.dist-info → rolfedh_doc_utils-0.1.41.dist-info}/WHEEL +1 -1
- rolfedh_doc_utils-0.1.41.dist-info/entry_points.txt +20 -0
- rolfedh_doc_utils-0.1.41.dist-info/top_level.txt +21 -0
- validate_links.py +213 -0
- rolfedh_doc_utils-0.1.4.dist-info/METADATA +0 -285
- rolfedh_doc_utils-0.1.4.dist-info/RECORD +0 -17
- rolfedh_doc_utils-0.1.4.dist-info/entry_points.txt +0 -5
- rolfedh_doc_utils-0.1.4.dist-info/top_level.txt +0 -5
- {rolfedh_doc_utils-0.1.4.dist-info → rolfedh_doc_utils-0.1.41.dist-info}/licenses/LICENSE +0 -0
check_scannability.py
CHANGED
|
@@ -17,8 +17,11 @@ import sys
|
|
|
17
17
|
import argparse
|
|
18
18
|
from datetime import datetime
|
|
19
19
|
from doc_utils.scannability import check_scannability
|
|
20
|
+
from doc_utils.version_check import check_version_on_startup
|
|
20
21
|
from doc_utils.file_utils import collect_files, parse_exclude_list_file
|
|
22
|
+
from doc_utils.version import __version__
|
|
21
23
|
|
|
24
|
+
from doc_utils.spinner import Spinner
|
|
22
25
|
BASE_SENTENCE_WORD_LIMIT = 22
|
|
23
26
|
BASE_PARAGRAPH_SENTENCE_LIMIT = 3
|
|
24
27
|
|
|
@@ -26,6 +29,8 @@ def print_help():
|
|
|
26
29
|
print(__doc__)
|
|
27
30
|
|
|
28
31
|
def main():
|
|
32
|
+
# Check for updates (non-blocking, won't interfere with tool operation)
|
|
33
|
+
check_version_on_startup()
|
|
29
34
|
# Manual check for -h or --help to display the full docstring
|
|
30
35
|
if '-h' in sys.argv or '--help' in sys.argv:
|
|
31
36
|
print_help()
|
|
@@ -39,6 +44,7 @@ def main():
|
|
|
39
44
|
parser.add_argument('--exclude-dir', action='append', default=[], help='Directory to exclude (can be used multiple times).')
|
|
40
45
|
parser.add_argument('--exclude-file', action='append', default=[], help='File to exclude (can be used multiple times).')
|
|
41
46
|
parser.add_argument('--exclude-list', type=str, help='Path to a file containing directories or files to exclude, one per line.')
|
|
47
|
+
parser.add_argument('--version', action='version', version=f'%(prog)s {__version__}')
|
|
42
48
|
# Do not add -h/--help to argparse, handled manually above
|
|
43
49
|
args = parser.parse_args()
|
|
44
50
|
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Check Source Directives
|
|
4
|
+
|
|
5
|
+
Detects code blocks (----) that are missing [source] directive in AsciiDoc files.
|
|
6
|
+
This helps prevent AsciiDoc-to-DocBook XML conversion errors.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
check-source-directives # Scan current directory
|
|
10
|
+
check-source-directives asciidoc # Scan asciidoc/ directory
|
|
11
|
+
check-source-directives --fix # Scan and fix issues in current directory
|
|
12
|
+
check-source-directives --fix asciidoc # Scan and fix issues in asciidoc/ directory
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import argparse
|
|
16
|
+
import sys
|
|
17
|
+
from doc_utils.missing_source_directive import find_missing_source_directives
|
|
18
|
+
from doc_utils.version_check import check_version_on_startup
|
|
19
|
+
from doc_utils.version import __version__
|
|
20
|
+
|
|
21
|
+
# ANSI color codes
|
|
22
|
+
RED = '\033[0;31m'
|
|
23
|
+
YELLOW = '\033[1;33m'
|
|
24
|
+
GREEN = '\033[0;32m'
|
|
25
|
+
NC = '\033[0m' # No Color
|
|
26
|
+
|
|
27
|
+
def main():
|
|
28
|
+
# Check for updates (non-blocking)
|
|
29
|
+
check_version_on_startup()
|
|
30
|
+
|
|
31
|
+
parser = argparse.ArgumentParser(
|
|
32
|
+
description='Detect code blocks (----) missing [source] directive in AsciiDoc files',
|
|
33
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
34
|
+
epilog="""
|
|
35
|
+
Examples:
|
|
36
|
+
%(prog)s # Scan current directory
|
|
37
|
+
%(prog)s asciidoc # Scan asciidoc/ directory
|
|
38
|
+
%(prog)s --fix # Scan and fix issues in current directory
|
|
39
|
+
%(prog)s --fix asciidoc # Scan and fix issues in asciidoc/ directory
|
|
40
|
+
"""
|
|
41
|
+
)
|
|
42
|
+
parser.add_argument('directory', nargs='?', default='.',
|
|
43
|
+
help='Directory to scan (default: current directory)')
|
|
44
|
+
parser.add_argument('--fix', action='store_true',
|
|
45
|
+
help='Automatically insert [source] directives where missing')
|
|
46
|
+
parser.add_argument('--version', action='version', version=f'%(prog)s {__version__}')
|
|
47
|
+
|
|
48
|
+
args = parser.parse_args()
|
|
49
|
+
|
|
50
|
+
mode = "Fixing" if args.fix else "Scanning for"
|
|
51
|
+
print(f"{mode} code blocks missing [source] directive in: {args.directory}")
|
|
52
|
+
print("=" * 64)
|
|
53
|
+
print()
|
|
54
|
+
|
|
55
|
+
try:
|
|
56
|
+
results = find_missing_source_directives(
|
|
57
|
+
scan_dir=args.directory,
|
|
58
|
+
auto_fix=args.fix
|
|
59
|
+
)
|
|
60
|
+
except ValueError as e:
|
|
61
|
+
print(f"{RED}Error: {e}{NC}", file=sys.stderr)
|
|
62
|
+
sys.exit(1)
|
|
63
|
+
except Exception as e:
|
|
64
|
+
print(f"{RED}Unexpected error: {e}{NC}", file=sys.stderr)
|
|
65
|
+
sys.exit(1)
|
|
66
|
+
|
|
67
|
+
# Display results
|
|
68
|
+
for file_info in results['file_details']:
|
|
69
|
+
filepath = file_info['filepath']
|
|
70
|
+
issues = file_info['issues']
|
|
71
|
+
|
|
72
|
+
print(f"{YELLOW}File: {filepath}{NC}")
|
|
73
|
+
|
|
74
|
+
for issue in issues:
|
|
75
|
+
print(f" {RED}Line {issue['line_num']}:{NC} Code block without [source] directive")
|
|
76
|
+
print(f" Previous line ({issue['prev_line_num']}): {issue['prev_line']}")
|
|
77
|
+
print()
|
|
78
|
+
|
|
79
|
+
if args.fix:
|
|
80
|
+
if file_info.get('fixed'):
|
|
81
|
+
print(f" {GREEN}✓ Fixed {len(issues)} issue(s){NC}")
|
|
82
|
+
elif 'error' in file_info:
|
|
83
|
+
print(f" {RED}✗ Failed to fix file: {file_info['error']}{NC}")
|
|
84
|
+
print()
|
|
85
|
+
|
|
86
|
+
# Summary
|
|
87
|
+
print("=" * 64)
|
|
88
|
+
if results['total_issues'] == 0:
|
|
89
|
+
print(f"{GREEN}✓ No issues found!{NC}")
|
|
90
|
+
sys.exit(0)
|
|
91
|
+
else:
|
|
92
|
+
if args.fix:
|
|
93
|
+
print(f"{GREEN}Fixed {results['total_issues']} code block(s) in {results['files_fixed']} file(s){NC}")
|
|
94
|
+
sys.exit(0)
|
|
95
|
+
else:
|
|
96
|
+
print(f"{RED}Found {results['total_issues']} code block(s) missing [source] directive in {results['files_with_issues']} file(s){NC}")
|
|
97
|
+
print(f"\nRun with --fix to automatically fix these issues")
|
|
98
|
+
sys.exit(1)
|
|
99
|
+
|
|
100
|
+
if __name__ == '__main__':
|
|
101
|
+
main()
|