gradle asciidoc 使用
node npm (yarn) java KindleGen
备注: 具体的安装可以参考网上相关文档,KindleGen 下载地址:https://www.amazon.com/gp/feature.html?docId=1000765211
a. git clone code
git clone https://github.com/mraible/infoq-mini-book.git
修改build.sh 中 KindleGen 位置比如我的在 /opt/kind/kindlegen
b. build
./build.sh //epub html
./generate-pdf.sh pdf
build
└── asciidoc
├── epub3
│ └── images
└── html5
└── images

备注: 主要说明asciidoc 代码
src/docs 主要是文档以及需要的图片资源
└── asciidoc
├── chapters
├── images
└── styles
├── epub
│ └── fonts
└── pdf
└── fonts
build.gradle gradle 构建 task
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.ben-manes:gradle-versions-plugin:0.15.0'
classpath 'com.bluepapa32:gradle-watch-plugin:0.1.5'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
classpath 'org.asciidoctor:asciidoctorj-epub3:1.5.0-alpha.7'
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16'
classpath 'org.jruby:jruby-complete:9.1.12.0'
}
}
apply plugin: 'java'
apply plugin: 'org.asciidoctor.convert'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.bluepapa32.watch'
version = '4.1.0-SNAPSHOT'
asciidoctorj {
version = '1.5.6'
}
import org.asciidoctor.gradle.AsciidoctorTask
def attrs = ['sourcedir' : '../../../main/webapp',
'source-highlighter': 'coderay',
'epub3-stylesdir' : './styles/epub',
// NOTE don't include leading ./ because it messes up paths in the epub files
'imagesdir' : 'images',
'toc' : 'left',
'icons' : 'font',
'sectanchors' : '',
'idprefix' : '',
'idseparator' : '-']
tasks.withType(AsciidoctorTask) { task ->
attributes attrs
sources {
include 'index.adoc'
}
}
task html(type: AsciidoctorTask, description: 'Generates single page HTML') {
backends 'html5'
}
// NOTE please use ./generate-pdf.sh instead of this task for now
task prepress(type: AsciidoctorTask, description: 'Generates PDF for prepress printing') {
attributes attrs + ['media' : 'prepress', 'pdfmarks': '', 'pdf-theme': 'infoq-prepress']
attrs.remove('source-highlighter')
requires file('src/main/ruby/asciidoctor-pdf-extensions.rb')
backends 'pdf'
outputDir "$buildDir/asciidoc/pdf-prepress"
separateOutputDirs false
}
// NOTE please use ./generate-pdf.sh screen instead of this task for now
task pdf(type: AsciidoctorTask, description: 'Generates PDF') {
attributes attrs + ['pdfmarks': '']
requires file('src/main/ruby/asciidoctor-pdf-extensions.rb')
backends 'pdf'
}
task epub(type: AsciidoctorTask, description: 'Generates EPUB3') {
backends 'epub3'
}
task mobi(type: AsciidoctorTask, description: 'Generates MOBI') {
backends 'epub3'
attrs.put('ebook-format', 'kf8')
attributes attrs
}
pdf.shouldRunAfter html
epub.shouldRunAfter pdf
//task all(dependsOn: ['html', 'pdf', 'epub', 'mobi'])
task all(dependsOn: ['html', 'epub', 'mobi'])
defaultTasks 'all'
watch {
asciidoc {
files fileTree(dir: 'src/docs/asciidoc', include: '**/*.adoc')
tasks 'asciidoctor'
}
}
https://www.amazon.com/gp/feature.html?docId=1000765211
http://asciidoctor.org/docs/asciidoctor-gradle-plugin/
https://github.com/asciidoctor/asciidoctor-maven-plugin
gradle asciidoc 使用的更多相关文章
- Gradle环境下导出Swagger为PDF
更多精彩博文,欢迎访问我的个人博客 说明 我个人是一直使用Swagger作为接口文档的说明的.但是由于在一些情况下,接口文档说明需要以文件的形式交付出去,如果再重新写一份文档难免有些麻烦.于是在网上看 ...
- 在gradle中构建java项目
目录 简介 构建java项目的两大插件 管理依赖 编译代码 管理resource 打包和发布 生成javadoc 简介 之前的文章我们讲到了gradle的基本使用,使用gradle的最终目的就是为了构 ...
- Gradle配置APK自动签名完整流程
转载请注明出处:http://www.cnblogs.com/LT5505/p/6256683.html 一.生成签名 1.命令行生成签名,输入命令keytool -genkey -v -keysto ...
- gradle学习笔记(1)
1. 安装 (1) 下载最新gradle压缩包,解压到某处.地址是:Gradle web site: (2) 添加环境变量: 1) 变量名:GRADLE_HOM ...
- Gradle 实现 Android 多渠道定制化打包
Gradle 实现 Android 多渠道定制化打包 版权声明:本文为博主原创文章,未经博主允许不得转载. 最近在项目中遇到需要实现 Apk 多渠道.定制化打包, Google .百度查找了一些资料, ...
- 解决 Could not find com.android.tools.build:gradle 问题
今天拉同事最新的代码,编译时老是报如下错误: Error:Could not find com.android.tools.build:gradle:2.2.0.Searched in the fol ...
- React Native Android gradle下载慢问题解决
很多人会遇到 初次运行 react-native run android的时候 gradle下载极慢,甚至会失败的问题 如下图 实际上这个问题好解决的 首先 把对应版本的gradle下载到本地任意一个 ...
- Android studio使用gradle动态构建APP(不同的包,不同的icon、label)
最近有个需求,需要做两个功能相似的APP,大部分代码是一样的,只是界面不一样,以前要维护两套代码,比较麻烦,最近在网上找资料,发现可以用gradle使用同一套代码构建两个APP.下面介绍使用方法: 首 ...
- 对Maven、gradle、svn、spring 3.0 fragment、git的想法
1.Maven Maven可以构建项目,采用pom方式配置主项目和其他需要引用的项目.同时可结合spring3.0的新特性web fragment. 从现实出发,特别是对于管理不到位,程序员整体素质 ...
随机推荐
- java.net.SocketException: Connection reset 问题分析
1. socket编程时容易碰到如下异常: java.net.SocketException: Connection reset by peer: socket write error at java ...
- HighCharts常用设置
1. X轴文字斜着放,在xAxis里设置 xAxis: { labels: { rotation: -90 //竖直放 rotation: -45 //45度倾斜 } } 2. 柱形图柱形的宽度和边框 ...
- Pytorch入门笔记
import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): #nn. ...
- 005——数组(五)array_diff_ukey()array_diff_uassoc()array_intersect()array_intersect_assoc()array_intersect_key()array_intersect_ukey()array_intersect_uassoc()
<?php function dump($arr) { print_r($arr); } /**array_diff_ukey() 通过回调函数的方式,返回一个数组在其他数组中不存在键名的值 * ...
- Web框架之Django-20-基于mysql数据库的连接
Web框架之Django-20-基于mysql数据库的连接 想要连接mysql首先需要安装pymysql这个驱动 然后在app的init文件中引入驱动 import pymysql pym ...
- spring boot + dubbo 服务部署实例
项目github:https://github.com/nalidou/spring-dubbo 1. 公共组件:dubbo-component 提供了接口定义.实体类等,其他项目可以直接导入jar包 ...
- Windows平台编程涉及的函数
VirtualAlloc 调用进程的虚拟地址空间 GetTickCount 返回从操作系统启动到当前所经历过的毫秒数 malloc.h内存分配函数,需要头文件malloc.h
- va_start、va_arg、va_end、va_copy 可变参函数
1.应用与原理 在C语言中,有时我们无法给出一个函数参数的列表,比如: int printf(const char *format, ...); int fprintf(FILE *s ...
- igmpproxy源代码学习——配置信息加载 loadConfig
在igmpproxy主程序运行之前需要先读取配置文件,igmpproxy的配置文件通常为/etc/igmpproxy.conf或者/var/igmpproxy.conf 其内容如下: ...
- vscode 实用插件
1.Auto Rename Tag,非常实用!要修改标签名称的时候自动修改结束标签,节省一半时间,提升效率,非常棒! 2.vscode-icon,这款必须要推荐,明显提升效率的小插件,在项目文件多类型 ...