-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[create-pull-request] automated change (#37)
Co-authored-by: akosbalasko <[email protected]>
- Loading branch information
1 parent
33799c4
commit 2575232
Showing
8 changed files
with
180 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
400 | ||
439 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: | ||
author: M_bot (https://forum.obsidian.md/u/M_bot) | ||
Publication Date: Fri Jul 30 2021 | ||
Last modification Date: Fri Jul 30 2021 | ||
--- | ||
|
||
|
||
<p>Since 0.4.0, <code>econtains</code> or “exact contains” allows you to look for exact matches only rather than substrings. There isn’t documentation on it quite yet but the following should hopefully work</p> | ||
<pre><code class="lang-auto">```dataview | ||
TABLE Season | ||
WHERE econtains(School, "FHS") | ||
``` | ||
</code></pre> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
title: | ||
author: M_bot (https://forum.obsidian.md/u/M_bot) | ||
Publication Date: Sat Aug 07 2021 | ||
Last modification Date: Sat Aug 07 2021 | ||
--- | ||
|
||
|
||
<p>I’ve only taken a quick glance but you should be able to do the same in regular dataview. Just in case anyone wants add on without having to use JS</p> | ||
<pre><code class="lang-auto">```dataview | ||
list | ||
where contains(this.file.inlinks, file.link) | ||
and !contains(this.file.outlinks, file.link) | ||
``` | ||
</code></pre> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: | ||
author: Moonbase59 (https://forum.obsidian.md/u/Moonbase59) | ||
Publication Date: Sat Aug 07 2021 | ||
Last modification Date: Sat Aug 07 2021 | ||
--- | ||
|
||
|
||
<h2>List of backlinks not including outgoing links from this note</h2> | ||
<p>I made a short description, so that everyone can follow how to do things like that. It requires <code>```dataviewjs</code> though.</p> | ||
<h3>Here’s what it looks like</h3> | ||
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.obsidian.md/uploads/default/original/3X/f/0/f09e077225825f21ded236a385e6321293097863.png" data-download-href="https://forum.obsidian.md/uploads/default/f09e077225825f21ded236a385e6321293097863" title="Test Dataview - List of backlinks not including outgoing links from this note.md () - Knowledgebase - Obsidian_001"><img src="https://forum.obsidian.md/uploads/default/optimized/3X/f/0/f09e077225825f21ded236a385e6321293097863_2_430x500.png" alt="Test Dataview - List of backlinks not including outgoing links from this note.md () - Knowledgebase - Obsidian_001" data-base62-sha1="ykBaskRqxRjEBOIcNJ8o5SMnq95" width="430" height="500" srcset="https://forum.obsidian.md/uploads/default/optimized/3X/f/0/f09e077225825f21ded236a385e6321293097863_2_430x500.png, https://forum.obsidian.md/uploads/default/optimized/3X/f/0/f09e077225825f21ded236a385e6321293097863_2_645x750.png 1.5x, https://forum.obsidian.md/uploads/default/optimized/3X/f/0/f09e077225825f21ded236a385e6321293097863_2_860x1000.png 2x" data-small-upload="https://forum.obsidian.md/uploads/default/optimized/3X/f/0/f09e077225825f21ded236a385e6321293097863_2_10x10.png"><div class="meta"> | ||
<svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"/></svg><span class="filename">Test Dataview - List of backlinks not including outgoing links from this note.md () - Knowledgebase - Obsidian_001</span><span class="informations">892×1035 85.6 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"/></svg> | ||
</div></a></div><p></p> | ||
<h3>Here’s the code</h3> | ||
<pre><code class="lang-auto"># List of backlinks not including outgoing links from this note | ||
|
||
An outlink: [[Test Dataview Links]] | ||
|
||
### outlinks | ||
|
||
```dataview | ||
list from outgoing([[#]]) | ||
``` | ||
|
||
### inlinks | ||
|
||
```dataview | ||
list from [[#]] | ||
``` | ||
|
||
### Backlinks w/o the outgoing links | ||
|
||
You can simply filter one array's elements by setting the condition based on other array's elements. | ||
|
||
The `some()` method tests whether at least one element in the array passes the test implemented by the provided function. And I’ve added a function which just checks if the inlink path exists in the outlinks array with the same value to be able to filter from the first array using a `not` (`!`). | ||
|
||
#### Long form for better understanding | ||
|
||
```dataviewjs | ||
var outlinks = dv.current().file.outlinks; | ||
var inlinks = dv.current().file.inlinks; | ||
|
||
dv.list(inlinks.filter(i => !outlinks.some(o => o.path === i.path))); | ||
``` | ||
|
||
#### Short form | ||
|
||
```dataviewjs | ||
dv.list(dv.current().file.inlinks | ||
.filter(i => !dv.current().file.outlinks.some( | ||
o => o.path === i.path))); | ||
``` | ||
</code></pre> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
title: | ||
author: allenormond (https://forum.obsidian.md/u/allenormond) | ||
Publication Date: Fri Jul 23 2021 | ||
Last modification Date: Fri Jul 23 2021 | ||
--- | ||
|
||
|
||
<p>Any reliable way to filter by checking if an array includes a value? I have files with:</p> | ||
<pre><code class="lang-auto">--- | ||
School: [NFHS] | ||
--- | ||
</code></pre> | ||
<p>and</p> | ||
<pre><code class="lang-auto">--- | ||
School: [NFHS, FHS] | ||
--- | ||
</code></pre> | ||
<p>When I use the following, both files are returned:</p> | ||
<pre><code class="lang-auto">```dataview | ||
TABLE Season | ||
WHERE contains(School,"FHS") | ||
</code></pre> | ||
<p>Any way to create a query that would only return the second file?<br> | ||
Thanks!</p> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: | ||
author: macdrifter (https://forum.obsidian.md/u/macdrifter) | ||
Publication Date: Fri Sep 03 2021 | ||
Last modification Date: Fri Sep 03 2021 | ||
--- | ||
|
||
|
||
<p>EDIT:</p> | ||
<p>“econtains” is the wrong operator. This query works:</p> | ||
<pre><code>```dataview | ||
LIST | ||
WHERE contains(company,"Disney") | ||
``` | ||
</code></pre> | ||
<p>====================</p> | ||
<p>I’ve seen several examples on here of using the WHERE clause in interesting ways but none seem to address my use case. I’d like to use a WHERE LIKE style phrase. I understand that the closest to a “LIKE” operator is the “contains” clause in Dataview.</p> | ||
<p>Use Case follows.</p> | ||
<p>I use meta fields to create a lite CRM in Obsidian.</p> | ||
<p>I have “company” notes spread across multiple folders in Obsidian. When I create a note for a person I will add a YAML field for “company” and use internal linking to insert the company name property.</p> | ||
<p>I have a field for “company” that looks like this for each “person” note:</p> | ||
<pre><code>--- | ||
company: [[Notes/Disney]] | ||
date: 2021-09-03 | ||
tags: contact | ||
--- | ||
</code></pre> | ||
<p>I’d like to use Dataview to display all notes with the company “Disney” meta field. I don’t want to worry about the folder that the “Disney” note is in. I’ve tried variations of this Dataview query but they all fail:</p> | ||
<pre><code>```dataview | ||
LIST | ||
WHERE econtains(company,"Disney") | ||
``` | ||
</code></pre> | ||
<p>I get zero result for the above query</p> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: | ||
author: pseudometa (https://forum.obsidian.md/u/pseudometa) | ||
Publication Date: Fri Aug 13 2021 | ||
Last modification Date: Fri Aug 13 2021 | ||
--- | ||
|
||
|
||
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.obsidian.md/uploads/default/original/3X/3/5/355a6d274b43c8b611671d7ea37ca7c7fccb8d54.png" data-download-href="https://forum.obsidian.md/uploads/default/355a6d274b43c8b611671d7ea37ca7c7fccb8d54" title="129053094-6dcbb2e5-fc40-4038-93f2-07223ce6bcc2"><img src="https://forum.obsidian.md/uploads/default/optimized/3X/3/5/355a6d274b43c8b611671d7ea37ca7c7fccb8d54_2_517x202.png" alt="129053094-6dcbb2e5-fc40-4038-93f2-07223ce6bcc2" data-base62-sha1="7BZ2HrRbrusk7HhHW2PoP66UP7S" width="517" height="202" srcset="https://forum.obsidian.md/uploads/default/optimized/3X/3/5/355a6d274b43c8b611671d7ea37ca7c7fccb8d54_2_517x202.png, https://forum.obsidian.md/uploads/default/optimized/3X/3/5/355a6d274b43c8b611671d7ea37ca7c7fccb8d54_2_775x303.png 1.5x, https://forum.obsidian.md/uploads/default/original/3X/3/5/355a6d274b43c8b611671d7ea37ca7c7fccb8d54.png 2x" data-small-upload="https://forum.obsidian.md/uploads/default/optimized/3X/3/5/355a6d274b43c8b611671d7ea37ca7c7fccb8d54_2_10x10.png"><div class="meta"> | ||
<svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"/></svg><span class="filename">129053094-6dcbb2e5-fc40-4038-93f2-07223ce6bcc2</span><span class="informations">937×368 34 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"/></svg> | ||
</div></a></div><p></p> | ||
<pre><code class="lang-auto">```dataview | ||
TABLE round(file.size * 1.005) as "Character Est.", round(file.size * 1.005 / 4.79) as "Word Est. (English)" | ||
FROM "folder" | ||
``` | ||
</code></pre> | ||
<p>This is a simple snippet to display character count of all notes in a folder & also calculate an <em>estimate</em> of the word count.</p> | ||
<p>Since dataview only offers <code>file.size</code> as attribute, there were some workarounds to achieve this:</p> | ||
<ul> | ||
<li>One character takes approximately <strong>1,005 bytes</strong>, <a href="https://stackoverflow.com/questions/32348137/obtaining-a-reliable-character-count-from-a-text-files-size-in-bytes" rel="noopener ugc">due to variable-width character encoding</a> | ||
</li> | ||
<li>According to a <a href="http:https://norvig.com/mayzner.html" rel="noopener ugc">comprehensive Google Books Analysis</a>, the average length of a word in an <strong>English</strong> text is <strong>4,79 characters</strong> long.</li> | ||
<li>taken together, this results in <code>round(file.size * 1.005 / 4.79)</code> as an estimation for the word count.</li> | ||
<li>if the notes are written in a different language, the factor will have to be adjusted. In German, for example, <a href="https://www.duden.de/sprachwissen/sprachratgeber/Durchschnittliche-Lange-eines-deutschen-Wortes" rel="noopener ugc">the average word in a given text is 5,99 characters long</a>.</li> | ||
</ul> | ||
<p>Caveats:</p> | ||
<ul> | ||
<li>the notes do appear in alphabetical order. If you are doing longform writing and the order of notes (chapters) is relevant, the notes need to have a specific numbering prepended.</li> | ||
</ul> | ||
<p>(I have created/contributed to feature requests at the <a href="https://github.com/blacksmithgu/obsidian-dataview/issues/397" rel="noopener ugc">dataview-plugin</a>, <a href="https://github.com/kevboh/longform/issues/14" rel="noopener ugc">longform-plugin</a>, and <a href="https://github.com/lukeleppan/better-word-count/issues/22" rel="noopener ugc">Better Word Count plugin</a>, hoping that one of them will implement a better and more precise solution, but until then, this snippet will have to do.)</p> | ||