def edit_page_content(self, page_title: str, modify: typing.Callable[[str], str], force: bool, context: int) -> str:
"""
Edit the content of a single page.
Args:
page_title (str): The title of the page to be edited
modify (Callable[[str], str]): Function to modify the page content
force (bool): If True, actually edit the page; if False, perform a dry run
context (int): The number of context lines for diff
Returns:
str: Status of the edit operation
"""
page_to_edit = self.toWiki.getPage(page_title)
if not force and not page_to_edit.exists:
return "👎"
text = page_to_edit.text()
new_text = modify(text)
if new_text == text:
return "↔"
if force:
comment = "edited by wikiedit"
page_to_edit.edit(new_text, comment)
return "✅"
else:
diff_str = self.getDiff(text, new_text, n=context)
return f"👍{diff_str}"