Skip to content

Commit

Permalink
Merge pull request #1196 from GuillaumeGomez/doc-condition
Browse files Browse the repository at this point in the history
Fix doc condition for warning
  • Loading branch information
sdroege committed Jun 23, 2021
2 parents 6ed30fc + 7d2b1fd commit 1bef39f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/codegen/doc/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn code_blocks_transformation(
fn get_language<'a>(entry: &'a str, out: &mut String) -> &'a str {
if let (_, Some(after)) = try_split(entry, LANGUAGE_SEP_BEGIN) {
if let (before, Some(after)) = try_split(after, LANGUAGE_SEP_END) {
if ["text", "rust"].contains(&before) {
if !["text", "rust"].contains(&before) {
out.push_str(&format!("\n\n**⚠️ The following code is in {} ⚠️**", before));
}
out.push_str(&format!("\n\n```{}", before));
Expand Down Expand Up @@ -107,7 +107,7 @@ fn format(
ret.push_str(&replace_symbols(before, env, in_type));

let (lang, after) = get_markdown_language(after);
if ["text", "rust"].contains(&lang) && after.lines().count() > 1 {
if !["text", "rust"].contains(&lang) && after.lines().count() > 1 {
ret.push_str(&format!("**⚠️ The following code is in {0} ⚠️**\n\n", lang));
}
ret.push_str(&format!("```{}\n", lang));
Expand Down

0 comments on commit 1bef39f

Please sign in to comment.