diff --git a/src/pasta.rs b/src/pasta.rs index 3a54070..a728211 100644 --- a/src/pasta.rs +++ b/src/pasta.rs @@ -80,6 +80,10 @@ impl Pasta { pub fn content_not_highlighted(&self) -> String { html_highlight(&self.content, "txt") } + + pub fn content_escaped(&self) -> String { + self.content.replace("`", "\\`").replace("$", "\\$") + } } impl fmt::Display for Pasta { diff --git a/templates/pasta.html b/templates/pasta.html index 879c948..6e069ac 100644 --- a/templates/pasta.html +++ b/templates/pasta.html @@ -16,13 +16,33 @@ {{pasta.id_as_animals()}}
-
- {% if args.highlightsyntax %} -
{{pasta.content_syntax_highlighted()}}
- {%- else %} -
{{pasta.content_not_highlighted()}}
- {%- endif %} +
+ + Copy + +
+ {% if args.highlightsyntax %} +
{{pasta.content_syntax_highlighted()}}
+ {%- else %} +
{{pasta.content_not_highlighted()}}
+ {%- endif %} +
+ + + {% include "footer.html" %}