Skip to content

Commit

Permalink
add jdk8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
subchen committed Mar 25, 2014
1 parent cc9ab52 commit f9aadd1
Show file tree
Hide file tree
Showing 27 changed files with 325 additions and 212 deletions.
21 changes: 11 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
*.class

# Package Files #
*.war
*.ear

# Build Directorys #
/.gradle
/build
/bin
*.class

# Package Files #
*.war
*.ear

# Build Directorys #
/.gradle
/build
/bin
*.log
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 2.1.0 (2014-03-25)
-----------------------------

* javadoc 8 support


Version 2.0.0 (2013-11-16)
-----------------------------

Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
javadoc.chm
http://subchen.github.io/javadoc.chm/

Copyright 2010-2013 Guoqiang Chen. All rights reserved.
Copyright 2010-2014 Guoqiang Chen. All rights reserved.
Email: [email protected]

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This software generates an Microsoft HTML Help(CHM) from generic javadoc style API documents.
It's a easy way to search something from javadoc with pre-compiled full text index.

Javadoc.chm can identify the new doc style for java 7.0+.
Javadoc.chm can identify the new doc style for java 8.0+.

# Requirements

Expand All @@ -14,7 +14,7 @@ Javadoc.chm can identify the new doc style for java 7.0+.

Download binary jar

https://github.com/subchen/javadoc.chm/raw/master/dist/javadoc.chm-2.0.0.jar
https://github.com/subchen/javadoc.chm/raw/master/dist/javadoc.chm-2.1.0.jar

Generates HTML Help project files

Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'java'

sourceCompatibility = 1.6
targetCompatibility = 1.6
version = '2.0.0'
version = '2.1.0'

defaultTasks 'runtimejar'

Expand Down Expand Up @@ -36,7 +36,6 @@ task runtimejar(dependsOn: jar) {
//zipgroupfileset(dir: 'lib', includes: '*.jar')
zipgroupfileset(dir: 'build/libs', includes: '**/*.jar')
}

}
}

2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
maven.group.id = com.github.subchen
maven.artifact.id = javadoc.chm
maven.version = 2.0.0
maven.version = 2.1.0

product.name = ${maven.artifact.id}
product.version = ${maven.version}
Expand Down
Binary file not shown.
10 changes: 10 additions & 0 deletions run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set classpath=%classpath%;lib/commons-collections-3.2.1.jar
set classpath=%classpath%;lib/commons-io-2.4.jar
set classpath=%classpath%;lib/commons-lang-2.6.jar
set classpath=%classpath%;lib/commons-logging-1.1.1.jar
set classpath=%classpath%;lib/log4j-1.2.17.jar
set classpath=%classpath%;lib/velocity-1.7.jar
set classpath=%classpath%;build/javadoc.chm-2.1.0.jar

java -Xms512m -Xmx512m jerbrick.tools.chm.Application D:/Downloads/jdk-8-apidocs/docs/api utf-8

