Prolog "markup"

         
/**
* Warranty & Liability
* To the extent permitted by applicable law and unless explicitly
* otherwise agreed upon, XLOG Technologies AG makes no warranties
* regarding the provided information. XLOG Technologies AG assumes
* no liability that any problems might be solved with the information
* provided by XLOG Technologies AG.
*
* Rights & License
* All industrial property rights regarding the information - copyright
* and patent rights in particular - are the sole property of XLOG
* Technologies AG. If the company was not the originator of some
* excerpts, XLOG Technologies AG has at least obtained the right to
* reproduce, change and translate the information.
*
* Reproduction is restricted to the whole unaltered document. Reproduction
* of the information is only allowed for non-commercial uses. Selling,
* giving away or letting of the execution of the library is prohibited.
* The library can be distributed as part of your applications and libraries
* for execution provided this comment remains unchanged.
*
* Restrictions
* Only to be distributed with programs that add significant and primary
* functionality to the library. Not to be distributed with additional
* software intended to replace any components of the library.
*
* Trademarks
* Jekejeke is a registered trademark of XLOG Technologies AG.
*/
:- multifile(runner_case/5).
:- discontiguous(runner_case/5).
:- multifile(runner_pred/5).
:- discontiguous(runner_pred/5).
:- multifile(runner_file/3).
runner_file(common, markup, 'XLOG 3.3 markup streams').
/****************************************************************/
/* Ascii Sink */
/****************************************************************/
/* tag(A) */
runner_pred(tag,1, common, markup, 'XLOG 3.3.1').
runner_case(tag,1, common, markup, 'XLOG 3.3.1, XLOG 1') :-
open_output_atom_stream(S),
tag(S, '<span class="vr">'), write(S, 'foo'), tag(S, '</span>'),
close_output_atom_stream(S, X),
X == '\33\[38;2;0;136;136mfoo\33\[39m'.
runner_case(tag,1, common, markup, 'XLOG 3.3.1, XLOG 2') :-
open_output_atom_stream(S),
tag(S, '&amp;'),
close_output_atom_stream(S, X),
X == '&' .
runner_case(tag,1, common, markup, 'XLOG 3.3.1, XLOG 3') :-
open_output_atom_stream(S),
tag(S, 'John <i>Doe</i>'),
close_output_atom_stream(S, X),
X == 'John \33\[3mDoe\33\[23m'.
runner_case(tag,1, common, markup, 'XLOG 3.3.1, XLOG 4') :-
open_output_atom_stream(S),
catch(tag(S, '<foo'), error(E,_), true),
E == syntax_error(missing_angle).
/* tag_format(T, L) */
runner_pred(tag_format,2, common, markup, 'XLOG 3.3.2').
runner_case(tag_format,2, common, markup, 'XLOG 3.3.2, XLOG 1') :-
open_output_atom_stream(S),
tag_format(S, '<a href="~a">~a</a>', ['<>', '<>']),
close_output_atom_stream(S, X),
X == '\33\]8;;&lt;&gt;\33\\\<>\33\]8;;\33\\\'.
/****************************************************************/
/* XML Sink */
/****************************************************************/
/* dom_output_new(S, W) */
runner_pred(dom_output_new,2, common, markup, 'XLOG 3.3.3').
runner_case(dom_output_new,2, common, markup, 'XLOG 3.3.3, XLOG 1') :-
open_output_atom_stream(S), dom_output_new(S, W),
write(W, 'foo<bar>baz'),
flush_output(W), sys_output_atom_stream_get(S, X),
X == 'foo&lt;bar&gt;baz'.
runner_case(dom_output_new,2, common, markup, 'XLOG 3.3.3, XLOG 2') :-
open_output_atom_stream(S), dom_output_new(S, W),
tag(W, '<p>'), write(W, 'foo'), tag(W, '</p>'),
flush_output(W), sys_output_atom_stream_get(S, X),
X == '<p>foo</p>\n'.

Use Privacy (c) 2005-2026 XLOG Technologies AG