diff --git a/castervoice/apps/gitter.py b/castervoice/apps/gitter.py index b5f3a51ab..2949a50d8 100644 --- a/castervoice/apps/gitter.py +++ b/castervoice/apps/gitter.py @@ -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": + 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) \ No newline at end of file +control.non_ccr_app_rule(GitterRule(), context=context) diff --git a/docs/readthedocs/Application_Commands_Quick_Reference.md b/docs/readthedocs/Application_Commands_Quick_Reference.md index ca5dfee89..c3c1460c3 100644 --- a/docs/readthedocs/Application_Commands_Quick_Reference.md +++ b/docs/readthedocs/Application_Commands_Quick_Reference.md @@ -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` | +| ` header`| | | # Jetbrains | Command | Command | Command |