OcttKB Cross-Repo Sync (HTML to Raw)

This commit is contained in:
2023-07-11 11:28:00 +00:00
parent 6cb76e325b
commit 46c11002a1
748 changed files with 48 additions and 23 deletions

View File

@ -0,0 +1,8 @@
created: 20230130080040533
creator: Octt
modified: 20230130080526665
modifier: Octt
tags: $:/tags/Macro
title: $:/Macros/.@
\define .@Wikipedia(Article Subdomain) <<WikipediaFrame "$Article$" "$Subdomain$">>

View File

@ -0,0 +1,37 @@
created: 20230129125013039
creator: Octt
modified: 20230301212518124
modifier: Octt
tags:
title: $:/Macros/Breadcrumbs/Main
\define cp() javascript:(navigator.clipboard.writeText("$(currentTiddler)$"))
\define MakeViewBreadcrumbs()
\whitespace trim
<span class="View-Breadcrumbs">
<$set name="Caller" value=<<currentTiddler>>>
<$list filter="[<currentTiddler>split[/]limit[-1]]" counter="Index">
<span class="Path-Elem" data-path-elem=<<currentTiddler>>>
<$link to={{{[<Caller>split[/]limit<Index>join[/]]}}}>
<<currentTiddler>>
</$link>
</span>
<span class="Inline-Sep">
<span>/</span>
</span>
</$list>
</$set>
<$set name="Tiddler" value={{{[<currentTiddler>split[/]last[]]}}}>
<span class="Path-Elem" data-path-elem=<<Tiddler>>>
<details>
<summary>
<$text text=<<Tiddler>>/>
</summary>
<$macrocall $name="tiddlertree" tag=<<currentTiddler>>/>
</details>
</span>
</$set>
<a href=<<cp>> class="Path-Copy" title="Copy path to Clipboard">▪️</a>
</span>
\end

View File

@ -0,0 +1,40 @@
/*\
Hide i18n namespace labels dynamically from the Breadcrumbs line
(by wrapping them in CSS-selectable elements)
\*/
(function(){
"use strict";
exports.name = "i18nBreadcrumbsNamespaceLabelStrip";
exports.params = [];
exports.run = function() {
try {
var Languages = $tw.wiki.getTiddler('$:/i18n').fields.Languages.toLowerCase().split(' ');
var Path = this.getVariable('currentTiddler');
var Select = `.tc-story-river > div[data-tiddler-title="${Path}"] > .View-Breadcrumbs > .Path-Elem`;
var List = document.querySelectorAll(Select + ':last-of-type');
for (var i=0; i < List.length; i++) {
// At end of tiddler path (e.g: Tests/Misc/Test:en)
var Name = List[i].innerHTML.trim();
var Code = Name.toLowerCase().split(':').slice(-1)[0];
if (Languages.includes(Code)) {
List[i].innerHTML = `${Name.split(':').slice(0, -1)}<span class="Inline-Hidden">:${Code}</span>`;
} else {
// At start of tiddler path (e.g: Testing:en/Misc/Test); handle $:/ prefix if present
var Index = Path.startsWith('$:/') ? 2 : 1;
var Code = Path.toLowerCase().split(':')[Index];
if (Code) {
Code = Code.split('/')[0];
if (Languages.includes(Code)) {
var List = document.querySelectorAll(`${Select}:nth-child(${Index})`);
for (var i=0; i < List.length; i++) {
// TODO // List[i].innerHTML = `<span class="Inline-Hidden">:${Code}</span>/${Path.split(':')[Index].split('/').slice(1).join('/')}`;
};
};
};
};
};
} catch(e) {
$OcttKB.ErrAtLine(e);
};
}})();

View File

@ -0,0 +1,8 @@
created: 20230125222831006
creator: Octt
modified: 20230202185802952
modifier: Octt
module-type: macro
tags:
title: $:/Macros/Breadcrumbs/i18nNamespaceLabelStrip.js
type: application/javascript

View File

