1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-03 14:59:57 +00:00
TiddlyWiki5/editions/ja-JP/tiddlers/howtos/Concatenating text and variables using macro substitution.tid
IchijikuIchigo bb53cc5791
[ja_JP] Japanese translation update (#8705)
* [ja-JP] Japanese translation of editions\tw5.com\tiddlers\videos\Videos.tid

* [ja-JP] A little correction to the Japanese translation

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\videos\Introduction Video.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\videos\Introducing TiddlyDesktop Video.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\videos\TiddlyWiki on Firefox for Android Video.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\videos\Working with the TiddlyWiki5 repository video.tid'

* [ja-JP] Japanese translation of editions\tw5.com\tiddlers\community\OXTWIG.tid

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\community\TiddlyWiki Hangouts.tid'

* [ja-JP] Japanese translation of editions\tw5.com\tiddlers\learning\Learning.tid

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\filters\Introduction to filter notation.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Sharing a TiddlyWiki on Dropbox.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\workingwithtw\Sharing your tiddlers with others.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\learning\Copying tiddlers between TiddlyWiki files.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Creating SubStories.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Editing Tiddlers with Emacs.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Making curved text with SVG.tid'

* [ja-JP] Japanese translation of editions\tw5.com\tiddlers\demonstrations\Tasks\TaskManagementExample.tid

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\demonstrations\Tasks\Compose ballad.tid'

* [ja-JP] Japanese translation of editions\tw5.com\tiddlers\demonstrations\Tasks\done.tid

* [ja-JP] Japanese translation of editions\tw5.com\tiddlers\demonstrations\Tasks\done.tid

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\demonstrations\Tasks\Go to Mordor.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\demonstrations\Tasks\Kill the Dragon.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\demonstrations\Tasks\Get the Ring.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\demonstrations\Tasks\Make the beds.tid'

* [ja-JP] Japanese translation of editions\tw5.com\tiddlers\demonstrations\Tasks\task.tid

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Adding a Twitter Follow button.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\about\Philosophy of Tiddlers.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Adopt a Titles Policy.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Concatenating text and variables using macro substitution.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Constructing JSON tiddlers.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Editing Tiddlers with Vim.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Formatting_List_Results_as_Tables_(no_CSS).tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Formatting List Results as Tables with CSS - Specified Columns Methods.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Formatting List Results as Tables with CSS - Variable Column Method.tid'

* [ja-JP] Japanese translation of editions\tw5.com\tiddlers\howtos\How_to_add_a_new_tab_to_the_sidebar.tid

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\How to change the sort order of sub-branches in a TOC macro.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\How to create a custom tiddler colour rule.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\How to create a custom tiddler icon rule.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\How to export tiddlers.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\How to hide the authors and other fields with CSS.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\How to put the last modification date in a banner.tid'

* [ja-JP] Japanese translation of editions\tw5.com\tiddlers\howtos\How_to_turn_off_camel_case_linking.tid

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\How to widen tiddlers (aka story river).tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\images\Icon Gallery.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Modifying JSON tiddlers.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Reading data from JSON tiddlers.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Simple ways to write protect tiddlers.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\demonstrations\Tasks\TaskManagementExampleDraggable.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\demonstrations\Tasks\TaskManagementExampleDraggableTemplate.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Visible Transclusions.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\demonstrations\KeyboardDrivenInput\Demonstration_ keyboard-driven-input Macro.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\How to add a banner for GitHub contributions.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\How to create a custom story tiddler template.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\How to create keyboard shortcuts.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\How to customize TiddlyDesktop.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\How to embed PDF and other documents.tid'

* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\learning\Introduction to Lists.tid'

* [ja_JP] Japanese translation update from commit: 6d11f4b

* [ja-JP] Corrected the display content of modified date in Japanese translation
2024-10-29 10:47:06 +00:00

61 lines
2.8 KiB
Plaintext

created: 20160424150551727
modified: 20241018105413659
original-modified: 20230615114519672
tags: Learning
title: Concatenating text and variables using macro substitution
ja-title: マクロ置換を使用してテキストと変数を連結する
type: text/vnd.tiddlywiki
!! 重要
<<.from-version "5.3.0">> テキストと変数を連結するには、[[置換された属性|Substituted Attribute Values]]や[[置換フィルター演算子|substitute Operator]]を使用することをお勧めします。
~TiddlyWikiでは、変数の値をさまざまなテキスト文字列と組み合わせることがよくあります。一部のプログラミング言語では、このプロセスはテキストの"連結"と呼ばれることがよくあります。
---
!! 何があったのか
例えば、顧客データベースのテンプレートを設定し、顧客に関する追加の連絡先情報をリンクによって自動的に参照するようにしたいとします。Tiddler内では、次のようなことを試すかもしれません:
<<.bad-example "`[[Additional Info|<<currentTiddler>>-Contact]]`">>
しかし、これは正しく機能しません。これを試すと、リンクは文字通りに解釈され、次の場所に移動しようとします:
```
<<currentTiddler>>-Contact
```
解決策は、マクロを使用して、`<<currentTiddler>>`がレンダリングされた値と、追加のテキスト`-Contact`とを組み合わせることです。
Tiddlerの冒頭で、次のようなマクロを作成します:
```
\define linkup(link) [[Additional Info|$link$-Contact]]
```
新しいマクロを次のように呼び出すること試すかもしれません:
<<.bad-example "`<<linkup <<currentTiddler>> >>`">>
しかし、そうすると、`<<currentTiddler>>`はレンダリングされずに、文字通り渡されることがわかります。
代わりに、次のように[[MacroCallWidget]]ウィジェットを使用できます:
```
<$macrocall $name="linkup" link=<<currentTiddler>> />
```
この場合、変数の値をマクロに直接渡しました。これは、このタスクを実行するための一般的な方法です。他の変数に基づいてさらにリンクを作成したい場合は、それぞれの状況でマクロを再利用できます。
この場合のように、使用している変数が`currentTiddler`だけであれば、次のように、簡単にマクロを記述できます:
```
\define linkup() [[Additional Info|$(currentTiddler)$-Contact]]
```
この場合、引数を渡さないことに注意してください。代わりに、特別な構文`$(variable)$`を使用して変数を参照します。引数を渡さないため、次のように`<$macrocall>`ウィジェットなしでより簡単に呼び出すことができます:
```
<<linkup>>
```