source: trunk/SRC/Utilities/mergeonline_help.pro @ 378

Last change on this file since 378 was 325, checked in by pinsard, 17 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

  • Property svn:keywords set to Id
File size: 7.3 KB
Line 
1;+
2;
3; @file_comments
4; Have one unique online help for IDL and SAXO
5;
6; @categories
7; Documentation
8;
9; @restrictions
10; Needs at least version 6.2
11;
12; @history
13; Sept 2006: Sebastien Masson (smasson\@lodyc.jussieu.fr)
14;
15; @version
16; $Id$
17;
18;-
19PRO mergeonline_help
20;
21  compile_opt idl2, strictarrsubs
22;
23; is the IDL version at least 6.2 ?
24  idlversion = float(strmid(!version.release, 0, 3))
25  IF idlversion LT 6.2 THEN BEGIN
26    ras = report('Warning: You need at least IDL 6.2 to use SAXO/IDL merged online help')
27    return
28  ENDIF
29;---------------------------------------------------------------
30; check directories
31;---------------------------------------------------------------
32; get the environment variable $HOME
33  home = getenv('HOME')
34; is it defined?
35  IF home EQ '' THEN return
36; is $HOME a writable directory?
37  home = (file_search(home, /test_directory, /test_write, /mark_directory))[0]
38  IF home EQ '' THEN return
39
40; is !dir + '/help/online_help a directory ?
41  homeidl = !dir + '/help/online_help'
42  homeidl = (file_search(homeidl, /test_directory, /mark_directory))[0]
43  IF homeidl EQ '' THEN return
44
45; is $HOME/.assistant a directory ? if not, create it
46  homeassist = home + '.assistant'
47  IF file_test(homeassist, /directory) EQ 0 THEN file_mkdir, homeassist
48; is $HOME/.assistant a writable directory?
49  homeassist = (file_search(homeassist, /test_directory, /test_write, /mark_directory))[0]
50  IF homeassist EQ '' THEN return
51; is $HOME/.assistant/src a directory ? if not, create it?
52  homesrc = homeassist + 'src'
53  IF file_test(homesrc, /directory) EQ 0 THEN file_mkdir, homesrc
54; is $HOME/.assistant/src a writable directory?
55  homesrc = (file_search(homesrc, /test_directory, /test_write, /mark_directory))[0]
56  IF homesrc EQ '' THEN return
57
58  homesaxo = file_dirname((find('buildinit.pro'))[0], /mark_directory) + 'Documentation/idldoc_assistant_output/'
59  IF file_test(homesaxo + 'idldoc-lib.adp') EQ 0 THEN BEGIN
60    print, 'Error when looking for the file '+ homesaxo + 'idldoc-lib.adp...'
61    return
62  ENDIF
63;---------------------------------------------------------------
64; check existence and version of the file that need to be created
65;---------------------------------------------------------------
66
67; do idl.adp and home.html already exists?
68  IF file_test(homesrc + 'home.html') AND file_test(homesrc + 'idl.adp') $
69     AND file_test(homesrc + 'aboutsaxo.txt') THEN BEGIN
70; is the revision version of homesrc+'idl.adp' the same of homesaxo + 'idldoc-lib.adp' ?
71; is $Id found in homesrc+'idl.adp'
72    idladp = getfile(homesrc+'idl.adp')
73    line = strmatch(idladp, '*$Id*')
74    line = (where(line EQ 1))[0]
75    IF line NE -1 THEN BEGIN
76      new = idladp[line]
77; is $Id  found in homesaxo + 'idldoc-lib.adp'
78      saxoadp = getfile(homesaxo + 'idldoc-lib.adp')
79      line = strmatch(saxoadp, '*$Id*')
80      line = (where(line EQ 1))[0]
81      IF line NE -1 THEN BEGIN
82        old = saxoadp[line]
83; are the 2 revision tags the same ?
84        IF array_equal(old, new) THEN BEGIN
85; is IDL version the same of homesrc + 'home.html' ?
86          homehtml = getfile(homesrc+'home.html')
87          line = strmatch(homehtml, '*IDL '+ string(idlversion, format = '(f3.1)') + '*')
88          line = (where(line EQ 1))[0]
89          IF line NE -1 THEN  BEGIN
90            !help_path = homesrc
91            print, 'Use SAXO/IDL merged online help...'
92            return
93          ENDIF
94        ENDIF
95      ENDIF
96    ENDIF
97  ENDIF
98;---------------------------------------------------------------
99; build homesrc + 'idl.adp'
100;---------------------------------------------------------------
101; --- modify the original idl.adp ---
102  idladp = getfile(homeidl+'idl.adp')
103; extract part from </profile> to </assistantconfig>
104  line1 = strmatch(idladp, '*</profile>*')
105  line1 = (where(line1 EQ 1))[0]
106  line2 = strmatch(idladp, '*</assistantconfig>*')
107  line2 = (where(line2 EQ 1))[0] - 1L
108  idladp = idladp[line1:line2]
109; put the complete path of the references
110  idladp = strsed(idladp, 'ref=\"', 'ref="'+homeidl)
111; --- modify the original idldoc-lib.adp ---
112  saxoadp = getfile(homesaxo + 'idldoc-lib.adp')
113; extract part from </profile>
114  line1 = strmatch(saxoadp, '*</profile>*')
115  line1 = (where(line1 EQ 1))[0] + 1
116  saxoadp = saxoadp[line1:*]
117; put the complete path of the references
118  saxoadp = strsed(saxoadp, 'ref=\"', 'ref="'+homesaxo)
119; --- merge idl.adp and idldoc-lib.adp, add an header and write it in a new file ---
120  header = ['<!DOCTYPE DCF>' $
121            , '<assistantconfig version="3.3.0">' $
122            , '   <profile>' $
123            , '      <property name="name">SAXO - IDL ' + !version.release + ' Help</property>' $
124            , '      <property name="title">SAXO - IDL ' + !version.release + ' Help</property>' $
125            , '      <property name="startpage">' + homesrc + 'home.html</property>' $
126            , '      <property name="aboutmenutext">About SAXO</property>' $
127            , '      <property name="abouturl">' + homesrc + 'aboutsaxo.txt</property>' $
128            , '      <property name="assistantdocs">' + homeidl + '</property>']
129  newadp = [temporary(header), temporary(idladp), temporary(saxoadp)]
130;
131  putfile, homesrc + 'idl.adp', temporary(newadp)
132;---------------------------------------------------------------
133; build homesrc + 'home.html'
134;---------------------------------------------------------------
135  homehtml = getfile(homeidl+'home.html')
136; put the complete path of the references
137  homehtml = strsed(homehtml, 'ref=\"', 'ref="'+homeidl)
138; find the first line containing '</h3>'
139  line = strmatch(homehtml, '*</h3>*')
140  line = (where(line EQ 1))[0]
141; insert one line after this line
142  homehtml = [homehtml[0:line] $
143              , '<a name="SAXOdir"> </a><p class="pIndentedRelative"><img src="images/blueball_idl.gif" id="blueballSAXOdir" border="0" hspace="0" vspace="0"/> &#160;&#160;<a href="' + homesaxo + 'home.html">SAXO Directory</a></p>' $
144              , homehtml[line+1:*]]
145; find the last line containing '</h3>'
146  line = strmatch(homehtml, '*</h3>*')
147  line = (where(line EQ 1, cnt))[cnt-1]
148; insert one line after this line
149  homehtml = [homehtml[0:line] $
150              , '<a name="SAXOweb"> </a><p class="pIndentedRelative"><img src="images/blueball_idl.gif" id="blueballSAXOweb" border="0" hspace="0" vspace="0"/> &#160;&#160;<a href="http://forge.ipsl.jussieu.fr/saxo">SAXO Home Page</a> </p>' $
151              , homehtml[line+1:*]]
152
153; put the complete path of the images
154  homehtml = strsed(homehtml, 'src=\"', 'src="'+homeidl)
155; except for SAXOIDL_OnlineHelp_title.png
156  parent = path_sep(/parent_directory)+path_sep()
157  homehtml = strsed(homehtml, 'src=\".*IDL_OnlineHelp_Title\.gif\"', 'src="' + homesaxo + parent + 'xmldoc/images/SAXOIDL_OnlineHelp_title.png"')
158;
159  putfile, homesrc + 'home.html', temporary(homehtml)
160;---------------------------------------------------------------
161; build homesrc + 'aboutsaxo.txt'
162;---------------------------------------------------------------
163  about = getfile(homesaxo + parent + parent + 'overview')
164; remove the lines containing @
165  lines = strmatch(about, '@*')
166  about = about[where(lines EQ 0)]
167; add some informattions:
168  about = [about, '', 'More informations on', 'http://forge.ipsl.jussieu.fr/saxo', '']
169;
170  putfile, homesrc + 'aboutsaxo.txt', temporary(about)
171;---------------------------------------------------------------
172  ras = report('Merge of SAXO and IDL online help done...')
173  !help_path = homesrc
174;
175  RETURN
176  END
Note: See TracBrowser for help on using the repository browser.