Compare commits

..

No commits in common. "ca830713d38116d1513cc6ee108bf504106a5e76" and "3e9ecd4b70da3a70ea8d6f13d45cea21f2f2307e" have entirely different histories.

53 changed files with 22 additions and 376 deletions

1
.gitignore vendored
View File

@ -5,4 +5,3 @@ venv/
cli_docs/_build/
dist/
build/
.pypi_token

View File

@ -18,9 +18,9 @@ copyright = '2021 Soren Bjornstad'
author = 'Soren Bjornstad'
# The short X.Y version
version = "0.3.0"
version = "0.2.0"
# The full version, including alpha/beta/rc tags
release = "0.3.0"
release = "0.2.0"
# -- General configuration ---------------------------------------------------

File diff suppressed because one or more lines are too long

View File

@ -6,4 +6,4 @@ rm -rf build/
rm -f dist/*
mkdir -p dist
python setup.py sdist bdist_wheel
TWINE_PASSWORD=$(cat .pypi_token) twine upload --username '__token__' dist/*
twine upload dist/*

View File

@ -9,7 +9,7 @@ with open("README.md", "r") as fh:
setuptools.setup(
name="tzk",
version="0.3.0",
version="0.2.0",
author="Soren I. Bjornstad",
author_email="zettelkasten@sorenbjornstad.com",
description="Build tool for TiddlyWiki Zettelkasten",

View File

@ -13,7 +13,6 @@ information about the defined products without actually running any build steps.
from collections.abc import Mapping
from contextlib import contextmanager
import functools
import itertools
import os
from pathlib import Path
import re
@ -368,11 +367,11 @@ def _privatize_line(line: str, replacement_table: Dict[str, str],
Basics:
>>> _privatize_line("MsAlice is a test person.", {'MsAlice': 'A.'})
'[[A.|PrivatePerson]] is a test person.'
'<<privateperson "A.">> is a test person.'
>>> _privatize_line("This woman, known as MsAlice, is a test person.", \
{'MsAlice': 'A.'})
'This woman, known as [[A.|PrivatePerson]], is a test person.'
'This woman, known as <<privateperson "A.">>, is a test person.'
>>> _privatize_line("[[MsAlice]] is a test person.", {'MsAlice': 'A.'})
'[[A.|PrivatePerson]] is a test person.'
@ -381,12 +380,6 @@ def _privatize_line(line: str, replacement_table: Dict[str, str],
"sentence, that's fine too.", {'MsAlice': 'A.'})
"When we talk about [[A.|PrivatePerson]] in the middle of a sentence, that's fine too."
Content inside a macro:
>>> _privatize_line('''Text with a footnote.''' \
'''<<fnote "Here's my footnote about MsAlice.">>''', \
{'MsAlice': 'A.'})
'Text with a footnote.<<fnote "Here\\'s my footnote about [[A.|PrivatePerson]].">>'
Links with different text and target:
>>> _privatize_line("We can talk about [[Alice|MsAlice]] " \
"with different text.", {'MsAlice': 'A.'})
@ -395,12 +388,12 @@ def _privatize_line(line: str, replacement_table: Dict[str, str],
Multiple replacements with different people:
>>> _privatize_line("We can have [[MsAlice]] and MrBob talk to each other " \
"in the same line.", {'MsAlice': 'A.', 'MrBob': 'B.'})
'We can have [[A.|PrivatePerson]] and [[B.|PrivatePerson]] talk to each other in the same line.'
'We can have [[A.|PrivatePerson]] and <<privateperson "B.">> talk to each other in the same line.'
Multiple replacements with the same person:
>>> _privatize_line("We can have MsAlice talk to herself (MsAlice) " \
"in the same line.", {'MsAlice': 'A.'})
'We can have [[A.|PrivatePerson]] talk to herself ([[A.|PrivatePerson]]) in the same line.'
'We can have <<privateperson "A.">> talk to herself (<<privateperson "A.">>) in the same line.'
>>> _privatize_line("Likewise [[MsAlice]] can do it with brackets " \
"([[MsAlice]]).", {'MsAlice': 'A.'})
@ -408,7 +401,7 @@ def _privatize_line(line: str, replacement_table: Dict[str, str],
>>> _privatize_line('We can talk about [[Alice|MsAlice]] lots of ways, ' \
'like MsAlice and [[MsAlice]].', {'MsAlice': 'A.'})
'We can talk about [[Alice|PrivatePerson]] lots of ways, like [[A.|PrivatePerson]] and [[A.|PrivatePerson]].'
'We can talk about [[Alice|PrivatePerson]] lots of ways, like <<privateperson "A.">> and [[A.|PrivatePerson]].'
Replacements with alternate link text:
>>> _privatize_line('We can talk about [[Alice|MsAlice]] and [[Bob|MrBob]] as well', \
@ -484,7 +477,7 @@ def _privatize_line(line: str, replacement_table: Dict[str, str],
if not is_spurious_substring():
new_line = (line[0:start_idx]
+ f'[[{replace_initials}|PrivatePerson]]'
+ f'<<privateperson "{replace_initials}">>'
+ line[end_idx:])
elif is_bare_bracketed_link(start_idx, end_idx):
# link with the person as the target and text
@ -560,8 +553,7 @@ def replace_private_people(initialer: Callable[[str], str] = None, replace_link_
assert 'public_wiki_folder' in build_state
replacement_table = _private_people_replacement_table(initialer)
root = (Path(build_state['public_wiki_folder']) / "tiddlers")
tid_files = itertools.chain(root.glob("**/*.tid"), root.glob("**/*.json"))
tid_files = (Path(build_state['public_wiki_folder']) / "tiddlers").glob("**/*.tid")
for tiddler in tid_files:
dirty = False

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/appear/defaults/button-class
tc-btn-invisible tc-tiddlylink

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/appear/defaults/default-state
$:/temp/appear/

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/appear/defaults/keep
yes

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/appear/defaults/mode
block

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/appear/defaults/show
»