@ -0,0 +1,84 @@
created: 20230109160537807
creator: Octt
modified: 20230219103224267
modifier: Octt
tags: $:/tags/Macro
title: $:/Macros/Directory
\whitespace trim
<!-- Directory Features --->
\define DirTreeList(Prefix)
<$set name="Prefix" filter=" $Prefix$" value="$Prefix$" emptyValue=<<currentTiddler>>>
<$macrocall $name="tree_" prefix={{{[<Prefix>addsuffix[/]]}}}/>
</$set>
\end
\define dirtreelist(Prefix) <<DirTreeList "$Prefix$">>
<!-- Below are the old and ugly macros -->
\define CurDirList()
<$set name="Name" value=<<GetCurrentDirectoryPath>>>
<ul>
<$list filter="[prefix<Name>]">
<li>
<$link>
<<currentTiddler>>
</$link>
</li>
</$list>
</ul>
</$set>
\end
\define TCurDirList(h:"2")
<h$h$ class="DirList-Title">Directory Listing</h$h$>
<<CurDirList>>
\end
\define DirList(Path)
<$set name="Name" value=<<GetDirectoryPath $Path$>>>
<ul>
<$list filter="[prefix<Name>]">
<li>
<$link>
<<currentTiddler>>
</$link>
</li>
</$list>
</ul>
</$set>
\end
\define TDirList(Path h:"2")
<h$h$ class="DirList-Title">Directory Listing of [[$Path$]]/</h$h$>
<<DirList $Path$>>
\end
\define GetCurrentDirectoryPath() $(currentTiddler)$/
\define GetDirectoryPath(Path) $Path$/
<!--
\define GetDirectoryPath(Path) $Path$/
\define DirList(Path:<<currentTiddler>>)
<$set name="Name" value=<$macrocall $name="GetDirectoryPath" Path=$Path$/>>>
<ul>
<$list filter="[prefix<Name>]">
<li>
<$link>
<<currentTiddler>>
</$link>
</li>
</$list>
</ul>
</$set>
\end
\define TDirList(Path)
<h2>Directory Listing</h2>
<<DirList $Path$>>
\end
--->

View File

