openstenoproject/plover — pull request #215 by morinted (2014-11-03 04:27:30+00:00)
Title: Add different output modes: Caps, Title, Lowercase, Snake, Camel

This pull adds several different cases. Namely:

- CAPITAL CASE
- Title Case
- lower case
- snake_case
- CamelCase

They are controlled by "MODE" commands, similar to "PLOVER" commands. They can be toggled with CAPS, TITLE, LOWER, SNAKE, and CAMEL. They can all be turned off with CLEAR.

CAPS, Title case, and lower case are mutually exclusive, so turning on one will turn off the others. CamelCase is mutually exclusive to all other cases. Snake case is only exclusive with camel case.

This means CAPS, title, and lower case can be used with snake case. This functionality is useful for programmers and regular stenographers alike. The cases are useful for programmers while coding, such as in variable names. For regular stenographers, CAPS can represent yelling, or scene cues, for example. Title case is useful for journalism.

I've tried to keep some sanity while coding these. The initial implementation used global variables, but this wasn't testable. Now, a dict of the cases has been added as a variable to the Action class. Since the cases are persistent, the case is passed along on each stroke. The MODE command directly modifies the mode of the action.

Some sample strokes for testing:

"KA*PS": "{MODE:CAPS}",
"K-BGS": "{MODE:CAMEL}",
"TAO*EULT": "{MODE:TITLE}",
"STPHA*EUBG": "{MODE:SNAKE}",
"HRO*ER": "{MODE:LOWER}",
"KHRAO*ER": "{MODE:CLEAR}",

Hope the code is up to standard -- if not, I'd be happy to make it so.

Ted