@@ -4,7 +4,7 @@ Context managers for SWI Prolog
4
4
Synopsis
5
5
--------
6
6
7
- ```
7
+ ``` prolog
8
8
?- use_module(library(with)).
9
9
10
10
% IO streams automatically closed
@@ -78,7 +78,7 @@ goals must succeed. If they fail, the error
78
78
For example, the provided manage_context/3 clause
79
79
for opening files could be defined:
80
80
81
- ```
81
+ ``` prolog
82
82
with:manage_context(open(File, Mode, Stream),
83
83
open(File, Mode, Stream),
84
84
close(Stream)).
@@ -87,7 +87,7 @@ with:manage_context(open(File, Mode, Stream),
87
87
88
88
The result is that the following are equivalent:
89
89
90
- ```
90
+ ``` prolog
91
91
?- setup_call_cleanup(open(File, read, Stream),
92
92
is_stream(Stream),
93
93
close(Stream)).
@@ -100,7 +100,7 @@ The result is that the following are equivalent:
100
100
To show defined context managers, using ``` listing/1 ``` . E.g, the
101
101
context managers packaged with this module are:
102
102
103
- ```
103
+ ``` prolog
104
104
?- use_module(library(with)), listing(with:manage_context/3).
105
105
106
106
manage_context(open(A, C, D), (absolute_file_name(A, B), open(B, C, D)), close(D)).
@@ -114,7 +114,7 @@ Installation
114
114
115
115
Using SWI-Prolog 6.3 or later:
116
116
117
- ```
117
+ ``` prolog
118
118
?- pack_install(with).
119
119
120
120
```
0 commit comments