104 changes: 54 additions & 50 deletions src/main/java/jerbrick/tools/chm/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* javadoc.chm
* http://subchen.github.io/javadoc.chm/
*
* Copyright 2010-2013 Guoqiang Chen. All rights reserved.
* Copyright 2010-2014 Guoqiang Chen. All rights reserved.
* Email: [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,53 +17,57 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jerbrick.tools.chm;

import java.io.File;
import java.io.IOException;
import java.util.Map;
import jerbrick.tools.chm.reader.ApiReader;
import jerbrick.tools.chm.style.Javadoc7Style;
import org.apache.commons.io.FileUtils;

public class Application {

public static void main(String[] args) throws Exception {
if (args.length > 0) {
Config.apiLocation = new File(args[0]);
}
if (args.length > 1) {
Config.encoding = args[1];
}

if (new File(Config.apiLocation, "resources/background.gif").exists()) {
Config.style = new Javadoc7Style();
}

clean();

ApiReader api = new ApiReader();
Map<String, Object> apiContext = api.getApiContext();

TemplateWriter writer = new TemplateWriter();
writer.apply(apiContext);
}

private static void clean() throws IOException {
File f = new File(Config.apiLocation, "htmlhelp.hhp");
if (f.exists()) f.delete();
f = new File(Config.apiLocation, "htmlhelp.hhc");
if (f.exists()) f.delete();
f = new File(Config.apiLocation, "htmlhelp.hhk");
if (f.exists()) f.delete();
f = new File(Config.apiLocation, "build.bat");
if (f.exists()) f.delete();
f = new File(Config.apiLocation, "hhc.exe");
if (f.exists()) f.delete();
f = new File(Config.apiLocation, "hha.dll");
if (f.exists()) f.delete();
f = new File(Config.apiLocation, "redirs/");
if (f.exists()) FileUtils.deleteDirectory(f);
}

package jerbrick.tools.chm;

import java.io.File;
import java.io.IOException;
import java.util.Map;
import jerbrick.tools.chm.reader.ApiReader;
import jerbrick.tools.chm.style.*;
import org.apache.commons.io.FileUtils;

public class Application {

public static void main(String[] args) throws Exception {
if (args.length > 0) {
Config.apiLocation = new File(args[0]);
}
if (args.length > 1) {
Config.encoding = args[1];
}

if (new File(Config.apiLocation, "resources/fonts").exists()) {
Config.style = new Javadoc8Style();
} else if (new File(Config.apiLocation, "resources/background.gif").exists()) {
Config.style = new Javadoc7Style();
} else {
Config.style = new JavadocStyle();
}

clean();

ApiReader api = new ApiReader();
Map<String, Object> apiContext = api.getApiContext();

TemplateWriter writer = new TemplateWriter();
writer.apply(apiContext);
}

private static void clean() throws IOException {
File f = new File(Config.apiLocation, "htmlhelp.hhp");
if (f.exists()) f.delete();
f = new File(Config.apiLocation, "htmlhelp.hhc");
if (f.exists()) f.delete();
f = new File(Config.apiLocation, "htmlhelp.hhk");
if (f.exists()) f.delete();
f = new File(Config.apiLocation, "build.bat");
if (f.exists()) f.delete();
f = new File(Config.apiLocation, "hhc.exe");
if (f.exists()) f.delete();
f = new File(Config.apiLocation, "hha.dll");
if (f.exists()) f.delete();
f = new File(Config.apiLocation, "redirs/");
if (f.exists()) FileUtils.deleteDirectory(f);
}

}
2 changes: 1 addition & 1 deletion src/main/java/jerbrick/tools/chm/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* javadoc.chm
* http://subchen.github.io/javadoc.chm/
*
* Copyright 2010-2013 Guoqiang Chen. All rights reserved.
* Copyright 2010-2014 Guoqiang Chen. All rights reserved.
* Email: [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/jerbrick/tools/chm/TemplateWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* javadoc.chm
* http://subchen.github.io/javadoc.chm/
*
* Copyright 2010-2013 Guoqiang Chen. All rights reserved.
* Copyright 2010-2014 Guoqiang Chen. All rights reserved.
* Email: [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/jerbrick/tools/chm/model/ClassInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* javadoc.chm
* http://subchen.github.io/javadoc.chm/
*
* Copyright 2010-2013 Guoqiang Chen. All rights reserved.
* Copyright 2010-2014 Guoqiang Chen. All rights reserved.
* Email: [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/jerbrick/tools/chm/model/FieldInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* javadoc.chm
* http://subchen.github.io/javadoc.chm/
*
* Copyright 2010-2013 Guoqiang Chen. All rights reserved.
* Copyright 2010-2014 Guoqiang Chen. All rights reserved.
* Email: [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/jerbrick/tools/chm/model/MethodInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* javadoc.chm
* http://subchen.github.io/javadoc.chm/
*
* Copyright 2010-2013 Guoqiang Chen. All rights reserved.
* Copyright 2010-2014 Guoqiang Chen. All rights reserved.
* Email: [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/jerbrick/tools/chm/model/PackageInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* javadoc.chm
* http://subchen.github.io/javadoc.chm/
*
* Copyright 2010-2013 Guoqiang Chen. All rights reserved.
* Copyright 2010-2014 Guoqiang Chen. All rights reserved.
* Email: [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* javadoc.chm
* http://subchen.github.io/javadoc.chm/
*
* Copyright 2010-2013 Guoqiang Chen. All rights reserved.
* Copyright 2010-2014 Guoqiang Chen. All rights reserved.
* Email: [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/jerbrick/tools/chm/reader/ApiReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* javadoc.chm
* http://subchen.github.io/javadoc.chm/
*
* Copyright 2010-2013 Guoqiang Chen. All rights reserved.
* Copyright 2010-2014 Guoqiang Chen. All rights reserved.
* Email: [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
27 changes: 15 additions & 12 deletions src/main/java/jerbrick/tools/chm/reader/IndexesReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* javadoc.chm
* http://subchen.github.io/javadoc.chm/
*
* Copyright 2010-2013 Guoqiang Chen. All rights reserved.
* Copyright 2010-2014 Guoqiang Chen. All rights reserved.
* Email: [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,23 +19,23 @@
*/
package jerbrick.tools.chm.reader;

import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import jerbrick.tools.chm.Config;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import jerbrick.tools.chm.Config;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;

public class IndexesReader {

private Map<String, KeyManager> keyManagerMaps = new HashMap<String, KeyManager>();
private Map<String, KeyManager> keyManagerMaps = new HashMap<String, KeyManager>(256);

public Map<String, String> getIndexes(File resource) throws IOException {
Pattern p = Config.style.getIndexRegex();
Matcher m = p.matcher(FileUtils.readFileToString(resource, Config.encoding));

Map<String, String> indexMaps = new HashMap<String, String>(512);
Map<String, String> indexMaps = new HashMap<String, String>(1024);
while (m.find()) {
addIndex(indexMaps, m.group(2), m.group(1));
}
Expand All @@ -48,10 +48,13 @@ private void addIndex(Map<String, String> indexMaps, String text, String url) th
urlToUse = StringUtils.remove(urlToUse, "../");
urlToUse = StringUtils.remove(urlToUse, "./");

if (text.indexOf('(') < 0 && url.indexOf('#') < 0) {
if (url.indexOf('#') < 0) {
key = text + " class";
} else {
} else {
key = StringUtils.substringBefore(text, "(");
if (text.indexOf('(') != -1) {
key = key + "()";
}

String textToUse = StringUtils.substringBefore(urlToUse, ".html");
textToUse = textToUse.replace('/', '.') + "." + text;
Expand Down
Loading

0 comments on commit f9aadd1

Please sign in to comment.