[petsc-dev] Manual figures are messed up
Barry Smith
bsmith at mcs.anl.gov
Thu Oct 8 12:50:42 CDT 2015
I can't image this would work because \\begin{verbatim} is not a token. Plus if decrease for each } you will exit the verbatim "safe" zone as soon as you hit a }
Barry
> On Oct 8, 2015, at 9:54 AM, Stefano Zampini <stefano.zampini at gmail.com> wrote:
>
> What about the patch in attachment?
>
> 2015-10-08 1:54 GMT+03:00 Barry Smith <bsmith at mcs.anl.gov>:
>
> > On Sep 30, 2015, at 7:46 AM, Stefano Zampini <stefano.zampini at gmail.com> wrote:
> >
> > I just noticed that Figures 19 and 20 in the manual (current release and master) are messed up. The htmlmap process seems not to work properly.
>
> The tool /bin/maint/mapnameslatex.py is what looks through the tokens in the .tex files and replaces PETSc functions etc with an href. Unfortunately it is simple minded. It should turn off replacement when it detects a \begin{verbatim} and turn it back on when it hits the \end{verbatim} here is the entire engine
>
> while 1:
> token = lex.token() # Get a token
> if not token: break # No more tokens
> if token.type == 'NEWLINE':
> print text
> text = ''
> else:
> # \href cannot be used in many places in Latex
> if token.value in ['\\href{','\\findex{','\\sindex{','\\subsection{','\\chapter{','\\section{','\\caption{','\\trl{']:
> bracket = bracket + 1;
> if bracket == 0:
> value = token.value
> if mappedstring.has_key(value):
> mvalue = mappedstring[value].replace('_','\\_')
> value = '\\href{'+'http://www.mcs.anl.gov/petsc/petsc-'+version+'/docs/'+mappedlink[value]+'}{'+mvalue+'}\\findex{'+value+'}'
> else:
> value = token.value
> if token.value[0] == '}' and bracket:
> bracket = bracket - 1;
> text = text+value
>
> You want to take a crack at fixing it? Because I don't really feel like it :-(
>
> Barry
>
>
>
> >
> > --
> > Stefano
>
>
>
>
> --
> Stefano
> <patch_manual>
More information about the petsc-dev
mailing list