Dont generate html if it exists and is newer
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113880 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
' Word2HTML.vbs
|
||||
' $Id: word2html.vbs,v 1.4 2003/06/29 13:39:02 dion Exp $
|
||||
' $Id: word2html.vbs,v 1.5 2003/08/28 05:15:09 dion Exp $
|
||||
Option Explicit
|
||||
|
||||
' Creates the output directories to the same depth as the inputFile specified
|
||||
@@ -39,11 +39,23 @@ Function CreateOutputDirectories(inBaseDir, inputFile, outBaseDir)
|
||||
CreateOutputDirectories = folder
|
||||
End Function
|
||||
|
||||
Function ExportAsHTML(inputFile, outputFile)
|
||||
Dim obj, HTMLFormat, wdDoNotSaveChanges
|
||||
Set obj = WScript.CreateObject("Word.Application")
|
||||
HTMLFormat = 8
|
||||
wdDoNotSaveChanges = 0
|
||||
|
||||
obj.Visible = FALSE
|
||||
obj.Documents.Open inputFile,,True
|
||||
obj.ActiveDocument.SaveAs outputFile, HTMLFormat
|
||||
obj.Quit wdDoNotSaveChanges
|
||||
|
||||
End Function
|
||||
|
||||
' Main chunk of code
|
||||
Dim basedir, FileSys, HTMLFormat, inputFile, obj, outputDir, outputFile
|
||||
Dim basedir, FileSys, inputFile, outputDir, outputFile
|
||||
On Error Resume Next
|
||||
|
||||
HTMLFormat = 8
|
||||
' work out the directory structure for the input file
|
||||
Set FileSys = WScript.CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
@@ -57,11 +69,15 @@ basedir = FileSys.GetAbsolutePathName(WScript.Arguments(2))
|
||||
outputFile = CreateOutputDirectories(basedir, inputFile, outputDir) & "\" & _
|
||||
FileSys.GetBaseName(inputFile) & ".html"
|
||||
|
||||
Set obj = WScript.CreateObject("Word.Application")
|
||||
|
||||
obj.Visible = FALSE
|
||||
obj.Documents.Open inputFile,,True
|
||||
obj.ActiveDocument.SaveAs outputFile, HTMLFormat
|
||||
Dim wdDoNotSaveChanges
|
||||
wdDoNotSaveChanges = 0
|
||||
obj.Quit wdDoNotSaveChanges
|
||||
' check if output file exists and is newer than input file
|
||||
' if it is, skip output
|
||||
If FileSys.Exists(outputFile) Then
|
||||
Dim fileOutput, fileInput
|
||||
Set fileOutput = FileSys.GetFile(outputFile)
|
||||
Set fileInput = FileSys.GetFile(inputFile)
|
||||
If fileOutput.DateLastModified < fileInput.DateLastModified Then
|
||||
ExportAsHTML inputFile, outputFile
|
||||
End If
|
||||
Else
|
||||
ExportAsHTML inputFile, outputFile
|
||||
End If
|
||||
Reference in New Issue
Block a user