Skip to content

Commit

Permalink
bug: initial release issues
Browse files Browse the repository at this point in the history
image links bundle paths
duplicate title and H1
  • Loading branch information
DamianFlynn committed Dec 2, 2022
1 parent 0740e13 commit 0ee8431
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"--hugo-content-dir",
"/Users/damianflynn/Sites/damianflynn/content",
"--obsidian-vault-dir",
"/Users/damianflynn/Sites/obsidian"
"/Users/damianflynn/vault/Cranium"
"--export-dir",
"share"
]
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import argparse
import os

__version__ = "0.2.0"
__version__ = "0.3.0"

parser = argparse.ArgumentParser()

Expand Down
9 changes: 6 additions & 3 deletions obsidian_parser/obsidianparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,10 @@ def retrieve_bundle_assets(self, hugo_page: str) -> None:
link["link"] = "opps-missing-image.png"

# Update the link in the Hugo Page.
hugo_link = f'![{link["text"]}]({link["link"]})'
hugo_link = f'![{link["text"]}]({link["link"]})' # HTML Link
hugo_link = f'![[{link["link"]}|{link["text"]}]]' # Wiki Link
wiki_link = link["source"]
#note_content = note_content.replace(wiki_link, hugo_link)
note_content = note_content.replace(wiki_link, hugo_link)

# Write the Updated Page content.
with open(os.path.join(hugo_page), "w", encoding = "utf-8") as f:
Expand Down Expand Up @@ -288,11 +289,13 @@ def replace_wiki_links(self, text: str) -> str:
def check_frontmatter(self, hugo_page: str):
post = frontmatter.loads(hugo_page)

post_body = post.content
#first_heading = re.search(r"^# (.*)", post.content, re.MULTILINE)
title_heading = re.search(r"^# (.*)", post.content, re.MULTILINE)
if title_heading:
title_heading = title_heading.group(1)
print('First Match = {}'.format(title_heading))
post_body = post_body.replace(f'# {title_heading}\n', '')
else:
print('Not Found')

Expand All @@ -318,7 +321,7 @@ def check_frontmatter(self, hugo_page: str):
newpost += f"toc: {post['toc']}\n" if 'toc' in post.keys() else f"toc: false \n"
newpost += f"comments: {post['comments']}\n" if 'comments' in post.keys() else f"comments: false \n"
newpost += f"---\n\n"
newpost += post.content
newpost += post_body
return newpost

def reformat_article(self, hugo_page: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# This call to setup() does all the work
setup(
name="obsidian-parser",
version="0.2.0",
version="0.3.0",
description="Demo library",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 0ee8431

Please sign in to comment.