2 if(match(s,/^__docfor:(.*)/,data)){
9 lines[length(lines)] = s;
12 function emit_line() {
13 if (! line_done) emit(indent $0);
17 function emit_docfor(k) {
23 function emit_img(key) {
25 emit("![" key "][" key "]");
29 function done() { line_done = 1; }
31 function check_begin_docfor(s){
32 if (match(s,/^\(\*D\[([^\]]*)\]/,data)) {
33 curdocblock = data[1];
34 } else if (match(s,/^D\[([^\]]*)\]/,data)) {
35 curdocblock = data[1];
41 function store_docfor_if_docforblock(s) {
42 if (!line_done && curdocblock != "") {
43 docfor[curdocblock] = docfor[curdocblock] "\n" s;
51 refs["matita"] = "http://matita.cs.unibo.it";
60 match($0, "screenshot *\"([^\"]+)\"", data);
62 refs[key] = key ".png";
63 $0 = gensub(/\(\*\* *screenshot[^*]*\*\)/,"",$0);
70 # literate programming
72 check_begin_docfor($0);
77 check_begin_docfor($0);
91 store_docfor_if_docforblock($0);
100 print length(lines) > "/dev/stderr";
101 for (i =0; i< length(lines); i++){
102 print process(lines[i]);
105 print "[" i "]: " refs[i];