[docs] xmldocs - docelic modified 16 files

docs at icdevgroup.org docs at icdevgroup.org
Sun May 29 11:01:43 EDT 2005


User:      docelic
Date:      2005-05-29 15:01:40 GMT
Modified:  refs     yesno.filter
Added:     refs     date2time.filter date_change.filter
Added:              decode_entities.filter digits.filter
Added:              digits_dot.filter duration.filter
Added:              encode_entities.filter filesafe.filter gate.filter
Added:              html2text.filter integer.filter large.filter
Added:              line.filter pagefile.filter sql.filter
Log:
- Some fixes and more filters documented

Revision  Changes    Path
1.2       +1 -2      xmldocs/refs/yesno.filter


rev 1.2, prev_rev 1.1
Index: yesno.filter
===================================================================
RCS file: /var/cvs/xmldocs/refs/yesno.filter,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- yesno.filter	29 May 2005 11:19:33 -0000	1.1
+++ yesno.filter	29 May 2005 15:01:39 -0000	1.2
@@ -18,7 +18,6 @@
 <programlisting>
 OK (yes)? [filter yesno]Good input[/filter] [br]
 OK (no)? [filter yesno][/filter]            [br]
-OK (no)? [filter yesno /]
 </programlisting>
 __END__
 
@@ -26,7 +25,7 @@
 <programlisting>
 OK (yes)? [filter yesno]Good input[/filter]  [br]
 OK (yes)? [filter yesno]   [/filter]         [br]
-OK (no)? [filter no_white yesno]   [/filter] [br]
+OK (no)? [filter strip yesno]   [/filter] [br]
 </programlisting>
 __END__
 



1.1                  xmldocs/refs/date2time.filter


rev 1.1, prev_rev 1.0
Index: date2time.filter
===================================================================
__NAME__ purpose
convert date (possibly with specified time) to number of seconds since Epoch
__END__


__NAME__ see also
__END__


__NAME__ description
The filter replaces date specification in form of
</para><para>
<literal><replaceable>MM</replaceable>[/-]<replaceable>DD</replaceable>[/-]<replaceable>YY(YY)?</replaceable>(:<replaceable>hh</replaceable>(<replaceable>mm</replaceable>)?)?</literal>
</para><para>
to a number of seconds since &glos-epoch;.
</para><para>
If the year specification contains 2 digits only and is less than 
<literal>50</literal>, as is say, <literal>02</literal>, 
then it is treated as an offset from year <literal>2000</literal>, and not
<literal>1900</literal>. In other words, <literal>05</literal> is understood
as year <literal>2005</literal>, <literal>80</literal> is understood as
<literal>1980</literal>.
</para><para>
Unspecified month or day default to <literal>1</literal>, unspecified
hours or minutes default to <literal>0</literal>.
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para><para>
The <function>timelocal()</function> function used in the filter comes from the
<classname>Time::Local</classname> &PERL; module.
__END__

__NAME__ online: Converting dates and times to seconds since Epoch
<programlisting><![CDATA[
[filter date2time]01/01/2005[/filter]    <br/>
[filter date2time]01/01/05[/filter]      <br/>
<br/>
[filter date2time]01-01-2005[/filter]    <br/>
[filter date2time]01-01-05[/filter]      <br/>
<br/>
[filter date2time]01-01-2005:10[/filter] <br/>
[filter date2time]01-01-05:1045[/filter] <br/>
]]></programlisting>
__END__



1.1                  xmldocs/refs/date_change.filter


rev 1.1, prev_rev 1.0
Index: date_change.filter
===================================================================
__NAME__ purpose
convert MMDDYYYY date (possibly with specified time) to YYYYMMDDhhmm
__END__


__NAME__ see also
date2time
__END__


__NAME__ description
The filter replaces date specification in form of
</para><para>
<literal><replaceable>MM</replaceable>[/-]<replaceable>DD</replaceable>[/-]<replaceable>YY(YY)?</replaceable>(:<replaceable>hh</replaceable>(<replaceable>mm</replaceable>)?)?</literal>
</para><para>
or
</para><para>
<literal><replaceable>YYYY</replaceable>[/-]<replaceable>MM</replaceable>[/-]<replaceable>DD</replaceable>(:<replaceable>hh</replaceable>(<replaceable>mm</replaceable>)?)?</literal>
</para><para>
to <literal><replaceable>YYYYMMDD</replaceable>((<replaceable>hh</replaceable>)?(<replaceable>mm</replaceable>)?)?</literal>.
</para><para>
If the year specification contains 2 digits only and is less than 
<literal>50</literal>, as is say, <literal>02</literal>, 
then it is treated as an offset from year <literal>2000</literal>, and not
<literal>1900</literal>. In other words, <literal>05</literal> is understood
as year <literal>2005</literal>, <literal>80</literal> is understood as year
<literal>1980</literal>.
</para><para>
Time specification unspecified in input get omitted from output as well.
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para><para>
The filter is most commonly used with date selection fields.
</para><para>
If only two out of four time digits are specified, then due to the operation
of the <function>sprintf()</function> function, they tend to indicate minutes
and not hours!
</para><para>
When the input data starts with year specification, the year must have
4-digit format (i.e. <literal>2005</literal> and
<emphasis role='bold'>not</emphasis> just <literal>05</literal>)!
__END__