View File

@ -1,13 +0,0 @@
/*\
title: $:/plugins/tobibeer/appear/popup.js
type: application/javascript
module-type: utils
An enhanced version of the core Popup to support:
* absolute popups
* preview popups
* popup z-index
@preserve
\*/
(function(){"use strict";var t=require("$:/core/modules/utils/dom/popup.js").Popup,e=require("$:/core/modules/widgets/reveal.js").reveal,s=e.prototype.refresh;t.prototype.show=function(t){var e,s=t.domNode,p=$tw.utils.hasClass(s,"tc-popup-absolute"),o=this.popupInfo(s),i=function(t){var e=t,s=0,p=0;do{s+=e.offsetLeft||0;p+=e.offsetTop||0;e=e.offsetParent}while(e);return{left:s,top:p}},l={left:s.offsetLeft,top:s.offsetTop};e=o.popupLevel;if(o.isHandle){e++}this.cancel(e);if(this.findPopup(t.title)===-1){this.popups.push({title:t.title,wiki:t.wiki,domNode:s})}l=p?i(s):l;t.wiki.setTextReference(t.title,"("+l.left+","+l.top+","+s.offsetWidth+","+s.offsetHeight+")");if(this.popups.length>0){this.rootElement.addEventListener("click",this,true)}};t.prototype.popupInfo=function(t){var e,s=false,p=t;while(p&&e===undefined){if($tw.utils.hasClass(p,"tc-popup-handle")||$tw.utils.hasClass(p,"tc-popup-keep")){s=true}if($tw.utils.hasClass(p,"tc-reveal")&&($tw.utils.hasClass(p,"tc-popup")||$tw.utils.hasClass(p,"tc-popup-handle"))){e=parseInt(p.style.zIndex)-1e3}p=p.parentNode}var o={popupLevel:e||0,isHandle:s};return o};t.prototype.handleEvent=function(t){if(t.type==="click"){var e=this.popupInfo(t.target),s=e.popupLevel-1;if(e.isHandle){if(s<0){s=1}else{s++}}this.cancel(s)}};e.prototype.refresh=function(){var t,e,p=this.isOpen;e=s.apply(this,arguments);t=this.domNodes[0];if(this.isOpen&&(p!==this.isOpen||!t.style.zIndex)&&t&&(this.type==="popup"||$tw.utils.hasClass(t,"tc-block-dropdown")&&$tw.utils.hasClass(t,"tc-reveal"))){t.style.zIndex=1e3+$tw.popup.popups.length}return e}})();

View File

@ -1,3 +0,0 @@
module-type: utils
title: $:/plugins/tobibeer/appear/popup.js
type: application/javascript

View File

@ -1,31 +0,0 @@
title: $:/plugins/tobibeer/appear/readme
This plugin provides the ''$appear'' widget that can render popups and sliders (inline or block) as well as accordion menus.
!! Attributes
; type
: set to `popup` to have the content appear as a popup
; show
: the button label
; hide
: the hide button label
; mode
: either `block` or `inline`, with respect to the inner content
: any other mode is interpreted as block mode, without the default styles applying, e.g. drop-shadows
; once
: allows to click the button once, then hides it (unless the state is deleted)
; $state
: the widget calculates a state for you, use this to append a simple id
; state
: alternatively, specify a fully qualified state
; keep
: make popups sticky when `yes` or `true`
; handle / handler / variables
: allows to take the popup contents out of the flow and render them elsewhere on the page
: required to properly create popups in table cells and other constained elements
: specify variables to take along
<br>
; documentation / examples / demos...
: http://tobibeer.github.io/tw5-plugins#appear

