Changeset 192 for trunk/SRC/Utilities
- Timestamp:
- 09/22/06 11:37:08 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Utilities/mergeonline_help.pro
r177 r192 23 23 compile_opt idl2, strictarrsubs 24 24 ; 25 ; Are we using a "Unix" machine?26 IF !d.name NE 'X' THEN return27 25 ; is the IDL version at least 6.2 ? 28 IF float(strmid(!version.release, 0, 3)) LT 6.2 THEN return 26 IF float(strmid(!version.release, 0, 3)) LT 6.2 THEN BEGIN 27 print, 'Warning: You need at least IDL 6.2 to use SAXO/IDL merged online help' 28 return 29 ENDIF 30 ;--------------------------------------------------------------- 31 ; check directories 32 ;--------------------------------------------------------------- 29 33 ; get the environment variable $HOME 30 34 home = getenv('HOME') … … 34 38 home = (file_search(home, /test_directory, /test_write, /mark_directory))[0] 35 39 IF home EQ '' THEN return 40 41 ; is !dir + '/help/online_help a directory ? 42 homeidl = !dir + '/help/online_help' 43 homeidl = (file_search(homeidl, /test_directory, /mark_directory))[0] 44 IF homeidl EQ '' THEN return 45 36 46 ; is $HOME/.assistant a directory ? if not, create it 37 47 homeassist = home + '.assistant' … … 40 50 homeassist = (file_search(homeassist, /test_directory, /test_write, /mark_directory))[0] 41 51 IF homeassist EQ '' THEN return 42 ; is "$HOME/.assistant/src a directory ? if not, create it?52 ; is $HOME/.assistant/src a directory ? if not, create it? 43 53 homesrc = homeassist + 'src' 44 54 IF file_test(homesrc, /directory) EQ 0 THEN file_mkdir, homesrc … … 46 56 homesrc = (file_search(homesrc, /test_directory, /test_write, /mark_directory))[0] 47 57 IF homesrc EQ '' THEN return 58 59 homesaxo = file_dirname(find('buildinit.pro'), /mark_directory) + 'Documentation/idldoc_assistant_output/' 60 IF file_test(homesaxo + 'idldoc-lib.adp') EQ 0 THEN BEGIN 61 print, 'Error when looking for the file '+ homesaxo + 'idldoc-lib.adp...' 62 return 63 ENDIF 64 ;--------------------------------------------------------------- 65 ; check existance and version of the file that need to be created 66 ;--------------------------------------------------------------- 67 48 68 ; do idl.adp and home.html already exists? 49 69 IF file_test(homesrc + 'home.html') AND file_test(homesrc + 'idl.adp') $ 50 AND file_test(homesrc + 'aboutsaxo.txt') THEN BEGIN 51 !help_path = homesrc 52 return 70 AND file_test(homesrc + 'aboutsaxo.txt') THEN BEGIN 71 ; is the revision version of homesrc+'idl.adp' the same of homesaxo + 'idldoc-lib.adp' ? 72 ; is $Id found in homesrc+'idl.adp' 73 idladp = getfile(homesrc+'idl.adp') 74 line = strmatch(idladp, '*$Id*') 75 line = (where(line EQ 1))[0] 76 IF line NE -1 THEN BEGIN 77 new = idladp[line] 78 ; is $Id found in homesaxo + 'idldoc-lib.adp' 79 saxoadp = getfile(homesaxo + 'idldoc-lib.adp') 80 line = strmatch(saxoadp, '*$Id*') 81 line = (where(line EQ 1))[0] 82 IF line NE -1 THEN BEGIN 83 old = saxoadp[line] 84 ; are the 2 revision tags the same?? 85 IF array_equal(old, new) THEN BEGIN 86 !help_path = homesrc 87 print, 'Use SAXO/IDL merged online help...' 88 return 89 ENDIF 90 ENDIF 91 ENDIF 53 92 ENDIF 54 ; create idl.adp and home.html 55 homeidladp = !dir + '/help/online_help' 56 IF file_test(homeidladp + '/idl.adp') EQ 0 THEN BEGIN 57 print, 'Error when looking for the file '+homeidladp + '/idl.adp ...' 58 print, 'Check the value or your environment variable $IDL_DIR that defines !dir' 59 return 60 ENDIF 61 homesaxoadp = file_dirname(find('buildinit.pro'), /mark_directory) + 'Documentation/idldoc_assistant_output' 62 ; 63 spawn, homesaxoadp + '/../xmldoc/mergeonline_help.sh' $ 64 + ' ' + homeidladp $ 65 + ' ' + homesaxoadp $ 66 + ' ' + homesrc $ 67 + ' ' + !version.release $ 68 , /sh, exit_status = err 93 ;--------------------------------------------------------------- 94 ; build homesrc + 'idl.adp' 95 ;--------------------------------------------------------------- 96 ; --- modify the original idl.adp --- 97 idladp = getfile(homeidl+'idl.adp') 98 ; extract part from </profile> to </assistantconfig> 99 line1 = strmatch(idladp, '*</profile>*') 100 line1 = (where(line1 EQ 1))[0] 101 line2 = strmatch(idladp, '*</assistantconfig>*') 102 line2 = (where(line2 EQ 1))[0] - 1L 103 idladp = idladp[line1:line2] 104 ; put the complete path of the references 105 idladp = strsed(idladp, 'ref=\"', 'ref="'+homeidl) 106 ; --- modify the original idldoc-lib.adp --- 107 saxoadp = getfile(homesaxo + 'idldoc-lib.adp') 108 ; extract part from </profile> 109 line1 = strmatch(saxoadp, '*</profile>*') 110 line1 = (where(line1 EQ 1))[0] + 1 111 saxoadp = saxoadp[line1:*] 112 ; put the complete path of the references 113 saxoadp = strsed(saxoadp, 'ref=\"', 'ref="'+homesaxo) 114 ; --- merge idl.adp and idldoc-lib.adp, add an header and write it in a new file --- 115 header = ['<!DOCTYPE DCF>' $ 116 , '<assistantconfig version="3.3.0">' $ 117 , ' <profile>' $ 118 , ' <property name="name">SAXO - IDL ' + !version.release + ' Help</property>' $ 119 , ' <property name="title">SAXO - IDL ' + !version.release + ' Help</property>' $ 120 , ' <property name="startpage">' + homesrc + 'home.html</property>' $ 121 , ' <property name="aboutmenutext">About SAXO</property>' $ 122 , ' <property name="abouturl">' + homesrc + 'aboutsaxo.txt</property>' $ 123 , ' <property name="assistantdocs">' + homeidl + '</property>'] 124 newadp = [temporary(header), temporary(idladp), temporary(saxoadp)] 69 125 ; 70 IF err EQ 0 THEN !help_path = homesrc 126 putfile, homesrc + 'idl.adp', temporary(newadp) 127 ;--------------------------------------------------------------- 128 ; build homesrc + 'home.html' 129 ;--------------------------------------------------------------- 130 homehtml = getfile(homeidl+'home.html') 131 ; put the complete path of the references 132 homehtml = strsed(homehtml, 'ref=\"', 'ref="'+homeidl) 133 ; find the first line containing '</h3>' 134 line = strmatch(homehtml, '*</h3>*') 135 line = (where(line EQ 1))[0] 136 ; insert one line after this line 137 homehtml = [homehtml[0:line] $ 138 , '<a name="SAXOdir"> </a><p class="pIndentedRelative"><img src="images/blueball_idl.gif" id="blueballSAXOdir" border="0" hspace="0" vspace="0"/>   <a href="' + homesaxo + 'home.html">SAXO Directory</a></p>' $ 139 , homehtml[line+1:*]] 140 ; find the last line containing '</h3>' 141 line = strmatch(homehtml, '*</h3>*') 142 line = (where(line EQ 1, cnt))[cnt-1] 143 ; insert one line after this line 144 homehtml = [homehtml[0:line] $ 145 , '<a name="SAXOweb"> </a><p class="pIndentedRelative"><img src="images/blueball_idl.gif" id="blueballSAXOweb" border="0" hspace="0" vspace="0"/>   <a href="http://forge.ipsl.jussieu.fr/saxo">SAXO Home Page</a> </p>' $ 146 , homehtml[line+1:*]] 147 148 ; put the complete path of the images 149 homehtml = strsed(homehtml, 'src=\"', 'src="'+homeidl) 150 ; except for SAXOIDL_OnlineHelp_title.png 151 homehtml = strsed(homehtml, 'src=\".*IDL_OnlineHelp_Title\.gif\"', 'src="' + homesaxo + '../xmldoc/images/SAXOIDL_OnlineHelp_title.png"') 152 ; 153 putfile, homesrc + 'home.html', temporary(homehtml) 154 ;--------------------------------------------------------------- 155 ; build homesrc + 'aboutsaxo.txt' 156 ;--------------------------------------------------------------- 157 about = getfile(homesaxo + '../../overview') 158 ; remove the lines containing @ 159 lines = strmatch(about, '@*') 160 about = about[where(lines EQ 0)] 161 ; add some informattions: 162 about = [about, '', 'More informations on', 'http://forge.ipsl.jussieu.fr/saxo', ''] 163 ; 164 putfile, homesrc + 'aboutsaxo.txt', temporary(about) 165 ;--------------------------------------------------------------- 166 print, 'Merge of SAXO and IDL online help done...' 167 !help_path = homesrc 71 168 ; 72 169 RETURN
Note: See TracChangeset
for help on using the changeset viewer.