@@ -99,6 +99,9 @@ pub fn run(
99
99
IndexEntry :: SubHeading ( _heading) => {
100
100
// Ignore
101
101
}
102
+ IndexEntry :: Chapter { title, path } if path. is_empty ( ) => {
103
+ log:: info!( "Processing placeholder: {:?}" , title) ;
104
+ }
102
105
IndexEntry :: Chapter { title, path } => {
103
106
log:: info!( "Processing {}: {:?}" , path, title) ;
104
107
let in_path = {
@@ -265,6 +268,13 @@ pub fn generate_index(
265
268
let mut heading_is_open = false ;
266
269
for entry in chapters {
267
270
match entry {
271
+ IndexEntry :: Chapter { title, path } if path. is_empty ( ) => {
272
+ if !heading_is_open {
273
+ generated_html. push_str ( "<ul>\n " ) ;
274
+ heading_is_open = true ;
275
+ }
276
+ generated_html. push_str ( & format ! ( "<li>{}</li>\n " , title) ) ;
277
+ }
268
278
IndexEntry :: Chapter { title, path } => {
269
279
if !heading_is_open {
270
280
generated_html. push_str ( "<ul>\n " ) ;
@@ -327,6 +337,10 @@ mod test {
327
337
title : "Link Title 2" . to_owned ( ) ,
328
338
path : "./test2.md" . to_owned ( ) ,
329
339
} ,
340
+ IndexEntry :: Chapter {
341
+ title : "Link Title 3" . to_owned ( ) ,
342
+ path : String :: new ( ) ,
343
+ } ,
330
344
] ;
331
345
let title = "My Title" ;
332
346
let template = "<title>$TITLE</title>\n $INDEX" ;
@@ -344,6 +358,7 @@ mod test {
344
358
<h2>SubHeading 2</h2>\n \
345
359
<ul>\n \
346
360
<li><a href=\" ./test2.html\" >Link Title 2</a></li>\n \
361
+ <li>Link Title 3</li>\n \
347
362
</ul>\n "
348
363
) ;
349
364
}
@@ -370,7 +385,7 @@ mod test {
370
385
## Subheading 2.1\n \
371
386
\n \
372
387
- [Link 5](./link5.md)\n \
373
- - [Link 6](./link6.md )\n \
388
+ - [Link 6]()\n \
374
389
";
375
390
let index_entries = load_book ( summary_src) . unwrap ( ) ;
376
391
assert_eq ! (
@@ -403,7 +418,7 @@ mod test {
403
418
} ,
404
419
IndexEntry :: Chapter {
405
420
title: "Link 6" . to_string( ) ,
406
- path: "./link6.md" . to_string ( )
421
+ path: String :: new ( ) ,
407
422
} ,
408
423
]
409
424
) ;
0 commit comments