review-preproc User Guide
Re:VIEW has a preprocessor, review-preproc
. It can embed a (part of) file into *.re files.
#@mapfile
#@mapfile
The code below is a sample of embedding code from scripts/hello.rb
.
#@mapfile(filename)
and #@end
are markers for preprocessor. You can embed and update the content of the file filename
into Re:VIEW file with review-preproc
command.
First, add #@mapfile()
and #@end
on the document.
Then execute review-preproc
command. The command display the result on stdout.
With --replace
option, review-preproc
replaces the Re:VIEW file.
If you use rake
to build Re:VIEW document, you can add the code to Rakefile to define a task of review-preproc
.
Then, you can execute preprocessor with rake
.
#@maprange
#@maprange
You also can embed a part of the target file with #@maprange
marker.
Add #@range_begin(ID)
and #@range_end
in the target file you want to embed. In #@range_begin(ID)
, you must add ID as parameger to identify the part.
In the code below, sample
is the ID of the range to embed.
In *.re file, add #@maprange(filename,ID)
, instead of #@mapfile(filename)
, and #@end
.
After that, execute review-preproc
or rake preproc
, and you get the *.re files embedded the hello
method in scripts/range.rb
.
#@@maprange
#@@maprange
But in some language, a line #@range_begin
is not a comment. If you want to embed some code of such languages, you can use new markers #@@range_begin
and #@@range_end
into a comment in the target document.
Let's explain how to do. A target file range.c
is below:
There are markers #@@range_begin
and #@@range_end
around put_hello
method.
In *.re
, add #@maprange(scripts/range.c,sample)
and #@end
.
With review-preproc
, we get the result of conversion like below:
Last updated