Cleaned up style

master
Mark 2022-10-29 15:43:59 -07:00
parent 09f78a7642
commit c58819a7d6
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
2 changed files with 18 additions and 19 deletions

View File

@ -36,7 +36,7 @@ def cmd_save(command, runner) -> None:
if len(command.args) != 1: if len(command.args) != 1:
printf( printf(
HTML( HTML(
f"<err>Command <cmd_code>:{command.name}</cmd_code> takes exactly one argument.</err>" f"<err>Command <code>:{command.name}</code> takes exactly one argument.</err>"
), ),
style = lamb.utils.style style = lamb.utils.style
) )
@ -67,7 +67,7 @@ def cmd_save(command, runner) -> None:
printf( printf(
HTML( HTML(
f"Wrote {len(runner.macro_table)} macros to <cmd_code>{target}</cmd_code>" f"Wrote {len(runner.macro_table)} macros to <code>{target}</code>"
), ),
style = lamb.utils.style style = lamb.utils.style
) )
@ -81,7 +81,7 @@ def cmd_load(command, runner):
if len(command.args) != 1: if len(command.args) != 1:
printf( printf(
HTML( HTML(
f"<err>Command <cmd_code>:{command.name}</cmd_code> takes exactly one argument.</err>" f"<err>Command <code>:{command.name}</code> takes exactly one argument.</err>"
), ),
style = lamb.utils.style style = lamb.utils.style
) )
@ -108,9 +108,9 @@ def cmd_load(command, runner):
printf( printf(
FormattedText([ FormattedText([
("class:warn", f"Syntax error on line {i+1:02}: "), ("class:warn", f"Syntax error on line {i+1:02}: "),
("class:cmd_code", l[:e.loc]), ("class:code", l[:e.loc]),
("class:err", l[e.loc]), ("class:err", l[e.loc]),
("class:cmd_code", l[e.loc+1:]) ("class:code", l[e.loc+1:])
]), ]),
style = lamb.utils.style style = lamb.utils.style
) )
@ -120,7 +120,7 @@ def cmd_load(command, runner):
printf( printf(
FormattedText([ FormattedText([
("class:warn", f"Skipping line {i+1:02}: "), ("class:warn", f"Skipping line {i+1:02}: "),
("class:cmd_code", l), ("class:code", l),
("class:warn", f" is not a macro definition.") ("class:warn", f" is not a macro definition.")
]), ]),
style = lamb.utils.style style = lamb.utils.style
@ -132,7 +132,7 @@ def cmd_load(command, runner):
printf( printf(
FormattedText([ FormattedText([
("class:ok", f"Loaded {x.label}: "), ("class:ok", f"Loaded {x.label}: "),
("class:cmd_code", str(x.expr)) ("class:code", str(x.expr))
]), ]),
style = lamb.utils.style style = lamb.utils.style
) )
@ -145,7 +145,7 @@ def mdel(command, runner) -> None:
if len(command.args) != 1: if len(command.args) != 1:
printf( printf(
HTML( HTML(
f"<err>Command <cmd_code>:{command.name}</cmd_code> takes exactly one argument.</err>" f"<err>Command <code>:{command.name}</code> takes exactly one argument.</err>"
), ),
style = lamb.utils.style style = lamb.utils.style
) )
@ -172,7 +172,7 @@ def macros(command, runner) -> None:
("class:cmd_h", "\nDefined Macros:\n"), ("class:cmd_h", "\nDefined Macros:\n"),
] + ] +
[ [
("class:cmd_text", f"\t{name} \t {exp}\n") ("class:text", f"\t{name} \t {exp}\n")
for name, exp in runner.macro_table.items() for name, exp in runner.macro_table.items()
]), ]),
style = lamb.utils.style style = lamb.utils.style
@ -209,7 +209,7 @@ def rlimit(command, runner) -> None:
elif len(command.args) != 1: elif len(command.args) != 1:
printf( printf(
HTML( HTML(
f"<err>Command <cmd_code>:{command.name}</cmd_code> takes exactly one argument.</err>" f"<err>Command <code>:{command.name}</code> takes exactly one argument.</err>"
), ),
style = lamb.utils.style style = lamb.utils.style
) )
@ -262,25 +262,27 @@ def rlimit(command, runner) -> None:
def help(command, runner) -> None: def help(command, runner) -> None:
printf( printf(
HTML( HTML(
"\n<cmd_text>" + "\n<text>" +
"<cmd_h>Usage:</cmd_h>" + "<cmd_h>Usage:</cmd_h>" +
"\n" + "\n" +
"\tWrite lambda expressions using your <cmd_key>\\</cmd_key> key." + "\tWrite lambda expressions using your <cmd_key>\\</cmd_key> key." +
"\n" + "\n" +
"\tMacros can be defined using <cmd_key>=</cmd_key>, as in <cmd_code>T = λab.a</cmd_code>" + "\tMacros can be defined using <cmd_key>=</cmd_key>, as in <code>T = λab.a</code>" +
"\n" + "\n" +
"\tRun commands using <cmd_key>:</cmd_key>, for example <cmd_code>:help</cmd_code>" + "\tRun commands using <cmd_key>:</cmd_key>, for example <code>:help</code>" +
"\n" +
"\tHistory can be accessed with <cmd_key>$</cmd_key>, which will expand to the result of the last successful reduction." +
"\n\n" + "\n\n" +
"<cmd_h>Commands:</cmd_h>"+ "<cmd_h>Commands:</cmd_h>"+
"\n" + "\n" +
"\n".join([ "\n".join([
f"\t<cmd_code>{name}</cmd_code> \t {text}" f"\t<code>{name}</code> \t {text}"
for name, text in help_texts.items() for name, text in help_texts.items()
]) + ]) +
"\n\n" "\n\n"
"<muted>Detailed documentation can be found on this project's git page.</muted>" + "<muted>Detailed documentation can be found on this project's git page.</muted>" +
"</cmd_text>" "</text>"
), ),
style = lamb.utils.style style = lamb.utils.style
) )

View File

@ -11,6 +11,7 @@ style = Style.from_dict({ # type: ignore
"err": "#FF0000", "err": "#FF0000",
"prompt": "#00FFFF", "prompt": "#00FFFF",
"ok": "#B4EC85", "ok": "#B4EC85",
"code": "#AAAAAA italic",
"muted": "#AAAAAA", "muted": "#AAAAAA",
# Syntax # Syntax
@ -23,12 +24,8 @@ style = Style.from_dict({ # type: ignore
# Command formatting # Command formatting
# cmd_h: section titles # cmd_h: section titles
# cmd_code: example snippets
# cmd_text: regular text
# cmd_key: keyboard keys, usually one character # cmd_key: keyboard keys, usually one character
"cmd_h": "#FF6600 bold", "cmd_h": "#FF6600 bold",
"cmd_code": "#AAAAAA italic",
"cmd_text": "#FFFFFF",
"cmd_key": "#B4EC85 bold", "cmd_key": "#B4EC85 bold",
# Only used in greeting # Only used in greeting