mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-04-24 07:41:29 +00:00
Merge branch 'master' into single-tiddler-mode
This commit is contained in:
53
core/modules/parsers/wikiparser/rules/import.js
Normal file
53
core/modules/parsers/wikiparser/rules/import.js
Normal file
@@ -0,0 +1,53 @@
|
||||
/*\
|
||||
title: $:/core/modules/parsers/wikiparser/rules/import.js
|
||||
type: application/javascript
|
||||
module-type: wikirule
|
||||
|
||||
Wiki pragma rule for importing variable definitions
|
||||
|
||||
```
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
```
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.name = "import";
|
||||
exports.types = {pragma: true};
|
||||
|
||||
/*
|
||||
Instantiate parse rule
|
||||
*/
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /^\\import[^\S\n]/mg;
|
||||
};
|
||||
|
||||
/*
|
||||
Parse the most recent match
|
||||
*/
|
||||
exports.parse = function() {
|
||||
var self = this;
|
||||
// Move past the pragma invocation
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
// Parse the filter terminated by a line break
|
||||
var reMatch = /(.*)(\r?\n)|$/mg;
|
||||
reMatch.lastIndex = this.parser.pos;
|
||||
var match = reMatch.exec(this.parser.source);
|
||||
this.parser.pos = reMatch.lastIndex;
|
||||
// Parse tree nodes to return
|
||||
return [{
|
||||
type: "importvariables",
|
||||
attributes: {
|
||||
filter: {type: "string", value: match[1]}
|
||||
},
|
||||
children: []
|
||||
}];
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -3,6 +3,5 @@ title: $:/core/templates/exporters/StaticRiver/Content
|
||||
\define renderContent()
|
||||
{{{ $(exportFilter)$ ||$:/core/templates/static-tiddler}}}
|
||||
\end
|
||||
<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]">
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
<<renderContent>>
|
||||
</$importvariables>
|
||||
|
||||
@@ -6,4 +6,5 @@ extension: .tid
|
||||
\define renderContent()
|
||||
{{{ $(exportFilter)$ +[limit[1]] ||$:/core/templates/tid-tiddler}}}
|
||||
\end
|
||||
<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]"><<renderContent>></$importvariables>
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
<<renderContent>>
|
||||
@@ -2,7 +2,7 @@ title: $:/core/templates/server/static.tiddler.html
|
||||
|
||||
\whitespace trim
|
||||
\define tv-wikilink-template() $uri_encoded$
|
||||
<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]">
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
@@ -25,5 +25,4 @@ title: $:/core/templates/server/static.tiddler.html
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
</$importvariables>
|
||||
</html>
|
||||
@@ -4,6 +4,7 @@ title: $:/core/templates/static.tiddler.html
|
||||
\define tv-config-toolbar-icons() no
|
||||
\define tv-config-toolbar-text() no
|
||||
\define tv-config-toolbar-class() tc-btn-invisible
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
`<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
@@ -22,9 +23,7 @@ title: $:/core/templates/static.tiddler.html
|
||||
<body class="tc-body">
|
||||
`{{$:/StaticBanner||$:/core/templates/html-tiddler}}`
|
||||
<section class="tc-story-river">
|
||||
`<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]">
|
||||
<$view tiddler="$:/core/ui/ViewTemplate" format="htmlwikified"/>
|
||||
</$importvariables>`
|
||||
`<$view tiddler="$:/core/ui/ViewTemplate" format="htmlwikified"/>`
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -119,10 +119,8 @@ $:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$
|
||||
</$list>
|
||||
\end
|
||||
|
||||
<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]">
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
|
||||
<div>
|
||||
<<plugin-library-listing>>
|
||||
</div>
|
||||
|
||||
</$importvariables>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/core/ui/PageStylesheet
|
||||
|
||||
<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]">
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
|
||||
<$set name="currentTiddler" value={{$:/language}}>
|
||||
|
||||
@@ -13,5 +13,3 @@ title: $:/core/ui/PageStylesheet
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
</$importvariables>
|
||||
|
||||
@@ -3,8 +3,7 @@ title: $:/core/ui/PageTemplate
|
||||
\define containerClasses()
|
||||
tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$
|
||||
\end
|
||||
|
||||
<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]">
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
|
||||
<$set name="tv-config-toolbar-icons" value={{$:/config/Toolbar/Icons}}>
|
||||
|
||||
@@ -55,5 +54,3 @@ tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
</$importvariables>
|
||||
|
||||
@@ -13,7 +13,7 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
The HTTP WebServer functionality has been significantly improved:
|
||||
|
||||
* Adds ability to make a wiki that is read-only for anonymous users, but allows editing for users who log in
|
||||
* Adds ability to make a wiki that is read-only for anonymous users (with the editing UI hidden), but allows editing for users who log in
|
||||
* Adds support for serving static file attachments over HTTP
|
||||
* Adds support for multiple user credentials for basic authentication via a CSV file containing usernames/passwords
|
||||
* Hides UI features like the new tiddler button and the edit button when the user only has read-only access to the wiki
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
created: 20150219175930000
|
||||
modified: 20170712154519026
|
||||
modified: 20180928145730028
|
||||
tags: Concepts
|
||||
title: Pragma
|
||||
type: text/vnd.tiddlywiki
|
||||
@@ -16,3 +16,5 @@ The following pragmas are available:
|
||||
: for adjusting the set of rules used to parse the text
|
||||
;`\whitespace trim` or `\whitespace notrim`
|
||||
: <<.from-version "5.1.15">> Control whether whitespace is trimmed from the start and end of text runs (the default is ''notrim''). This setting can be useful when the whitespace generated by linebreaks disturbs formatting
|
||||
;`\import <filter-expression>`
|
||||
: <<.from-version "5.1.18">> for importing macro definitions from tiddlers identified by a filter expression
|
||||
|
||||
@@ -22,10 +22,8 @@ Startup actions are useful for customising TiddlyWiki according to environmental
|
||||
</$reveal>
|
||||
```
|
||||
|
||||
Note that global macros are not available within startup action tiddlers by default. If you need to access them then you'll need to explicitly include them:
|
||||
Note that global macros are not available within startup action tiddlers by default. If you need to access them then you'll need to explicitly include them with an ''import'' [[pragma|Pragma]] at the top of the tiddler:
|
||||
|
||||
```
|
||||
<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]">
|
||||
...actions that depend upon global macros...
|
||||
</$importvariables>
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
```
|
||||
|
||||
@@ -4,8 +4,7 @@ title: ReadMe
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define tv-wikilink-template() https://tiddlywiki.com/static/$uri_doubleencoded$.html
|
||||
|
||||
<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]">
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
|
||||
Welcome to TiddlyWiki, a non-linear personal web notebook that anyone can use and keep forever, independently of any corporation.
|
||||
|
||||
@@ -32,5 +31,3 @@ Developer documentation is in progress at https://tiddlywiki.com/dev/
|
||||
<<list-links "[tag[TiddlyWiki on Node.js]] -[[Installing TiddlyWiki on Node.js]] -[[Using TiddlyWiki on Node.js]] -[[Upgrading TiddlyWiki on Node.js]]">>
|
||||
|
||||
//This readme file was automatically generated by TiddlyWiki//
|
||||
|
||||
</$importvariables>
|
||||
|
||||
@@ -4,6 +4,7 @@ tags: $:/tags/RawMarkupWikified/TopBody
|
||||
title: $:/SplashScreen
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
\rules only filteredtranscludeinline transcludeinline macrocallinline
|
||||
<div class="tc-remove-when-wiki-loaded">
|
||||
<style scoped>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
caption: $:/tags/RawMarkupWikified/BottomBody
|
||||
created: 20180926170345251
|
||||
description: marks tiddlers included as wikified text at the bottom of `<body>`
|
||||
modified: 20180927084336737
|
||||
modified: 20180928145806493
|
||||
tags: SystemTags
|
||||
title: SystemTag: $:/tags/RawMarkupWikified/BottomBody
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The [[system tag|SystemTags]] `$:/tags/RawMarkupWikified/BottomBody` marks wikified tiddlers to be included as raw markup at the bottom of the `<body>` section in the generated HTML file.
|
||||
<<.from-version "5.1.18">> The [[system tag|SystemTags]] `$:/tags/RawMarkupWikified/BottomBody` marks wikified tiddlers to be included as raw markup at the bottom of the `<body>` section in the generated HTML file.
|
||||
|
||||
Note that the wiki must be saved and reloaded in order for a raw markup tiddler to take effect. Also note that global macros are not available by default within raw markup tiddlers; you can use the ImportVariablesWidget to explicitly import them.
|
||||
@@ -1,11 +1,11 @@
|
||||
caption: $:/tags/RawMarkupWikified/TopBody
|
||||
created: 20180926170345251
|
||||
description: marks tiddlers included as wikified text at the top of `<body>`
|
||||
modified: 20180927084353235
|
||||
modified: 20180928145800288
|
||||
tags: SystemTags
|
||||
title: SystemTag: $:/tags/RawMarkupWikified/TopBody
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The [[system tag|SystemTags]] `$:/tags/RawMarkupWikified/TopBody` marks wikified tiddlers to be included as raw markup at the top of the `<body>` section in the generated HTML file.
|
||||
<<.from-version "5.1.18">> The [[system tag|SystemTags]] `$:/tags/RawMarkupWikified/TopBody` marks wikified tiddlers to be included as raw markup at the top of the `<body>` section in the generated HTML file.
|
||||
|
||||
Note that the wiki must be saved and reloaded in order for a raw markup tiddler to take effect. Also note that global macros are not available by default within raw markup tiddlers; you can use the ImportVariablesWidget to explicitly import them.
|
||||
@@ -1,11 +1,11 @@
|
||||
caption: $:/tags/RawMarkupWikified/TopHead
|
||||
created: 20180926170345251
|
||||
description: marks tiddlers included as wikified text at the top of `<head>`
|
||||
modified: 20180927084358475
|
||||
modified: 20180928145753616
|
||||
tags: SystemTags
|
||||
title: SystemTag: $:/tags/RawMarkupWikified/TopHead
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The [[system tag|SystemTags]] `$:/tags/RawMarkupWikified/TopHead` marks wikified tiddlers to be included as raw markup at the top of the `<head>` section in the generated HTML file.
|
||||
<<.from-version "5.1.18">> The [[system tag|SystemTags]] `$:/tags/RawMarkupWikified/TopHead` marks wikified tiddlers to be included as raw markup at the top of the `<head>` section in the generated HTML file.
|
||||
|
||||
Note that the wiki must be saved and reloaded in order for a raw markup tiddler to take effect. Also note that global macros are not available by default within raw markup tiddlers; you can use the ImportVariablesWidget to explicitly import them.
|
||||
@@ -1,9 +1,9 @@
|
||||
caption: importvariables
|
||||
created: 20140612142500000
|
||||
modified: 20140612175900970
|
||||
modified: 20180928150043777
|
||||
tags: Widgets
|
||||
title: ImportVariablesWidget
|
||||
type: text/vnd.tiddlywiki
|
||||
caption: importvariables
|
||||
|
||||
! Introduction
|
||||
|
||||
@@ -31,3 +31,11 @@ So-called global macros are implemented within the main page template ([[$:/core
|
||||
...
|
||||
</$importvariables>
|
||||
```
|
||||
|
||||
! `\import` Pragma
|
||||
|
||||
<<.from-version "5.1.18">> The `\import` [[pragma|Pragma]] is an alternative syntax for using the ImportVariablesWidget. For example, the previous example could be expressed as:
|
||||
|
||||
```
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]
|
||||
```
|
||||
Reference in New Issue
Block a user