View File

@ -1,21 +0,0 @@
tags: $:/tags/Stylesheet
title: $:/plugins/tobibeer/appear/styles
\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline html
<pre>.tc-reveal.appear-block,
.tc-popup.appear {
border-radius: 5px;
padding: 1px 1em;
<<box-shadow "2px 2px 4px rgba(0,0,0,0.3)">>;
}
.tc-popup.appear {
padding: 0 1em;
background: <<colour background>>;
}
.appear-reveal.appear-inline{
margin-left:5px;
}
.appear-reveal.appear-inline.appear-once{
margin-left:0;
}</pre>

File diff suppressed because one or more lines are too long

View File

@ -1,3 +0,0 @@
module-type: widget
title: $:/plugins/tobibeer/appear/widget.js
type: application/javascript

View File

@ -1,15 +0,0 @@
{
"author": "Tobias Beer",
"core-version": ">=5.1.9",
"created": "20220505135225785",
"dependents": "",
"description": "Create popups, sliders or accordion menus with the appear widget.",
"documentation": "https://tobibeer.github.io/tw5-appear",
"list": "readme",
"modified": "20220505135225785",
"plugin-type": "plugin",
"requires": "",
"source": "https://github.com/tobibeer/tw5-appear",
"title": "$:/plugins/tobibeer/appear",
"version": "0.6.2"
}

View File

@ -1,20 +0,0 @@
title: $:/plugins/tobibeer/preview/config
\define default()
<dt>$(defaults)$$(option)$</dt>
<dd>
//{{$:/plugins/tobibeer/preview/lingo/$(option)$}}<$list
filter="[[$(option)$]prefix[template]]">
{{$(defaults)$$(option)$}}</$list>://<br>
<$edit-text tag=input tiddler="$(defaults)$$(option)$"/>
</dd>
\end
<dl class="preview-defaults">
<$vars defaults="$:/plugins/tobibeer/preview/defaults/">
<$list filter="[all[tiddlers+shadows]removeprefix<defaults>sort[title]]" variable="option">
<<default>>
</$list>
</$vars>
</dl>
<style>.preview-defaults input {width:90%;}</style>

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/defaults/class
tc-popup-keep

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/defaults/delay
1500

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/defaults/exclude
[is[system]] [all[shadows]] [!has[text]]

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/defaults/keys
CTRL

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/defaults/not
tc-drop-down tc-sidebar-scrollable tc-topbar tc-tiddler-title

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/defaults/template
$:/plugins/tobibeer/preview/template

View File

@ -1,11 +0,0 @@
/*\
title: $:/plugins/tobibeer/preview/keyboard.js
type: application/javascript
module-type: utils
Fixes $:/core/modules/utils/dom/keyboard.js by providing an alternative.
Do not use as an API, let's fix the core.
@preserve
\*/
(function(){"use strict";var e={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46};exports.parseKeyDescriptorTB=function(t){var l,r,y,s=t.toUpperCase().split("+"),K={keyCode:null,shiftKey:false,altKey:false,ctrlKey:false};for(y=0;y<s.length;y++){l=false;r=s[y];if(r.substr(0,1)==="!"){l=true;r=r.substr(1)}if(r==="CTRL"){K.ctrlKey=l?null:true}else if(r==="SHIFT"){K.shiftKey=l?null:true}else if(r==="ALT"){K.altKey=l?null:true}else if(r==="META"){K.metaKey=l?null:true}else if(e[r]){K.keyCode=e[r]}else{K.keyCode=r.charCodeAt(0)}}return K};exports.checkKeyDescriptorTB=function(e,t){var l=!!t.metaKey;return(t.keyCode===null||e.keyCode===t.keyCode)&&(t.shiftKey===null?!e.shiftKey:e.shiftKey===t.shiftKey)&&(t.altKey===null?!e.altKey:e.altKey===t.altKey)&&(t.ctrlKey===null?!e.ctrlKey:e.ctrlKey===t.ctrlKey)&&(t.metaKey===null?!e.metaKey:e.metaKey===l)}})();

View File

