diff --git a/.gitignore b/.gitignore index d103455..0ccc27a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,9 @@ upload-experiment.sh # Ignore the key used for testing purposes key.txt + +# node +node_modules + +#vs code +.vscode diff --git a/README.md b/README.md index 5d8c4df..9d18609 100644 --- a/README.md +++ b/README.md @@ -45,58 +45,66 @@ conditions, you'd need to create four lists. ### Presenting multiple words as one group -By defaut, the boilerplate experiment treats every word in the stimuli as a -group of its own containing one word. Note, in some papers, the terminology for -a group is a segment. Sometimes it is handy to group multiple words together, -to shorten the time it takes to complete the experiment for example. This is -possible, but must be enabled. The file `globals.js` contains another variable: +Previously, when the spr was presenting multiple words as one group/simultaneous, you +needed to separate them by inserting e.g. a `/`, as of now, you have to +specifically create groups yourself and grouping of words is always on. On +the. There are two kinds of groups `{{A group of words that is not recorded}}` +`{{#A group of words that is NOT recorded.}}`. Recorded means that the +RT of this group is logged. Of course it is fine to have just one `{{word}}` +in a {{#group}}. the curly braces and # are stripped from the rendered +output. You should not put word letters etc outside of a group. + +All the words of your spr need to be enclosed in **{{**double curly braces**}}** +so the phrase "double curly braces" is presented together. If you want the to +be presented individually, you'll need to make three groups such as -```javascript -const GROUPING_STRING = null; +``` +{{double}} {{curly}} {{braces}} ``` -To enable grouping you must define a useful delimiter between groups. -A little bit further in the file there's a commented version of this: +#### White space issues + +In the example with three groups above, the " " are put outside of the group +as that might be more readable than e.g. -```javascript -const GROUPING_STRING = "/"; +``` +{{double }}{{curly }}{{braces}} ``` -So in order to enable grouping, comment the first version and uncomment -the latter. In theory you can fill out any string instead of the `"/"` -(useful in case you need to use / in a stimulus). -Notice the string is turned into a regular expression in order to split -the stimulus into parts and to remove the `/` in the case described here. +In this example the spaces are embedded inside the groups, both methods are +fine, but the author finds the first method better readable. If you put +none white space characters outside of a group it will be considered a syntax error. + +#### Presenting **bold** and *italic* words or ***both*** + +Like HTML you can render words in bold or italic like this: -```javascript -re = RegExp(GROUPING_STRING,'gu'); +``` +{{a word in bold or some words in italic}} ``` -So make sure if you are going to be creative, that the expression is valid. +or even both. -### Warning the grouping string is going to be removed as it shouldn't be displayed +``` +{{Bold and italic}} +``` -In the stimulus file you should take care that the grouping string is removed -from the stimulus. So you should take in mind how the stimulus would appear -after the grouping string is removed. +However, the syntax for this is more strict than HTML, forgetting to close a bold +or italic tag will result in an error. The bold or you'll have to close the +innermost group first and then the outermost group. So the following are errors: -#### Example +1. -```javascript -{ - stimulus : "This is/my fantasic stimlus./Don't you think!" -} -``` + {{Oops close i first}} -The "/" will be removed, essentially gluing "is" and "my" together, just like -"stimulus." and "Word". +2. -#### Example improved + {{Oops forgot to close b}} -```javascript -{ - stimulus : "This is/ my fantasic stimlus./ Don't you think" -} +If you want then to be partially overlapping you should open a new group + +``` +{{Bold and italic , only italic ``` ## Output diff --git a/build.bash b/build.bash new file mode 100755 index 0000000..7b0fff4 --- /dev/null +++ b/build.bash @@ -0,0 +1,7 @@ +#!/bin/bash + +# "Compile" grammar.js, from grammar.ne +npx nearleyc -o ./plugins/grammar.js ./plugins/grammar.ne -e spr_grammar + +# package it using esbuild +node ./build.mjs diff --git a/build.mjs b/build.mjs new file mode 100644 index 0000000..572d385 --- /dev/null +++ b/build.mjs @@ -0,0 +1,13 @@ +import * as esbuild from 'esbuild' + +await esbuild.build({ + entryPoints: [ + './plugins/jspsych-spr-moving-window.js', + ], + bundle:true, + outdir: 'dist', + minify: false, + sourcemap: true, + format: "esm" +}) + diff --git a/globals.js b/globals.js index 653e2c4..7c19756 100644 --- a/globals.js +++ b/globals.js @@ -42,12 +42,3 @@ const FIX_CHOICES = [' ']; // is on screen. const FINISH_TEXT_DUR = 3000; -// If no grouping character is selected or if it is null as in this example -// every word is a group of its own: sentences are split on whitespace. -// each word will be a one word group -const GROUPING_STRING = null; -// Or create word groups based on a splitting string -// Create groups using a "/". Note that every occurrence -// of a "/" will lead to presentation as a word group and the a "/" itself -// will not be displayed in the stimulus -//const GROUPING_STRING = "/"; diff --git a/index.html b/index.html index 73d37b5..df44a8f 100644 --- a/index.html +++ b/index.html @@ -28,9 +28,8 @@ - - +