vita 0.1.1 → 0.2.0
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/README.md +20 -6
- data/doc/backlinks.png +0 -0
- data/doc/notes.png +0 -0
- data/doc/outlinks.png +0 -0
- data/lib/vita/garden.rb +3 -1
- data/lib/vita/garden_note.rb +26 -4
- data/lib/vita/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: 86ecbe16917de241d894f019175d823a4e06606cee81f5d20534210e159ac814
|
4
|
+
data.tar.gz: f497eab7e3b8e2cd4828a9a39f16e792653f2583c4fa4e3b21b6fc6cdb75e806
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73a39e21fdfe22f0b143b387e8ed06edc534ed8cd46e519f70a395b7307bc354304780111d05ee9753986393521d6f6202eeb687c99c83d770bebd623a79ffe7
|
7
|
+
data.tar.gz: 5fea8bdbc8437cb18639f6f4bc5f88205ecac87621a75e57245097c95ff8000c41eabd65424ee6660c4cebb59b50a021781b2c9dfd6993d29d077dc9c1a0b4ab
|
data/README.md
CHANGED
@@ -43,17 +43,31 @@ Vita creates a `publish` folder containing HTML files for publishing to a web se
|
|
43
43
|
|
44
44
|
## Links between notes
|
45
45
|
|
46
|
-
Vita looks for connections between notes.
|
46
|
+
Vita looks for connections between notes. When a note's title (or a [synonym](#synonyms)) appears in the content of another note, Vita creates a link between the two.
|
47
47
|
|
48
|
-
When a note
|
48
|
+
When viewing a note, links in the note's content are hyperlinked:
|
49
49
|
|
50
|
-
|
50
|
+
<img src="doc/outlinks.png" alt="Screenshot of a note in Vita, showing hyperlinks from a note's content to other notes" style="width: 75%">
|
51
51
|
|
52
|
-
|
52
|
+
A list of links from other notes to the current note follows the note's content:
|
53
53
|
|
54
|
-
|
54
|
+
<img src="doc/backlinks.png" alt="Screenshot of the "links to this note" panel in Vita, showing notes that reference the current note" style="width: 75%">
|
55
55
|
|
56
|
-
|
56
|
+
Each link includes an excerpt from the other note. Clicking one of these links navigates to the other note.
|
57
|
+
|
58
|
+
## Synonyms
|
59
|
+
|
60
|
+
Synonyms allow referring to notes using multiple names. Adding synonyms can be helpful when a note's title appears in other notes in different forms or tenses.
|
61
|
+
|
62
|
+
For example, notes may refer to a note titled "Cohesion" using terms like "cohesive", "coherent", or "coherence". Adding these words as synonyms to the "Cohesion" note allows Vita to connect the notes with links.
|
63
|
+
|
64
|
+
To specify a note's synonyms, add a `Synonyms:` line at the start of the file containing a comma-separated list of alternative names. For example, in a file called `Cohesion.txt`:
|
65
|
+
|
66
|
+
```
|
67
|
+
Synonyms: cohesive, coherent, coherence
|
68
|
+
|
69
|
+
A module is cohesive if the elements in the module are related and the module is coherent as a whole.
|
70
|
+
```
|
57
71
|
|
58
72
|
## Home note
|
59
73
|
|
data/doc/backlinks.png
CHANGED
Binary file
|
data/doc/notes.png
CHANGED
Binary file
|
data/doc/outlinks.png
CHANGED
Binary file
|
data/lib/vita/garden.rb
CHANGED
@@ -60,7 +60,9 @@ module Vita
|
|
60
60
|
|
61
61
|
def notes=(notes)
|
62
62
|
@notes = notes.map { |note| GardenNote.new(self, note) }.sort_by(&:title)
|
63
|
-
@notes_hash = @notes.
|
63
|
+
@notes_hash = @notes.flat_map { |note|
|
64
|
+
note.all_names.map { |name| [name.downcase, note] }
|
65
|
+
}.to_h
|
64
66
|
|
65
67
|
if home_note
|
66
68
|
@notes.delete(home_note)
|
data/lib/vita/garden_note.rb
CHANGED
@@ -12,12 +12,30 @@ module Vita
|
|
12
12
|
@note = note
|
13
13
|
end
|
14
14
|
|
15
|
+
# Get this note's primary title.
|
15
16
|
def title
|
16
17
|
@note.title
|
17
18
|
end
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
# Get alternative names for this note.
|
21
|
+
def synonyms
|
22
|
+
if @note.content.start_with? "Synonyms:"
|
23
|
+
@note.content[9..@note.content.index("\n")].split(",").map(&:strip)
|
24
|
+
else
|
25
|
+
[]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Get all names for this note, including its title and synonyms.
|
30
|
+
def all_names
|
31
|
+
[title, *synonyms]
|
32
|
+
end
|
33
|
+
|
34
|
+
# Get a regular expression that matches any of this note's names surrounded
|
35
|
+
# by word boundaries.
|
36
|
+
def names_regexp
|
37
|
+
elements = all_names.map { |name| /#{Regexp.quote(name)}/i }
|
38
|
+
/\b#{Regexp.union(elements)}\b/
|
21
39
|
end
|
22
40
|
|
23
41
|
def path
|
@@ -29,7 +47,11 @@ module Vita
|
|
29
47
|
end
|
30
48
|
|
31
49
|
def content
|
32
|
-
@note.content
|
50
|
+
if @note.content.start_with? "Synonyms:"
|
51
|
+
@note.content[@note.content.index("\n") + 1..]
|
52
|
+
else
|
53
|
+
@note.content
|
54
|
+
end
|
33
55
|
end
|
34
56
|
|
35
57
|
def html
|
@@ -62,7 +84,7 @@ module Vita
|
|
62
84
|
|
63
85
|
def create_outlinks
|
64
86
|
notes = garden.linkable_notes - [self]
|
65
|
-
regexp = Regexp.union(notes.map(&:
|
87
|
+
regexp = Regexp.union(notes.map(&:names_regexp))
|
66
88
|
matches = NoteScanner.new(content).scan(regexp)
|
67
89
|
|
68
90
|
matches.map do |match|
|
data/lib/vita/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vita
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alec Cursley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|