From 7181da294b2720fb2766c6182bb33619627d03bf Mon Sep 17 00:00:00 2001 From: BarbUk Date: Mon, 28 Oct 2019 15:06:57 +0400 Subject: [PATCH] Handle rich snippet --- snippy | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/snippy b/snippy index 9022d1f..4578c54 100755 --- a/snippy +++ b/snippy @@ -89,6 +89,11 @@ strindex() { [[ "$x" = "$1" ]] && echo -1 || echo "${#x}" } +is_rich_snippet() { + file="$1" + grep -q "##richsnippet" "$file" +} + # Move the cursor up or left move_cursor() { local key=$1 @@ -187,7 +192,11 @@ run() { fi # Copy snippet in clipboard - xsel -b --input < "$tmpfile" + if is_rich_snippet "${snippets_directory}/${snippet}"; then + xclip -t text/html -selection clipboard < "$tmpfile" + else + xclip -selection clipboard < "$tmpfile" + fi # Paste into the current application. if is_gui; then