summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/mpman-ru/extract-bm.awk
blob: 6518c72b9cc5fd3efab811dd769fc522d2974cad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
  p=index($0,"{")
}

/^[^%]section\{/ {
  noss=0
  nos++
  sub("\\\\MF","Metafont",$0)
  s=substr($0,p+1,index($0,"}")-p-1)
  printf "\\BOOKMARK [1][-]{section."
  if (nos < 16) 
   print nos "}{" s "}{}"
  else
   printf "%c%s\n", nos+49, "}{" s "}{}"
}

/^[^%]subsection\{/ {
  noss++
  gsub("\\\\texttt\{|\\\\-|\{\}","",$0)
  gsub("\\\\","",$0)
  s=substr($0,p,index($0,"}")-p)
  print "\\BOOKMARK [2][-]{subsection." nos "." noss "}{" s "}{section." nos "}"
}