Skip to content

Commit

Permalink
Added store and retrieve to gitter (#651)
Browse files Browse the repository at this point in the history
* Add store and retrieve

* Enhancements with action_if_text and advanced formatting

* Added  header <header_size> header that was commented out and included documentation

* Change spacing handling
LexiconCode authored Jul 16, 2019
1 parent beffc33 commit 16e557b
Showing 2 changed files with 37 additions and 17 deletions.
43 changes: 31 additions & 12 deletions castervoice/apps/gitter.py
Original file line number Diff line number Diff line change
@@ -5,26 +5,45 @@
"""
from castervoice.lib.imports import *


class GitterRule(MergeRule):
pronunciation = "Gitter"

mapping = {
"bold": R(Text("****") + Key("left:2")),
"emphasize": R(Text("**") + Key("left")),
# "header": R(Text( "" )), # H1 ## H2 ### H3
"insert item": R(Text("* ")),
"block quote": R(Text("> ")),
"mention": R(Text("@")),
"insert link": R(Text("[]()") + Key("left:3")),
"insert image": R(Text("![]()") + Key("left:3")),
"insert code": R(Text("``") + Key("left")),
"formatted code": R(Text("```") + Key("s-enter")),
"bold":
R(Store() + Text("****") + Key("left:2") +
Retrieve(action_if_text="right:2")),
"emphasize":
R(Store() + Text("**") + Key("left:1") + Retrieve(action_if_text="right:1")),
"<header_size> header":
R(Store() + Text("%(header_size)s ") + Retrieve(action_if_text="s-enter")),
"insert item":
R(Store() + Text("*") + Key("space") + Retrieve(action_if_text="s-enter")),
"block quote":
R(Store() + Text(">") + Key("space") + Retrieve(action_if_text="s-enter")),
"mention":
R(Store() + Text("@") + Retrieve(action_if_text="right, space")),
"insert link":
R(Store() + Text("[]()") + Key("left:3") +
Retrieve(action_if_text="right:2")),
"insert image":
R(Store() + Text("![]()") + Key("left:3") +
Retrieve(action_if_text="right:2")),
"insert code":
R(Store() + Text("``") + Key("left") + Retrieve(action_if_text="right")),
"formatted code":
R(Store() + Text("``````") + Pause("0.5") + Key("left:3,s-enter:2,up") +
Retrieve()),
}
extras = [
Dictation("text"),
Choice("header_size", {
"small": "###",
"medium": "##",
"large": "#",
}),
]
Defaults = {}


context = AppContext(executable="gitter")
control.non_ccr_app_rule(GitterRule(), context=context)
control.non_ccr_app_rule(GitterRule(), context=context)
11 changes: 6 additions & 5 deletions docs/readthedocs/Application_Commands_Quick_Reference.md
Original file line number Diff line number Diff line change
@@ -333,11 +333,12 @@

# Gitter

| Command | Command | Command |
|:--------------|:-----------------|:--------------|
| `block quote` | `formatted code` | `insert item` |
| `bold` | `insert code` | `insert link` |
| `emphasize` | `insert image` | `mention` |
| Command | Command | Command |
|:---------------|:-----------------|:--------------|
| `block quote` | `formatted code` | `insert item` |
| `bold` | `insert code` | `insert link` |
| `emphasize` | `insert image` | `mention` |
| `<size> header`| | |

# Jetbrains
| Command | Command | Command |

0 comments on commit 16e557b

Please sign in to comment.