@@ -133,13 +133,15 @@ impl Renderer {
133133write ! ( w, r#" <span class="source">{}</span>"# , text)
134134}
135135DisplaySourceLine :: Annotation { annotation, range} =>{
136+ let desc =self . get_annotation_type_style ( & annotation. annotation_type ) ;
136137let indent =if range. start ==0 { 0 } else { range. start +1 } ;
137138write ! ( w, "{:>width$}" , "" , width = indent) ?;
138139let horizontal_mark =MarkKind :: get ( MarkKind :: Horizontal ) ;
139140if range. start ==0 {
140141write ! (
141142 w,
142- "{}{} {}" ,
143+ r#"<span class="{}">{}{} {}</span>"# ,
144+ desc,
143145 repeat( horizontal_mark)
144146. take( range. len( ) )
145147. collect:: <String >( ) ,
@@ -149,7 +151,8 @@ impl Renderer {
149151} else {
150152write ! (
151153 w,
152- "{} {}" ,
154+ r#"<span class="{}">{} {}</span>"# ,
155+ desc,
153156 repeat( horizontal_mark)
154157. take( range. len( ) )
155158. collect:: <String >( ) ,
@@ -171,33 +174,25 @@ impl Renderer {
171174match line{
172175DisplayRawLine :: Origin { path, pos} =>{
173176write ! ( w, "{:>width$}" , "" , width = lineno_max) ?;
174- //S::fmt(
175- //w,
176- //format_args!(
177- //"{}{}>",
178- //MarkKind::get(MarkKind::Horizontal),
179- //MarkKind::get(MarkKind::Horizontal),
180- //),
181- //&[StyleType::Emphasis, StyleType::LineNo],
182- //)?;
183- //write!(w, " {}", path)?;
184- //if let Some(line) = pos.0 {
185- //write!(w, ":{}", line)?;
186- //}
177+ write ! (
178+ w,
179+ r#"<span class="ui">{}{}></span>"# ,
180+ MarkKind :: get( MarkKind :: Horizontal ) ,
181+ MarkKind :: get( MarkKind :: Horizontal ) ,
182+ ) ?;
183+ write ! ( w, " {}" , path) ?;
184+ if let Some ( line) = pos. 0 {
185+ write ! ( w, ":{}" , line) ?;
186+ }
187187writeln ! ( w)
188188}
189189DisplayRawLine :: Annotation { annotation, ..} =>{
190190let desc =self . get_annotation_type_style ( & annotation. annotation_type ) ;
191- //let s = [StyleType::Emphasis, style];
192- //S::fmt(w, desc, &s)?;
193- //if let Some(id) = annotation.id {
194- //S::fmt(w, format_args!("[{}]", id), &s)?;
195- //}
196- //S::fmt(
197- //w,
198- //format_args!(": {}\n", annotation.label),
199- //&[StyleType::Emphasis],
200- //)
191+ write ! ( w, r#"<span class="title"><span class="{}">{}"# , desc, desc) ?;
192+ if let Some ( id) = annotation. id {
193+ write ! ( w, "[{}]" , id) ?;
194+ }
195+ write ! ( w, "</span>: {}</span>\n " , annotation. label) ?;
201196Ok ( ( ) )
202197}
203198}
@@ -219,20 +214,25 @@ impl Renderer {
219214w : & mut impl std:: io:: Write ,
220215display_mark : & DisplayMark ,
221216) -> std:: io:: Result < ( ) > {
217+ let desc =self . get_annotation_type_style ( & display_mark. annotation_type ) ;
222218let ch =match display_mark. mark_type {
223219DisplayMarkType :: AnnotationStart =>MarkKind :: get ( MarkKind :: DownRight ) ,
224220DisplayMarkType :: AnnotationEnd =>MarkKind :: get ( MarkKind :: UpRight ) ,
225221DisplayMarkType :: AnnotationThrough =>MarkKind :: get ( MarkKind :: Vertical ) ,
226222} ;
227- write ! ( w, " {}", ch) ?;
223+ write ! ( w, r#"<span>{}</span>"# , desc , ch) ?;
228224Ok ( ( ) )
229225}
230226
231227fn fmt_header ( & self , w : & mut impl std:: io:: Write ) -> std:: io:: Result < ( ) > {
232228writeln ! ( w, "<html><head><style>" ) ?;
233- writeln ! ( w, r#".lineno {{ color:red ; }}"# ) ?;
229+ writeln ! ( w, r#".lineno {{ color:blue ; }}"# ) ?;
234230writeln ! ( w, r#".line {{ color: blue; }}"# ) ?;
231+ writeln ! ( w, r#".ui {{ color: blue; }}"# ) ?;
235232writeln ! ( w, r#".source {{ color: gray; }}"# ) ?;
233+ writeln ! ( w, r#".error {{ color: red; }}"# ) ?;
234+ writeln ! ( w, r#".warning {{ color: yellow; }}"# ) ?;
235+ writeln ! ( w, r#".title {{ font-weight: bold; }}"# ) ?;
236236write ! ( w, "</style></head><body><pre>" )
237237}
238238