开发者

OPA mapi syntax error

So I have a database record that contains a field with a list(string) I would like to convert this list of strings to some xhtml to display.

I've written the following function:

display_lp(path) = (
  do List.mapi(x, characterlp -> <div class="show_content" id=#show_content > {x} :    <textarea class="edit_content" id=#edit_content_lp cols="20" rows="1"> {characterlp} </textarea></div> ), /characters[path]/lifepaths -> y
  XMLConvert.of_list_using("","","",y)
)

however it doesn't compile. It gives me a syntax error:

Syntax error at line 270, column 188 The error may be in the following citation, usually in the red part (starting at ⚐) or 开发者_如何学运维just before: <<) void )

display_lp(path) = ( do List.mapi(x, characterlp -> {x} : {characterlp} )⚐, /characters[path]/lifepaths -> y XMLConvert.of_list_using("","","",y) )

display(path) = (

> Hint: expected (while parsing starting at line 270, column 188) Error Syntax error

What am I doing wrong here?


This is what i guess what you wanted to do :

display_lp(path) =
  y = List.mapi(
    x, characterlp ->
      <div class="show_content" id=#show_content>
      {x}:
      <textarea class="edit_content" id=#edit_content_lp cols="20" rows="1">
      {characterlp}
      </textarea>
      </div>
  , /characters[path]/lifepaths)
  XmlConvert.of_list_using(<></>,<></>,<></>,y)
  1. First, your List.mapi is mis-parenthesed

  2. Secondly, I don't understand your -> y after /characters[path]/lifepaths, i guess you wanted to put the result of List.mapi in the y variable.

  3. Third, there is a typo : this is XmlConvert and NOT XMLConvert (uppercase)

  4. Finally, XmlConvert has for signature : xhtml, xhtml, xhtml, list(xhtml)

    That means you must provide type xhtml for the first 3 arguments, which is not compatible with the type string "" :)

    The equivalent of "" in xhtml is <>

Hope that solves your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