plugins {
	id 'org.asciidoctor.convert' version '1.5.3'
}

apply plugin: 'java'
apply plugin: 'org.asciidoctor.convert'

version = '3.1.0-SNAPSHOT'

asciidoctorj {
	version = '1.5.4'
}

asciidoctor {
	resources {
		from('src/docs/images')
	}
	resources {
		from('src/docs/resources')
	}
	attributes 'build-gradle': file('build.gradle'),
		'sourcedir': project.asciidoctor.sourceDir,
		'endpoint-url': 'https://jmonkeyengine.github.io/wiki',
		'source-highlighter' : 'coderay',
		'linkcss': 'true',
		//'imagesdir':'/images',
		'toc':'left',
		'icons': 'font',
		'setanchors':'true',
		'idprefix':'',
		'idseparator':'-',
		'docinfo1':'true',
		'wiki_link_edit_prefix': 'https://github.com/jMonkeyEngine/wiki/edit/master/src/docs/asciidoc',
		'wiki_link_create_prefix': 'https://github.com/jMonkeyEngine/wiki/new/master/src/docs/asciidoc',
		'orgname':'jMonkeyEngine'
	options header_footer: true,
		template_dirs: [file('src/templates/slim').absolutePath]
/*
	extensions {
		block_macro(name: 'iframe') {
			parent, target, attributes ->
			String content = """<iframe src="${target}"></iframe>""";
			createBlock(parent, "pass", [content], attributes, config);
		}
	}
*/
}

asciidoctor.doLast {
	copy {
		from 'build/asciidoc/html5'
		into 'build/asciidoc/html5'
		rename { String fileName -> 'index.html'}
		include 'documentation.html'
	}
}
