File tree Expand file tree Collapse file tree 2 files changed +23
-25
lines changed Expand file tree Collapse file tree 2 files changed +23
-25
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ use semver::{Version, VersionReq};
8
8
use std:: collections:: BTreeMap ;
9
9
use std:: io;
10
10
use std:: path:: PathBuf ;
11
- use std:: process;
12
11
13
12
mod std_links;
14
13
@@ -21,29 +20,7 @@ static ADMONITION_RE: Lazy<Regex> = Lazy::new(|| {
21
20
Regex :: new ( r"(?m)^ *> \[!(?<admon>[^]]+)\]\n(?<blockquote>(?: *> .*\n)+)" ) . unwrap ( )
22
21
} ) ;
23
22
24
- fn main ( ) {
25
- let mut args = std:: env:: args ( ) . skip ( 1 ) ;
26
- match args. next ( ) . as_deref ( ) {
27
- Some ( "supports" ) => {
28
- // Supports all renderers.
29
- return ;
30
- }
31
- Some ( arg) => {
32
- eprintln ! ( "unknown argument: {arg}" ) ;
33
- std:: process:: exit ( 1 ) ;
34
- }
35
- None => { }
36
- }
37
-
38
- let preprocessor = Spec :: new ( ) ;
39
-
40
- if let Err ( e) = handle_preprocessing ( & preprocessor) {
41
- eprintln ! ( "{}" , e) ;
42
- process:: exit ( 1 ) ;
43
- }
44
- }
45
-
46
- fn handle_preprocessing ( pre : & dyn Preprocessor ) -> Result < ( ) , Error > {
23
+ pub fn handle_preprocessing ( pre : & dyn Preprocessor ) -> Result < ( ) , Error > {
47
24
let ( ctx, book) = CmdPreprocessor :: parse_input ( io:: stdin ( ) ) ?;
48
25
49
26
let book_version = Version :: parse ( & ctx. mdbook_version ) ?;
@@ -65,7 +42,7 @@ fn handle_preprocessing(pre: &dyn Preprocessor) -> Result<(), Error> {
65
42
Ok ( ( ) )
66
43
}
67
44
68
- struct Spec {
45
+ pub struct Spec {
69
46
/// Whether or not warnings should be errors (set by SPEC_DENY_WARNINGS
70
47
/// environment variable).
71
48
deny_warnings : bool ,
Original file line number Diff line number Diff line change
1
+ fn main ( ) {
2
+ let mut args = std:: env:: args ( ) . skip ( 1 ) ;
3
+ match args. next ( ) . as_deref ( ) {
4
+ Some ( "supports" ) => {
5
+ // Supports all renderers.
6
+ return ;
7
+ }
8
+ Some ( arg) => {
9
+ eprintln ! ( "unknown argument: {arg}" ) ;
10
+ std:: process:: exit ( 1 ) ;
11
+ }
12
+ None => { }
13
+ }
14
+
15
+ let preprocessor = mdbook_spec:: Spec :: new ( ) ;
16
+
17
+ if let Err ( e) = mdbook_spec:: handle_preprocessing ( & preprocessor) {
18
+ eprintln ! ( "{}" , e) ;
19
+ std:: process:: exit ( 1 ) ;
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments