diff --git a/.github/workflows/cla-check.yml b/.github/workflows/cla-check.yml new file mode 100644 index 000000000..27e404543 --- /dev/null +++ b/.github/workflows/cla-check.yml @@ -0,0 +1,30 @@ +name: Check CLA Signature +on: + pull_request_target: + types: + - opened + - reopened + paths-ignore: + - 'licenses/cla-individual.md' +jobs: + check_cla: + runs-on: ubuntu-latest + permissions: + pull-requests: write + if: ${{ (github.event.pull_request.user.login != github.repository_owner) }} + steps: + - run: | + if ! curl -s https://raw.githubusercontent.com/Jermolene/TiddlyWiki5/tiddlywiki-com/licenses/cla-individual.md | grep -o "@$USER,"; then + echo "CLA not signed" + gh pr comment "$NUMBER" -b "@$USER It appears that this is your first contribution to the project, welcome. + + With apologies for the bureaucracy, please could you prepare a separate PR to the 'tiddlywiki-com' branch with your signature for the Contributor License Agreement (see [contributing.md](https://github.com/Jermolene/TiddlyWiki5/blob/master/contributing.md))." + else + echo "CLA already signed" + gh pr comment "$NUMBER" -b "Confirmed: **$USER** has already signed the Contributor License Agreement (see [contributing.md](https://github.com/Jermolene/TiddlyWiki5/blob/master/contributing.md))" + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.pull_request.number }} + USER: ${{ github.actor }} diff --git a/.github/workflows/cla-signed.yml b/.github/workflows/cla-signed.yml new file mode 100644 index 000000000..fc3b205b8 --- /dev/null +++ b/.github/workflows/cla-signed.yml @@ -0,0 +1,70 @@ +name: CLA Signed + +on: + pull_request_target: + types: + - opened + - closed + paths: + - 'licenses/cla-individual.md' + +env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.pull_request.number }} + AUTHOR: ${{ github.event.pull_request.user.login }} + +jobs: + # check if PRs updating the CLA are targetting the tiddlywiki-com branch + check-signature-branch: + if: (github.event.pull_request.merged != true) && (github.event.pull_request.user.login != github.repository_owner) + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - run: | + if ! $BRANCH == "tiddlywiki-com"; then + echo "This CLA signature targets the wrong branch" + gh pr comment "$NUMBER" -b "@$AUTHOR Signatures to the CLA must target the 'tiddlywiki-com' branch." + fi + env: + BRANCH: ${{ github.event.pull_request.base.ref }} + + # leave a comment on each open PR by a given author when their signature is added to the CLA + cla-signed: + if: (github.event.pull_request.merged == true) && (github.event.pull_request.user.login != github.repository_owner) + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: List open PRs by user + id: list-prs + uses: actions/github-script@v6 + with: + result-encoding: string + script: | + const owner = context.repo.owner, + repo = context.repo.repo, + author = context.payload.pull_request.user.login; + + const { data: pullRequests } = await github.rest.pulls.list({ + owner: owner, + repo: repo, + state: 'open', + sort: 'created', + direction: 'desc', + per_page: 100 + }); + const userPullRequests = pullRequests.filter(pr => pr.user.login === author), + prNumbers = userPullRequests.map(pr => pr.number).join(','); + console.log(`Open pull requests by ${author}:${prNumbers}`); + return prNumbers; + + - name: Comment open PRs by the same author + run: | + prs=($(echo ${{ steps.list-prs.outputs.result }} | tr "," "\n")) + + for number in "${prs[@]}" + do + gh pr comment "$number" -b "**$AUTHOR** has signed the Contributor License Agreement (see [contributing.md](https://github.com/Jermolene/TiddlyWiki5/blob/master/contributing.md))" + done diff --git a/bin/build-site.sh b/bin/build-site.sh index f308518b4..fbb34cc98 100755 --- a/bin/build-site.sh +++ b/bin/build-site.sh @@ -5,7 +5,7 @@ # Default to the current version number for building the plugin library if [ -z "$TW5_BUILD_VERSION" ]; then - TW5_BUILD_VERSION=v5.3.3 + TW5_BUILD_VERSION=v5.3.6 fi echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]" diff --git a/contributing.md b/contributing.md index 9dc10d0da..549e862a6 100644 --- a/contributing.md +++ b/contributing.md @@ -1,3 +1,3 @@ -
Here we focus on contributions via GitHub Pull Requests but there are many other ways that anyone can help the TiddlyWiki project, such as reporting bugs or helping to improve our documentation.
PRs must meet these minimum requirements before they can be considered for merging:
The "imperative mood" means written as if giving a command or instruction. See this post for more details, but the gist is that the title of the PR should make sense when used to complete the sentence "If applied, this commit will...". So for example, these are good PR titles:
These a poorly worded PR titles:
PR titles may also include a short prefix to indicate the subsystem to which they apply. For example:
One of the principles of open source is that many pairs of eyes on the code can improve quality. So, we welcome comments and critiques of pending PRs. Conventional Comments has some techniques to help make comments as constructive and actionable as possible. Notably, they recommend prefixing a comment with a label to clarify the intention:
praise | Praises highlight something positive. Try to leave at least one of these comments per review. Do not leave false praise (which can actually be damaging). Do look for something to sincerely praise |
nitpick | Nitpicks are small, trivial, but necessary changes. Distinguishing nitpick comments significantly helps direct the reader's attention to comments requiring more involvement |
suggestion | Suggestions are specific requests to improve the subject under review. It is assumed that we all want to do what's best, so these comments are never dismissed as “mere suggestions”, but are taken seriously |
issue | Issues represent user-facing problems. If possible, it's great to follow this kind of comment with a suggestion |
question | Questions are appropriate if you have a potential concern but are not quite sure if it's relevant or not. Asking the author for clarification or investigation can lead to a quick resolution |
thought | Thoughts represent an idea that popped up from reviewing. These comments are non-blocking by nature, but they are extremely valuable and can lead to more focused initiatives and mentoring opportunities |
chore | Chores are simple tasks that must be done before the subject can be “officially” accepted. Usually, these comments reference some common process. Try to leave a link to the process description so that the reader knows how to resolve the chore |
Like other OpenSource projects, TiddlyWiki5 needs a signed contributor license agreement from individual contributors. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the UnaMesa Association (the legal entity that owns TiddlyWiki on behalf of the community).
Create a GitHub pull request to add your name to cla-individual.md
or cla-entity.md
, with the date in the format (YYYY/MM/DD).
step by step
tiddlywiki-com
Jeremy Ruston, @Jermolene, 2011/11/22
The CLA documents used for this project were created using Harmony Project Templates. "HA-CLA-I-LIST Version 1.0" for "CLA-individual" and "HA-CLA-E-LIST Version 1.0" for "CLA-entity". +
Here we focus on contributions via GitHub Pull Requests but there are many other ways that anyone can help the TiddlyWiki project, such as reporting bugs or helping to improve our documentation.
PRs must meet these minimum requirements before they can be considered for merging:
The "imperative mood" means written as if giving a command or instruction. See this post for more details, but the gist is that the title of the PR should make sense when used to complete the sentence "If applied, this commit will...". So for example, these are good PR titles:
These a poorly worded PR titles:
PR titles may also include a short prefix to indicate the subsystem to which they apply. For example:
One of the principles of open source is that many pairs of eyes on the code can improve quality. So, we welcome comments and critiques of pending PRs. Conventional Comments has some techniques to help make comments as constructive and actionable as possible. Notably, they recommend prefixing a comment with a label to clarify the intention:
praise | Praises highlight something positive. Try to leave at least one of these comments per review. Do not leave false praise (which can actually be damaging). Do look for something to sincerely praise |
nitpick | Nitpicks are small, trivial, but necessary changes. Distinguishing nitpick comments significantly helps direct the reader's attention to comments requiring more involvement |
suggestion | Suggestions are specific requests to improve the subject under review. It is assumed that we all want to do what's best, so these comments are never dismissed as “mere suggestions”, but are taken seriously |
issue | Issues represent user-facing problems. If possible, it's great to follow this kind of comment with a suggestion |
question | Questions are appropriate if you have a potential concern but are not quite sure if it's relevant or not. Asking the author for clarification or investigation can lead to a quick resolution |
thought | Thoughts represent an idea that popped up from reviewing. These comments are non-blocking by nature, but they are extremely valuable and can lead to more focused initiatives and mentoring opportunities |
chore | Chores are simple tasks that must be done before the subject can be “officially” accepted. Usually, these comments reference some common process. Try to leave a link to the process description so that the reader knows how to resolve the chore |
Like other OpenSource projects, TiddlyWiki5 needs a signed contributor license agreement from individual contributors. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the UnaMesa Association (the legal entity that owns TiddlyWiki on behalf of the community).
Create a GitHub pull request to add your name to cla-individual.md
or cla-entity.md
, with the date in the format (YYYY/MM/DD).
step by step
tiddlywiki-com
Jeremy Ruston, @Jermolene, 2011/11/22
The CLA documents used for this project were created using Harmony Project Templates. "HA-CLA-I-LIST Version 1.0" for "CLA-individual" and "HA-CLA-E-LIST Version 1.0" for "CLA-entity".
This file was automatically generated by TiddlyWiki5
\ No newline at end of file diff --git a/core/images/input-button.tid b/core/images/input-button.tid new file mode 100644 index 000000000..731a1e0cd --- /dev/null +++ b/core/images/input-button.tid @@ -0,0 +1,5 @@ +title: $:/core/images/input-button +tags: $:/tags/Image + +\parameters (size:"22pt") + \ No newline at end of file diff --git a/core/language/en-GB/Buttons.multids b/core/language/en-GB/Buttons.multids index 3ee898b4f..15273d18e 100644 --- a/core/language/en-GB/Buttons.multids +++ b/core/language/en-GB/Buttons.multids @@ -104,6 +104,8 @@ ShowSideBar/Caption: show sidebar ShowSideBar/Hint: Show sidebar TagManager/Caption: tag manager TagManager/Hint: Open tag manager +TestCaseImport/Caption: import tiddlers +TestCaseImport/Hint: Import tiddlers Timestamp/Caption: timestamps Timestamp/Hint: Choose whether modifications update timestamps Timestamp/On/Caption: timestamps are on diff --git a/core/language/en-GB/Docs/PaletteColours.multids b/core/language/en-GB/Docs/PaletteColours.multids index 1c671a67c..bc1b36c3d 100644 --- a/core/language/en-GB/Docs/PaletteColours.multids +++ b/core/language/en-GB/Docs/PaletteColours.multids @@ -65,6 +65,10 @@ sidebar-tab-foreground-selected: Sidebar tab foreground for selected tabs sidebar-tab-foreground: Sidebar tab foreground sidebar-tiddler-link-foreground-hover: Sidebar tiddler link foreground hover sidebar-tiddler-link-foreground: Sidebar tiddler link foreground +stability-stable: Badge for stability level "stable" +stability-experimental: Badge for stability level "experimental" +stability-deprecated: Badge for stability level "deprecated" +stability-legacy: Badge for stability level "legacy" testcase-accent-level-1: Test case accent colour with no nesting testcase-accent-level-2: Test case accent colour with 2nd level nesting testcase-accent-level-3: Test case accent colour with 3rd level nesting or higher diff --git a/core/modules/filters/backtranscludes.js b/core/modules/filters/backtranscludes.js index 7d4215073..253b9dd7b 100644 --- a/core/modules/filters/backtranscludes.js +++ b/core/modules/filters/backtranscludes.js @@ -16,11 +16,11 @@ Filter operator for returning all the backtranscludes from a tiddler Export our filter function */ exports.backtranscludes = function(source,operator,options) { - var results = []; + var results = new $tw.utils.LinkedList(); source(function(tiddler,title) { - $tw.utils.pushTop(results,options.wiki.getTiddlerBacktranscludes(title)); + results.pushTop(options.wiki.getTiddlerBacktranscludes(title)); }); - return results; + return results.makeTiddlerIterator(options.wiki); }; })(); diff --git a/core/modules/filters/transcludes.js b/core/modules/filters/transcludes.js index bd618296b..8f42b3bae 100644 --- a/core/modules/filters/transcludes.js +++ b/core/modules/filters/transcludes.js @@ -20,7 +20,7 @@ exports.transcludes = function(source,operator,options) { source(function(tiddler,title) { results.pushTop(options.wiki.getTiddlerTranscludes(title)); }); - return results.toArray(); + return results.makeTiddlerIterator(options.wiki); }; })(); diff --git a/core/modules/indexers/back-indexer.js b/core/modules/indexers/back-indexer.js index b9daf3328..77b51b819 100644 --- a/core/modules/indexers/back-indexer.js +++ b/core/modules/indexers/back-indexer.js @@ -75,7 +75,7 @@ BackSubIndexer.prototype._getTarget = function(tiddler) { } var parser = this.wiki.parseText(tiddler.fields.type, tiddler.fields.text, {}); if(parser) { - return this.wiki[this.extractor](parser.tree); + return this.wiki[this.extractor](parser.tree, tiddler.fields.title); } return []; } diff --git a/core/modules/saver-handler.js b/core/modules/saver-handler.js index 119c3e67a..23056bcc2 100644 --- a/core/modules/saver-handler.js +++ b/core/modules/saver-handler.js @@ -95,6 +95,7 @@ function SaverHandler(options) { if($tw.browser) { $tw.rootWidget.addEventListener("tm-save-wiki",function(event) { self.saveWiki({ + wiki: event.widget.wiki, template: event.param, downloadType: "text/plain", variables: event.paramObject @@ -102,6 +103,7 @@ function SaverHandler(options) { }); $tw.rootWidget.addEventListener("tm-download-file",function(event) { self.saveWiki({ + wiki: event.widget.wiki, method: "download", template: event.param, downloadType: "text/plain", @@ -147,20 +149,22 @@ Save the wiki contents. Options are: method: "save", "autosave" or "download" template: the tiddler containing the template to save downloadType: the content type for the saved file + wiki: optional wiki, overriding the default wiki specified in the constructor */ SaverHandler.prototype.saveWiki = function(options) { options = options || {}; var self = this, + wiki = options.wiki || this.wiki, method = options.method || "save"; // Ignore autosave if disabled - if(method === "autosave" && ($tw.config.disableAutoSave || this.wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes")) { + if(method === "autosave" && ($tw.config.disableAutoSave || wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes")) { return false; } var variables = options.variables || {}, template = (options.template || - this.wiki.getTiddlerText("$:/config/SaveWikiButton/Template","$:/core/save/all")).trim(), + wiki.getTiddlerText("$:/config/SaveWikiButton/Template","$:/core/save/all")).trim(), downloadType = options.downloadType || "text/plain", - text = this.wiki.renderTiddler(downloadType,template,options), + text = wiki.renderTiddler(downloadType,template,options), callback = function(err) { if(err) { alert($tw.language.getString("Error/WhileSaving") + ":\n\n" + err); diff --git a/core/modules/startup/plugins.js b/core/modules/startup/plugins.js index ab74214b9..fc8ba9589 100644 --- a/core/modules/startup/plugins.js +++ b/core/modules/startup/plugins.js @@ -61,7 +61,7 @@ exports.startup = function() { // Collect the shadow tiddlers of any modified plugins $tw.utils.each(changes.modifiedPlugins,function(pluginTitle) { var pluginInfo = $tw.wiki.getPluginInfo(pluginTitle); - if(pluginInfo) { + if(pluginInfo && pluginInfo.tiddlers) { $tw.utils.each(Object.keys(pluginInfo.tiddlers),function(title) { changedShadowTiddlers[title] = false; }); diff --git a/core/modules/storyviews/classic.js b/core/modules/storyviews/classic.js index c2848c435..044cd97f0 100644 --- a/core/modules/storyviews/classic.js +++ b/core/modules/storyviews/classic.js @@ -82,6 +82,10 @@ ClassicStoryView.prototype.remove = function(widget) { removeElement = function() { widget.removeChildDomNodes(); }; + // Blur the focus if it is within the descendents of the node we are removing + if($tw.utils.domContains(targetElement,targetElement.ownerDocument.activeElement)) { + targetElement.ownerDocument.activeElement.blur(); + } // Abandon if the list entry isn't a DOM element (it might be a text node) if(!targetElement || targetElement.nodeType === Node.TEXT_NODE) { removeElement(); diff --git a/core/modules/utils/dom/dom.js b/core/modules/utils/dom/dom.js index 4ba037ed5..0b71e128c 100644 --- a/core/modules/utils/dom/dom.js +++ b/core/modules/utils/dom/dom.js @@ -270,6 +270,7 @@ Copy plain text to the clipboard on browsers that support it */ exports.copyToClipboard = function(text,options) { options = options || {}; + text = text || ""; var textArea = document.createElement("textarea"); textArea.style.position = "fixed"; textArea.style.top = 0; @@ -289,7 +290,7 @@ exports.copyToClipboard = function(text,options) { var succeeded = false; try { succeeded = document.execCommand("copy"); - } catch (err) { + } catch(err) { } if(!options.doNotNotify) { var successNotification = options.successNotification || "$:/language/Notifications/CopiedToClipboard/Succeeded", @@ -326,7 +327,7 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) { variables["tv-popup-coords"] = Popup.buildCoordinates(Popup.coordinatePrefix.csOffsetParent,nodeRect); var absRect = $tw.utils.extend({}, nodeRect); - for (var currentNode = selectedNode.offsetParent; currentNode; currentNode = currentNode.offsetParent) { + for(var currentNode = selectedNode.offsetParent; currentNode; currentNode = currentNode.offsetParent) { absRect.left += currentNode.offsetLeft; absRect.top += currentNode.offsetTop; } diff --git a/core/modules/widgets/data.js b/core/modules/widgets/data.js index 2c6e2c593..63f12e1f9 100644 --- a/core/modules/widgets/data.js +++ b/core/modules/widgets/data.js @@ -91,7 +91,9 @@ DataWidget.prototype.computeDataTiddlerValues = function() { var titles = this.wiki.filterTiddlers(filter); $tw.utils.each(titles,function(title) { var tiddler = self.wiki.getTiddler(title); - tiddlers.push(tiddler); + if(tiddler) { + tiddlers.push(tiddler); + } }); } } diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 2850dec5f..5673c9e3b 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -551,28 +551,45 @@ exports.getTiddlerBacklinks = function(targetTitle) { /* -Return an array of tiddler titles that are directly transcluded within the given parse tree +Return an array of tiddler titles that are directly transcluded within the given parse tree. `title` is the tiddler being parsed, we will ignore its self-referential transclusions, only return */ -exports.extractTranscludes = function(parseTreeRoot) { +exports.extractTranscludes = function(parseTreeRoot, title) { // Count up the transcludes var transcludes = [], checkParseTree = function(parseTree, parentNode) { for(var t=0; tcaption | |||
---|---|---|---|
<$link/> | <$transclude field="caption"><$transclude field="description"><$view field="title"/>$transclude>$transclude> | diff --git a/editions/tw5.com/tiddlers/system/wikitext-macros.tid b/editions/tw5.com/tiddlers/system/wikitext-macros.tid index c09b0d8fe..9746af1ae 100644 --- a/editions/tw5.com/tiddlers/system/wikitext-macros.tid +++ b/editions/tw5.com/tiddlers/system/wikitext-macros.tid @@ -75,7 +75,7 @@ type: text/vnd.tiddlywiki||
< |
<$codeblock code=<>/> |
- <> |
+ <$transclude $variable="code" $mode="block"/> |