Was this page helpful?

Web.Size

    Table of contents
    1. 1. Usage Restrictions
    2. 2. Parameters
    3. 3. Result
    4. 4. Samples
    web.Size(size : num) : str

    Convert numeric size to text.

    Usage Restrictions

    1.8.3 or later.

    Parameters

    Name Type Description
    size num The numeric size.

    Result

    The text representation of the numeric size in pixel or percent. If the value is >= 1.0, the result will be in pixel. Otherwise, if the value is < 1.0, the result is in percent.  To obtain 100%, use 0.999, which is rounded up.

    Samples

      Output

    To convert the number 5 to pixel:

    {{ web.Size(5) }} 

    5px

    To convert the number 0.5 to percent:

    {{ web.Size(0.5) }} 

    50%

    Sample DekiScript extension to render an image using a width and height specified by the user.  Note that web.size is used to format the output:

    <extension>
      <function>
        <name>image</name> 
        <description>Simple DekiScript Sample to render an image.</description> 
        <param name="width" type="int">width</param> 
        <param name="height" type="int">height</param> 
        <return>
          <html xmlns:eval="http://mindtouch.com/2007/dekiscript">
            <body>
             <img src="http://wiki.opengarden.org/@api/deki/site/logo.png" eval:width="web.size(args.width)" eval:height="web.size(args.height)"/>
            </body>
          </html>
        </return>
      </function>
    </extension>

    N/A

     

    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by