Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added store and retrieve to gitter #651

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 31 additions & 12 deletions castervoice/apps/gitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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 |
Expand Down