@@ -134,6 +134,10 @@ fn write_header_(ctxt: ctxt, lvl: hlvl, title: str) {
134
134
ctxt. w . write_line ( "" ) ;
135
135
}
136
136
137
+ fn write_lead ( ctxt : ctxt , title : str ) {
138
+ ctxt. w . write_str ( #fmt ( "__%s__: " , title) )
139
+ }
140
+
137
141
fn header_kind ( doc : doc:: itemtag ) -> str {
138
142
alt doc {
139
143
doc : : modtag ( _) {
@@ -478,7 +482,8 @@ fn write_args(
478
482
args : [ doc:: argdoc ]
479
483
) {
480
484
if vec:: is_not_empty ( args) {
481
- ctxt. w . write_line ( "Arguments:" ) ;
485
+ write_lead ( ctxt, "Arguments" ) ;
486
+ ctxt. w . write_line ( "" ) ;
482
487
ctxt. w . write_line ( "" ) ;
483
488
vec:: iter ( args) { |arg| write_arg ( ctxt, arg) } ;
484
489
ctxt. w . write_line ( "" ) ;
@@ -505,7 +510,7 @@ fn should_write_argument_list() {
505
510
let markdown = test:: render ( source) ;
506
511
assert str:: contains (
507
512
markdown,
508
- "Arguments: \n \
513
+ "__Arguments__: \n \
509
514
\n \
510
515
* `b`\n \
511
516
* `c`\n \
@@ -533,7 +538,8 @@ fn write_return(
533
538
) {
534
539
alt doc. desc {
535
540
some ( d) {
536
- ctxt. w . write_line ( #fmt ( "Return value: %s" , d) ) ;
541
+ write_lead ( ctxt, "Return value" ) ;
542
+ ctxt. w . write_line ( d) ;
537
543
ctxt. w . write_line ( "" ) ;
538
544
}
539
545
none { }
@@ -544,7 +550,7 @@ fn write_return(
544
550
fn should_write_return_type_on_new_line ( ) {
545
551
let markdown = test:: render (
546
552
"#[doc(return = \" test\" )] fn a() -> int { }" ) ;
547
- assert str:: contains ( markdown, "\n Return value : test" ) ;
553
+ assert str:: contains ( markdown, "\n __Return value__ : test" ) ;
548
554
}
549
555
550
556
#[ test]
@@ -553,7 +559,7 @@ fn should_write_blank_line_between_return_type_and_next_header() {
553
559
"#[doc(return = \" test\" )] fn a() -> int { } \
554
560
fn b() -> int { }"
555
561
) ;
556
- assert str:: contains ( markdown, "Return value : test\n \n ##" ) ;
562
+ assert str:: contains ( markdown, "__Return value__ : test\n \n ##" ) ;
557
563
}
558
564
559
565
#[ test]
@@ -573,7 +579,8 @@ fn should_write_blank_line_after_return_description() {
573
579
fn write_failure ( ctxt : ctxt , str : option < str > ) {
574
580
alt str {
575
581
some( str) {
576
- ctxt. w . write_line ( #fmt ( "Failure conditions: %s" , str) ) ;
582
+ write_lead ( ctxt, "Failure conditions" ) ;
583
+ ctxt. w . write_line ( str) ;
577
584
ctxt. w . write_line ( "" ) ;
578
585
}
579
586
none { }
@@ -586,7 +593,7 @@ fn should_write_failure_conditions() {
586
593
"#[doc(failure = \" it's the fail\" )] fn a () { }" ) ;
587
594
assert str:: contains (
588
595
markdown,
589
- "\n \n Failure conditions : it's the fail\n \n " ) ;
596
+ "\n \n __Failure conditions__ : it's the fail\n \n " ) ;
590
597
}
591
598
592
599
fn write_const (
@@ -722,7 +729,7 @@ fn should_write_resource_signature() {
722
729
fn should_write_resource_args ( ) {
723
730
let markdown = test:: render ( "#[doc(args(a = \" b\" ))]\
724
731
resource r(a: bool) { }") ;
725
- assert str:: contains ( markdown, "Arguments: \n \n * `a` - b" ) ;
732
+ assert str:: contains ( markdown, "__Arguments__: \n \n * `a` - b" ) ;
726
733
}
727
734
728
735
fn write_iface ( ctxt : ctxt , doc : doc:: ifacedoc ) {
@@ -787,7 +794,7 @@ fn should_write_iface_method_signature() {
787
794
fn should_write_iface_method_argument_header ( ) {
788
795
let markdown = test:: render (
789
796
"iface a { fn a(b: int); }" ) ;
790
- assert str:: contains ( markdown, "\n \n Arguments: \n \n " ) ;
797
+ assert str:: contains ( markdown, "\n \n __Arguments__: \n \n " ) ;
791
798
}
792
799
793
800
#[ test]
@@ -808,14 +815,14 @@ fn should_not_write_iface_method_arguments_if_none() {
808
815
fn should_write_iface_method_return_info ( ) {
809
816
let markdown = test:: render (
810
817
"iface a { #[doc(return = \" test\" )] fn a() -> int; }" ) ;
811
- assert str:: contains ( markdown, "Return value : test" ) ;
818
+ assert str:: contains ( markdown, "__Return value__ : test" ) ;
812
819
}
813
820
814
821
#[ test]
815
822
fn should_write_iface_method_failure_conditions ( ) {
816
823
let markdown = test:: render (
817
824
"iface a { #[doc(failure = \" nuked\" )] fn a(); }" ) ;
818
- assert str:: contains ( markdown, "Failure conditions : nuked" ) ;
825
+ assert str:: contains ( markdown, "__Failure conditions__ : nuked" ) ;
819
826
}
820
827
821
828
fn write_impl ( ctxt : ctxt , doc : doc:: impldoc ) {
@@ -869,7 +876,7 @@ fn should_write_impl_method_signature() {
869
876
fn should_write_impl_method_argument_header ( ) {
870
877
let markdown = test:: render (
871
878
"impl a for int { fn a(b: int) { } }" ) ;
872
- assert str:: contains ( markdown, "\n \n Arguments: \n \n " ) ;
879
+ assert str:: contains ( markdown, "\n \n __Arguments__: \n \n " ) ;
873
880
}
874
881
875
882
#[ test]
@@ -890,14 +897,14 @@ fn should_not_write_impl_method_arguments_if_none() {
890
897
fn should_write_impl_method_return_info ( ) {
891
898
let markdown = test:: render (
892
899
"impl a for int { #[doc(return = \" test\" )] fn a() -> int { } }" ) ;
893
- assert str:: contains ( markdown, "Return value : test" ) ;
900
+ assert str:: contains ( markdown, "__Return value__ : test" ) ;
894
901
}
895
902
896
903
#[ test]
897
904
fn should_write_impl_method_failure_conditions ( ) {
898
905
let markdown = test:: render (
899
906
"impl a for int { #[doc(failure = \" nuked\" )] fn a() { } }" ) ;
900
- assert str:: contains ( markdown, "Failure conditions : nuked" ) ;
907
+ assert str:: contains ( markdown, "__Failure conditions__ : nuked" ) ;
901
908
}
902
909
903
910
fn write_type (
0 commit comments