Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with processor Use in Obsidian-to-Hugo Conversion #19

Open
kl2111 opened this issue Oct 26, 2023 · 0 comments
Open

Issue with processor Use in Obsidian-to-Hugo Conversion #19

kl2111 opened this issue Oct 26, 2023 · 0 comments

Comments

@kl2111
Copy link

kl2111 commented Oct 26, 2023

Hello, I'm facing challenges understanding the usage of processor. I have a list of tuples named error_description in my Obsidian double-links, which I'd like to keep unaltered during the Obsidian-to-Hugo conversion. I am attempting to use processors to replace [[error_description]] with (error_description) during this process.

However, I've noticed that the code seems to go directly to the else block, printing Debug: No match for [[error_description]]). I confirmed that [[error_description]] does indeed exist in the original text. Below is the snippet of code in question:

def process_file(file_contents: str) -> str:
    processed_contents = file_contents
    print(f"Debug: error_descriptions = {error_descriptions}")
    for error_description in error_descriptions:
        search_str = f'[[error_description]])'
        print(f"Debug: Looking for {search_str}")
        if search_str in processed_contents:
            print(f"Debug: Replacing {search_str}")
            processed_contents = processed_contents.replace(search_str, f'({error_description})')
        else:
            print(f"Debug: No match for {search_str}")
    print(f"Debug: Final file contents: {processed_contents[:100]}")  # Output the first 100 chars after modification

# Build and Run ObsidianToHugo
obsidian_to_hugo = ObsidianToHugo(
    obsidian_vault_dir=obsidian_vault_dir_path,
    hugo_content_dir=hugo_content_dir_path,
    processors=[process_file],
)
obsidian_to_hugo.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant