diff options
| author | bors <bors@rust-lang.org> | 2016-09-14 08:28:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-14 08:28:05 -0700 |
| commit | 5a5736db916ac30ca67945bbf0aee41ced1fcf05 (patch) | |
| tree | d681ded3fcaea851b72f01b8e1d0b08bba9597bf /src/librustdoc/html/highlight.rs | |
| parent | 97b561a0944141a02a0cebe577c3c69e436abcf4 (diff) | |
| parent | e368cdd2d5fc2ceff4c4745600fda29dba9fd81f (diff) | |
| download | rust-5a5736db916ac30ca67945bbf0aee41ced1fcf05.tar.gz rust-5a5736db916ac30ca67945bbf0aee41ced1fcf05.zip | |
Auto merge of #36472 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests - Successful merges: #36334, #36335, #36363, #36374, #36467 - Failed merges:
Diffstat (limited to 'src/librustdoc/html/highlight.rs')
| -rw-r--r-- | src/librustdoc/html/highlight.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 6cb79d6e863..855588a4c3a 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -33,7 +33,8 @@ use syntax::parse; use syntax_pos::Span; /// Highlights `src`, returning the HTML output. -pub fn render_with_highlighting(src: &str, class: Option<&str>, id: Option<&str>) -> String { +pub fn render_with_highlighting(src: &str, class: Option<&str>, id: Option<&str>, + extension: Option<&str>) -> String { debug!("highlighting: ================\n{}\n==============", src); let sess = parse::ParseSess::new(); let fm = sess.codemap().new_filemap("<stdin>".to_string(), None, src.to_string()); @@ -47,6 +48,9 @@ pub fn render_with_highlighting(src: &str, class: Option<&str>, id: Option<&str> return format!("<pre>{}</pre>", src); } + if let Some(extension) = extension { + write!(out, "{}", extension).unwrap(); + } write_footer(&mut out).unwrap(); String::from_utf8_lossy(&out[..]).into_owned() } |
