plugin:textinsert
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:textinsert [2017-12-07 15:15] – [textinsert Plugin] turnermm | plugin:textinsert [2022-08-30 01:16] (current) – compatible Igor 82.64.33.11 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
---- plugin ---- | ---- plugin ---- | ||
Line 6: | Line 6: | ||
email : turnermm02@shaw.ca | email : turnermm02@shaw.ca | ||
type : syntax | type : syntax | ||
- | lastupdate : 2017-12-07 | + | lastupdate : 2019-10-03 |
- | compatible : Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Hrun, | + | compatible : Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Hrun, |
depends | depends | ||
conflicts | conflicts | ||
- | similar | + | similar |
tags : replace, macro, entities, entity | tags : replace, macro, entities, entity | ||
- | downloadurl: | + | downloadurl: |
bugtracker : https:// | bugtracker : https:// | ||
- | sourcerepo : https:// | + | sourcerepo : https:// |
donationurl: | donationurl: | ||
---- | ---- | ||
Line 21: | Line 21: | ||
===== Installation ===== | ===== Installation ===== | ||
- | Install | + | Search and install the plugin using the [[plugin:extension|Extension Manager]]. |
===== Examples/ | ===== Examples/ | ||
+ | |||
This plugin provides an administrative panel where you enter macro names and their substitution texts. | This plugin provides an administrative panel where you enter macro names and their substitution texts. | ||
Line 33: | Line 34: | ||
All Roads Lead to " | All Roads Lead to " | ||
- | The textinsert plugin will allow you to create macros for extended texts. You can create paragraph length texts with HTML markup which have to be repeated, for instance, as instructions at the tops of pages. | + | The textinsert plugin will allow you to create macros for extended texts. You can create paragraph length texts with HTML markup which has to be repeated |
- | Macro_HTML | + | |
**Note**: The underscore is required. | **Note**: The underscore is required. | ||
+ | ==== Basic Syntax ==== | ||
+ | # | ||
==== Macro Inclusions ==== | ==== Macro Inclusions ==== | ||
- | Some of the functionality of this plugin at its simplest can be implemented with Dokuwiki's own entities facility: [[: | + | Some of the functionality of this plugin at its simplest can be implemented with DokuWiki's own entities facility: [[: |
One advantage of TextInsert comes when dealing with extended blocks of text and with its ability to include other macros inside the primary macro definition. That is, it can accept: | One advantage of TextInsert comes when dealing with extended blocks of text and with its ability to include other macros inside the primary macro definition. That is, it can accept: | ||
Line 48: | Line 50: | ||
MACRO_2 | MACRO_2 | ||
- | The result | + | The result |
- | This macro can include a second macro inside it. | + | This macro can include a second macro inside it. |
- | + | ||
It accepts only one level of macro inclusion, so that if MACRO_3 were included in MACRO_2, MACRO_3 would not be rendered. | It accepts only one level of macro inclusion, so that if MACRO_3 were included in MACRO_2, MACRO_3 would not be rendered. | ||
==== Entity Inclusions ==== | ==== Entity Inclusions ==== | ||
- | TextInsert will also accept entities in its macro definitions. | + | |
- | | + | TextInsert will also accept entities in its macro definitions. |
+ | MACRO_2 | ||
The final result would be: This macro can include a second---macro---inside it. | The final result would be: This macro can include a second---macro---inside it. | ||
==== Standard Namespace Macros ==== | ==== Standard Namespace Macros ==== | ||
- | Textinsert will accept namespace | + | |
+ | Textinsert will accept namespace | ||
^ Macro ^ Definition | ^ Macro ^ Definition | ||
Line 68: | Line 72: | ||
There is a configuration option which governs whether or not standard namespace macros are accepted. | There is a configuration option which governs whether or not standard namespace macros are accepted. | ||
+ | |||
+ | === _ID_ and _NS_: Pseudo Namespace Macros for Sidebars=== | ||
+ | |||
+ | When used in a sidebar the standard namespace macro '' | ||
+ | |||
+ | <code html> | ||
+ | <a href="/ | ||
+ | </ | ||
+ | |||
+ | If you use '' | ||
==== Example of Multi Paragraph Text Block ==== | ==== Example of Multi Paragraph Text Block ==== | ||
Line 73: | Line 87: | ||
If you want to create multi-pragraph blocks, then you need to use the HTML paragraph tag, <P>. . .</ | If you want to create multi-pragraph blocks, then you need to use the HTML paragraph tag, <P>. . .</ | ||
- | < | + | < |
< | < | ||
<p> | <p> | ||
Line 95: | Line 109: | ||
==== Screen Shot of Edit Panel ==== | ==== Screen Shot of Edit Panel ==== | ||
- | {{http://www.mturner.org/userfiles/ | + | {{https://i.imgur.com/8zMF7Ik.png}} |
===== Syntax ===== | ===== Syntax ===== | ||
Line 115: | Line 129: | ||
===== Parameter Interpolation ===== | ===== Parameter Interpolation ===== | ||
- | ==== Syntax ==== | + | ==== Basic Syntax ==== |
Macro Definition as defined on page: | Macro Definition as defined on page: | ||
- | | + | |
Replacement String defined in Macro database: | Replacement String defined in Macro database: | ||
- | | + | |
%1 will be replaced by param1,%2 by param2, etc. | %1 will be replaced by param1,%2 by param2, etc. | ||
Line 128: | Line 142: | ||
| Mountain_Ranges | | Mountain_Ranges | ||
- | | + | |
**Result:** '' | **Result:** '' | ||
+ | |||
+ | ==== DokuWiki Basic Text Formatting Syntax ==== | ||
+ | |||
+ | Parameters may use the [[wiki: | ||
+ | |||
+ | ==== Multi-line Syntax ==== | ||
+ | < | ||
+ | # | ||
+ | parameter one, //comment one | ||
+ | parameter two, // comment two | ||
+ | parameter three, | ||
+ | parameter four | ||
+ | . | ||
+ | . | ||
+ | parameter <n> | ||
+ | ~@# | ||
+ | </ | ||
+ | |||
+ | Comments are allowed but not included in the final output. | ||
+ | |||
+ | **Example: | ||
+ | < | ||
+ | # | ||
+ | Alps, // | ||
+ | Rockies, // U.S. and Canada | ||
+ | Andes | ||
+ | ~@# | ||
+ | </ | ||
+ | |||
+ | The final result will be the same as for the single line syntax, as shown above in the example for the [[# | ||
+ | |||
+ | " | ||
+ | |||
+ | < | ||
+ | # | ||
+ | Alps, // | ||
+ | |||
+ | Rockies, // U.S. and Canada | ||
+ | |||
+ | Andes | ||
+ | or Andean Mountains (Spanish: Cordillera de los Andes)\, which are the | ||
+ | longest continental mountain range in the world\, forming a continuous | ||
+ | highland along the western edge of South America. The Andes also have | ||
+ | the 2nd most elevated highest peak of any mountain range\, only | ||
+ | behind the Himalayas. | ||
+ | |||
+ | ~@# | ||
+ | </ | ||
+ | |||
+ | In order for this to work, the commas must be escaped, since they represent parameter boundaries: '' | ||
+ | |||
===== Language Translation ===== | ===== Language Translation ===== | ||
- | This version of textinsert makes translation substitutions based on ISO-derived namespaces.((This is consistent with the scheme used by the [[: | + | '' |
+ | - de: | ||
+ | - ns1: | ||
Macros of this type must use the following syntax: | Macros of this type must use the following syntax: | ||
# | # | ||
A default entry for this type of macro must be entered into the textinsert database as '' | A default entry for this type of macro must be entered into the textinsert database as '' | ||
- | | + | |
+ | <code php> | ||
+ | $lang[' | ||
+ | </ | ||
- | If a translation is not found, the default string will be used. | + | If a translation is not found, the default string will be used. |
+ | |||
+ | Use of '' | ||
==== Example ==== | ==== Example ==== | ||
Line 150: | Line 222: | ||
In each lang.php, you need only a single entry, for instance: | In each lang.php, you need only a single entry, for instance: | ||
- | | + | < |
+ | $lang[' | ||
+ | </ | ||
When you include # | When you include # | ||
- | | + | ==== Improved Language Localization ==== |
+ | |||
+ | Using '' | ||
+ | |||
+ | The format of macros.php must follow this example: | ||
+ | <code php> | ||
+ | <?php | ||
+ | | ||
+ | | ||
+ | . | ||
+ | | ||
+ | </ | ||
+ | To use the earlier example: | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | /* textinsert/ | ||
+ | $lang_de[' | ||
+ | </ | ||
+ | |||
==== Embedding ==== | ==== Embedding ==== | ||
- | Translation macros can be included in standard and HTML macros. | + | Translation macros can be included in standard and HTML macros. |
- | ^ ^ Macro Name ^ Definition | | + | ^ # ^ Macro Name ^ Definition | |
- | |1| LANG_nation | <h2>I live in Canada</ | + | |1| LANG_nation | %%<h2>I live in Canada</ |
- | |2| nation_HTML | # | + | |2| nation_HTML | %%# |
|3| LANG_city | |3| LANG_city | ||
If the default replacement string contains HTML, then you should use form 2 in the above table when not in a language context; otherwise the HTML will appear in your output as plain text and the HTML will be lost. | If the default replacement string contains HTML, then you should use form 2 in the above table when not in a language context; otherwise the HTML will appear in your output as plain text and the HTML will be lost. | ||
- | In a language context, any HTML that you place in your definition will be output as HTML. Assume this is ths definition for LANG_nation in the lang/ | + | In a language context, any HTML that you place in your definition will be output as HTML. Assume this is the definition for LANG_nation in the lang/ |
- | $lang[' | + | <code php> |
+ | $lang[' | ||
+ | </ | ||
In the German namespace, # | In the German namespace, # | ||
Line 174: | Line 270: | ||
It is also possible to include macros in your translations: | It is also possible to include macros in your translations: | ||
- | $lang[' | + | <code php> |
- | | + | $lang[' |
+ | $lang[' | ||
+ | </ | ||
| | ||
This results in: Ich lebe in **Berlin**, in Deutschland | This results in: Ich lebe in **Berlin**, in Deutschland | ||
- | |||
- | | ||
===== Configuration and Settings ===== | ===== Configuration and Settings ===== | ||
+ | |||
There are two configuration settings. | There are two configuration settings. | ||
^stdreplace|Accept standard macro replacements as used in namespace templates|default: | ^stdreplace|Accept standard macro replacements as used in namespace templates|default: | ||
^farm|If this is a farm and you and would like each animal to have its own macro database, please select this option; otherwise all animals will share the same, i.e. the farmer' | ^farm|If this is a farm and you and would like each animal to have its own macro database, please select this option; otherwise all animals will share the same, i.e. the farmer' | ||
- | |||
===== Development ===== | ===== Development ===== | ||
+ | === Change Log === | ||
- | + | {{rss> | |
- | === Change Log === | + | |
- | {{rss> | + | |
===== Discussion ===== | ===== Discussion ===== | ||
- | All questions have been moved to [[plugin: | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
+ | All earlier questions have been moved to [[plugin: | ||
plugin/textinsert.1512656141.txt.gz · Last modified: 2017-12-07 15:15 by turnermm