Permalink
Browse files

Overhauled commands to work with Pandoc 1.8

  • Loading branch information...
dsanson committed Jan 31, 2011
1 parent 85b8b16 commit b4e20284f7eb588d4898d803ca664ff3c78b1fb5
@@ -6,6 +6,10 @@
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env ruby
+#
+# This script centers pandoc title blocks
+# to make them look nice.
+#
meta = 1
width = ENV['TM_COLUMNS'].to_i
@@ -25,7 +29,7 @@ end
<key>input</key>
<string>document</string>
<key>name</key>
- <string>Center Pandoc Metadata</string>
+ <string>Center Title Block</string>
<key>output</key>
<string>replaceDocument</string>
<key>scope</key>
@@ -11,7 +11,7 @@
<key>keyEquivalent</key>
<string>^~@m</string>
<key>name</key>
- <string>HTML to Markdown</string>
+ <string>Convert HTML to Markdown</string>
<key>output</key>
<string>openAsNewDocument</string>
<key>scope</key>
@@ -5,7 +5,7 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>perl -pe 's/\[\]\[#(.*?)\]/[$1]/g' | perl -pe 's/\[(.*?)\]\[#(.*?)\]/[$2\@$1]/g'
+ <string>perl -pe 's/\[\]\[#(.*?)\]/[@$1]/g' | perl -pe 's/\[(.*?)\]\[\#(.*?)\]/[\@$2, $1]/g'
</string>
<key>input</key>
@@ -5,7 +5,7 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>pandoc -Ss -w context </string>
+ <string>pandoc -Ss -w context --bibliography=$TM_PANDOC_BIB</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
@@ -5,7 +5,7 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>pandoc -sS -w latex --biblio=$TM_PANDOC_BIB --biblio-format=$TM_PANDOC_BIBTYPE --csl=$TM_PANDOC_CSL</string>
+ <string>pandoc -sS -w latex --bibliography=$TM_PANDOC_BIB</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
@@ -7,8 +7,8 @@
<key>command</key>
<string># $TM_FILEPATH: full path of current doc
-filename=${TM_FILEPATH}
-basename=${filename%.*}
+filename="${TM_FILEPATH}"
+basename="${filename%.*}"
# Find a unique name
@@ -26,7 +26,7 @@ targetname="$basename$connective$inc.odt"
# run pandoc
echo "&lt;pre&gt;"
- pandoc -sS -o "$targetname" --biblio=$TM_PANDOC_BIB --biblio-format=$TM_PANDOC_BIBTYPE --csl=$TM_PANDOC_CSL
+ pandoc -sS -o "$targetname" --bibliography=$TM_PANDOC_BIB
echo "&lt;/pre&gt;"
# verify that the file exists
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>beforeRunningCommand</key>
- <string>saveActiveFile</string>
- <key>command</key>
- <string>#!/bin/sh
-
-opts="$TM_PANDOC_OPTS"
-filename="$TM_FILEPATH"
-basename="${filename%.*}"
-if [ -f "$basename.tex" ]; then
- cp "$basename.tex" "$basename-old.tex"
-fi
-if [ -f "$basename.pdf" ]; then
- cp "$basename.pdf" "$basename-old.pdf"
-fi
-echo "&lt;pre&gt;"
-pandoc $opts -w context -sS --biblio="$TM_PANDOC_BIB" --biblio-format="$TM_PANDOC_BIBTYPE" --csl="$TM_PANDOC_CSL" &gt; "$basename.tex" &amp;&amp; texexec --purgeall --pdf "$basename.tex" &amp;&amp; open "$basename.pdf"
-echo "&lt;/pre&gt;"</string>
- <key>input</key>
- <string>selection</string>
- <key>keyEquivalent</key>
- <string>^~@p</string>
- <key>name</key>
- <string>Convert to PDF via ConTeXt (citations)</string>
- <key>output</key>
- <string>showAsHTML</string>
- <key>scope</key>
- <string>text.html.markdown.pandoc</string>
- <key>uuid</key>
- <string>AA1CB3C8-7D9E-4ADA-ACD5-BEF3DDFD1E7D</string>
-</dict>
-</plist>
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>beforeRunningCommand</key>
- <string>saveActiveFile</string>
- <key>command</key>
- <string>#!/bin/sh
-
-opts="$TM_PANDOC_OPTS"
-filename="$TM_FILEPATH"
-basename="${filename%.*}"
-if [ -f "$basename.tex" ]; then
- cp "$basename.tex" "$basename-old.tex"
-fi
-if [ -f "$basename.pdf" ]; then
- cp "$basename.pdf" "$basename-old.pdf"
-fi
-echo "&lt;pre&gt;"
-pandoc $opts -w context -sS &gt; "$basename.tex" &amp;&amp; texexec --purgeall --pdf "$basename.tex" &amp;&amp; open "$basename.pdf"
-echo "&lt;/pre&gt;"</string>
- <key>input</key>
- <string>selection</string>
- <key>keyEquivalent</key>
- <string>^~@p</string>
- <key>name</key>
- <string>Convert to PDF via ConTeXt</string>
- <key>output</key>
- <string>showAsHTML</string>
- <key>scope</key>
- <string>text.html.markdown.pandoc</string>
- <key>uuid</key>
- <string>0AF6F61D-7FB0-4016-A4C2-79F3DEE1B635</string>
-</dict>
-</plist>
@@ -17,14 +17,14 @@ if [ -f "$basename.pdf" ]; then
cp "$basename.pdf" "$basename-old.pdf"
fi
echo "&lt;pre&gt;"
-markdown2pdf $opts --biblio="$TM_PANDOC_BIB" --biblio-format="$TM_PANDOC_BIBTYPE" --csl="$TM_PANDOC_CSL" -o "$basename.pdf" &amp;&amp; open "$basename.pdf"
+markdown2pdf $opts --bibliography="$TM_PANDOC_BIB" -o "$basename.pdf" &amp;&amp; open "$basename.pdf"
echo "&lt;/pre&gt;"</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>^~@p</string>
<key>name</key>
- <string>Convert to PDF via LaTeX (citations)</string>
+ <string>Convert to PDF (citations)</string>
<key>output</key>
<string>showAsHTML</string>
<key>scope</key>
@@ -24,7 +24,7 @@ echo "&lt;/pre&gt;"</string>
<key>keyEquivalent</key>
<string>^~@p</string>
<key>name</key>
- <string>Convert to PDF via LaTeX</string>
+ <string>Convert to PDF</string>
<key>output</key>
<string>showAsHTML</string>
<key>scope</key>
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>beforeRunningCommand</key>
- <string>saveActiveFile</string>
- <key>command</key>
- <string>#!/bin/sh
-
-opts="$TM_PANDOC_OPTS"
-filename="$TM_FILEPATH"
-basename="${filename%.*}"
-if [ -f "$basename.tex" ]; then
- cp "$basename.tex" "$basename-old.tex"
-fi
-if [ -f "$basename.pdf" ]; then
- cp "$basename.pdf" "$basename-old.pdf"
-fi
-echo "&lt;pre&gt;"
-pandoc $opts -t latex --xetex -sS --biblio="$TM_PANDOC_BIB" --biblio-format="$TM_PANDOC_BIBTYPE" --csl="$TM_PANDOC_CSL" &gt; "$basename.tex" &amp;&amp; xelatex "$basename.tex" &amp;&amp; open "$basename.pdf"
-echo "&lt;/pre&gt;"</string>
- <key>input</key>
- <string>selection</string>
- <key>keyEquivalent</key>
- <string>^~@p</string>
- <key>name</key>
- <string>Convert to PDF via XeLaTeX (citations)</string>
- <key>output</key>
- <string>showAsHTML</string>
- <key>scope</key>
- <string>text.html.markdown.pandoc</string>
- <key>uuid</key>
- <string>88F4BB72-E04B-4AE9-9DEB-AA2A153BB79E</string>
-</dict>
-</plist>
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>beforeRunningCommand</key>
- <string>saveActiveFile</string>
- <key>command</key>
- <string>#!/bin/sh
-
-opts="$TM_PANDOC_OPTS"
-filename="$TM_FILEPATH"
-basename="${filename%.*}"
-if [ -f "$basename.tex" ]; then
- cp "$basename.tex" "$basename-old.tex"
-fi
-if [ -f "$basename.pdf" ]; then
- cp "$basename.pdf" "$basename-old.pdf"
-fi
-echo "&lt;pre&gt;"
-markdown2pdf $opts --xetex -o "$basename.pdf" &amp;&amp; open "$basename.pdf"
-echo "&lt;/pre&gt;"
-</string>
- <key>input</key>
- <string>selection</string>
- <key>keyEquivalent</key>
- <string>^~@p</string>
- <key>name</key>
- <string>Convert to PDF via XeLaTeX</string>
- <key>output</key>
- <string>showAsHTML</string>
- <key>scope</key>
- <string>text.html.markdown.pandoc</string>
- <key>uuid</key>
- <string>9E45F681-4DCE-40D5-8DF6-0FBE9526E8CE</string>
-</dict>
-</plist>
@@ -5,7 +5,8 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string># this calls a compiled haskell program. The source is in the
+ <string># this calls a compiled haskell program.
+# The source is in the
# Pandoc.tmbundle/Support/bin
demoteheaders</string>
@@ -5,7 +5,16 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>date=`date "+%B %d, %Y"`
+ <string># If the document has a three-line pandoc title
+# block, this should put the current date
+# on the third line.
+#
+# Note that it is pretty dumb: it won't handle
+# the multi-line title or author fields that
+# pandoc allows
+#
+
+date=`date "+%B %d, %Y"`
sed "3 s/%.*/% $date/"</string>
<key>input</key>
<string>document</string>
@@ -5,8 +5,7 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>pandoc -Ss --biblio=$TM_PANDOC_BIB --biblio-format=$TM_PANDOC_BIBTYPE --csl=$TM_PANDOC_CSL
-</string>
+ <string>pandoc -Ss --bibliography=$TM_PANDOC_BIB</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
@@ -5,8 +5,7 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>pandoc -Ss --biblio=$TM_PANDOC_BIB --biblio-format=$TM_PANDOC_BIBTYPE --csl=$TM_PANDOC_CSL
-
+ <string>pandoc -Ss --bibliography=$TM_PANDOC_BIB
</string>
<key>input</key>
<string>selection</string>
@@ -5,7 +5,8 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string># this calls a compiled haskell program. The source is in the
+ <string># this calls a compiled haskell program.
+# The source is in the
# Pandoc.tmbundle/Support/bin
promoteheaders</string>
@@ -5,9 +5,7 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string># Adapted from the wonderful Outlines Bundle, modified
-# so that the conversion looks more like the bullets pandoc
-# generates.
+ <string># Taken from the wonderful Outlines Bundle.
perl -pe 's/^(\s*)/\1- /'</string>
<key>input</key>
@@ -5,7 +5,7 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>pandoc -s -t markdown --no-wrap --reference-links --biblio=$TM_PANDOC_BIB --biblio-format=$TM_PANDOC_BIBTYPE --csl=$TM_PANDOC_CSL</string>
+ <string>pandoc -s -t markdown --no-wrap --reference-links --bibliography=$TM_PANDOC_BIB</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
@@ -5,7 +5,7 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>pandoc -s -t markdown --biblio=$TM_PANDOC_BIB --biblio-format=$TM_PANDOC_BIBTYPE --csl=$TM_PANDOC_CSL --reference-links</string>
+ <string>pandoc -s -t markdown --bibliography=$TM_PANDOC_BIB --reference-links</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>beforeRunningCommand</key>
- <string>nop</string>
- <key>command</key>
- <string>pandoc -f html "$TM_SELECTED_TEXT"</string>
- <key>fallbackInput</key>
- <string>none</string>
- <key>input</key>
- <string>selection</string>
- <key>name</key>
- <string>Download selected URL and convert to Markdown</string>
- <key>output</key>
- <string>openAsNewDocument</string>
- <key>uuid</key>
- <string>C8A41311-5DBC-4546-9940-18597760A860</string>
-</dict>
-</plist>
Oops, something went wrong.

0 comments on commit b4e2028

Please sign in to comment.