Fix import path issue in gopher scripts
Add script directory to sys.path so imports work when scripts are called from remote_publish.sh. Also remove unused variable and no-op regex.
This commit is contained in:
@@ -10,10 +10,14 @@ Usage:
|
||||
|
||||
import argparse
|
||||
import re
|
||||
import sys
|
||||
import textwrap
|
||||
import yaml
|
||||
from pathlib import Path
|
||||
|
||||
# Add script directory to path for imports
|
||||
sys.path.insert(0, str(Path(__file__).parent))
|
||||
|
||||
from ascii_art import (
|
||||
LINE_WIDTH,
|
||||
POST_HEADER,
|
||||
@@ -100,10 +104,8 @@ def convert_formatting(text: str) -> str:
|
||||
# Bold: **text** -> *text*
|
||||
text = re.sub(r"\*\*([^*]+)\*\*", r"*\1*", text)
|
||||
|
||||
# Italic: *text* or _text_ -> _text_
|
||||
# Be careful not to match our converted bold
|
||||
# Italic: *text* -> _text_ (but not our converted bold *text*)
|
||||
text = re.sub(r"(?<!\*)\*([^*]+)\*(?!\*)", r"_\1_", text)
|
||||
text = re.sub(r"_([^_]+)_", r"_\1_", text)
|
||||
|
||||
# Horizontal rules
|
||||
text = re.sub(r"^---+$", "-" * LINE_WIDTH, text, flags=re.MULTILINE)
|
||||
@@ -185,7 +187,6 @@ def wrap_paragraphs(text: str) -> str:
|
||||
"""Wrap text to LINE_WIDTH, preserving code blocks and structure."""
|
||||
lines = text.split("\n")
|
||||
result = []
|
||||
in_code_block = False
|
||||
paragraph = []
|
||||
|
||||
def flush_paragraph():
|
||||
|
||||
@@ -9,9 +9,13 @@ Usage:
|
||||
|
||||
import argparse
|
||||
import re
|
||||
import sys
|
||||
import yaml
|
||||
from pathlib import Path
|
||||
|
||||
# Add script directory to path for imports
|
||||
sys.path.insert(0, str(Path(__file__).parent))
|
||||
|
||||
from ascii_art import (
|
||||
HEADER_BLOG_INDEX,
|
||||
DIR_TO_HEADER,
|
||||
|
||||
Reference in New Issue
Block a user