File: buildman.g

package info (click to toggle)
gap-openmath 11.2.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 612 kB
  • ctags: 3
  • sloc: xml: 456; sh: 72; makefile: 11
file content (106 lines) | stat: -rw-r--r-- 3,340 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
###########################################################################
##
#W    buildman.g             OpenMath Package           Alexander Konovalov
##                                                      
###########################################################################


ExtractMyManualExamples:=function( pkgname, main, files )
local path, tst, i, s, name, output, ch, a;
path:=Directory( 
        Concatenation(PackageInfo(pkgname)[1].InstallationPath, "/doc") );
Print("Extracting manual examples for ", pkgname, " package ...\n" );
tst:=ExtractExamples( path, main, files, "Chapter" );
Print(Length(tst), " chapters detected\n");
for i in [ 1 .. Length(tst) ] do 
  Print( "Chapter ", i, " : \c" );
  if Length( tst[i] ) > 0 then
    s := String(i);
    if Length(s)=1 then 
      # works for <100 chapters
      s:=Concatenation("0",s); 
    fi;
    name := Filename( 
              Directory( 
                Concatenation( PackageInfo(pkgname)[1].InstallationPath, 
                               "/tst" ) ), 
                Concatenation( LowercaseString(pkgname), s, ".tst" ) );
    output := OutputTextFile( name, false ); # to empty the file first
    SetPrintFormattingStatus( output, false ); # to avoid line breaks
    ch := tst[i];
    AppendTo(output, "# ", pkgname, ", chapter ",i,"\n");
    for a in ch do
      AppendTo(output, "\n# ",a[2], a[1]);
    od;
    Print("extracted ", Length(ch), " examples \n");
  else
    Print("no examples \n" );    
  fi;  
od;
end;

###########################################################################

OPENMATHMANUALFILES:=[ 
"../PackageInfo.g", 
"../gap/omget.gd",
"../gap/omput.gd",
"../gap/test.gd" 
];

###########################################################################
##
##  OPENMATHBuildManual()
##
OPENMATHBuildManual:=function()
local mypath, path, main, files, f, bookname;
mypath := GAPInfo.PackagesInfo.("openmath")[1].InstallationPath;
path:=Concatenation( mypath, "/doc/");
main:="manual.xml";
bookname:="openmath";
MakeGAPDocDoc( path, main, OPENMATHMANUALFILES, bookname );  
CopyHTMLStyleFiles( path );
GAPDocManualLab( "openmath" );; 
ExtractMyManualExamples( "openmath", main, OPENMATHMANUALFILES);
end;


###########################################################################
##
##  OPENMATHBuildManualForGAP44()
##
OPENMATHBuildManualForGAP44:=function()
local mypath, path, main, files, f, bookname;
mypath := GAPInfo.PackagesInfo.("openmath")[1].InstallationPath;
path:=Concatenation( mypath, "/doc/");
main:="manual.xml";
bookname:="openmath";
MakeGAPDocDoc( path, main, OPENMATHMANUALFILES, bookname );  
GAPDocManualLab( "openmath" );; 
end;


###########################################################################
##
##  OPENMATHBuildManualHTML()
##
OPENMATHBuildManualHTML:=function()
local path, main, files, str, r, h;
path:=Concatenation(
        GAPInfo.PackagesInfo.("openmath")[1].InstallationPath, "/doc/");
main:="manual.xml";
str:=ComposedXMLString( path, main, OPENMATHMANUALFILES );
r:=ParseTreeXMLString( str );
CheckAndCleanGapDocTree( r );
h:=GAPDoc2HTML( r, path );
GAPDoc2HTMLPrintHTMLFiles( h, path );
end;

###########################################################################

OPENMATHBuildManual();

###########################################################################
##
#E
##