@ -0,0 +1,32 @@
created: 20230215192523775
creator: Octt
modified: 20230305221555052
modifier: Octt
tags: $:/tags/Macro
title: $:/Macros/ExtLinks
\define WiktionaryL(Word, Subdomain:"en") [[$Word$|https://$Subdomain$.wiktionary.org/wiki/$Word$]]
\define MyWARC(Id, Type:"content") <small><<[ "[[OcttArchive|https://articles.octt.eu.org/bookmark/$Id$/$Type$]]">></small>
\define mywarc(id, type:"content") <<MyWARC "$id$" "$type$">>
\define RedditLink(Path, Title:"Reddit") [[$Title$|https://old.reddit.com/$Path$]]
\define RedditL(Path, Title:"Reddit") <<RedditLink "$Path$" "$Title$">>
\define HackernewsL(Id, Title:"HN") [[$Title$|https://news.ycombinator.com/item?id=$Id$]]
\define YouTubeLink(Id, Title:"YouTube", Prefix:"watch?v=") [[$Title$|https://youtube.com/$Prefix$$Id$]]
\define YoutubeLink(Id, Title:"YouTube", Prefix:"watch?v=") <<YouTubeLink "$Id$" "$Title$" "$Prefix$">>
\define YouTubeL(Id, Title:"YouTube", Prefix:"watch?v=") <<YouTubeLink "$Id$" "$Title$" "$Prefix$">>
\define YoutubeL(Id, Title:"YouTube", Prefix:"watch?v=") <<YouTubeLink "$Id$" "$Title$" "$Prefix$">>
\define TwitterLink(Path, Title:"Twitter") [[$Title$|https://twitter.com/$Path$]]
\define MatrixLink(ID, Title:"Matrix") [[$Title$|https://matrix.to/#/$ID$]]
\define FDroidLink(Package, Title:"F-Droid") [[$Title$|https://f-droid.org/en/packages/$Package$]]
\define GPlayLink(Package, Title:"GPlay") [[$Title$|https://play.google.com/store/apps/details?id=$Package$]]
\define FlathubLink(Package, Title:"Flathub") [[$Title$|https://flathub.org/apps/details/$Package$]]

View File

@ -0,0 +1,39 @@
created: 20230215225211565
creator: Octt
modified: 20230215230528887
modifier: Octt
tags: $:/tags/Macro
title: $:/Macros/Footnotes
<!--
Note: The most of the code in this macro (DetailsFootnotes) is copied from [[$:/plugins/kookma/refnotes/macros/showfnotes]]
-->
\define DetailsFootnotes(filter:"[<currentTiddler>]", title:"Empty" class:"fnote-list DetailsFootnotes", emptyMessage:"")
<$vars leftDelimiter="<<fnote ">
<$list filter="[subfilter<__filter__>search:text:literal<leftDelimiter>limit[1]]" variable=null emptyMessage=<<__emptyMessage__>> ><!-- check to see if there is any footnote -->
<details class="tw-details">
<summary>
<$reveal tag="div" type="nomatch" default="Empty" text=<<__title__>> >
<span>$title$</span>
</$reveal>
</summary>
<ol class="$class$">
<$list filter=<<__filter__>> >
<$macrocall $name="find"
text={{!!text}}
begin="<<fnote "
end=">>"
output="output-fnote"
/>
</$list>
</ol>
</details>
</$list>
</$vars>
\end
\define output-fnote(p)
<$vars output=$p$>
<li><<output>></li>
</$vars>
\end

View File

@ -0,0 +1,77 @@
created: 20230111212908327
creator: Octt
modified: 20230228224933898
modifier: Octt
tags: $:/tags/Macro
title: $:/Macros/Frames
\whitespace trim
\define iFrame100Style()
Margin: 0px;
Padding: 0px;
Width: 100vw;
Height: 100vh;
\end
\define EmbedFromLine(Link)
<p class="Embed-From EmbedFrom">Embed of [[$Link$]]</p>
\end
\define iFrame(Src, Class:"iFrameNormal", Attrs)
<<EmbedFromLine "$Src$">>
<input class="NoSelect Checkbox-Btn Embed-Fullscreen-Btn" type="checkbox" label="Fullscreen"/>
<label class="NoSelect Checkbox-Btn Embed-Fullscreen-Btn">Fullscreen</label>
<iframe class="$Class$" frameborder="0" $Attrs$ src="$Src$"></iframe>
\end
\define iframe(src, class, attrs) <<iFrame "$src$" "$class$" "$attrs$">>
\define ^iFrame(Src, FrameClass, Attrs, Title, Heading, DetailsClass) <$macrocall $name="Details" Content=<<iFrame "$Src$" "$FrameClass$" "$Attrs$">> Summary="$Title$" Heading="$Heading$" Class="$DetailsClass$"/>
\define ^iframe(src, frameclass, attrs, title, heading, detailsClass) <$macrocall $name="details" content=<<iframe "$src$" "$frameclass$" "$attrs$">> summary="$title$" heading="$heading$" class="$detailsclass$"/>
\define iFrameFixed(Src, Class:"iFrameNormal", Attrs) <<iFrame "$Src$" "$Class$" 'scrolling="no" $Attrs$'>>
\define iFrameBypassFixed(Src, Class:"iFrameNormal", Attrs) <<iFrameBypass "$Src$" "$Class$" 'scrolling="no" $Attrs$'>>
\define iFrameFixedBypass(Src, Class:"iFrameNormal", Attrs) <<iFrameBypass "$Src$" "$Class$" 'scrolling="no" $Attrs$'>>
\define iFrameBypass(Src, Class:"iFrameNormal", Attrs)
<<EmbedFromLine "$Src$">>
<iframe class="$Class$" frameborder="0" $Attrs$ src='
data:text/html;utf8,
<!DOCTYPE html>
<!-- Code from X-Frame-Bypass: <https://github.com/niutech/x-frame-bypass> --->
<html>
<head>
<style>
html, body { overflow: hidden; }
html, body, iframe { margin: 0px; padding: 0px; width: 100%; height: 100%; border: none; }
</style>
<script src="https://octospacc.gitlab.io/pastebin/custom-elements-builtin.0.6.5.min.js"></script>
<script src="https://octospacc.gitlab.io/pastebin/x-frame-bypass.js" type="module"></script>
</head>
<body><iframe frameborder="0" is="x-frame-bypass" src="$Src$"></iframe></body>
</html>
'></iframe>
\end
\define iFrame100(Src)
<<EmbedFromLine "$Src$">>
<iframe style=<<iFrame100Style>> frameborder="0" src="$Src$"></iframe>
\end
\define iFrame100NoScroll(Src)
<<EmbedFromLine "$Src$">>
<iframe style=<<iFrame100Style>> frameborder="0" src="$Src$" scrolling="no"></iframe>
\end
\define iFrame100UriDirect(Src)
<iframe style=<<iFrame100Style>> frameborder="0" src=$Src$></iframe>
\end
\define iFrame100Tid(Tid)
<<EmbedFromLine "$Tid$">>
<<iFrame100UriDirect """<<b64TidUriEnc "$Tid$">>""">>
\end

View File

@ -0,0 +1,90 @@
created: 20220920092322164
creator: Octt
modified: 20230605214618218
modifier: Octt
tags: $:/tags/Macro
title: $:/Macros/Main
\whitespace trim
<!-- Wrap any text in potentially markuppable characters, sanifying markup first -->
\define [(Text, L:"[", R:"]") <span><span>$L$</span><span>$Text$</span><span>$R$</span></span>
<!-- My macro to provide HTML <details> -->
\define Details(Content, Summary:"Details", Heading:"0", Class:"tw-details")
<details class="$Class$">
<summary><h$Heading$><strong>$Summary$</strong></h$Heading$></summary>
$Content$
</details>
\end
\define details(content, summary:"Details", heading:"0", class:"tw-details") <<Details "$content$" "$summary$" "$heading$" "$class$">>
<!-- -- -- -->
<!-- Transclude with clickable link --->
\define #:(Name)
<style>
.Transcluding > h1,
.Transcluding > h2,
.Transcluding > h3,
.Transcluding > h4,
.Transcluding > h5,
.Transcluding > h6 {
Display: Inline;
}
</style>
<div class="Transcluding">
[[#|$Name$]]
{{$Name$}}
</div>
\end
<!-- Transclude with tobibeer/inc macro inside an HTML <details> element -->
\define {<(Tiddler, Heading:"0")
\whitespace trim
<details class="tw-details">
<summary>
[[_|$Tiddler$]]&nbsp;
<h$Heading$ style="display: inline;">
''$Tiddler$''
</h$Heading$>
</summary>
<<{ "$Tiddler$">>
</details>
\end
\define {^(Tiddler, Heading) <<{< "$Tiddler$" "$Heading$">>
\define ^{(Tiddler, Heading) <<{< "$Tiddler$" "$Heading$">>
<!-- Link to currentTiddler --->
\define lself() [[$(currentTiddler)$]]
\define #lself() [[#|$(currentTiddler)$]]
<!-- Field Checkbox --->
\define x#(Field, Text)
<$checkbox field="$Field$" checked="true" unchecked="false" default="false"> $Text$</$checkbox>
\end
\define Table(Rows) <table class="Octt-Table" style="Width:100%;"><style>.Octt-Table tr:nth-child(odd){background-color:#EEEEEE;}</style>$Rows$</table>
\define ColorText(Text, Foreground)
<span style="Color:$Foreground$;">$Text$</span>
\end
\define ColorSpan(Text, Background)
<span style="Color:#FFFFFF; Background-Color:$Background$;">$Text$</span>
\end
\define StrAppend(Str, Suffix, Prefix) $Prefix$$Str$$Suffix$
\define LImg(Src, Href, Alt)
<a rel="noopener noreferrer" target="_blank" href="$Href$"><img src="$Src$" alt="$Alt$"></a>
\end
\define iboxL(img, caption) <<ibox "$img$" "$caption$ <span>[</span>[[Source|$img$]]<span>]</span>">>
\define #[(Title, Link) <<[ "[[$Title$|$Link$]]">>
\define [#(Title, Link) <$macrocall $name="#[" Title="$Title$" Link="$Link$"/>

View File

@ -0,0 +1,67 @@
/*\
See [[$:/Macros/MediaWiki]] for usage of this macro.
Note: source must always be credited, and thus it's not ideal to use this macro directly. Please use the <<MediaWiki>> wrapper macro instead, as it provides a link to the source automatically. (This feature is implemented in its own non-JS macro to make at least the URL show on static wiki exports.)
\*/
(function(){
"use strict";
exports.name = "MediaWikiEmbedInternal";
exports.params = [
{name: "Article"},
{name: "Domain"},
{name: "Sections"},
];
exports.run = function(Article, Domain, Sections) {
try {
let Text;
Sections = parseInt(Sections) || 0;
Domain = $OcttKB.MediaWiki.MkDomain(Domain);
const Req = new XMLHttpRequest();
Req.open('GET', Domain + '/w/api.php?action=query&formatversion=2&prop=extracts&format=json&origin=*&titles=' + Article, false);
Req.send();
Text = JSON.parse(Req.responseText).query.pages[0].extract;
if (!Text) {
Text = '<p>An error occurred while trying to extract the content. Close and reopen this <i>tiddler</i> to retry, or click the link to open the source in a new tab.</p>'
};
Text = Text.replaceAll('\n', '').replaceAll('<p class="mw-empty-elt"></p>', '');
if (Sections != 0) {
for (let i=1; i<=6; i++) {
Text = Text.replaceAll(`</p><h${i}>`, `</p><!--:PARAGRAPH:--->\n<h${i}>`);
};
Text = Text.replaceAll(`</p><p>`, `</p><!--:PARAGRAPH:---><p>`);
//Text = Text.split('<!--:PARAGRAPH:--->').slice(0, Max+1).join('');
//Text = Text.split('<p>').slice(0, Max+1).join('<p>');
if (Sections < 0) {
Sections = 0;
};
Text = Text.split('<!--:PARAGRAPH:--->').slice(0, Sections).join('');
//Text += '<p>[...]</p>'
};
/*
Sections = Sections.split(' ');
for (let i=0; i<Sections.length; i++) {
const Sec = Sections[i];
if (Sec) {
const Ind = Sec.toLowerCase()[0];
const Val = Sec.substring(1);
if (Ind == 'p' || Ind == 's') {
if (Ind == 'p') {
const Sep = '<!--:PARAGRAPH:--->';
} else
if (Ind == 's') {
const Sep = '<!--:SECTION:--->';
};
Text = Text.split(Sep).slice(0, Val).join('');
} else
if (Ind == '#') {
};
};
};
*/
return Text;
} catch(e) {
return $OcttKB.ErrAtLine(e);
};
}})();

View File

@ -0,0 +1,10 @@
Note: source must always be credited, and thus it's not ideal to use this macro directly. Please use the <<MediaWiki>> wrapper macro instead, as it provides a link to the source automatically. (This feature is implemented in its own non-JS macro to make at least the URL show on static wiki exports.)
See [[$: /Macros/MediaWiki]] for usage of this macro.
created: 20230108190340455
creator: Octt
modified: 20230429192152268
modifier: Octt
module-type: macro
tags:
title: $:/Macros/MediaWiki/EmbedInternal.js
type: application/javascript

View File

@ -0,0 +1,32 @@
/*\
Get the cover image from a MediaWiki article.
[<<]MediaWikiGetCover "Article" "Full Domain OR Wikipedia Subdomain" "Manual URL OR NULL"[>>]
\*/
(function(){
"use strict";
exports.name = "MediaWikiGetCover";
exports.params = [
{name: "Article"},
{name: "Domain"},
{name: "URL"},
];
exports.run = function(Article, Domain, URL) {
try {
if (!URL || URL && !$OcttKB.Options.Nulls.includes(URL.toLowerCase())) {
let File;
Domain = $OcttKB.MediaWiki.MkDomain(Domain);
const Req = new XMLHttpRequest();
Req.open('GET', Domain + '/w/api.php?action=query&prop=pageimages&format=json&piprop=original&origin=*&titles=' + Article, false);
Req.send();
File = Object.values(JSON.parse(Req.responseText).query.pages)[0];
if (File && File.original && File.original.source) {
return `<img src="${File.original.source}">`;
};
};
return '';
} catch(e) {
return $OcttKB.ErrAtLine(e);
};
}})();

View File

@ -0,0 +1,8 @@
created: 20230112154435120
creator: Octt
modified: 20230124213845342
modifier: Octt
module-type: macro
tags:
title: $:/Macros/MediaWiki/GetCover.js
type: application/javascript

View File

@ -0,0 +1,50 @@
created: 20230110102736164
creator: Octt
modified: 20230305223746772
modifier: Octt
tags: $:/tags/Macro
title: $:/Macros/MediaWiki/Main
<!--
[<<]MediaWiki[>>]
| Embed sections of an article from a MediaWiki server.
| [<<]MediaWiki "Article" "Full Domain OR Wikipedia Subdomain" "Section Filtering" "Cover Media"[>>]
--->
\define MediaWiki(Article Domain Sections Cover)
<div class="MediaWikiEmbed MediaWikiEmbedBlock">
<div class="EmbedFrom MediaWikiEmbedFrom">
From <$set name="FullDomain" filter="[[$Domain$]regexp[\.]then[$Domain$]else[$Domain$.Wikipedia.org]]">
<$macrocall $name="ExtMediaWikiAnchor" Article="$Article$" Domain=<<FullDomain>>/>
</$set>
</div>
<div class="MediaWikiEmbedCover">
<<MediaWikiGetCover "$Article$" "$Domain$" "$Cover$">>
</div>
<div class="MediaWikiEmbedContent">
<<MediaWikiEmbedInternal "$Article$" "$Domain$" "$Sections$">>
</div>
</div>
\end
\define ExtMediaWikiAnchor(Article, Domain) [[$Domain$/$Article$|https://$Domain$/wiki/$Article$]]
\define WikipediaLink(Article, Subdomain:"en") [[$Article$|https://$Subdomain$.wikipedia.org/wiki/$Article$]]
\define WikipediaLink-(Article, Subdomain:"en") [[$Article$ - Wikipedia|https://$Subdomain$.wikipedia.org/wiki/$Article$]]
<!--
<a href={{{[[$Article$]search-replace:g[ ],[_]prepend[https://$Subdomain$.wikipedia.org/]]}}}>$Article$</a>
-->
\define WikipediaFrame(Article, Subdomain:"en")
<<iFrame "https://$Subdomain$.m.wikipedia.org/wiki/$Article$">>
\end
\define wikipediaframe(Article, Subdomain) <<WikipediaFrame "$Article$" "$Subdomain$">>
\define ^WikipediaFrame(Article, Subdomain, Title:"Wikipedia")
<details class="tw-details">
<summary><strong>$Title$</strong></summary>
<<WikipediaFrame "$Article$" "$Subdomain$">>
</details>
\end
\define ^wikipediaframe(Article, Subdomain, Title) <<^WikipediaFrame "$Article$" "$Subdomain$" "$Title$">>

View File

@ -0,0 +1,16 @@
created: 20220921191720432
modified: 20220922052514703
tags:
title: $:/Macros/Music Archiving Status
\define r(Title Notes)
<tr>
<td>$Title$</td>
<td><<x# ".Music $Title$ | GotAny">></td>
<td><<x# ".Music $Title$ | GotLossless">></td>
<td><<x# ".Music $Title$ | UploadedLossless:Archive.org">></td>
<td>$Notes$</td>
</tr>
\end
<$importvariables filter="$:/Macros">

View File

@ -0,0 +1,7 @@
created: 20230226210106105
creator: Octt
modified: 20230226210446048
modifier: Octt
title: $:/Macros/Styles
\define NoDisp() display: none;

View File

@ -0,0 +1,37 @@
created: 20230301190809321
creator: Octt
modified: 20230301211845785
modifier: Octt
tags: $:/tags/Macro
title: $:/Macros/TiddlerTree
<!-- Most of the code derived from:
- $:/core/macros/toc
-->
\define tiddlertree(tag,sort:"",itemClassFilter,exclude,path)
\whitespace trim
<div class="tc-table-of-contents">
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
<$set name="excluded" filter="[enlist<__exclude__>] [<__tag__>]">
<$set name="FolderPath" value=<<StrAppend "$tag$" "/">> >
<ol class="tc-toc toc-selective-expandable">
<<tree_ "$tag$/" show-title:"false">>
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
<$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage=<<toc-selective-expandable-empty-message>> >
<$macrocall $name="toc-unlinked-selective-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>>/>
</$list>
</$list>
<!--
<$list filter="""[all[shadows+tiddlers]prefix<FolderPath>] -[<__tag__>] -[enlist<__exclude__>]""">
<$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage=<<toc-selective-expandable-empty-message>> >
<$macrocall $name="tiddlertree-unlinked-selective-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>>/>
</$list>
</$list>
-->
</ol>
</$set>
</$set>
</$let>
</div>
\end

View File

@ -0,0 +1,23 @@
/*\
Return the content of a tiddler encoded as [[Base64]] and encapsulated in a data URI.
<<b64TidUriEnc "Tiddler Name">>
\*/
(function(){
"use strict";
exports.name = "b64TidUriEnc";
exports.params = [
{name: "Name"}
];
exports.run = function(Name) {
try {
let Tid = $tw.wiki.getTiddler(Name);
let Type = Tid.fields.type || "text/vnd.tiddlywiki";
let Data = $tw.utils.base64Encode(Tid.fields.text);
return "data:" + Type + ";base64," + Data;
} catch(e) {
return e;
};
};
})();

View File

@ -0,0 +1,6 @@
created: 20221109224522256
modified: 20221110153303563
module-type: macro
tags:
title: $:/Macros/b64TidUriEnc.js
type: application/javascript

View File

@ -0,0 +1,52 @@
created: 20220926113710012
modified: 20230108195259126
tags: $:/tags/Macro
title: $:/Macros/i18n
\define i18n-target()
<$list filter="[[$(currentTiddler)$]tags[]prefix[i18n:]split[:]last[]]">
<span style="Padding:8px;">
<<currentTiddler>>
</span>
</$list>
\end
\define i18n()
<style>
/* Rainbow gradient from https://stackoverflow.com/a/63302468 */
.LanguageBox {
Border: Solid Black 1px;
Padding: 4px;
Background: Linear-Gradient(
90deg,
RGBA(255, 0, 0, 1) 0%,
RGBA(255, 154, 0, 1) 10%,
RGBA(208, 222, 33, 1) 20%,
RGBA(79, 220, 74, 1) 30%,
RGBA(63, 218, 216, 1) 40%,
RGBA(47, 201, 226, 1) 50%,
RGBA(28, 127, 238, 1) 60%,
RGBA(95, 21, 242, 1) 70%,
RGBA(186, 12, 248, 1) 80%,
RGBA(251, 7, 217, 1) 90%,
RGBA(255, 0, 0, 1) 100%
);
}
.LanguageBox > Div {
Border: Solid Black 1px;
Padding: 4px;
Font-Size: Larger;
Text-Align: Center;
Background: White;
}
</style>
<div class="LanguageBox"><div>
<$vars id={{!!i18n}}>
<$list filter="[!is[system]contains:i18n<id>]">
<$link>
<$macrocall $name="i18n-target"/>
</$link>
</$list>
</$vars>
</div></div>
\end

View File

@ -0,0 +1,69 @@
created: 20220922135257709
modified: 20220925154754580
tags: $:/tags/Macro
title: $:/Macros/ltabs
<!-- The following code is almost totally derived from [[$:/core/macros/tabs]] --->
\define ltabs-button()
\whitespace trim
<$button set=<<ltabsState>> setTo=<<currentTab>> default=<<__default__>> selectedClass="tc-tab-selected" tooltip={{!!tooltip}} role="switch">
<span>&nbsp;[[#|$(currentTab)$]]&nbsp;</span>
<$tiddler tiddler=<<save-currentTiddler>>>
<$set name="tv-wikilinks" value="no">
<$transclude tiddler=<<__buttonTemplate__>> mode="inline">
<$transclude tiddler=<<currentTab>> field="caption">
<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
</$transclude>
</$transclude>
</$set>
</$tiddler>
<<__actions__>>
</$button>
\end
\define ltabs-tab()
\whitespace trim
<$set name="save-currentTiddler" value=<<currentTiddler>>>
<$tiddler tiddler=<<currentTab>>>
<<ltabs-button>>
</$tiddler>
</$set>
\end
\define ltabs-tab-list()
\whitespace trim
<$list filter=<<__ltabsList__>> variable="currentTab" storyview="pop">
<<ltabs-tab>>
</$list>
\end
\define ltabs-tab-body()
\whitespace trim
<$list filter=<<__ltabsList__>> variable="currentTab">
<$reveal type="match" state=<<ltabsState>> text=<<currentTab>> default=<<__default__>> retain=<<__retain__>> tag="div">
<$transclude tiddler=<<__template__>> mode="block">
<$tiddler tiddler=<<currentTab>>>
<$transclude mode="block" />
</$tiddler>
</$transclude>
</$reveal>
</$list>
\end
\define ltabs(ltabsList,default,state:"$:/state/tab",class,template,buttonTemplate,retain,actions,explicitState)
\whitespace trim
<$qualify title=<<__state__>> name="qualifiedState">
<$let ltabsState={{{ [<__explicitState__>minlength[1]] ~[<qualifiedState>] }}}>
<div class={{{ [[tc-tab-set]addsuffix[ ]addsuffix<__class__>] }}}>
<div class={{{ [[tc-tab-buttons]addsuffix[ ]addsuffix<__class__>] }}}>
<<ltabs-tab-list>>
</div>
<div class={{{ [[tc-tab-divider]addsuffix[ ]addsuffix<__class__>] }}}/>
<div class={{{ [[tc-tab-content]addsuffix[ ]addsuffix<__class__>] }}}>
<<ltabs-tab-body>>
</div>
</div>
</$let>
</$qualify>
\end