@ -1,3 +0,0 @@
module-type: utils
title: $:/plugins/tobibeer/preview/keyboard.js
type: application/javascript

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/lingo/class
css classes applied to the popup

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/lingo/delay
delay popup for this many milliseconds

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/lingo/exclude
no preview for links to tiddlers matching this filter

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/lingo/keys
modifier keys to trigger popup directly on-hover (ctrl, alt+shift, meta, etc...)

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/lingo/not
no preview for links inside elements with these classes

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/lingo/open
view at ''<<WIKI>>''

View File

@ -1,3 +0,0 @@
title: $:/plugins/tobibeer/preview/lingo/template
the preview template

View File

@ -1,10 +0,0 @@
/*\
title: $:/plugins/tobibeer/preview/link.js
type: application/javascript
module-type: startup
Enhances the link widget for on-hover previews
@preserve
\*/
(function(){var e,t=require("$:/core/modules/widgets/link.js").link,i=t.prototype.render,o=t.prototype.handleClickEvent;t.prototype.render=function(){i.apply(this,arguments);var t=this,o=this.wiki,p=this.domNodes[0],r=o.getTiddler(t.to),n="$:/plugins/tobibeer/preview/defaults/",u="$:/temp/tobibeer/preview-",l=$tw.utils.parseKeyDescriptorTB(o.getTextReference(n+"keys","").toUpperCase()),s=o.getTextReference(n+"delay").toUpperCase(),a=function(e){var i=$tw.popup.popupInfo(e),p=i.popupLevel;return o.getTextReference(u+p)&&o.getTextReference(u+p+"-tiddler")===t.to?null:i},f=function(){var i,r=a(p);if(r){i=r.popupLevel;clearTimeout(t.previewTimeout);$tw.popup.cancel(i);i++;o.setText(u+i+"-tiddler","text",null,t.to);if($tw.popup.findPopup(u+i)===-1){setTimeout(function(){$tw.popup.triggerPopup({domNode:p,title:u+i,wiki:o});e=0},50)}}},d=function(){var e,i,r=1,u=o.getTextReference(n+"not","");if(u){$tw.utils.each(u.split(" "),function(e){var t=p;while(t&&r){if($tw.utils.hasClass(t,e)){r=0;return false}t=t.parentNode}})}if(r){i=o.getTextReference(n+"exclude","");e=i?o.filterTiddlers(i):[];if(e.indexOf(t.to)>=0){r=0}}return r};s=s!==undefined?parseInt(s):null;if(s!==null&&isNaN(s)){s=0}if(r){$tw.utils.addClass(p,"tc-popup-handle");$tw.utils.addClass(p,"tc-popup-absolute");["mouseover","mouseout"].forEach(function(i){p.addEventListener(i,function(o){var p=o||window.event;if(i==="mouseover"){if(d()){if(!p.keyCode){p.keyCode=0}if($tw.utils.checkKeyDescriptorTB(p,l)){if(!e){e=1;f()}}else if(s!==null){e=0;t.previewTimeout=setTimeout(f,s)}}}else{e=0;clearTimeout(t.previewTimeout)}})})}};t.prototype.handleClickEvent=function(){o.apply(this,arguments);clearTimeout(this.previewTimeout);$tw.popup.cancel(Math.max(0,$tw.popup.popupInfo(this.domNodes[0]).popupLevel))}})();

View File

@ -1,3 +0,0 @@
module-type: startup
title: $:/plugins/tobibeer/preview/link.js
type: application/javascript

View File

@ -1,24 +0,0 @@
tags: $:/tags/PageTemplate
title: $:/plugins/tobibeer/preview/popups
\define state(num)
$:/temp/tobibeer/preview-$num$
\end
\define classes(num)
tc-popup appear appear-block appear-reveal tc-preview-tiddler tc-preview-tiddler-$num$ $(default-classes)$
\end
\define level(num)
<$reveal tag="div" type="popup" state=<<state $num$>> class=<<classes $num$>>>
<$tiddler tiddler={{$:/temp/tobibeer/preview-$num$-tiddler}}>
<$transclude tiddler={{$:/plugins/tobibeer/preview/defaults/template}} mode="block"/>
</$tiddler>
</$reveal>
\end
<$vars default-classes={{$:/plugins/tobibeer/preview/defaults/class}}>
<$list filter="1 2 3 4 5 6 7 8 9">
<$macrocall $name="level" num={{!!title}}/>
</$list>
</$vars>

View File

@ -1,8 +0,0 @@
title: $:/plugins/tobibeer/preview/readme
The plugin $:/plugins/tobibeer/preview enhances the core <<x LinkWidget>> to display a preview of tiddlers when hovering an internal link.
<br>
; documentation / examples / demos...
: http://tobibeer.github.io/tw5-plugins#preview

View File

