Drafts: Templates and Tags
Drafts custom actions support a number of tags for dynamically inserting text when an action is performed. These can be used in most fields that accept text in Email, Message, Dropbox, Evernote and URL actions.
- [[draft]] : The full text of the draft.
- [[title]] : The first line of the draft only.
- [[body]] : The remainder of the draft text after the first line is removed.
- [[selection]] : If text was selected within the draft before selecting an action, this tag will return only that selected text. If no text was selected, it will return the full text of the draft.
- [[line|n]] : The text of a specific line number in the draft, where “n” is the line number. i.e. [[line|1]], [[line|2]].
- [[line|n..n]] : In addition to specific lines, the lines tag (above) can accept ranges of lines, such as “[[line|2..5]]” for lines 2 through 5. This initial or trailing number in the range can be omitted to indicate the beginning or end, i.e. [[line|2..]] is line 2 through the end of the draft, [[line|..4]] is the first for lines of the draft.
- [[clipboard]] : The current contents of the iOS clipboard.
- [[date]] : Timestamp in the format YYYY-MM-DD.
- [[date|format]] : Timestamp, formatted based on a custom strfime format string. For example [[draft|%m-%d-%Y]] becomes “01–02–2013”. Read Dr. Drang’s great post on Drafts’ format strings for more ideas.
- [[created|format]] : Same as “date”, but returns the timestamp for the creation of the draft, rather than the current time.
- [[modified|format]] : Same as “date”, but returns the timestamp for the last modification date of the draft content, rather than the current time.
- [[time]] : Timestamp in the format YYYY-MM-DD-HH-MM-SS.
- : Wrap text in double-curly brackets to have the text URL encoded.
- TextExpander Snippets : If you use TextExpander Touch, snippets found in templates can be expanded at the time actions are executed. By default this is disabled, to enable visit Settings, under the Actions section. The options for this setting are:
- No: Do not expand TextExpander snippets. This is the default, and if you do not use TE, or do not want dynamic expansion of snippets, leave it disabled.
- Fenced: Only text inside << >> delimiters will be checked for TextExpander snippets. A single delimited string can contain more than one snippet and/or other text, but only text in the delimiters will be expanded. This offers the highest level of compatibility to prevent expanding snippets accidently in URLs or other texts.
- All: Entire texts of custom action templates will be evaluated for TextExpander snippets. This is the easiest to configure, but runs the risk of expanding snippets that you might not intend to expand. For example if you define a snippet with a forward slash, it might conflict with URLs in URL Actions.