obsidian-parser 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54b2b8b2c841d2c15bf739cc6e2c20a6dea2e29261719104ad1903adbd1a3337
4
- data.tar.gz: c51dd21ba256fd8c5f03eb646aee741d45167f0cad79eb7ba715c4c776335205
3
+ metadata.gz: 347ae1e2c1152ccae4ae2ad6a19c4477ae07a8dca77dcfd73d1e31da823cf5f6
4
+ data.tar.gz: 4d2257fd34be583429baf260e3136ca6cdf6cdb4d66fbd592abc396e81a32dfa
5
5
  SHA512:
6
- metadata.gz: 633e3ccd369bc760f316d977aedf485cef4d76bbe28af3f29079a92d5bcb2b92a6a2d529ea0dcf60c09a85bac2c598838ea70ff51b50b60e372ae33652523cae
7
- data.tar.gz: 8cac449aa204d036b5e72444afa1235e9dab3cb6b46cd1992d104d6a165775a70171f921c3b3a4064752c5daf08075c20d415a800bc1b6ca6f9c9fcd7c6037b1
6
+ metadata.gz: 99cfb58610e351574d4ca83faa28b90117ae63a2d219151f005d87e365ee80704d44759c2610cd6bf9b8301fec0ffeb4245d112231fa9ace90202283ad094758
7
+ data.tar.gz: a032cb2063e781db38c5ecafbe13f047d36e16cb5d71cf4c6b8558e40a6867d20b510a25aabbfe2201f5ce45a80a0ca7c729f1c5bd3e78f8030f01be812f61ac
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2023-07-27
4
+
5
+ - Note objects have a `parent` attribute.
6
+
3
7
  ## [0.2.0] - 2023-07-24
4
8
 
5
9
  - Note objects have a `content` attribute. Call `content.generate_html` to generate HTML on demand.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- obsidian-parser (0.2.0)
4
+ obsidian-parser (0.3.0)
5
5
  kramdown (~> 2.4)
6
6
  kramdown-parser-gfm (~> 1.1)
7
7
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Obsidian
4
4
  class Parser
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
@@ -23,12 +23,13 @@ module Obsidian
23
23
  end
24
24
 
25
25
  class Note
26
- def initialize(title, slug, last_modified, content: nil)
26
+ def initialize(title, slug, last_modified, content: nil, parent: nil)
27
27
  # TODO: check frontmatter for titles as well
28
28
  @title = title
29
29
  @slug = slug
30
30
  @last_modified = last_modified
31
31
  @content = content
32
+ @parent = parent
32
33
  end
33
34
 
34
35
  def inspect
@@ -39,6 +40,7 @@ module Obsidian
39
40
  attr_reader :slug
40
41
  attr_reader :last_modified
41
42
  attr_reader :content
43
+ attr_reader :parent
42
44
  end
43
45
 
44
46
  class Index
@@ -58,9 +60,11 @@ module Obsidian
58
60
  def add_note(title, parent_slug, last_modified, content: nil)
59
61
  slug = Obsidian.build_slug(title, parent_slug)
60
62
  directory = nested_directory(parent_slug.split("/"))
61
- note = Note.new(title, slug, last_modified, content: content)
63
+ note = Note.new(title, slug, last_modified, content: content, parent: directory)
62
64
 
63
65
  directory.notes << note
66
+
67
+ note
64
68
  end
65
69
 
66
70
  def inspect
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obsidian-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mat Moore
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-24 00:00:00.000000000 Z
11
+ date: 2023-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown