pike.git / src / modules / Image / mkdoc.pike

version» Context lines:

pike.git/src/modules/Image/mkdoc.pike:1:   import Stdio;   import Array;      mapping parse=([]); + int illustration_counter;    -  + string illustration_code=read_bytes("illustration.pike"); + object lena_image=Image.image()->fromppm(read_file("doc/lena.ppm")); +    /*      module : mapping <- moduleM    "desc" : text    "see also" : array of references    "note" : mapping of "desc": text    "classes" : mapping    class : mapping <- classM    "see also" : array of references    "desc" : text
pike.git/src/modules/Image/mkdoc.pike:171:    exit(1);    }    return f;   }      string fixdesc(string s,string prefix)   {    s=stripws(s);       string t,u,v; +     t=s; s="";    while (sscanf(t,"%s<ref>%s</ref>%s",t,u,v)==3)    {    s+=t+make_nice_reference(u,prefix);    t=v;    }    s+=t; -  +  +  t=s; s=""; +  while (sscanf(t,"%s<illustration>%s</illustration>%s",t,u,v)==3) +  { +  s+=t; +  mixed err=catch { +  object x=compile_string(replace(illustration_code,"***the string***",u))(); +  x->lena_image=lena_image; +  u=x->doit("illustration_"+illustration_counter+++".gif"); +  }; +  if (err) +  { +  stderr->write("error while compiling and running\n"+u+"\n"); +  } +  else s+=u; +  t=v; +  } +  s+=t; +     return htmlify(replace(s,"\n\n","\n\n<p>"));   }      string standard_doc(mapping info,string myprefix)   {    string res="";       if (info->desc && stripws(info->desc)!="")    res+="\n\n<blockquote>\n"+fixdesc(info->desc,myprefix)+    "\n</blockquote>\n";