Vorlage:ParseTextValue4ical: Unterschied zwischen den Versionen

Aus Bayernflora
Wechseln zu: Navigation, Suche
K (text output)
K (CRLF TEst)
 
(34 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 13: Zeile 13:
  
 
next line goes here
 
next line goes here
}}
+
and here it goes further
 +
a line very long text very long text very long text very long text very long text}}
 
</pre>
 
</pre>
  
{{ParseTextValue4ical|1=very long text very long text very long text very long text very long text very long text  
+
{{ParseTextValue4ical|1=very long text very long text very long text very long text very long text very long text  
  
 
next line goes here
 
next line goes here
}}
+
and here it goes further
 +
a line very long text very long text very long text very long text very long text}}
  
 
[[{{ns:category}}:{{#switch: {{CONTENTLANGUAGE}}<!--
 
[[{{ns:category}}:{{#switch: {{CONTENTLANGUAGE}}<!--
Zeile 32: Zeile 34:
 
-->]]
 
-->]]
 
</noinclude><includeonly><!--  
 
</noinclude><includeonly><!--  
-->{{#vardefine: textLength |{{#len: {{{1|}}}}}}}<!--
 
 
  -->{{#vardefine: textBreakLength |74}}<!--  
 
  -->{{#vardefine: textBreakLength |74}}<!--  
 
  -->{{#vardefine: text|<!--  
 
  -->{{#vardefine: text|<!--  
Zeile 39: Zeile 40:
 
       -->{{#replace:<!--  
 
       -->{{#replace:<!--  
 
         -->{{#replace:<!--  
 
         -->{{#replace:<!--  
           -->{{{1|}}}|<nowiki></nowiki>
+
           -->{{#replace:<!--
 
+
            -->{{{1|}}}<!--
<nowiki></nowiki>|\n}}<!--  
+
          -->|\|\\}}<!--
       -->|\|\\}}<!--  
+
        -->|<nowiki></nowiki>
     -->|,|\,}}<!--  
+
<nowiki></nowiki>|\n}}<!--
   -->|;|\;}}<!--  
+
       -->|,|\,}}<!--  
 +
     -->|;|\;}}<!--  
 +
   -->|:|\:}}<!--  
 
  -->}}<!--  
 
  -->}}<!--  
 +
-->{{#vardefine: textLength |{{#len: {{#var: text }}}}}}<!--
 
  -->{{#vardefine: i-loop |1}}<!--  
 
  -->{{#vardefine: i-loop |1}}<!--  
  
Zeile 52: Zeile 56:
  
 
   cut text each textBreakLength
 
   cut text each textBreakLength
   -->{{#arraymap: {{PADLEFT:|{{#expr: floor ( {{#var: textLength}} / {{#var: textBreakLength }} ) }}|.}}<!--
+
   -->{{#arraymap: {{#replace:{{PADLEFT:|{{#expr: floor ( {{#var: textLength}} / {{#var: textBreakLength }} ) }}|.}}|.|x.}}<!--
 
   -->|.<!-- sep
 
   -->|.<!-- sep
 
   -->|§<!-- assign temporary var
 
   -->|§<!-- assign temporary var
 
   -->|<!--  
 
   -->|<!--  
 
   -->{{#vardefine: textWrapped |<!--  
 
   -->{{#vardefine: textWrapped |<!--  
     -->{{#sub: {{#var: text}} | 0 | {{#expr: {{#var: i-loop}} * {{#var: textBreakLength}} }} }}<!--  
+
     -->{{#sub: {{#ifeq: {{#var: i-loop}} | 1 |{{#var: text}}|{{#var: textWrapped}}}}| 0 | {{#expr: {{#var: i-loop}} * {{#var: textBreakLength}} }} }}<!--  
     --><nowiki></nowiki>
+
  CRLF needed here!!!
 +
     -->
 
  <nowiki></nowiki><!--  
 
  <nowiki></nowiki><!--  
     -->{{#sub: {{#var: text}} | {{#expr: {{#var: i-loop}} * {{#var: textBreakLength}} }} }}<!--  
+
     -->{{#sub: {{#ifeq: {{#var: i-loop}} | 1 |{{#var: text}}|{{#var: textWrapped}}}}| {{#expr: {{#var: i-loop}} * {{#var: textBreakLength}} }} }}<!--  
   -->}}<!--  
+
   -->}}<!-- vardefine: textWrapped
     set -->{{#vardefine: i-loop |{{#expr: 1 + {{#var: i-loop}}}}}}<!--output
+
 
 +
     reset i-loop
 +
  -->{{#vardefine: i-loop |{{#expr: 1 + {{#var: i-loop}}}}}}<!--
 +
 
 
   -->|<!--output sep
 
   -->|<!--output sep
 
   -->}}<!-- end arraymap  
 
   -->}}<!-- end arraymap  
   -->{{#vardefine: textWrapped}}<!-- text output
+
   -->{{#replace:{{#var: textWrapped}}|\:|:}}<!-- text output
  
else-->|{{#var: text}}<!-- text output
+
else-->|{{#replace:{{#var: text}}|\:|:}}<!-- text output
 
-->}}<!-- end if
 
-->}}<!-- end if
 
   
 
   
 
--></includeonly>
 
--></includeonly>

Aktuelle Version vom 20. Januar 2014, 15:57 Uhr

Following transformation will be done:

  • wrap text to 75 and indent it by 1 space
  • escape: \, \; \n

Parameters

1= 
the text value
{{ParseTextValue4ical|1=very long text very long text very long text very long text very long text very long text 

next line goes here
and here it goes further
a line very long text very long text very long text very long text very long text}}
very long text very long text very long text very long text very long text
 very long text \n\nnext line goes here\nand here it goes further\na lin
e very long text very long text very long text very long text very long 
text