Skip to content

Commit

Permalink
Merge pull request #424 from ancho/feature/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies for 2.6.0
  • Loading branch information
manikmagar authored Mar 1, 2018
2 parents aac695e + d8b625f commit da3dab3
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 173 deletions.
30 changes: 15 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@ plugins {
id "eclipse"
id "idea"
id "io.sdkman.vendors" version "1.1.1" apply false
id "com.jfrog.bintray" version "1.7.3" apply false
id "com.github.kt3k.coveralls" version "2.8.1" apply false
id 'com.github.ben-manes.versions' version '0.15.0'
id "com.jfrog.bintray" version "1.8.0" apply false
id "com.github.kt3k.coveralls" version "2.8.2" apply false
id 'com.github.ben-manes.versions' version '0.17.0'
}

// common variables
ext {
asciidoctorjVersion = '1.5.6'
asciidoctorjDiagramVersion = '1.5.4.1'
commonsIoVersion = '2.5'
commonsIoVersion = '2.6'
commonsConfigurationVersion = '1.10'
commonsLangVersion = '3.6'
commonsVfs2Version = '2.1'
commonsLangVersion = '3.7'
commonsVfs2Version = '2.2'
args4jVersion = '2.33'
freemarkerVersion = '2.3.26-incubating'
freemarkerVersion = '2.3.27-incubating'
junit4Version = '4.12'
flexmarkVersion = '0.27.0'
jettyServerVersion = '9.2.22.v20170606'
orientDbVersion = '2.2.28'
groovyVersion = '2.4.12'
flexmarkVersion = '0.28.38'
jettyServerVersion = '9.2.24.v20180105'
orientDbVersion = '2.2.30'
groovyVersion = '2.4.13'
slf4jVersion = '1.7.25'
logbackVersion = '1.2.3'
assertjCoreVersion = '2.8.0'
thymeleafVersion = '3.0.7.RELEASE'
assertjCoreVersion = '2.9.0'
thymeleafVersion = '3.0.9.RELEASE'
jsonSimpleVersion = '1.1.1'
jade4jVersion = '1.2.5'
mockitoVersion = '2.10.0'
jade4jVersion = '1.2.7'
mockitoVersion = '2.13.0'
jsoupVersion = '1.10.3'
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ website=http://jbake.org
issues=https://github.com/jbake-org/jbake/issues
vcs=https://github.com/jbake-org/jbake/

jacocoVersion=0.7.9
jacocoVersion=0.8.0

bintrayDryRun=false
bintrayOrg=jbake
Expand Down
9 changes: 2 additions & 7 deletions jbake-core/src/main/java/org/jbake/app/ContentStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal;
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool;
import com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentPool;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.metadata.schema.OClass;
import com.orientechnologies.orient.core.metadata.schema.OSchema;
Expand All @@ -41,11 +40,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;

/**
* @author jdlee
Expand All @@ -63,7 +58,7 @@ public ContentStore(final String type, String name) {
pool.setAutoCreate(true);
db = pool.acquire();

ODatabaseRecordThreadLocal.INSTANCE.set(db);
ODatabaseRecordThreadLocal.instance().set(db);
updateSchema();
}

Expand Down
112 changes: 56 additions & 56 deletions jbake-core/src/main/java/org/jbake/parser/MarkupEngine.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
package org.jbake.parser;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.io.IOUtils;
import org.jbake.app.ConfigUtil.Keys;
Expand All @@ -21,10 +8,19 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
* Base class for markup engine wrappers. A markup engine is responsible for rendering
* markup in a source file and exporting the result into the {@link ParserContext#getContents() contents} map.
*
* <p>
* This specific engine does nothing, meaning that the body is rendered as raw contents.
*
* @author Cédric Champeau
Expand All @@ -35,46 +31,50 @@ public abstract class MarkupEngine implements ParserEngine {

/**
* Tests if this markup engine can process the document.
*
* @param context the parser context
* @return true if this markup engine has enough context to process this document. false otherwise
*/
public boolean validate(ParserContext context) { return true; }
public boolean validate(ParserContext context) {
return true;
}

/**
* Processes the document header. Usually subclasses will parse the document body and look for
* specific header metadata and export it into {@link ParserContext#getContents() contents} map.
*
* @param context the parser context
*/
public void processHeader(final ParserContext context) {}
public void processHeader(final ParserContext context) {
}

/**
* Processes the body of the document. Usually subclasses will parse the document body and render
* it, exporting the result using the {@link org.jbake.parser.ParserContext#setBody(String)} method.
*
* @param context the parser context
*/
public void processBody(final ParserContext context) {}
public void processBody(final ParserContext context) {
}

/**
* Parse given file to extract as much infos as possible
*
* @param file file to process
* @return a map containing all infos. Returning null indicates an error, even if an exception would be better.
*/
public Map<String, Object> parse(Configuration config, File file, String contentPath) {

Map<String,Object> content = new HashMap<String, Object>();
InputStream is = null;
public Map<String, Object> parse(Configuration config, File file, String contentPath) {

Map<String, Object> content = new HashMap<String, Object>();
List<String> fileContents = null;
try {
is = new FileInputStream(file);
try (InputStream is = new FileInputStream(file)) {

fileContents = IOUtils.readLines(is, config.getString(Keys.RENDER_ENCODING));
} catch (IOException e) {
LOGGER.error("Error while opening file {}", file, e);

return null;
} finally {
IOUtils.closeQuietly(is);
}

boolean hasHeader = hasHeader(fileContents);
ParserContext context = new ParserContext(
file,
Expand All @@ -91,30 +91,30 @@ public Map<String, Object> parse(Configuration config, File file, String content
}
// then read engine specific headers
processHeader(context);

if (content.get(Crawler.Attributes.DATE) == null) {
content.put(Crawler.Attributes.DATE, new Date(file.lastModified()));
content.put(Crawler.Attributes.DATE, new Date(file.lastModified()));
}

if (config.getString(Keys.DEFAULT_STATUS) != null) {
// default status has been set
if (content.get(Crawler.Attributes.STATUS) == null) {
// file hasn't got status so use default
content.put(Crawler.Attributes.STATUS, config.getString(Keys.DEFAULT_STATUS));
}
// default status has been set
if (content.get(Crawler.Attributes.STATUS) == null) {
// file hasn't got status so use default
content.put(Crawler.Attributes.STATUS, config.getString(Keys.DEFAULT_STATUS));
}
}

if (config.getString(Keys.DEFAULT_TYPE) != null) {
// default type has been set
// default type has been set
if (content.get(Crawler.Attributes.TYPE) == null) {
// file hasn't got type so use default
content.put(Crawler.Attributes.TYPE, config.getString(Keys.DEFAULT_TYPE));
}
}

if (content.get(Crawler.Attributes.TYPE)==null||content.get(Crawler.Attributes.STATUS)==null) {
if (content.get(Crawler.Attributes.TYPE) == null || content.get(Crawler.Attributes.STATUS) == null) {
// output error
LOGGER.warn("Error parsing meta data from header (missing type or status value) for file {}!", file);
LOGGER.warn("Error parsing meta data from header (missing type or status value) for file {}!", file);
return null;
}

Expand All @@ -129,21 +129,21 @@ public Map<String, Object> parse(Configuration config, File file, String content
return null;
}

if (content.get(Crawler.Attributes.TAGS) != null) {
String[] tags = (String[]) content.get(Crawler.Attributes.TAGS);
for( int i=0; i<tags.length; i++ ) {
tags[i]=tags[i].trim();
if (content.get(Crawler.Attributes.TAGS) != null) {
String[] tags = (String[]) content.get(Crawler.Attributes.TAGS);
for (int i = 0; i < tags.length; i++) {
tags[i] = tags[i].trim();
if (config.getBoolean(Keys.TAG_SANITIZE)) {
tags[i]=tags[i].replace(" ", "-");
tags[i] = tags[i].replace(" ", "-");
}
}
content.put(Crawler.Attributes.TAGS, tags);
}

// TODO: post parsing plugins to hook in here?

return content;
}
}

/**
* Checks if the file has a meta-data header.
Expand All @@ -160,9 +160,9 @@ private boolean hasHeader(List<String> contents) {
List<String> header = new ArrayList<String>();

for (String line : contents) {
if (!line.isEmpty()){
header.add(line);
}
if (!line.isEmpty()) {
header.add(line);
}
if (line.contains("=")) {
if (line.startsWith("type=")) {
typeFound = true;
Expand Down Expand Up @@ -193,8 +193,8 @@ private boolean hasHeader(List<String> contents) {

/**
* Process the header of the file.
* @param config
*
* @param config
* @param contents Contents of file
* @param content
*/
Expand All @@ -205,20 +205,20 @@ private void processHeader(Configuration config, List<String> contents, final Ma
}

if (line.isEmpty()) {
continue;
continue;
}
String[] parts = line.split("=",2);

String[] parts = line.split("=", 2);
if (parts.length != 2) {
continue;
}

String utf8BOM = "\uFEFF";
String key;
if (parts[0].contains(utf8BOM)) {
key = parts[0].trim().replace(utf8BOM, "");
key = parts[0].trim().replace(utf8BOM, "");
} else {
key = parts[0].trim();
key = parts[0].trim();
}
String value = parts[1].trim();

Expand All @@ -243,8 +243,8 @@ private void processHeader(Configuration config, List<String> contents, final Ma

private String[] getTags(String tagsPart) {
String[] tags = tagsPart.split(",");
for( int i=0; i<tags.length; i++ )
tags[i]=tags[i].trim();
for (int i = 0; i < tags.length; i++)
tags[i] = tags[i].trim();
return tags;
}

Expand Down Expand Up @@ -275,7 +275,7 @@ private void processBody(List<String> contents, final Map<String, Object> conten
body.append(line).append("\n");
}
}

content.put(Crawler.Attributes.BODY, body.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
import org.jbake.app.ConfigUtil.Keys;
import org.jbake.app.ContentStore;
import org.jbake.app.FileUtil;
import org.jbake.model.DocumentTypeUtils;
import org.jbake.model.DocumentTypes;
import org.jbake.template.model.PublishedCustomExtractor;
import org.jbake.template.model.TypedDocumentsExtractor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Loading

0 comments on commit da3dab3

Please sign in to comment.