Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: java
jdk:
- openjdk8
before_script: cd Source/MarkdownGenerator
after_success:
- bash <(curl -s https://codecov.io/bash)
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Java Markdown Generator
[![Travis](https://img.shields.io/travis/Steppschuh/Java-Markdown-Generator.svg)](https://travis-ci.org/Steppschuh/Java-Markdown-Generator/) [![Bintray](https://api.bintray.com/packages/steppschuh/Markdown-Generator/Markdown-Generator/images/download.svg) ](https://bintray.com/steppschuh/Markdown-Generator/Markdown-Generator/_latestVersion) [![Maven Central](https://img.shields.io/maven-central/v/net.steppschuh.markdowngenerator/markdowngenerator.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22net.steppschuh.markdowngenerator%22) [![Codecov](https://img.shields.io/codecov/c/github/Steppschuh/Java-Markdown-Generator.svg)](https://codecov.io/gh/Steppschuh/Java-Markdown-Generator)
[![Travis](https://img.shields.io/travis/Steppschuh/Java-Markdown-Generator.svg)](https://travis-ci.org/Steppschuh/Java-Markdown-Generator/) [![JitPack](https://img.shields.io/jitpack/v/Steppschuh/Java-Markdown-Generator.svg)](https://jitpack.io/#Steppschuh/Java-Markdown-Generator)
[![Bintray](https://api.bintray.com/packages/steppschuh/Markdown-Generator/Markdown-Generator/images/download.svg) ](https://bintray.com/steppschuh/Markdown-Generator/Markdown-Generator/_latestVersion) [![Maven Central](https://img.shields.io/maven-central/v/net.steppschuh.markdowngenerator/markdowngenerator.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22net.steppschuh.markdowngenerator%22) [![Codecov](https://img.shields.io/codecov/c/github/Steppschuh/Java-Markdown-Generator.svg)](https://codecov.io/gh/Steppschuh/Java-Markdown-Generator)

Simple to use Java library to generate beautiful markdown.

Expand All @@ -10,14 +11,26 @@ Simple to use Java library to generate beautiful markdown.
## Integration

### Gradle

You can get snapshot and release builds from [JitPack](https://jitpack.io/#Steppschuh/Java-Markdown-Generator):

```groovy
repositories {
maven {
url "http://dl.bintray.com/steppschuh/Markdown-Generator"
}
maven { url 'https://jitpack.io' }
}
dependencies {
compile 'com.github.Steppschuh:Java-Markdown-Generator:master-SNAPSHOT'
}
```

Alternatively, release builds are also available on [Bintray](https://bintray.com/steppschuh/Markdown-Generator/Markdown-Generator/):

```groovy
repositories {
maven { url 'http://dl.bintray.com/steppschuh/Markdown-Generator' }
}
dependencies {
compile 'net.steppschuh.markdowngenerator:markdowngenerator:1.3.1.1'
compile 'net.steppschuh.markdowngenerator:markdowngenerator:1.3.2'
}
```

Expand All @@ -26,7 +39,7 @@ dependencies {
<dependency>
<groupId>net.steppschuh.markdowngenerator</groupId>
<artifactId>markdowngenerator</artifactId>
<version>1.3.1.1</version>
<version>1.3.2</version>
</dependency>
```

Expand Down
2 changes: 2 additions & 0 deletions Source/MarkdownGenerator/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Source/MarkdownGenerator/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 14 additions & 9 deletions Source/MarkdownGenerator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

plugins {
id "com.jfrog.bintray" version "1.7.3"
id "com.jfrog.bintray" version "1.8.5"
}

allprojects {
Expand All @@ -17,14 +17,19 @@ allprojects {
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'java'
apply plugin: "jacoco"
apply plugin: 'jacoco'
jacoco {
toolVersion = '0.8.5'
}
}

def libraryVersion = '1.3.2'

group 'net.steppschuh.markdowngenerator'
version = '1.3.1.1'
version = libraryVersion

sourceCompatibility = 1.7
targetCompatibility = 1.7
sourceCompatibility = 1.8
targetCompatibility = 1.8

def pomConfig = {
licenses {
Expand Down Expand Up @@ -56,7 +61,7 @@ publishing {
artifact javadocJar
groupId 'net.steppschuh.markdowngenerator'
artifactId 'markdowngenerator'
version '1.3.1.1'
version "${libraryVersion}"
pom.withXml {
def root = asNode()
root.appendNode('description', 'Java library to generate markdown')
Expand All @@ -82,10 +87,10 @@ bintray {
githubRepo = 'Steppschuh/Java-Markdown-Generator'
githubReleaseNotesFile = 'README.md'
version {
name = '1.3.1.1'
desc = 'Markdown Generator 1.3.1.1'
name = "${libraryVersion}"
desc = "Markdown Generator ${libraryVersion}"
released = new Date()
vcsTag = '1.3.1.1'
vcsTag = "${libraryVersion}"
gpg {
sign = true
}
Expand Down
Binary file modified Source/MarkdownGenerator/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Tue Jul 14 14:30:46 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
zipStoreBase=GRADLE_USER_HOME
72 changes: 42 additions & 30 deletions Source/MarkdownGenerator/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions Source/MarkdownGenerator/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public class Table extends MarkdownElement {

public static final String SEPERATOR = "|";
public static final String SEPARATOR = "|";
public static final String WHITESPACE = " ";
public static final String DEFAULT_TRIMMING_INDICATOR = "~";
public static final int DEFAULT_MINIMUM_COLUMN_WIDTH = 3;
Expand All @@ -25,7 +25,7 @@ public class Table extends MarkdownElement {

private List<TableRow> rows;
private List<Integer> alignments;
private boolean firstRowIsHeader = true;
private boolean firstRowIsHeader;
private int minimumColumnWidth = DEFAULT_MINIMUM_COLUMN_WIDTH;
private String trimmingIndicator = DEFAULT_TRIMMING_INDICATOR;

Expand Down Expand Up @@ -108,15 +108,15 @@ public String serialize() {

StringBuilder sb = new StringBuilder();

String headerSeperator = generateHeaderSeperator(columnWidths, alignments);
String headerSeparator = generateHeaderSeparator(columnWidths, alignments);
boolean headerSeperatorAdded = !firstRowIsHeader;
if (!firstRowIsHeader) {
sb.append(headerSeperator).append(System.lineSeparator());
sb.append(headerSeparator).append(System.lineSeparator());
}

for (TableRow row : rows) {
for (int columnIndex = 0; columnIndex < columnWidths.size(); columnIndex++) {
sb.append(SEPERATOR);
sb.append(SEPARATOR);

String value = "";
if (row.getColumns().size() > columnIndex) {
Expand All @@ -138,16 +138,16 @@ public String serialize() {
sb.append(value);

if (columnIndex == row.getColumns().size() - 1) {
sb.append(SEPERATOR);
sb.append(SEPARATOR);
}
}

if (rows.indexOf(row) < rows.size() - 1) {
if (rows.indexOf(row) < rows.size() - 1 || rows.size() == 1) {
sb.append(System.lineSeparator());
}

if (!headerSeperatorAdded) {
sb.append(headerSeperator).append(System.lineSeparator());
sb.append(headerSeparator).append(System.lineSeparator());
headerSeperatorAdded = true;
}
}
Expand All @@ -170,8 +170,8 @@ public Table trim(int rowsToKeep) {
* Removes {@link TableRow}s from the center of the specified table until only the requested
* amount of rows is left.
*
* @param table Table to remove {@link TableRow}s from
* @param rowsToKeep Amount of {@link TableRow}s that should not be removed
* @param table Table to remove {@link TableRow}s from
* @param rowsToKeep Amount of {@link TableRow}s that should not be removed
* @param trimmingIndicator The content that trimmed cells should be filled with
* @return The trimmed table
*/
Expand Down Expand Up @@ -200,10 +200,10 @@ public static Table trim(Table table, int rowsToKeep, String trimmingIndicator)
return table;
}

public static String generateHeaderSeperator(Map<Integer, Integer> columnWidths, List<Integer> alignments) {
public static String generateHeaderSeparator(Map<Integer, Integer> columnWidths, List<Integer> alignments) {
StringBuilder sb = new StringBuilder();
for (int columnIndex = 0; columnIndex < columnWidths.entrySet().size(); columnIndex++) {
sb.append(SEPERATOR);
sb.append(SEPARATOR);

String value = StringUtil.fillUpLeftAligned("", "-", columnWidths.get(columnIndex));

Expand All @@ -225,7 +225,7 @@ public static String generateHeaderSeperator(Map<Integer, Integer> columnWidths,

sb.append(value);
if (columnIndex == columnWidths.entrySet().size() - 1) {
sb.append(SEPERATOR);
sb.append(SEPARATOR);
}
}
return sb.toString();
Expand Down
Loading