diff --git a/build.sh b/build.sh index 58267c1..7b4376a 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ #!/bin/bash set -e # exit when any command fails -asciidoctor livro.adoc -o index.html +asciidoctor -r ./ferramentas/addLazyLoadingImages.rb livro.adoc -o index.html open index.html diff --git a/ferramentas/addLazyLoadingImages.rb b/ferramentas/addLazyLoadingImages.rb new file mode 100644 index 0000000..078986c --- /dev/null +++ b/ferramentas/addLazyLoadingImages.rb @@ -0,0 +1,19 @@ +include Asciidoctor + +class AddLazyLoadingImages < Asciidoctor::Extensions::Postprocessor + def process document, output + if document.basebackend? 'html' + replacement = %() + output = output.gsub(//m, replacement) + end + output + end +end + +Asciidoctor::Extensions.register do + postprocessor AddLazyLoadingImages +end + +Asciidoctor.convert_file 'livro.adoc', safe: :safe + + diff --git a/livro.adoc b/livro.adoc index 1c4c379..8c1d1ef 100644 --- a/livro.adoc +++ b/livro.adoc @@ -7,7 +7,6 @@ include::atributos-pt_BR.adoc[] :xrefstyle: short :sectnums: :sectlinks: -:data-uri: :toc: :toclevels: 2 :!chapter-signifier: @@ -159,4 +158,4 @@ include::capitulos/cap21.adoc[] == 🚧 Descritores de atributos -== 🚧 Metaprogramação com classes \ No newline at end of file +== 🚧 Metaprogramação com classes