mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
Replace single newlines by default
This commit is contained in:
+1
-1
@@ -571,7 +571,7 @@ class abogen(QWidget):
|
|||||||
self.use_gpu = self.config.get(
|
self.use_gpu = self.config.get(
|
||||||
"use_gpu", True # Load GPU setting with default True
|
"use_gpu", True # Load GPU setting with default True
|
||||||
)
|
)
|
||||||
self.replace_single_newlines = self.config.get("replace_single_newlines", False)
|
self.replace_single_newlines = self.config.get("replace_single_newlines", True)
|
||||||
self._pending_close_event = None
|
self._pending_close_event = None
|
||||||
self.gpu_ok = False # Initialize GPU availability status
|
self.gpu_ok = False # Initialize GPU availability status
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -91,7 +91,7 @@ _sleep_procs = {"Darwin": None, "Linux": None} # Store sleep prevention process
|
|||||||
def clean_text(text, *args, **kwargs):
|
def clean_text(text, *args, **kwargs):
|
||||||
# Load replace_single_newlines from config
|
# Load replace_single_newlines from config
|
||||||
cfg = load_config()
|
cfg = load_config()
|
||||||
replace_single_newlines = cfg.get("replace_single_newlines", False)
|
replace_single_newlines = cfg.get("replace_single_newlines", True)
|
||||||
# Collapse all whitespace (excluding newlines) into single spaces per line and trim edges
|
# Collapse all whitespace (excluding newlines) into single spaces per line and trim edges
|
||||||
lines = [re.sub(r"[^\S\n]+", " ", line).strip() for line in text.splitlines()]
|
lines = [re.sub(r"[^\S\n]+", " ", line).strip() for line in text.splitlines()]
|
||||||
text = "\n".join(lines)
|
text = "\n".join(lines)
|
||||||
|
|||||||
Reference in New Issue
Block a user