# Copyright 2016-2023 The Khronos Group Inc. # # SPDX-License-Identifier: Apache-2.0 # This script adds CSS and markup to indicate the document is (perhaps # slowly) loading. It also inserts HTML comments marking where JavaScript # and HTML specific to the chunked HTML output target should be inserted. require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal' include ::Asciidoctor class MakeHtmlLoadable < Extensions::Postprocessor def process document, output if document.attr? 'stem' loading_msg = '' loadable_class = 'class="loadable"' loaded_script = ' ' hide_script = '' output.sub! /(?=<\/head>)/, loaded_script output.sub! /(
)/, '\1' + hide_script output.sub! /(?=
\n" end output end end