mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-11 12:19:00 +00:00
There is no more HtAccess
This commit is contained in:
1 parent
405985dd25
commit
1be3857dfe
1 file changed
-37
@@ -252,24 +252,11 @@ public class WebsiteMaker {
|
||||
convertDownloadEdge(freemarkerConfig, out);
|
||||
}
|
||||
|
||||
public void buildHtAccess(File out) throws Exception {
|
||||
Configuration freemarkerConfig = new Configuration(Configuration.VERSION_2_3_25);
|
||||
freemarkerConfig.setEncoding(Locale.ENGLISH, "UTF-8");
|
||||
freemarkerConfig.setOutputEncoding("UTF-8");
|
||||
freemarkerConfig.setOutputFormat(HTMLOutputFormat.INSTANCE);
|
||||
freemarkerConfig.setTemplateLoader(createLoader("extra"));
|
||||
freemarkerConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
|
||||
|
||||
outputDir.mkdirs();
|
||||
convertHtAccess(freemarkerConfig, out);
|
||||
}
|
||||
|
||||
public void buildWebsite(Domain domain, boolean newRelease) throws Exception {
|
||||
Configuration freemarkerConfig = makeFreemarkerConfig();
|
||||
|
||||
outputDir.mkdirs();
|
||||
convertTemplates(domain, freemarkerConfig, newRelease);
|
||||
buildHtAccess(new File(outputDir, ".htaccess"));
|
||||
}
|
||||
|
||||
private TemplateLoader createLoader() throws IOException {
|
||||
@@ -280,30 +267,6 @@ public class WebsiteMaker {
|
||||
return new FileTemplateLoader(new File(baseDir, base));
|
||||
}
|
||||
|
||||
private void convertHtAccess(Configuration freemarker, File outFile) throws Exception {
|
||||
Map<String, Object> dataModel = new HashMap<String, Object>();
|
||||
dataModel.put("setupPages", listHtmlNames(new File(outputDir, "setup")));
|
||||
dataModel.put("featurePages", listHtmlNames(new File(outputDir, "features")));
|
||||
dataModel.put("experimentalPages", listHtmlNames(new File(outputDir, "features/experimental")));
|
||||
Template template = freemarker.getTemplate("htaccess");
|
||||
FileOutputStream fileOut = new FileOutputStream(outFile);
|
||||
try {
|
||||
Writer wr = new BufferedWriter(new OutputStreamWriter(fileOut, "UTF-8"));
|
||||
template.process(dataModel, wr);
|
||||
wr.close();
|
||||
} finally {
|
||||
fileOut.close();
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> listHtmlNames(File dir) {
|
||||
List<String> out = new ArrayList<String>();
|
||||
for (String s : dir.list()) {
|
||||
if (s.endsWith(".html") && !s.equals("index.html")) out.add(s.substring(0, s.length() - 5));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private void convertChangelog(Configuration freemarker, File outFile) throws Exception {
|
||||
Map<String, Object> dataModel = createBasicDataModel();
|
||||
|
||||
|
||||
Reference in new issue
Block a user