Compare commits

..

No commits in common. "92baf351a50e20bb86dc4a86831a92cffbced196" and "35ca2b896e90e1570b155e6e18c801ae6ee3ce04" have entirely different histories.

2 changed files with 9 additions and 30 deletions

View File

@ -83,12 +83,6 @@ class ListenCommand(CliCommand):
@classmethod
def setup_arguments(cls, parser: argparse.ArgumentParser) -> None:
parser.add_argument(
"-h", "--host",
metavar="HOST",
help="Host to listen on.",
default=str(cm().listen_host or "127.0.0.1"),
)
parser.add_argument(
"-p", "--port",
metavar="PORT",
@ -115,7 +109,6 @@ class ListenCommand(CliCommand):
tw.exec(
[
("listen",
f"host={args.host}",
f"port={args.port}",
f"username={args.username}",
f"password={args.password}")

View File

@ -360,7 +360,7 @@ def _private_people_replacement_table(
@tzk_builder
def replace_private_people(initialer: Callable[[str], str] = None, replace_text = False) -> None:
def replace_private_people(initialer: Callable[[str], str] = None) -> None:
"""
Replace the names of people who are not marked Public with their initials.
@ -378,16 +378,12 @@ def replace_private_people(initialer: Callable[[str], str] = None, replace_text
(e.g., MsJaneDoe becomes J.D.). The links point to the tiddler ``PrivatePerson``,
which explains this process.
:param initialer: If you don't like the way that initials
are generated from tiddler filenames by default,
you can customize it by passing a callable
that takes one string argument
(a tiddler filename without the full path, e.g., ``MsJaneDoe.tid``)
and returns a string to be considered the "initials" of that person.
:param replace_text: If you have links in the form ``[[John|MrJohnDoe]]``, then enabling
this option ensures that the link text `John` is also replaced with
the initials.
:param initialer: If you don't like the way that initials
are generated from tiddler filenames by default,
you can customize it by passing a callable
that takes one string argument
(a tiddler filename without the full path, e.g., ``MsJaneDoe.tid``)
and returns a string to be considered the "initials" of that person.
"""
assert 'public_wiki_folder' in build_state
@ -405,18 +401,8 @@ def replace_private_people(initialer: Callable[[str], str] = None, replace_text
if '|' + replace_person + ']]' in lines[i]:
# link with the person as the target only;
# beware that you might have put something private in the text
if replace_text:
# with this option, the initials are also
# put in the text, solving the warning before
end = lines[i].find('|' + replace_person + ']]')
start = lines[i].rfind('[[', 0, end) + 2
search = f"[[{lines[i][start:end]}|{replace_person}]]"
replace = f"[[{replace_initials}|PrivatePerson]]"
lines[i] = lines[i].replace(search, replace)
else:
lines[i] = line.replace(replace_person, 'PrivatePerson')
elif '[[' + replace_person + ']]' in line:
lines[i] = lines[i].replace(replace_person, 'PrivatePerson')
elif '[[' + replace_person + ']]' in lines[i]:
# link with the person as the target and text
lines[i] = lines[i].replace(
replace_person,