Skip to content

Instantly share code, notes, and snippets.

@Pafuxu
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pafuxu/87da9f56207cc48da141 to your computer and use it in GitHub Desktop.
Save Pafuxu/87da9f56207cc48da141 to your computer and use it in GitHub Desktop.
引用タグを自動化する
tell application "Safari"
activate
set theURL to URL of front document
set theTitle to name of front document
set selectedText to (do JavaScript "(''+getSelection())" in document 1)
set the clipboard to "<blockquote class=\"block-quote_content\" cite=\"" & theURL & "\" title=\"「" & theTitle & "」から引用\">" & return & " " & "<p>" & selectedText & "</p>" & return & " " & "<footer>" & return & " " & "<cite>— <a href=\"" & theURL & "\">" & theTitle & "</cite>" & return & " " & "</footer>" & return & "</blockquote>" & return as string
end tell
tell application "Safari"
activate
set theURL to URL of front document
set theTitle to name of front document
set selectedText to (do JavaScript "(''+getSelection())" in document 1)
set the clipboard to "<q class=\"inline-quote_content\" cite=\"" & theURL & "\" title=\"「" & theTitle & "」から引用\">" & selectedText & "</q>" as string
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment