source: Tutorials/catalog.py @ 1741

Last change on this file since 1741 was 1705, checked in by toby, 9 years ago

load the tutorial web pages

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1# writes out approximate entries to put in GSASIIctrls tutorialCatalog
2import glob,os,re
3# make subdirectories in help & Exercises (trunk and MT)
4import subprocess
5import os
6cmd = 'svn propset svn:mime-type application/octet-stream '
7subprocess.call(cmd+'*/*/*.png',shell=True)
8subprocess.call(cmd+'*/*/*.jpg',shell=True)
9subprocess.call(cmd+'*/*/*.gif',shell=True)
10#
11cmd = ['svn','propset','svn:mime-type','text/html']
12cmd1 = ['svn','add']
13for f in glob.glob('*/*.htm'):
14    subprocess.call(cmd+[f])
15    for dr in ('../MT/help','../MT/Exercises','../GSASII/help/','../GSASII/Exercises/'):
16        d = os.path.join(dr,os.path.split(f)[0])
17        if not os.path.exists(d):
18            os.mkdir(d)
19            subprocess.call(cmd1+[d])
20for f in glob.glob('*/*.htm'):
21    p,n = os.path.split(f)
22   
23    fp = open(f,'r')
24    t = ''
25    for l in fp: 
26        if 'h1>' in l.lower(): t += l
27    fp.close()
28    t = re.sub('\n',' ',t)
29    t = re.sub('\r',' ',t)
30    t = re.sub('<.*?>','',t)
31    t = re.sub('  +',' ',t).strip()
32    print ("    ['"+p+"', '"+p+"', '"+n+"',\n       '"+t+"'],")
33   
Note: See TracBrowser for help on using the repository browser.