Roxen.git / server / modules / tags / countdown.pike

version» Context lines:

Roxen.git/server/modules/tags/countdown.pike:1:   // This is a roxen module. Copyright © 1997 - 2000, Roxen IS.   //    - constant cvs_version="$Id: countdown.pike,v 1.40 2000/11/02 22:47:19 nilsson Exp $"; + constant cvs_version="$Id: countdown.pike,v 1.41 2001/03/07 13:42:11 kuntri Exp $";   #include <module.h>   inherit "module";      constant thread_safe=1;   constant module_type = MODULE_TAG;   constant module_name = "Countdown";   constant module_doc = "Provides the <tt>&lt;countdown&gt;</tt> tag, that "   "shows the time remaining until a certain date.";      TAGDOCUMENTATION;   #ifdef manual - constant tagdoc=(["countdown":#"<desc tag><short> - This tag can count days, minutes, months, etc. from a specified date or time.</short> It can also - give the time to or from a few special events. See below for a full list.</desc> + constant tagdoc=([ + constant tagdoc=(["countdown":#"<desc tag='tag'><p><short> + This tag can count days, minutes, months, etc. from a specified date + or time.</short> It can also give the time to or from a few special + events. See below for a full list.</p></desc>      <p>Time:</p> - <attr name=year value=number>Sets the year.</attr> - <attr name=month value=number|month_name>Sets the month.</attr> - <attr name=day value=number|day_name>Sets the weekday.</attr> - <attr name=mday value=number>Sets the day of the month.</attr> - <attr name=hour value=number>Sets the hour.</attr> - <attr name=minute value=number>Sets the minute.</attr> - <attr name=second value=number>Sets the second.</attr> - <attr name=iso value=year-month-day>Sets the year, month and day all at once - (YYYY-MM-DD, YYYYMMDD or YYYY-MMM-DD) + <attr name='year' value='number'><p>Sets the year.</p></attr> + <attr name='month' value='number|month_name'><p>Sets the month.</p></attr> + <attr name='day' value='number|day_name'><p>Sets the weekday.</p></attr> + <attr name='mday' value='number'><p>Sets the day of the month.</p></attr> + <attr name='hour' value='number'><p>Sets the hour.</p></attr> + <attr name='minute' value='number'><p>Sets the minute.</p></attr> + <attr name='second' value='number'><p>Sets the second.</p></attr> + <attr name='iso' value='year-month-day'><p>Sets the year, month and day all at once. (YYYY-MM-DD, YYYYMMDD or YYYY-MMM-DD).</p>   <ex><countdown iso='2020-FEB-12'/></ex>   </attr> - <attr name=event value=easter,gregorian-easter,julian-easter,christmas,christmas-day,christmas-eve> - Sets the time of an evet to count down to.</attr> + <attr name='event' value='easter,gregorian-easter,julian-easter,christmas,christmas-day,christmas-eve'><p> + Sets the time of an event to count down to.</p></attr>    - <attr name=years value=number>Add this number of years to the result.</attr> - <attr name=months value=number>Add this number of months to the result.</attr> - <attr name=weeks value=number>Add this number of weeks to the result.</attr> - <attr name=days value=number>Add this number of days to the result.</attr> - <attr name=hours value=number>Add this number of hours to the result.</attr> - <attr name=beats value=number>Add this number of beats to the result.</attr> - <attr name=minutes value=number>Add this number of minutes to the result.</attr> - <attr name=seconds value=number>Add this number of seconds to the result.</attr> - <attr name=now value=year-month-day>Sets the 'present' time, if other than really present time. (YYYY-MM-DD, YYYYMMDD or YYYY-MMM-DD) + <attr name='years' value='number'><p>Add this number of years to the result.</p></attr> + <attr name='months' value='number'><p>Add this number of months to the result.</p></attr> + <attr name='weeks' value='number'><p>Add this number of weeks to the result.</p></attr> + <attr name='days' value='number'><p>Add this number of days to the result.</p></attr> + <attr name='hours' value='number'><p>Add this number of hours to the result.</p></attr> + <attr name='beats' value='number'><p>Add this number of beats to the result.</p></attr> + <attr name='minutes' value='number'><p>Add this number of minutes to the result.</p></attr> + <attr name='seconds' value='number'><p>Add this number of seconds to the result.</p></attr> + <attr name='now' value='year-month-day'><p>Sets the 'present' time, if other than really present time. (YYYY-MM-DD, YYYYMMDD or YYYY-MMM-DD)</p>            <ex><countdown now=\"1999-12-24\" year=\"2000\" display=\"days\"/></ex>   </attr>         <p>Presentation:</p>    - <attr name=display value=when|years|months|weeks|days|hours|beats|minutes|seconds|combined|dogyears|boolean> + <attr name='display' value='when|years|months|weeks|days|hours|beats|minutes|seconds|combined|dogyears|boolean>   <xtable>   <row><c><i>display=when</i></c><c>Shows when the time will occur. -  All arguments that are valid in a -  &lt;date&gt; tag can be used to modify the display.</c></row> +  All arguments that are valid in +  <xref href='date.tag' /> can be used to modify the display.</c></row>   <row><c><i>display=years</i></c><c>How many years until the time.</c></row>   <row><c><i>display=months</i></c><c>How many months until the time.</c></row>   <row><c><i>display=weeks</i></c><c>How many weeks until the time.</c></row>   <row><c><i>display=days</i></c><c>How many days until the time.</c></row>   <row><c><i>display=hours</i></c><c>How many hours until the time. <ex><countdown day=\"friday\" display=\"hours\"/></ex></c></row>   <row><c><i>display=beats</i></c><c>How many beats until the time.</c></row>   <row><c><i>display=minutes</i></c><c>How many minutes until the time.</c></row>   <row><c><i>display=seconds</i></c><c>How many seconds until the time.</c></row>   <row><c><i>display=combined</i></c><c>Shows an english text describing the time period.    Example: 2 days, 1 hour and 5 seconds. You may use the 'prec'    attribute to limit how precise the description is. Also, you can    use the 'month' attribute if you want to see years/months/days    instead of years/weeks/days.      <ex type='vert'>The world will go under in <countdown year='2038' display='combined' prec='day'/>.</ex></c></row>   <row><c><i>display=dogyears</i></c><c>How many dog-years until the time. (With one decimal) <ex><countdown years=\"2\" display=\"dogyears\"/></ex></c></row> - <row><c><i>display=boolean</i></c><c>Return true or false (1 or 0), depending on if the time is now or not. The -  fuzziness of 'now' is decided by the 'prec' option. - <ex type='vert'><p>Is this a Sunday?</p> + <row><c><i>display=boolean</i></c><c>Return true or false (1 or 0), depending on if the time is now or not. The fuzziness of 'now' is decided by the 'prec' option. +  + <ex type='vert'><b>Is this a Sunday?</b>   <define variable='var.test' preparse=''><countdown day='sunday' display='boolean'/></define>   <if variable='var.test = 1'>Yes, this is a Sunday.</if>   <else>No, it isn´t.</else></ex> - </c><row> + </c></row>   </xtable> -  +    </attr> - <attr name=type value=type>As for 'date'. Useful values for type include string, number and ordered.</attr> - <attr name=lang value=langcodes>The language in which the result should be written if the type is string. - <lang/> +     -  + <attr name='type' value='type'><p>As for 'date'. Useful values for type include string, number and ordered.</p></attr> + <attr name='lang' value='langcodes'><p>The language in which the result should be written if the type is string.</p> +    <ex type='vert'>Heute ist es ungefähr <countdown event='christmas' display='months' type='string' lang='de'/> Monate bis Weinachten.</ex>   </attr> - <attr name=since>Negate the period of time. - <ex type='vert'>I am <countdown iso='1980-06-28' since='' display='years' type='string'/> years old.</ex> +  + <attr name='since'><p>Negate the period of time.</p> + <ex type='vert'> +  I am <countdown iso='1980-06-28' since='' display='years' type='string'/> years old.</ex>   </attr> - <attr name=next>Always count down to the next event. &lt;countdown day='friday' - next=''&gt; says 6 on a friday as opposed to 0 without the next attribute. +     -  + <attr name='next'><p>Always count down to the next event. + <tag>countdown day='friday' next=''</tag> says 6 on a friday as opposed + to 0 without the next attribute.</p> +    <ex type='vert'>It is <countdown day='monday' next=''/> to monday.</ex>      </attr> - <attr name=prec value=year|month|week|day|hour|minute|second>Modifies the precision for 'boolean'- and 'combined'-arguments.</attr> - "]); + <attr name='prec' value='year|month|week|day|hour|minute|second'><p>Modifies the precision for 'boolean'- and 'combined'-arguments.</p></attr>" +  ]);   #endif      mapping set_to_julian_easter(int year) {    int G = year % 19;    int I = (19*G + 15) % 30;    int J = (year + year/4 + I) % 7;    int L = I - J;       mapping easter=([]);