[{"created":"20230419184101576","text":"<!-- Due recognition to TW_Tones without which I would not have been able to make this excise button. :) -->\n\n<!-- (NOTE) Edit \"ExciseTitleTrim\" to remove suffixes and prefixes you want to remove. Note that prefixes must be preceded by [Draft of '] and suffixes by ['] as the title is taken from the editor of the edited tiddler, whose title will appear as Draft of 'Tiddler'. Leave \"ExciseTrimDraftof\" as it is, because it only serves to derive the real title of the tiddler (without Draft of) -->\n\n\\define ExciseTitleTrim() <$text text={{{ [<storyTiddler>trim:prefix[Draft of '$:/sob/ex/]trim:prefix[Draft of '$:/sob/]trim:prefix[Draft of '$:/]trim:prefix[Draft of ']trim:suffix[']] }}}/>\n\n\\define ExciseTrimDraftof() <$text text={{{ [<storyTiddler>trim:prefix[Draft of ']trim:suffix[']] }}}/>\n\n<!-- (NOTE) After a transclusion, a link that takes us to the transcluded tiddler might be useful. I use \"+\" as a link, edit below if you want to change the look of that link.  -->\n\n\\define open-link() [[+|\n\\define close-link() ]]\n\n\\define lingo-base() $:/language/Buttons/Excise/\n\n\\define body(config-title)\n\\whitespace trim\n''<<lingo Hint>>''\n<hr><!-- (NOTE) Here I've differentiated the style of the prefix and suffix to appear in the same color as the tiddler titles, then underlined the suffix to make it more noticeable, since it is created by a manual input -->\n<$set name=\"NewExcisionPrefix\" value=\"{{$:/sob/Btn/EditorToolbar/Excise/Dropdown!!radio}}{{$:/sob/Btn/EditorToolbar/Excise/Dropdown!!part-of-title}}\">\n<$set name=\"NewExcisionSuffix\" value=\"{{$:/sob/Btn/EditorToolbar/Excise/Dropdown!!grab}}\">\n<$wikify name=Prefix-wikified text=<<NewExcisionPrefix>>>\n<$wikify name=Suffix-wikified text=<<NewExcisionSuffix>>>\n<div class=\"NewTitleDisplay\">&nbsp;\n<span class=\"PrefixStyle\">\n<$text name=Prefix-Text text=<<Prefix-wikified>>>\n<text src=<<Prefix-Text>>/>\n</$text>\n</span>\n<span class=\"SuffixStyle\">\n<$text name=Suffix-Text text=<<Suffix-wikified>>>\n<text src=<<Suffix-Text>>/>\n</$text>\n</span>\n</div>\n</$wikify>\n</$wikify>\n</$set>\n</$set>\n\n<!-- (NOTE) An error message appears here if the title of the tiddler you are about to create coincides with one that already exists -->\n<$wikify name=excision-title-wikified text={{$:/sob/Btn/EditorToolbar/Excise/Dropdown!!excision-title}}>\n<$set name=\"new-title\" value=<<excision-title-wikified>>>\n<$list filter=\"\"\"[<new-title>is[tiddler]]\"\"\">\n<div class=\"tc-error\">\n<<lingo Caption/TiddlerExists>>\n</div>\n</$list>\n</$set>\n</$wikify>\n\n<!-- (NOTE) With $radio you can set a predetermined prefix. Modify at will (Then see the \"perform excision\" button code if you want to make the radio default to a particular radio after each excision. Now the default is \"$:/sob/\") -->\n&#x276F;&thinsp;__Prefix:__\n<div class=\"centered\">\n<$tiddler tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\">\n<$radio field=\"radio\" value=\"\" default=\"$:/sob/\">&thinsp;None</$radio>&nbsp;\n<$radio field=\"radio\" value=\"$:/sob/\" default=\"$:/sob/\">&thinsp;Sobriety</$radio>&nbsp;\n<$radio field=\"radio\" value=\"$:/sob/ex/\" default=\"$:/sob/\">&thinsp;Sobriety ex</$radio>\n</$tiddler>\n</div>\n<div class=\"centered\"><!-- (NOTE) Error message that appears if the actions of the next button have no effect (if for example the trim trims all the title operation, for example in a tiddler that is called exactly like a prefix to be deleted) -->\n<$list filter=\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]get[part-of-title]count[]match[0]]\">\n<$list filter=\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]part-of-title-on[off]]\">\n,,Can't add part of title,,\n</$list>\n</$list>\n<br>\n<$fieldmangler><!-- (NOTE) A pair of buttons that add/remove parts of the title of the tiddler being edited using the one specified in \"ExciseTitleTrim\" as a criterion. This can be useful if you want to have similar titles between the starting tiddler and the tiddler that will contain the excised text.-->\n<$list filter=\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]part-of-title-on[on]]\" variable=null>\n <$set name=\"IdTrim+slash\" value=\"<<ExciseTitleTrim>>/\">\n  <$button><$action-setfield $tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" $field=\"part-of-title-on\" $value=\"off\"/><$action-setfield $tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" $field=\"part-of-title\" $value=<<IdTrim+slash>>/>\n    Add part of title\n  </$button>\n </$set>\n</$list>\n<$list filter=\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]part-of-title-on[off]]\" variable=null>\n  <$button><$action-setfield $tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" $field=\"part-of-title-on\" $value=\"on\"/><$action-setfield $tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" $field=\"part-of-title\" $value=\"\"/>\n    Remove part of title\n  </$button>\n</$list>\n</$fieldmangler>\n</div>\n\n<!-- (NOTE) Here you can insert the suffix. If nothing is entered, the \"Perform excision\" button will be unavailable (You can change this later by changing a couple of $list) -->\n&#x276F;&thinsp;__Add suffix:__&ensp;<$edit-text focus=\"yes\" class=\"small EditTextStyle\" tag=\"input\" tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" field=\"grab\" />\n\n<$wikify name=excision-title-wikified text={{$:/sob/Btn/EditorToolbar/Excise/Dropdown!!excision-title}}>\n<$list filter=\"\"\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]get[grab]count[]match[0]]\"\"\">\n<div class=\"centered\">''&#9652;''&nbsp;//Enter a suffix//&nbsp;''&#9652;''</div>\n</$list>\n</$wikify>\n\n<hr><!-- (NOTE) Based on the radio and based on whether a checkbox is selected, you see which tags will be assigned to the tiddler you are going to create. (The checkbox, even if it works according to a different mechanism, has the same functionality as that of the default excise button) Edit the radio-related tag Macros as desired. -->\n{{$:/core/images/tag-button}}&thinsp;//The tiddler will be tagged with://\n\n<$list filter=\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]get[radio]] +[match[$:/sob/]]\">\n<<tag $:/sob/>>&ensp;\n</$list>\n<$list filter=\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]get[radio]] +[match[$:/sob/ex/]]\">\n<<tag $:/sob/ex/>>&ensp;\n</$list>\n<$list filter=\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]get[tag-with-title]count[]!match[0]]\">\n<$macrocall $name=\"tag\" tag={{$:/sob/Btn/EditorToolbar/Excise/Dropdown!!tag-with-title}}/>\n</$list>\n\n<!-- (NOTE) Same functionality as the default \"Tag new tiddler with the title of this tiddler\" checkbox but achieved using a different mechanism -->\n<$wikify name=ExciseTrimDraftof-wikified text=<<ExciseTrimDraftof>>>\n<$set name=\"RealTitle\" value=<<ExciseTrimDraftof-wikified>>>\n<$checkbox tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" field=\"tag-with-title\" checked={{{ [<RealTitle>] }}} unchecked=\"\" default=\"\">&#32;Tag new tiddler with the title of this tiddler</$checkbox>\n</$set>\n</$wikify>\n\n<div class=\"Frame2px\"><!-- (NOTE) Added the options (via a change here and in the js tiddler) $transclud-block and $transclude-span -->\n''&#x276F;''&thinsp;Replace with:&#32;<$select tiddler=\"\"\"$config-title$/type\"\"\" default=\"transclude\">\n<option value=\"link\"><<lingo Caption/Replace/Link>></option>\n<option value=\"transclude\"><<lingo Caption/Replace/Transclusion>></option>\n<option value=\"TranscludeWidgetBlock\">$transclude-block</option>\n<option value=\"TranscludeWidgetSpan\">$transclude-span</option>\n</$select>\n<div class=\"EmptySpace1em\"></div>\n\n<!-- (NOTE) With this checkbox and a corresponding $action-sendmessage in the button there is the possibility to insert a link after the replacement of the excised text (e.g. {{NewExcision}}[[+|NewExcision]] ), this link leads to the new tiddler which contains the excised text -->\n<$checkbox tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" field=\"link+on\" checked=\"on\" unchecked=\"off\" default=\"off\">&#32;Add link +&thinsp;</$checkbox>\n<div class=\"EmptySpace1em\"></div>\n\n<!-- (NOTE) Disabled button that is shown instead of the real one if no suffix has been entered manually or the title of the new tiddler already exists. Modify the $lists if you want them to be shown based on other criteria -->\n<$wikify name=excision-title-wikified text={{$:/sob/Btn/EditorToolbar/Excise/Dropdown!!excision-title}}>\n<$set name=\"new-title\" value=<<excision-title-wikified>>>\n<$list filter=\"\"\"[<new-title>is[tiddler]] [[$:/sob/Btn/EditorToolbar/Excise/Dropdown]get[grab]count[]match[0]]\"\"\">\n<$button tooltip=\"You can't make the excision yet\" disabled>\n~~<<lingo Caption/Excise>>~~\n</$button>\n</$list>\n</$set>\n</$wikify>\n<!-- (NOTE) The real button. \nIf you want to insert new \"defaults\" in the field once an excision has been made:\nfor example if you want different prefix values handled by $radios, and you want a specific one to be selected by default, edit the $value of the $action-setfield $tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown \" $field=\"radio\"... -->\n<!-- (NOTE) Remove \"<$action-navigate $to=<<excision-title-wikified>>\n/>\" if you don't want the new tiddler to be put into focus in Story River -->\n<$wikify name=excision-title-wikified text={{$:/sob/Btn/EditorToolbar/Excise/Dropdown!!excision-title}}>\n<$set name=\"new-title\" value=<<excision-title-wikified>>>\n<$list filter=\"\"\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]get[grab]count[]!match[0]]\"\"\">\n<$list filter=\"\"\"[<new-title>!is[tiddler]]\"\"\">\n<$button>\n<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"excise\"\n\ttitle=<<excision-title-wikified>>\n\ttype={{$config-title$/type}}\n\tmacro={{$config-title$/macro-title}}\n/>\n<$list filter=\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]get[link+on]] +[match[on]]\">\n<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"\"\n\tsuffix={{{ [<open-link>] [<new-title>]  [<close-link>] +[join[]] }}}\n/></$list>\n<$list filter=\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]get[tag-with-title]count[]!match[0]]\">\n<$fieldmangler tiddler=<<excision-title-wikified>>>\n<$action-sendmessage $message=\"tm-add-tag\" $param={{$:/sob/Btn/EditorToolbar/Excise/Dropdown!!tag-with-title}}/>\n</$fieldmangler>\n</$list>\n<$list filter=\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]get[radio]] +[match[$:/sob/ex/]]\">\n<$fieldmangler tiddler=<<excision-title-wikified>>>\n<$action-sendmessage $message=\"tm-add-tag\" $param=\"$:/sob/ex/\"/>\n</$fieldmangler>\n</$list>\n<$list filter=\"[[$:/sob/Btn/EditorToolbar/Excise/Dropdown]get[radio]] +[match[$:/sob/]]\">\n<$fieldmangler tiddler=<<excision-title-wikified>>>\n<$action-sendmessage $message=\"tm-add-tag\" $param=\"$:/sob/\"/>\n</$fieldmangler>\n</$list>\n<$action-setfield $tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" $field=\"grab\" $value=\"\"\n/>\n<$action-setfield $tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" $field=\"link+on\" $value=\"off\"\n/>\n<$action-setfield $tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" $field=\"part-of-title\" $value=\"\"\n/>\n<$action-setfield $tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" $field=\"radio\" $value=\"$:/sob/\"\n/>\n<$action-setfield $tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" $field=\"tag-with-title\" $value=\"\"\n/>\n<$action-setfield $tiddler=\"$:/sob/Btn/EditorToolbar/Excise/Dropdown\" $field=\"part-of-title-on\" $value=\"on\"\n/>\n<$action-navigate $to=<<excision-title-wikified>>\n/>\n<<lingo Caption/Excise>>\n</$button>\n</$list>\n</$list>\n</$set>\n</$wikify>\n</div>\n\\end\n\n<$macrocall $name=\"body\" config-title=<<qualify \"$:/state/Excise/\">>/>\n\n","title":"$:/sob/Btn/EditorToolbar/Excise/Dropdown","tags":"","modified":"20230421132933391","excision-title":"{{$:/sob/Btn/EditorToolbar/Excise/Dropdown!!radio}}{{$:/sob/Btn/EditorToolbar/Excise/Dropdown!!part-of-title}}{{$:/sob/Btn/EditorToolbar/Excise/Dropdown!!grab}}","radio":"$:/sob/","grab":"","tag-with-title":"","icon+on":"off","part-of-title-on":"on","part-of-title":"","type":"text/vnd.tiddlywiki","link+on":"off"}]