ldionne / reveal-sampler

A reveal.js plugin to fetch code samples from source files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Concatenate multiple snippets with the same sample id

ldionne opened this issue · comments

Let's say I have a file

// ... some setup

// sample(main)
struct Foo { };
// end-sample

// some code that shouldn't appear in the sample

// sample(main)
struct Bar { };
// end-sample

This could create a sample main whose content is

struct Foo { };
struct Bar { };

i.e. the content of both samples, concatenated. This could be useful for e.g. not having to define stuff in a main function all the time:

// sample(main)
struct Foo { };
// end-sample

int main() {
// sample(main)
Foo foo;
// end-sample
}

Right now, we have to include the whole main() function in the sample.