plugins {
    id 'org.asciidoctor.jvm.convert' version '3.0.0-alpha.3'
    id 'org.asciidoctor.jvm.revealjs' version '3.0.0-alpha.3'
}

repositories {
    jcenter()
    maven {
        url "https://plugins.gradle.org/m2/"
    }
    maven {
    	url 'http://rubygems-proxy.torquebox.org/releases'
    }
}

dependencies {
    asciidoctorGems 'rubygems:asciidoctor-revealjs:2.0.0' 
}

asciidoctor {
	sourceDir 'asciidoc'
    sources {
        include '*.adoc'
    }
    outputDir file('build/docs/asciidoc')
	resources {
		from('asciidoc') {
	    	include '**/*.png'
	 	}
		into '.'
	}
    logDocuments = true
}

asciidoctorj {
	modules {
       // diagram.use() 
       diagram.version '1.5.16' 
    }
    // useIntermediateWorkDir = true
    attributes toc: 'left',
    	'source-highlighter': 'highlight.js'

    /*	
	extensions {
        block_macro (name: 'tweet') { parent, target, attributes ->
            String content = """<div class="tweet" data-src="https://twitter.com/${target}/status/${attributes.get('1')}"></div>"""
            config.remove 'content_model'
            createBlock(parent, "pass", [content], [:], config)
        }
    }
    */	
}

asciidoctorRevealJs {

    sourceDir 'revealjs'
    sources {
        include '*.adoc'
    }
    outputDir file('build/docs/revealjs')
	resources {
		from('revealjs') {
	    	include '**/*.png'
	    	include '**/*.css'
	 	}
		into '.'
	}

    attributes 'sourceDir': 'revealjs',
    	'imagesDir': 'revealjs',
        'icons':'font',
        'iconfont-name': 'fontawesome-4.5.0'

    revealjsOptions {
        controls = true
        slideNumber = true
        progressBar = true
        pushToHistory = true
        overviewMode = true
        touchMode = true
        backgroundTransition = 'convex' //none , fade, slide, convex, concave, zoom
        theme = 'sky' //'black', 'beige' , 'league', 'night', 'serif', 'simple', 'sky', 'solarized'
    }

	plugins 'rajgoel/chart/Chart.min.js'
}

revealjs {
	version '2.0.0' // why not '3.8.0' 
	templateGitHub {
   		organisation = 'hakimel'
    	repository = 'reveal.js'
    	tag = '3.8.0'
  	}
}

revealjsPlugins {
    github 'rajgoel', {
        organisation = 'rajgoel'
        repository = 'reveal.js-plugins'
        branch = 'master'
    }
}

build.dependsOn 'asciidoctorRevealJs'