Revision 2288 tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy

XTZPager.groovy (revision 2288)
74 74
		}
75 75

  
76 76
		def second = 0
77
		def texts = module.getProject().getTexts()
78
		println "-- Building 'default' edition of  ${texts.size()} texts..."
77
		def texts = orderedTextIDs.collect() { id -> module.getProject().getText(id) }
78
		def textsToProcess = texts.findAll() { text ->
79
			File txmFile = text.getXMLTXMFile()
80
			File firstHTMLPageFile = new File(outputDirectory, text.getName()+"_1.html");
81
			boolean mustBuild = false;
82
			if (!firstHTMLPageFile.exists() || txmFile.lastModified() >= firstHTMLPageFile.lastModified()) {
83
				return true
84
			}
85
				
86
			if (!text.isDirty() && !mustBuild) {
87
				Log.finer("skipping 'default html' step of $text");
88
				return false
89
			}
90
			
91
			return true
92
		}
93
		println "-- Building 'default' edition of ${textsToProcess.size()}/${texts.size()} texts..."
79 94

  
80 95
		def css = ["css/txm.css", "css/${corpusname}.css"] // default CSS inclusion
81 96

  
......
90 105
			}
91 106
		}
92 107

  
93
		ConsoleProgressBar cpb = new ConsoleProgressBar(texts.size())
94
		for (Text text : texts) {
108
		ConsoleProgressBar cpb = new ConsoleProgressBar(textsToProcess.size())
109
		for (Text text : textsToProcess) {
95 110

  
96 111
			File txmFile = text.getXMLTXMFile()
97 112
			try {
......
99 114

  
100 115
				String textname = text.getName()
101 116

  
102
				File firstHTMLPageFile = new File(outputDirectory, textname+"_1.html");
103
				boolean mustBuild = false;
104
				if (!firstHTMLPageFile.exists() || txmFile.lastModified() >= firstHTMLPageFile.lastModified()) {
105
					mustBuild = true
106
				}
107
				
108
				if (!text.isDirty() && !mustBuild) {
109
					Log.finer("skipping 'default html' step of $text");
110
					continue
111
				}
112

  
113 117
				Edition edition = text.getEdition("default")
114 118
				if (edition != null) {
115 119
					edition.delete()
......
161 165
		}
162 166

  
163 167
		// save changes
164
		println ""
165 168
		return true;
166 169
	}
167 170

  
......
183 186

  
184 187
		def second = 0
185 188

  
186
		def texts = module.getProject().getTexts()
189
		def texts = orderedTextIDs.collect() { id -> module.getProject().getText(id) }
187 190
		println "-- Building 'facs' edition of ${texts.size()} texts..."
188 191
		File newEditionDirectory = new File(htmlDirectory, "facs");
189 192
		newEditionDirectory.mkdir();

Also available in: Unified diff