__NAME__ online: Using date_change
<programlisting><![CDATA[
[filter date_change]2005-01-01[/filter]    <br/>
[filter date_change]2005/01/01[/filter]    <br/>
<br/>
[filter date_change]2005-01-01:10[/filter]    <br/>
[filter date_change]2005/05/29:1536[/filter]    <br/>
<br/>
[filter date_change]05-29-2005:1536[/filter]    <br/>
[filter date_change]05-29-05:1536[/filter]    <br/>
]]></programlisting>
__END__

__NAME__ missing
Example from real date widget
__END__



1.1                  xmldocs/refs/decode_entities.filter


rev 1.1, prev_rev 1.0
Index: decode_entities.filter
===================================================================
__NAME__ purpose
decode encoded HTML characters back to their normal representation
__END__

__NAME__ description
The filter decodes encoded &glos-HTML; characters back to their normal 
representation.
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para><para>
The filter is most commonly used as <literal>pre_filter</literal> in 
<database>mv_metadata</database> entries, for fields that contain 
characters from a character set other than iso8859-1.
</para><para>
For example, &amp;amp; is replaced with &amp;, &amp;lt; with &lt; etc.
__END__


__NAME__ online: Filter example
<programlisting>
[filter decode_entities]One &amp; Two &amp; Three[filter]
</programlisting>
__END__




1.1                  xmldocs/refs/digits.filter


rev 1.1, prev_rev 1.0
Index: digits.filter
===================================================================
__NAME__ purpose
eliminate non-digit characters
__END__

__NAME__ see also
digits_dot
__END__


__NAME__ description
The filter eliminates any non-digit characters (that is, anything that's not
in <literal>0-9</literal> range).
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
__END__


__NAME__ online: Filter example
<programlisting>
[filter digits]Only 2 digits should come out of this 1 line ;-)[/filter]
</programlisting>
__END__




1.1                  xmldocs/refs/digits_dot.filter


rev 1.1, prev_rev 1.0
Index: digits_dot.filter
===================================================================
__NAME__ purpose
eliminate non-digit characters, with the exception of a dot
__END__

__NAME__ see also
digits
__END__


__NAME__ description
The filter eliminates any non-digit characters, except a dot. (That is,
anything that's not a dot ("<literal>.</literal>") or
in a <literal>0-9</literal> range).
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
__END__


__NAME__ online: Filter example
<programlisting>
[filter digits_dot]Only the date should come out, and it is 03.06.1982[/filter]
</programlisting>
__END__




1.1                  xmldocs/refs/duration.filter


rev 1.1, prev_rev 1.0
Index: duration.filter
===================================================================
__NAME__ purpose
calculate end date from given start date and duration
__END__


__NAME__ see also
date2time,date_change
__END__


__NAME__ description
The filter takes a start date and a duration as inputs, and outputs
the end date.
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para><para>
The <function>timelocal()</function> function used in the filter comes from the
<classname>Time::Local</classname> &PERL; module.
__END__

__NAME__ online: Obtaining an end date string
The following example sets start date to Feb 12, 2005 (at 8:00 am),
and the duration to 12 hours. Filter output should return again, Feb 12, 2005,
but with the time set to 8:00 pm. So exactly, it should return 
<literal>200502122000</literal>.
<programlisting>
[cgi name=start_date set=200502120800 hide=1]
[cgi name=length     set="12 hours"   hide=1]
[filter op=duration.start_date.length /]
</programlisting>
__END__



1.1                  xmldocs/refs/encode_entities.filter


rev 1.1, prev_rev 1.0
Index: encode_entities.filter
===================================================================
__NAME__ purpose
encode non-standard HTML characters
__END__

__NAME__ description
The filter encodes non-standard &glos-HTML; characters to their encoded 
representation.
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para><para>
The filter is most commonly used to make untrusted &glos-CGI; input variables
harmless to the &IC; environment.
</para><para>
For example, &amp; is replaced with &amp;amp;, &lt; with &amp;lt; etc.
__END__


__NAME__ online: Filter example
<programlisting><![CDATA[
[filter encode_entities]One & Two & Three[filter]
]]></programlisting>
__END__




