Last active
April 13, 2019 11:34
-
-
Save mheland/ef0aab5de2ec87d8a9791a50827775f7 to your computer and use it in GitHub Desktop.
Translate HTML in clipboard to DokuWiki markup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Pipe clipboard to pandoc and pipe the DokuWiki markup back to clipboard | |
xclip -o -selection clipboard | pandoc -f html -t dokuwiki | xclip -selection clipboard | |
# Display first five non-blank lines from clipboard cut to one hundred characters in the confirmation dialog | |
result=$(xclip -o -selection clipboard | tr -s '\n' '\n' | head -n 5 | cut -c -100 ) | |
# Info box with preview of clipboard contents | |
zenity --info --title="HTML to Dokuwiki markup" --text="Clipboard preview: \n\n $result" --width=300 --height=100 | |
# Optional if you don't use Zenity... | |
# notify-send "Translated to DokuWiki markup in clipboard" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment