
org.jnario.doc.HtmlAssets Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.jnario.standalone Show documentation
Show all versions of org.jnario.standalone Show documentation
The required libraries to execute Jnario specifications without Eclipse.
The newest version!
/**
* Copyright (c) 2012 BMW Car IT and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.jnario.doc;
import com.google.inject.Singleton;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.xtend.lib.Data;
import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.generator.IFileSystemAccessExtension2;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.ListExtensions;
import org.eclipse.xtext.xbase.lib.util.ToStringHelper;
import org.jnario.doc.DocOutputConfigurationProvider;
import org.jnario.util.Strings;
@Data
@Singleton
@SuppressWarnings("all")
public class HtmlAssets {
private final List _cssFiles = ListExtensions.map(CollectionLiterals.newArrayList(
"bootstrap.min.css",
"bootstrap-responsive.min.css",
"custom.css",
"prettify.css"), new Function1() {
public String apply(final String it) {
return ("css/" + it);
}
});
public List getCssFiles() {
return this._cssFiles;
}
private final List _jsFiles = ListExtensions.map(CollectionLiterals.newArrayList(
"prettify.js",
"lang-jnario.js",
"jquery.js",
"bootstrap-tab.js"), new Function1() {
public String apply(final String it) {
return ("js/" + it);
}
});
public List getJsFiles() {
return this._jsFiles;
}
public void generate(final IFileSystemAccess fsa) {
List _cssFiles = this.getCssFiles();
this.copy(fsa, _cssFiles);
List _jsFiles = this.getJsFiles();
this.copy(fsa, _jsFiles);
}
private void copy(final IFileSystemAccess fsa, final Iterable files) {
final Function1 _function = new Function1() {
public Boolean apply(final String it) {
boolean _exists = HtmlAssets.this.exists(fsa, it);
return Boolean.valueOf((!_exists));
}
};
Iterable _filter = IterableExtensions.filter(files, _function);
for (final String file : _filter) {
String _load = this.load(file);
fsa.generateFile(file, DocOutputConfigurationProvider.ASSET_OUTPUT, _load);
}
}
private boolean exists(final IFileSystemAccess fsa, final String file) {
if ((!(fsa instanceof IFileSystemAccessExtension2))) {
return false;
}
final IFileSystemAccessExtension2 fsa2 = ((IFileSystemAccessExtension2) fsa);
final URI uri = fsa2.getURI(file, DocOutputConfigurationProvider.ASSET_OUTPUT);
Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy