obsidian-parser 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/obsidian/parser/obsidian_flavored_markdown.rb +7 -4
- data/lib/obsidian/parser/page.rb +4 -2
- data/lib/obsidian/parser/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37cfdc15ab5d67c4ac5972db19df269b71a20c516bc43bc9014daccdf42879eb
|
4
|
+
data.tar.gz: ed67a9489d6e3ed05df0b72d14773b5674945ae993b51386e76634023629de74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b39d82790d769bda1434db80434715715c9be20b9fae0fd9f9c51147354e9f8adb46062b3500ff07d1084d3435ab764fc7f27a22481dfc48447ef0524802cec
|
7
|
+
data.tar.gz: acd7d36cac25c162da92a939e132033afd2b4585af490c188505295b9d51134a3073b47fc8e457777a984facec6884230c6b5e2188554be1a56a0a26f8ceec8e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.5.4] - 2023-08-02
|
4
|
+
- Fix page getting clobbered when wikilinks point to non-existent pages.
|
5
|
+
- Expand `[[foo/index]]` wiklinks to `[foo](foo)`.
|
6
|
+
|
3
7
|
## [0.5.3] - 2023-08-01
|
4
8
|
- Support non-fully qualified titles when parsing wikilink syntax.
|
5
9
|
- Autolink raw URLs.
|
data/Gemfile.lock
CHANGED
@@ -47,12 +47,15 @@ module Obsidian
|
|
47
47
|
target = $~[:target]
|
48
48
|
fragment = $~[:fragment]
|
49
49
|
page = root.find_in_tree(target)
|
50
|
-
return text.nil? ? target.split("/").last : text if page.nil?
|
51
50
|
|
52
|
-
|
53
|
-
|
51
|
+
if page.nil?
|
52
|
+
text.nil? ? target.split("/").last : text
|
53
|
+
else
|
54
|
+
display_text = text.nil? ? page.slug.split("/").last : text
|
55
|
+
href = fragment.nil? ? page.slug : "#{page.slug}##{fragment}"
|
54
56
|
|
55
|
-
|
57
|
+
"[#{display_text}](#{href})"
|
58
|
+
end
|
56
59
|
end
|
57
60
|
end
|
58
61
|
|
data/lib/obsidian/parser/page.rb
CHANGED
@@ -103,16 +103,18 @@ module Obsidian
|
|
103
103
|
# If there is an exact match, we should always return that
|
104
104
|
# Otherwise, if we can skip over some anscestors and get a
|
105
105
|
# match, then return the first, shortest match.
|
106
|
+
# If a query slug contains `/index` we ignore it and treat it
|
107
|
+
# the same as `/`
|
106
108
|
def find_in_tree(query_slug)
|
107
109
|
# Exact match
|
108
110
|
return self if slug == query_slug
|
109
111
|
|
110
112
|
# Partial match
|
111
|
-
query_parts = query_slug.split("/")
|
113
|
+
query_parts = query_slug.split("/").reject { |part| part == "index" }
|
112
114
|
length = query_parts.size
|
113
115
|
slug_parts = slug.split("/")
|
114
116
|
|
115
|
-
if slug_parts.length
|
117
|
+
if slug_parts.length >= length
|
116
118
|
if slug_parts.slice(-length, length) == query_parts
|
117
119
|
return self
|
118
120
|
end
|
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.5.
|
4
|
+
version: 0.5.4
|
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-08-
|
11
|
+
date: 2023-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|