File tree Expand file tree Collapse file tree 6 files changed +27
-4
lines changed Expand file tree Collapse file tree 6 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ pub(crate) struct Layout {
1818 pub ( crate ) default_settings : FxHashMap < String , String > ,
1919 pub ( crate ) krate : String ,
2020 pub ( crate ) krate_version : String ,
21+ pub ( crate ) krate_version_extra : String ,
2122 /// The given user css file which allow to customize the generated
2223 /// documentation theme.
2324 pub ( crate ) css_file_extension : Option < PathBuf > ,
Original file line number Diff line number Diff line change @@ -528,13 +528,16 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
528528 if let Some ( url) = playground_url {
529529 playground = Some ( markdown:: Playground { crate_name : Some ( krate. name ( tcx) ) , url } ) ;
530530 }
531+ let krate_version = cache. crate_version . as_deref ( ) . unwrap_or_default ( ) ;
532+ let ( krate_version, krate_version_extra) = krate_version. split_once ( " " ) . unwrap_or ( ( krate_version, "" ) ) ;
531533 let mut layout = layout:: Layout {
532534 logo : String :: new ( ) ,
533535 favicon : String :: new ( ) ,
534536 external_html,
535537 default_settings,
536538 krate : krate. name ( tcx) . to_string ( ) ,
537- krate_version : cache. crate_version . as_deref ( ) . unwrap_or_default ( ) . to_string ( ) ,
539+ krate_version : krate_version. to_string ( ) ,
540+ krate_version_extra : krate_version_extra. to_string ( ) ,
538541 css_file_extension : extension_css,
539542 scrape_examples_extension : !call_locations. is_empty ( ) ,
540543 } ;
Original file line number Diff line number Diff line change @@ -492,6 +492,7 @@ ul.block, .block li {
492492}
493493
494494.sidebar-elems ,
495+ .sidebar > .version ,
495496.sidebar > h2 {
496497 padding-left : 24px ;
497498}
Original file line number Diff line number Diff line change @@ -102,8 +102,11 @@ <h2> {# #}
102102 {% if !layout.krate_version.is_empty() %}
103103 < span class ="version "> {{+ layout.krate_version}}</ span >
104104 {% endif %}
105- </ h2 >
106- </ div >
105+ </ h2 > {# #}
106+ </ div > {# #}
107+ {% if !layout.krate_version_extra.is_empty() %}
108+ < div class ="version "> {{+ layout.krate_version_extra}}</ div > {# #}
109+ {% endif %}
107110 {% endif %}
108111 {{ sidebar|safe }}
109112 </ nav > {# #}
Original file line number Diff line number Diff line change @@ -322,7 +322,15 @@ impl TestProps {
322322 ) ;
323323
324324 if let Some ( flags) = config. parse_name_value_directive ( ln, COMPILE_FLAGS ) {
325- self . compile_flags . extend ( flags. split_whitespace ( ) . map ( |s| s. to_owned ( ) ) ) ;
325+ self . compile_flags . extend (
326+ flags
327+ . split ( "\" " )
328+ . enumerate ( )
329+ . flat_map ( |( i, f) | {
330+ if i % 2 == 1 { vec ! [ f] } else { f. split_whitespace ( ) . collect ( ) }
331+ } )
332+ . map ( |s| s. to_owned ( ) ) ,
333+ ) ;
326334 }
327335 if config. parse_name_value_directive ( ln, INCORRECT_COMPILER_FLAGS ) . is_some ( ) {
328336 panic ! ( "`compiler-flags` directive should be spelled `compile-flags`" ) ;
Original file line number Diff line number Diff line change 1+ // compile-flags: "--crate-version=1.3.37-nightly (203c57dbe 2023-09-17)"
2+
3+ #![ crate_name="foo" ]
4+
5+ // main version next to logo, extra version data below it
6+ // @has 'foo/index.html' '//h2/span[@class="version"]' '1.3.37-nightly'
7+ // @has 'foo/index.html' '//nav[@class="sidebar"]/div[@class="version"]' '(203c57dbe 2023-09-17)'
You can’t perform that action at this time.
0 commit comments