Skip to content

Commit

Permalink
fix: export frontmatter
Browse files Browse the repository at this point in the history
match the updates to theme
  • Loading branch information
DamianFlynn committed Feb 15, 2023
1 parent 398c2b4 commit 252d4f8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"justMyCode": true,
"args": [
"--hugo-content-dir",
"/Users/damianflynn/Sites/damianflynn/content",
"/Users/damianflynn/Sites/garden/content",
"--obsidian-vault-dir",
"/Users/damianflynn/vault/Cranium"
"--export-dir",
Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import argparse
import os

__version__ = "0.3.2"
__version__ = "0.3.3"

parser = argparse.ArgumentParser()

Expand Down Expand Up @@ -38,7 +38,7 @@
def main():
"""Run the CLI."""
args = parser.parse_args()
print("Obsidian Parser CLI")
print(f"Obsidian Parser CLI {__version__}")
if not args.hugo_content_dir or not os.path.isdir(args.hugo_content_dir):
parser.error("The hugo content directory does not exist.")
if not args.obsidian_vault_dir or not os.path.isdir(args.obsidian_vault_dir):
Expand Down
11 changes: 9 additions & 2 deletions obsidian_parser/obsidianparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,21 +305,28 @@ def check_frontmatter(self, hugo_page: str):

newpost += f"title: {post['title']}\n" if 'title' in post.keys() else f"title: {title_heading}\n"
newpost += f"type: {post['type']}\n" if 'type' in post.keys() else f"type: article \n"
if 'subtitle' in post.keys(): newpost += f"subtitle: {post['subtitle']}\n"
newpost += f"layout: {post['layout']}\n" if 'layout' in post.keys() else f"layout: post \n"
if 'description' in post.keys(): newpost += f"description: {post['description']}\n"
if 'date' in post.keys(): newpost += f"date: {post['date']}\n"
if 'toc' in post.keys(): newpost += f"toc: {post['toc']}\n"
if 'years' in post.keys(): newpost += f"year: {post['years']}\n"
if 'series' in post.keys(): newpost += f"series: {post['series']}\n"
newpost += f"categories: {post['categories']}\n" if 'categories' in post.keys() else f"categories: ['todo'] \n"
if 'tags' in post.keys():
newpost += f"tags: {post['tags']}\n" if post['tags'] != [] else f"tags: ['untagged'] \n"
else:
newpost += f"tags: ['untagged'] \n"
if 'categories' in post.keys():
newpost += f"categories: {post['categories']}\n" if post['categories'] != [] else f"categories: ['reflection'] \n"
else:
newpost += f"categories: ['reflection'] \n"
newpost += f"draft: {post['draft']}\n" if 'draft' in post.keys() else f"draft: false \n"
if 'lastmod' in post.keys(): newpost += f"lastmod: {post['lastmod']}\n"
if 'url' in post.keys(): newpost += f"url: {post['url']}\n"
# featuredImage: {bundle}/{imageName}.png
if 'image' in post.keys(): newpost += f"image: {post['image']}\n"
if 'image_caption' in post.keys(): newpost += f"image_caption: {post['image_caption']}\n"
newpost += f"toc: {post['toc']}\n" if 'toc' in post.keys() else f"toc: false \n"
newpost += f"featured: {post['featured']}\n" if 'featured' in post.keys() else f"featured: false \n"
newpost += f"comments: {post['comments']}\n" if 'comments' in post.keys() else f"comments: false \n"
newpost += f"---\n\n"
newpost += post_body
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# This call to setup() does all the work
setup(
name="obsidian-parser",
version="0.3.2",
description="Demo library",
version="0.3.3",
description="Grabs all the notes from an Obsidian vault and processes them into a Hugo content directory.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://obsidian-parser.readthedocs.io/",
Expand Down

0 comments on commit 252d4f8

Please sign in to comment.