Compare commits
	
		
			4 Commits
		
	
	
		
			new-privat
			...
			77886cb1c6
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 77886cb1c6 | |||
| 57394668be | |||
| 3b1f91bcb0 | |||
| 4075c4fb18 | 
@@ -83,6 +83,12 @@ class ListenCommand(CliCommand):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def setup_arguments(cls, parser: argparse.ArgumentParser) -> None:
 | 
					    def setup_arguments(cls, parser: argparse.ArgumentParser) -> None:
 | 
				
			||||||
 | 
					        parser.add_argument(
 | 
				
			||||||
 | 
					            "--host",
 | 
				
			||||||
 | 
					            metavar="HOST",
 | 
				
			||||||
 | 
					            help="Host to listen on.",
 | 
				
			||||||
 | 
					            default=str(cm().listen_host or "127.0.0.1"),
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        parser.add_argument(
 | 
					        parser.add_argument(
 | 
				
			||||||
            "-p", "--port",
 | 
					            "-p", "--port",
 | 
				
			||||||
            metavar="PORT",
 | 
					            metavar="PORT",
 | 
				
			||||||
@@ -109,6 +115,7 @@ class ListenCommand(CliCommand):
 | 
				
			|||||||
            tw.exec(
 | 
					            tw.exec(
 | 
				
			||||||
                [
 | 
					                [
 | 
				
			||||||
                    ("listen",
 | 
					                    ("listen",
 | 
				
			||||||
 | 
					                    f"host={args.host}",
 | 
				
			||||||
                    f"port={args.port}",
 | 
					                    f"port={args.port}",
 | 
				
			||||||
                    f"username={args.username}",
 | 
					                    f"username={args.username}",
 | 
				
			||||||
                    f"password={args.password}")
 | 
					                    f"password={args.password}")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -360,7 +360,7 @@ def _private_people_replacement_table(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@tzk_builder
 | 
					@tzk_builder
 | 
				
			||||||
def replace_private_people(initialer: Callable[[str], str] = None) -> None:
 | 
					def replace_private_people(initialer: Callable[[str], str] = None, replace_text = False) -> None:
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Replace the names of people who are not marked Public with their initials.
 | 
					    Replace the names of people who are not marked Public with their initials.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -384,6 +384,10 @@ def replace_private_people(initialer: Callable[[str], str] = None) -> None:
 | 
				
			|||||||
                         that takes one string argument
 | 
					                         that takes one string argument
 | 
				
			||||||
                         (a tiddler filename without the full path, e.g., ``MsJaneDoe.tid``)
 | 
					                         (a tiddler filename without the full path, e.g., ``MsJaneDoe.tid``)
 | 
				
			||||||
                         and returns a string to be considered the "initials" of that person.
 | 
					                         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.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    assert 'public_wiki_folder' in build_state
 | 
					    assert 'public_wiki_folder' in build_state
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -401,8 +405,18 @@ def replace_private_people(initialer: Callable[[str], str] = None) -> None:
 | 
				
			|||||||
                    if '|' + replace_person + ']]' in lines[i]:
 | 
					                    if '|' + replace_person + ']]' in lines[i]:
 | 
				
			||||||
                        # link with the person as the target only;
 | 
					                        # link with the person as the target only;
 | 
				
			||||||
                        # beware that you might have put something private in the text
 | 
					                        # beware that you might have put something private in the text
 | 
				
			||||||
                        lines[i] = lines[i].replace(replace_person, 'PrivatePerson')
 | 
					                        if replace_text:
 | 
				
			||||||
                    elif '[[' + replace_person + ']]' in lines[i]:
 | 
					                            # 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:
 | 
				
			||||||
                        # link with the person as the target and text
 | 
					                        # link with the person as the target and text
 | 
				
			||||||
                        lines[i] = lines[i].replace(
 | 
					                        lines[i] = lines[i].replace(
 | 
				
			||||||
                                replace_person,
 | 
					                                replace_person,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user