Extension talk:DPL Page Name S/N Maker (using SemanticForms)

From mediawiki.org
Latest comment: 11 years ago by Michael Chidester in topic Expression error: Unexpected < operator.

Help:KEB-Expression error: Unexpected < operator.[edit]

Im running mediawiki-1.20.2 and DynamicPageList, ParserFunctions, StringFunctions and Semantic Forms with the latest version of today. The first page is created ok, but the second reports the following error:

The next serial number is Help:KEB-Expression error: Unexpected < operator.----

Any ideas what is wrong? /Regards Claes Lindvall

Template error[edit]

This template seems to be exactly what I need for a corporate wiki I'm developing, but when I added it it produced this error:


The next serial number is {{#pad:Expression error: Unrecognised punctuation character "{".

   |5
   |0
   }}

I already had the following installed, so I expected that I could just copy the template and it would work.

  • Mediawiki 1.20.2
  • Semantic MediaWiki 1.8
  • Semantic Forms 2.5.2
  • DynamicPageList 2.01
  • String functions (no version listed, but presumably 2.0.3)

The documentation mentions a "special version StringFunctions extension", so maybe that's what I'm missing? Where can I download it? Any idea of what could be wrong?

Cheers.

~ Michael Chidester (Contact) 14:49, 21 March 2013 (UTC)Reply

Nevermind, I figured it out. Or rather, I determined that if I replace the {{#pad:}} function with the {{padleft:}} magic word, the errors all resolve and it works.
~ Michael Chidester (Contact) 18:49, 21 March 2013 (UTC)Reply

Expression error: Unexpected < operator.[edit]

I'm still working on getting this running on a corporate wiki, but while it worked perfectly for the first one, for any result higher than "00001" it keeps kicking out the error message Expression error: Unexpected < operator. This error isn't covered on the Parser Functions help page, but based on the documentation I assumed that it must be a stray < character or possibly a tag inside a function where tags aren't allowed. However, even when I remove all instances of the < character from the template (by eliminating the comments, the <strong> tags, and the <noinclude> tags), the error message persists.

Here is the text of the template, after I modified it to use the {{padleft}} magic word:

[removed]

Any idea what the problem is and/or how I can correct it? Thanks! ~ Michael Chidester (Contact) 15:15, 22 March 2013 (UTC)Reply

Solution[edit]

Ultimately I determined that this was a DPL conflict, possibly due to the {{expr:}} function refusing to parse the standard output format of DPL. To help anyone having this problem in the future, here is my modified code, changing out the deprecated string functions for their replacements and modifying the DPL output to produce a regular string rather than a link:

{{#if: {{{form|}}}
  |  {{#ifexist: Form:{{{form|}}} 
       |
       | <strong class="error">Warning! The form "{{{form|}}}" may not be a valid form name!</strong>
     }}
  |
}}<!---
-->{{#if: {{{form|}}}
     | {{#ifeq: {{lc:{{NS:{{{namespace|}}} }} }} 
         | {{lc:{{{namespace|}}} }}
         | 
         | <strong class="error">Warning! "{{{namespace}}}" may not be a valid namespace name!</strong>
       }}
     |
   }}<!---
-->The next document number is '''<!--
-->{{#if: {{{namespace|}}} | {{{namespace|}}}: }}{{{prefix|}}}<!--
   -->{{padleft:<!----------- (X+1)                         =>  0000(X+1) 
      -->{{#expr:<!---------- 0000X+1                       =>  (X+1)
         -->{{replace|<!----- "Namespace:prefix0000X"       =>  "0000X" 
            -->{{replace|<!-- "*[[Namespace:prefix0000X]]"  =>  "Namespace:prefix0000X"
               -->{{#dpl:<!-- return pages named "*[[Namespace:prefix0000X]]"
                  -->titleregexp =^{{{prefix|}}}[0-9]{{{{pad|5}}}}$<!--
                  -->| namespace = {{{namespace|}}}<!--
                  -->| order = descending<!--
                  -->| mode = userformat<!--
                  -->| format = ,%PAGE%<!--
                  -->| noresultsheader = {{padleft:0|{{{pad|5}}}|0}}<!--
                  -->| count = 1
                  }}
               |/^([^{{!}}]+\{{!}}){1}([^\]]+).*/  
               |\2
               }}
            | {{#if: {{{namespace|}}} | {{{namespace|}}}:}}{{{prefix|}}}
            |
            }}
         +1
         }}
     | {{{pad|5}}}
     | 0
     }}'''
----
{{#if: {{{form|}}}
  | {{#forminput: {{{form|}}}
      | {{{width|20}}}
      | {{{prefix|}}}<!--
      -->{{padleft:<!----------- (X+1)                         =>  0000(X+1) 
         -->{{#expr:<!---------- 0000X+1                       =>  (X+1)
            -->{{replace|<!----- "Namespace:prefix0000X"       =>  "0000X" 
               -->{{replace|<!-- "*[[Namespace:prefix0000X]]"  =>  "Namespace:prefix0000X"
                  -->{{#dpl:<!-- return pages named "*[[Namespace:prefix0000X]]"
                     -->titleregexp =^{{{prefix|}}}[0-9]{{{{pad|5}}}}$<!--
                     -->| namespace = {{{namespace|}}}<!--
                     -->| order = descending<!--
                     -->| mode = userformat<!--
                     -->| format = ,%PAGE%<!--
                     -->| noresultsheader = {{padleft:0|{{{pad|5}}}|0}}<!--
                     -->| count = 1
                     }}
                  |/^([^{{!}}]+\{{!}}){1}([^\]]+).*/  
                  |\2
                  }}
               |{{#if: {{{namespace|}}} | {{{namespace|}}}:}}{{{prefix|}}}
               |
               }}
            +1
            }}
        | {{{pad|5}}}
        | 0
        }}
     | {{{buttonlabel|Add}}}
     | {{#if: {{{namespace|}}} | namespace = {{{namespace|}}} }}  
     }}
  | <includeonly><strong class="error">Warning! You haven't specified a SemanticForm for page creation! Please specify a SemanticForm name.</strong></includeonly>
}}<noinclude>
{{documentation}}
</noinclude>

Cheers. ~ Michael Chidester (Contact) 15:41, 26 March 2013 (UTC)Reply