1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-08 08:39:26 +03:00
juvix/test/BackendMarkdown
Paul Cadman 52a3eed162
Support extract-module-statements attribute in juvix code blocks (#2734)
This PR adds support for the `extract-module-statements` attribute for
Juvix code blocks:

So if you write something like the following block in a Juvix markdown
file:

````
```juvix extract-module-statements
module Foo;
   type T := t;
end;
```
````

The statement `type T := t;` from the body of the module is rendered in
the output. The `module Foo;` , and `end;` lines are not rendered in the
output.

A block with the `extract-module-statements` must contain a single local
module statement and nothing else. An error is reported if this is not
the case.

The `extract-module-statements` attribute also takes an optional
argument. It sets the number of statements from the module body to drop
from the output.

In the following example, the output will contain the single line `a : T
:= t;`.

````
```juvix extract-module-statements 1
module Foo;
   type T := t;
   a : T  := t;
end;
```
````

---------

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2024-04-18 17:01:59 +01:00
..
Negative.hs Support extract-module-statements attribute in juvix code blocks (#2734) 2024-04-18 17:01:59 +01:00
Positive.hs Add flags for the markdown and html backend: --strip-prefix and --ext. (#2681) 2024-03-09 18:42:09 +01:00