@ -1,8 +0,0 @@
tags: $:/tags/Stylesheet
title: $:/plugins/tobibeer/preview/styles
.tc-popup.tc-preview-tiddler{
max-width:600px;
width:100%;
padding:1em;
}

View File

@ -1,5 +0,0 @@
title: $:/plugins/tobibeer/preview/template
{{||$:/core/ui/ViewTemplate/tags}}
<$transclude mode="block"/>

View File

@ -1,15 +0,0 @@
{
"author": "Tobias Beer",
"core-version": ">=5.1.9",
"created": "20220505135243990",
"dependents": "",
"description": "Shows a tiddler preview when hovering internal links",
"documentation": "https://tobibeer.github.io/tw5-preview",
"list": "readme config",
"modified": "20220505135243990",
"plugin-type": "plugin",
"requires": "[[tobibeer/appear|http://tobibeer.github.io/tw5-plugins/#appear]]",
"source": "https://github.com/tobibeer/tw5-preview",
"title": "$:/plugins/tobibeer/preview",
"version": "0.5.6"
}

View File

@ -1,8 +1,6 @@
created: 20200121230518238
creator: soren
modified: 20220622234624323
modifier: soren
modified: 20210410005001202
title: $:/config/RelinkOnRename
type: text/vnd.tiddlywiki
no
yes

View File

@ -1,8 +0,0 @@
created: 20220622212041227
creator: soren
modified: 20220622212041250
modifier: soren
title: $:/config/shortcuts-mac/save-tiddler
type: text/vnd.tiddlywiki
cmd-Enter

View File

@ -1,8 +0,0 @@
created: 20220622212047526
creator: soren
modified: 20220622212047547
modifier: soren
title: $:/config/shortcuts-not-mac/save-tiddler
type: text/vnd.tiddlywiki
ctrl-Enter

View File

@ -1,6 +0,0 @@
created: 20220622212052270
creator: soren
modified: 20220622212052289
modifier: soren
title: $:/config/shortcuts/save-tiddler
type: text/vnd.tiddlywiki

View File

@ -2,7 +2,7 @@ caption: Spoiler banner
created: 20210622003118415
creator: soren
description: Display a warning banner on fiction tiddlers (any tiddler with a non-empty `universe` field) noting that we don't try to hide spoilers.
modified: 20220502164810636
modified: 20220201042246695
modifier: soren
private: no
public: no

View File

@ -1,8 +0,0 @@
created: 20220505135343597
creator: soren
modified: 20220505135454120
modifier: soren
title: $:/plugins/tobibeer/preview/defaults/delay
type: text/vnd.tiddlywiki
500

View File

@ -1,8 +0,0 @@
created: 20220505135432323
creator: soren
modified: 20220505135433494
modifier: soren
title: $:/plugins/tobibeer/preview/defaults/exclude
type: text/vnd.tiddlywiki
[is[system]] [all[shadows]]

View File

@ -1,8 +0,0 @@
created: 20220505135435971
creator: soren
modified: 20220505135437221
modifier: soren
title: $:/plugins/tobibeer/preview/defaults/keys
type: text/vnd.tiddlywiki
Ctrl

View File

@ -1,11 +0,0 @@
created: 20220505135633168
creator: soren
modified: 20220505135638189
modifier: soren
title: $:/plugins/tobibeer/preview/template
type: text/vnd.tiddlywiki
{{||$:/core/ui/ViewTemplate/subtitle}}
{{||$:/core/ui/ViewTemplate/tags}}
<$transclude mode="block"/>

View File

@ -1,10 +1,8 @@
caption: new source
created: 20200822190145295
creator: soren
description: Create a new source tiddler
list-after: $:/core/ui/Buttons/new-tiddler
modified: 20220504192240445
modifier: soren
modified: 20210522014032330
tags: $:/tags/PageControls
title: $:/sib/Buttons/NewSource
type: text/vnd.tiddlywiki
@ -27,6 +25,6 @@ type: text/vnd.tiddlywiki
readstatus="unread"
author=""
completed=""
year=<<now YYYY>>
year="2021"
/>
</$button>

View File

@ -3,7 +3,7 @@ created: 20210701023215046
creator: soren
description: Items we're currently working on but don't need to leave open. Drag and drop a link to a tiddler to add it.
list:
modified: 20220716205827340
modified: 20211026030511257
modifier: soren
tags: Meta Tool
title: $:/sib/Tools/Tray

View File

@ -10,7 +10,7 @@ import sys
from typing import Any, Callable, Dict, NoReturn
TZK_VERSION = "0.3.0"
TZK_VERSION = "0.2.0"
class BuildError(Exception):