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

Fixed small bug in note.from_lines #67

Merged
merged 4 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed bug where `:ObsidianOpen` blocked the NeoVim UI on Linux.
- Fixed URL encoding of space characters for better compatibility with external applications.
- Made more robust to unexpected types in frontmatter.
- Fixed edge case where frontmatter consisting of exactly one empty field would raise an exception.

## [v1.6.1](https://github.com/epwalsh/obsidian.nvim/releases/tag/v1.6.1) - 2022-10-17

Expand Down
3 changes: 3 additions & 0 deletions lua/obsidian/note.lua
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ note.from_lines = function(lines, path, root)
if #frontmatter_lines > 0 then
local frontmatter = table.concat(frontmatter_lines, "\n")
local ok, data = pcall(yaml.loads, frontmatter)
if type(data) == 'string' then
data = {data = nil}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just this:

Suggested change
data = {data = nil}
data = {}

end
if ok then
for k, v in pairs(data) do
if k == "id" then
Expand Down