1.1                  xmldocs/refs/filesafe.filter


rev 1.1, prev_rev 1.0
Index: filesafe.filter
===================================================================
__NAME__ purpose
make sure the input is ready for use as a filename
__END__

__NAME__ see also
__END__


__NAME__ description
The filter makes sure (possibly by intervening) that the input string is
ready and safe to be used as a filename.
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
__END__


__NAME__ online: Filter example
Here's a hypothetical download filename from the <ulink url="http://www.archive.org/details/prelinger">Prelinger Collection</ulink> at <ulink url="http://www.archive.org/">archive.org</ulink>.
<programlisting>
[filter filesafe]/tmp/uploads/new_world_through_chemistry/new_world_through_chemistry_edit.mp4[/filter]
</programlisting>
__END__




1.1                  xmldocs/refs/gate.filter


rev 1.1, prev_rev 1.0
Index: gate.filter
===================================================================
__NAME__ purpose
return input verbatim if the specified Scratch variable exists, empty string otherwise
__END__

__NAME__ see also
__END__


__NAME__ description
The filter allows "conditional output" of the input string, based on the
value of a &glos-scratch; variable.
</para><para>
In other words, received input is passed through verbatim, if the specified
&glos-scratch; variable holds a &glos-true; value. Empty string is returned
otherwise.
__END__



__NAME__ online: Filter example
<programlisting>
[set tide]1[/set]

[filter gate.tide]The Gate is open.[/filter]
</programlisting>
__END__




1.1                  xmldocs/refs/html2text.filter


rev 1.1, prev_rev 1.0
Index: html2text.filter
===================================================================
__NAME__ purpose
transform input most basic HTML input to plain-text
__END__


__NAME__ description
The filter only replaces &glos-HTML; newlines and paragraphs with ASCII
equivalents (newlines or empty strings).
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
__END__


__NAME__ online: Filter example
<programlisting><![CDATA[
[filter html2text]
<p>
Perl is a lot of fun!
</p>
<p>
Interesting tricks with the language can be seen at: <br>
MJD's <a href="http://perl.plover.com/">plover.com</a>.
</p>
<p>
Programming is an art.
</p>
[/filter]
]]></programlisting>
__END__




1.1                  xmldocs/refs/integer.filter


rev 1.1, prev_rev 1.0
Index: integer.filter
===================================================================
__NAME__ purpose
simply return integer value of the input
__END__


__NAME__ description
The filter simply returns integer value of the input
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
__END__


__NAME__ online: Filter example
<programlisting>
[filter integer]12.4[filter] 
</programlisting>
__END__

__NAME__ online: Erase whitespace, filter out non-digits, and return integer part of the number
<programlisting>
The whole is:  [filter no_white digits_dot integer]Stock 904.82[filter] 
</programlisting>
__END__




1.1                  xmldocs/refs/large.filter


rev 1.1, prev_rev 1.0
Index: large.filter
===================================================================
__NAME__ purpose
enclose input in HTML &lt;large&gt; tag
__END__


__NAME__ see also
small
__END__


__NAME__ description
The filter encloses input data in &glos-HTML; &lt;large&gt; tag.
__END__


__NAME__ online: Filter example
<programlisting>
You can see that "[filter large] This text is larger than usual. [/filter]"
</programlisting>
__END__




1.1                  xmldocs/refs/line.filter


rev 1.1, prev_rev 1.0
Index: line.filter
===================================================================
__NAME__ purpose
output just the first line of input
__END__

__NAME__ see also
unix,dos,mac
__END__


__NAME__ description
The filter outputs just the first line of input.
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
__END__


__NAME__ online: Filter example
<programlisting>
[filter line]Line 1  (visible)
Line 2  (not visible)
Line 3  (not visible)
[/filter]
</programlisting>
__END__




1.1                  xmldocs/refs/pagefile.filter


rev 1.1, prev_rev 1.0
Index: pagefile.filter
===================================================================
__NAME__ purpose
make sure the input is ready for use as an Interchange page
__END__

__NAME__ see also
filesafe
__END__


__NAME__ description
The filter makes sure (possibly by intervening) that the input string is
ready and safe to be used as an &IC; page name.
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
__END__


__NAME__ online: Filter example
<programlisting>
[filter pagefile]report[/filter]
</programlisting>
__END__




1.1                  xmldocs/refs/sql.filter


rev 1.1, prev_rev 1.0
Index: sql.filter
===================================================================
__NAME__ purpose
replace quoting with SQL quoting
__END__

__NAME__ see also
__END__


__NAME__ description
The filter replaces single quotes (<literal>'</literal>) with 
"double" single quotes (<literal>''</literal>).
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
__END__


_NAME__ online: Filter example
<programlisting>
</programlisting>
_END__









More information about the docs mailing list