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};
88use std:: collections:: BTreeMap ;
99use std:: io;
1010use std:: path:: PathBuf ;
11- use std:: process;
1211
1312mod std_links;
1413
@@ -21,29 +20,7 @@ static ADMONITION_RE: Lazy<Regex> = Lazy::new(|| {
2120 Regex :: new ( r"(?m)^ *> \[!(?<admon>[^]]+)\]\n(?<blockquote>(?: *> .*\n)+)" ) . unwrap ( )
2221} ) ;
2322
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 > {
4724 let ( ctx, book) = CmdPreprocessor :: parse_input ( io:: stdin ( ) ) ?;
4825
4926 let book_version = Version :: parse ( & ctx. mdbook_version ) ?;
@@ -65,7 +42,7 @@ fn handle_preprocessing(pre: &dyn Preprocessor) -> Result<(), Error> {
6542 Ok ( ( ) )
6643}
6744
68- struct Spec {
45+ pub struct Spec {
6946 /// Whether or not warnings should be errors (set by SPEC_DENY_WARNINGS
7047 /// environment variable).
7148 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