pax_global_header00006660000000000000000000000064135324076430014521gustar00rootroot0000000000000052 comment=74b2eac9e76b43c95973fc62bde9673a7397a9b4 jekyll-asciidoc-3.0.0/000077500000000000000000000000001353240764300145675ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/.deep_cover.rb000066400000000000000000000002621353240764300173050ustar00rootroot00000000000000DeepCover.configure do output 'coverage/report-deep-cover' paths %w(./lib) reporter :text if ENV['CI'] reporter :istanbul if ENV['DEEP_COVER_REPORTER'] == 'istanbul' end jekyll-asciidoc-3.0.0/.gitignore000066400000000000000000000001531353240764300165560ustar00rootroot00000000000000/.ruby-* /*.gem /.bundle/ /.yardoc/ /build/ /coverage/ /deep_cover/ /pkg/ /rdoc/ /Gemfile.lock .idea *.iml jekyll-asciidoc-3.0.0/.rubocop.yml000066400000000000000000000043111353240764300170400ustar00rootroot00000000000000AllCops: TargetRubyVersion: 2.3 Layout/SpaceInsideBlockBraces: SpaceBeforeBlockParameters: false Layout/AlignArguments: EnforcedStyle: with_fixed_indentation IndentationWidth: 4 Layout/AlignParameters: EnforcedStyle: with_fixed_indentation IndentationWidth: 4 Layout/IndentFirstArgument: Enabled: false Layout/LeadingCommentSpace: Enabled: false Layout/MultilineOperationIndentation: EnforcedStyle: indented Layout/RescueEnsureAlignment: Enabled: false Lint/AmbiguousBlockAssociation: Enabled: false Lint/ParenthesesAsGroupedExpression: Enabled: false Metrics/AbcSize: Enabled: false Metrics/BlockLength: Enabled: false Metrics/BlockNesting: Max: 4 Metrics/ClassLength: Enabled: false Metrics/CyclomaticComplexity: Enabled: false Metrics/LineLength: Max: 120 Metrics/MethodLength: Enabled: false Metrics/PerceivedComplexity: Enabled: false Naming/ConstantName: Enabled: false Naming/FileName: Enabled: false Naming/PredicateName: NameWhitelist: - has_yaml_header? - has_front_matter? Style/CaseEquality: Enabled: false Style/CharacterLiteral: Enabled: false Style/ConditionalAssignment: EnforcedStyle: assign_inside_condition IncludeTernaryExpressions: false Style/Documentation: Enabled: false # FIXME reenable me Style/DoubleNegation: Enabled: false Style/FrozenStringLiteralComment: Enabled: false Style/GuardClause: Enabled: false Style/HashSyntax: EnforcedStyle: ruby19_no_mixed_keys Style/MethodDefParentheses: EnforcedStyle: require_no_parentheses Style/MutableConstant: Enabled: false Style/MultilineIfModifier: Enabled: false Style/MultilineTernaryOperator: Enabled: false Style/NestedTernaryOperator: Enabled: false Style/NumericPredicate: EnforcedStyle: comparison Style/PercentLiteralDelimiters: PreferredDelimiters: default: () '%w': () '%r': // Style/PerlBackrefs: Enabled: false Style/RescueStandardError: EnforcedStyle: implicit Style/SymbolArray: EnforcedStyle: brackets # I'd like to enable this one, but rubocop gets confused Style/TernaryParentheses: Enabled: false Style/TrailingCommaInArrayLiteral: EnforcedStyleForMultiline: consistent_comma Style/TrailingCommaInHashLiteral: EnforcedStyleForMultiline: consistent_comma jekyll-asciidoc-3.0.0/.simplecov000066400000000000000000000001441353240764300165700ustar00rootroot00000000000000SimpleCov.start do add_filter %w(/.bundle/ /spec/) coverage_dir 'coverage/report-simplecov' end jekyll-asciidoc-3.0.0/.travis.yml000066400000000000000000000013601353240764300167000ustar00rootroot00000000000000dist: trusty git: # use depth 5 just in case two refs get pushed at once (like a tag) depth: 5 language: ruby rvm: - 2.5.5 - 2.4.6 - 2.3.8 - jruby-9.2.7.0 - jruby-9.1.17.0 matrix: include: - rvm: &release_rvm 2.6.3 env: COVERAGE=deep - rvm: *release_rvm env: JEKYLL_VERSION=3.0.0 - rvm: *release_rvm env: ASCIIDOCTOR_VERSION=1.5.8 bundler_args: --jobs=3 --retry=3 --without=docs script: - bundle exec rake spec - if [ ! -z $COVERAGE ]; then bundle exec rake lint; fi notifications: email: on_success: never on_failure: change deploy: provider: rubygems gem: jekyll-asciidoc api_key: ${RUBYGEMS_API_KEY} on: tags: true repo: asciidoctor/jekyll-asciidoc rvm: *release_rvm condition: -n $COVERAGE jekyll-asciidoc-3.0.0/.yardopts000066400000000000000000000003061353240764300164340ustar00rootroot00000000000000--charset UTF-8 --readme README.adoc --no-private --hide-api private --title "Jekyll AsciiDoc API Docs" --output-dir apidoc --exclude /(?:core|jekyll)_ext/ lib/**/*.rb - CHANGELOG.adoc LICENSE.adoc jekyll-asciidoc-3.0.0/CHANGELOG.adoc000066400000000000000000000201431353240764300167060ustar00rootroot00000000000000= {project-name} Changelog :project-name: Jekyll AsciiDoc Plugin :url-repo: https://github.com/asciidoctor/jekyll-asciidoc This document provides a high-level view of the changes to the {project-name} by release. For a detailed view of what has changed, refer to the {url-repo}/commits/master[commit history] on GitHub. == 3.0.0.beta.2 (2019-06-03) - @mojavelinux * allow site-wide AsciiDoc attributes to also be defined on `asciidoc` key in site configuration (#126) * set date page variable from revdate for any document in a collection (posts or otherwise) (#202) * allow non-ASCII word character to be used in name of attribute reference in config file * use File.write instead of IO.write (as IO.write has extra magic we don't need) * auto-generate excerpts for posts and documents written in AsciiDoc (#200) == 3.0.0.beta.1 (2018-12-29) - @mojavelinux * only support Ruby >= 2.2.0 and Jekyll >= 3.0.0 * update tests to only run against supported versions * load processor eagerly (at end of plugin initialization) * don't crash if document body is empty (#179) * process AsciiDoc header if page has only an AsciiDoc header but no body * honor layout defined in frontmatter defaults (#187) * allow page layout to be soft set in site config (#193) * set asciidoc property to true on all AsciiDoc pages (#189) * set asciidoc property to true on any (AsciiDoc) page enriched by this plugin (i.e., page.asciidoc) (#189) * don't call nil_or_empty? outside of an Asciidoctor context (#142) * don't delete category and tag; sync w/ first entry in array of matching property (#160) * don't coerce a falsy value of page-layout defined in _config.yml to nil * integrate collections that are not written (output flag is set to false) (#161) * document how to enable STEM support (#163) * document that a liquid tag that includes HTML must be enclosed in a passthrough block (#180) * document that page attributes must be defined in the document header (#172) * document both the plugins and gems config keys and when to use one vs the other (#159) * document how to disable publishing for a page * document how to make a draft post * recommend installing gems into project and using a .ruby-version file * pass standalone option through data instead of prepending to content * set up code coverage reports (#196) * set up code linter (Rubocop) (#201) == 2.1.1 (2018-11-08) - @mojavelinux * honor layout defined in frontmatter defaults (#187) * don't call nil_or_empty? outside of an Asciidoctor context (#142) * handle case when document body is empty (#179) == 2.1.0 (2017-05-21) - @mojavelinux * Add `tocify_asciidoc` Liquid filter for generating a table of contents from the parsed AsciiDoc document (Jekyll 3+ only) (#37) * Remove trailing `@` when resolving attribute reference in value of attribute defined in config * Set minimum version of Ruby to 1.9.3 in the gemspec * Prefixing attribute defined in config with minus removes previously defined (e.g., built-in) attribute (#123) * Convert attribute values in config as follows: true becomes empty string; false becomes nil, number becomes string (#127) * Merge category page variable into categories variable and tag page variable into tags variable (#149) * Assign document ID to page variable named docid (#146) * Enable CI for Windows platform by configuring job on AppVeyor * Catch SyntaxError when using Psych YAML parser with Ruby 1.9.3 * Document that the name of page variable created from a page attribute is automatically lowercased * Parse the value of the revdate attribute using `Jekyll::Utils.parse_date` * Document how to assign a specific time to a post * Document how to make site-wide AsciiDoc attributes accessible to Liquid templates (#137) * Fix crash when converting an auto-extracted excerpt when base_dir option is set to :docdir * Add additional documentation and make other minor improvements to the README == 2.0.1 (2016-07-06) - @mojavelinux * Align localtime and localdate attributes with site.time and site.timezone (#117) * Don't register hook callbacks again when regenerating site; use static methods for hook callbacks (#121) * Bundle CHANGELOG.adoc and test suite in gem * Minor improvements to README == 2.0.0 (2016-07-02) - @mojavelinux * Split source into multiple files; move all classes under the `Jekyll::AsciiDoc` module * Avoid redundant initialization caused by the jekyll-watch plugin * Set docdir, docfile, docname, outfile, outdir, and outpath attributes for each file (Jekyll 3+ only) (#59) - docdir is only set if value of `base_dir` option is `:docdir` - setting outdir allows proper integration with Asciidoctor Diagram * Automatically set `imagesoutdir` attribute if `imagesdir` attribute is relative to root * Pass site information (root, source, destination, baseurl and url) through as AsciiDoc attributes * Automatically generate stylesheet for Pygments (#30) * Change default layout to match collection label (#104) - page for pages, post for posts, collection label for all others - use layout named default as fallback * Resolve attribute references in attribute values defined in config (#103) * Apply AsciiDoc header integration to documents in all collections (#93) * Document how to create and enable templates to customize the HTML that Asciidoctor generates (#73) * Allow `base_dir` option to track document directory by setting the value to `:docdir` (Jekyll 3 only) (#80) * Add a comprehensive test suite (#77) * Allow site-wide Asciidoctor attributes to be specified as a Hash; convert to Hash if Array is used (#87) * Interpret page attribute values as YAML data * Use Jekyll.logger to write log messages (#85) * Add topic to all log messages * Restructure configuration keys so all general settings are under the `asciidoc` key (#82) * Don't enable `hardbreaks` attribute by default (#69) * Bump minimum version of Jekyll to 2.3.0 and document requirement in README (#76) * Allow layout to be disabled to create standalone document; add and document additional option values for layout (#63) * Make front matter header optional (#57) * Apply site-wide Asciidoctor configuration (options/attributes) when loading document header (#67) * Disable liquid processor on AsciiDoc files by default; enable using liquid page variable (#65) * Resolve empty page attribute value as empty string (#70) * Soft assign linkattrs attribute * Allow plugin to work in safe mode (#112) * Major restructure and rewrite of README * Document how to use plugin with GitLab Pages (#47) * Document `asciidocify` Liquid filter {url-repo}/issues?q=milestone%3Av2.0.0[issues resolved] | {url-repo}/releases/tag/v2.0.0[git tag] == 1.1.2 (2016-05-10) - @mkobit * Apply fix for documents that did not contain at least one attribute beginning with `page-` (#60) {url-repo}/issues?q=milestone%3Av1.1.2[issues resolved] | {url-repo}/releases/tag/v1.1.2[git tag] == 1.1.1 (2016-05-07) - @mkobit * The AsciiDoc document title overrides the title set in the front matter or the auto-generated title (in the case of a post) (#48) * The AsciiDoc page-related attributes override the matching entries in the page data (i.e., front matter) * The value of page-related attributes are treated as YAML values (automatic type coercion) * `page-` is the default prefix for page-related AsciiDoc attributes (e.g., `page-layout`) (#51) * The key to configure the page attribute prefix is `asciidoc_page_attribute_prefix`; the value should not contain the trailing hyphen (#51) * The date of a post can be set using the `revdate` AsciiDoc attribute (#53) * Only configure the Asciidoctor options once (previously it was being called twice in serve mode) * Set `env` attribute to `site` instead of `jekyll` (#55) {url-repo}/issues?q=milestone%3Av1.1.1[issues resolved] | {url-repo}/releases/tag/v1.1.1[git tag] == 1.0.1 (2016-03-19) - @mkobit Enables use with Jekyll 3. It is still compatible with Jekyll 2. * Jekyll 3 support (#36, #33) * Documentation and onboarding improvements (#25, #24) * Improvements to release process (#28) {url-repo}/issues?q=milestone%3Av1.0.1[issues resolved] | {url-repo}/releases/tag/v1.0.1[git tag] == 1.0.0 (2015-01-04) - @paulrayner Initial release. {url-repo}/issues?q=milestone%3Av1.0.0[issues resolved] | {url-repo}/releases/tag/v1.0.0[git tag] jekyll-asciidoc-3.0.0/Gemfile000066400000000000000000000006351353240764300160660ustar00rootroot00000000000000source 'https://rubygems.org' gemspec gem 'asciidoctor', ENV['ASCIIDOCTOR_VERSION'], require: false if ENV.key? 'ASCIIDOCTOR_VERSION' gem 'jekyll', %(~> #{ENV['JEKYLL_VERSION']}), require: false if ENV.key? 'JEKYLL_VERSION' # NOTE Windows does not include zoneinfo files, so load tzinfo-data gem gem 'tzinfo-data', platform: [:x64_mingw, :mingw], require: false group :docs do gem 'yard', require: false end jekyll-asciidoc-3.0.0/LICENSE.adoc000066400000000000000000000021471353240764300165050ustar00rootroot00000000000000.The MIT License .... Copyright (C) 2013-2018 Dan Allen, Paul Rayner, and the Asciidoctor Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .... jekyll-asciidoc-3.0.0/README.adoc000066400000000000000000001724131353240764300163640ustar00rootroot00000000000000= Jekyll AsciiDoc Plugin (powered by Asciidoctor) Dan Allen ; Paul Rayner v3.0.0, 2019-08-31 // Settings: :idprefix: :idseparator: - ifndef::env-github[:icons: font] ifdef::env-github,env-browser[] :toc: macro :toclevels: 1 endif::[] ifdef::env-github[] :status: :outfilesuffix: .adoc :!toc-title: :caution-caption: :fire: :important-caption: :exclamation: :note-caption: :paperclip: :tip-caption: :bulb: :warning-caption: :warning: endif::[] // Aliases: :path-config: pass:q[[.path]___config.yml__] :conum-guard: {sp} ifndef::icons[:conum-guard: {sp}#{sp}] // URIs: :url-repo: https://github.com/asciidoctor/jekyll-asciidoc :url-issues: {url-repo}/issues :url-search-issues: {url-repo}/search?type=Issues :url-chat: https://gitter.im/asciidoctor/asciidoctor :url-ci-travis: https://travis-ci.org/asciidoctor/jekyll-asciidoc :url-ci-appveyor: https://ci.appveyor.com/project/asciidoctor/jekyll-asciidoc :url-gem: http://rubygems.org/gems/jekyll-asciidoc :url-gem-asciidoctor: http://rubygems.org/gems/asciidoctor :url-asciidoc: http://asciidoc.org :url-asciidoctor: http://asciidoctor.org :url-asciidoctor-backends: https://github.com/asciidoctor/asciidoctor-backends :url-asciidoctor-docs: {url-asciidoctor}/docs :url-asciidoctor-diagram: {url-asciidoctor-docs}/asciidoctor-diagram :url-asciidoctor-discuss: http://discuss.asciidoctor.org :url-asciidoctor-manual: {url-asciidoctor-docs}/user-manual :url-asciidoc-practices: {url-asciidoctor-docs}/asciidoc-recommended-practices :url-jaq: https://github.com/asciidoctor/jekyll-asciidoc-quickstart :url-jekyll: https://jekyllrb.com :url-jekyll-docs: {url-jekyll}/docs :url-jekyll-discuss: https://talk.jekyllrb.com :url-front-matter: {url-jekyll-docs}/frontmatter :url-liquid-templates: {url-jekyll-docs}/templates :url-variables: {url-jekyll-docs}/variables :url-graphviz: http://www.graphviz.org :url-tilt: https://github.com/rtomayko/tilt :url-yaml: https://en.wikipedia.org/wiki/YAML :url-guide-publish-gem: http://guides.rubygems.org/publishing/#publishing-to-rubygemsorg ifdef::status[] image:https://img.shields.io/gem/v/jekyll-asciidoc.svg[Latest Release, link={url-gem}] image:https://img.shields.io/badge/license-MIT-blue.svg[MIT License, link=#copyright-and-license] image:https://img.shields.io/travis/asciidoctor/jekyll-asciidoc/master.svg[Build Status (Travis CI), link={url-ci-travis}] image:https://ci.appveyor.com/api/projects/status/3cf1f8p2cyoaoc25/branch/master?svg=true&passingText=green%20bar&failingText=%23fail&pendingText=checking[Build Status (AppVeyor), link={url-ci-appveyor}] endif::[] A plugin for {url-jekyll}[Jekyll] (>= 3.0.0) that converts {url-asciidoc}[AsciiDoc] source files in your site to HTML pages using {url-asciidoctor}[Asciidoctor]. ifeval::['{branch}' == 'master'] NOTE: You're viewing the documentation for the upcoming release. If you're looking for the documentation for an older release, please refer to one of the following branches: + {url-repo}/tree/v2.1.x#readme[2.1.x] ⁃ {url-repo}/tree/v2.0.x#readme[2.0.x] ⁃ {url-repo}/tree/v1.1.x#readme[1.1.x] ⁃ {url-repo}/tree/v1.0.x#readme[1.0.x] endif::[] toc::[] == Overview The plugin consists of three extensions: Converter -- `Jekyll::AsciiDoc::Converter`:: Converts AsciiDoc files to HTML pages. This plugin currently uses Asciidoctor to convert AsciiDoc content. Generator -- `Jekyll::AsciiDoc::Integrator`:: Promotes eligible AsciiDoc attributes (e.g., doctitle, id, author, and attributes that begin with the page attribute prefix) to page variables. These attributes are merged with the page variables defined in the front matter header. Liquid Filters:: * `asciidocify` -- Uses the converter from this plugin to convert a string of AsciiDoc content to HTML. * `tocify_asciidoc` -- Generates a table of contents in HTML from the parsed AsciiDoc document of the current page (since 2.1.0). These extensions are registered automatically when the [.app]*jekyll-asciidoc* gem is required. == Prerequisites To use this plugin, you must be using Jekyll >= 3.0.0 and Ruby >= 2.3.0 (with development headers installed). You should also be familiar with creating sites with Jekyll. If you're not, you should first read the {url-jekyll-docs}[Jekyll documentation] to familiarize yourself with how it works. Experience with AsciiDoc and Asciidoctor is also helpful, but not a requirement. Like Jekyll, this plugin was designed for developers, so some assembly is required. That means you'll be expected to edit configuration, modify HTML templates, and customize CSS to use it fully. == Installation This plugin is packaged as a gem named [.app]*{url-gem}[jekyll-asciidoc]* and published to RubyGems.org. The plugin depends on the [.app]*{url-gem-asciidoctor}[asciidoctor]* gem, which gets installed automatically. Your method of installation will depend on whether you use Bundler to manage the dependencies for your Jekyll project. IMPORTANT: Jekyll relies on several native gems, so it's necessary to have the Ruby development headers (e.g., ruby.h) on your machine in order to install AsciiDoc Jekyll (due to the requirements of Jekyll). The instructions for how to install the Ruby development headers are platform-specific and outside of the scope of this document. TIP: If you're using RVM, you should add a [.path]_.ruby-version_ file to the project so your shell automatically switches to the correct version of Ruby each time you enter the project. For more information, refer to the the page https://rvm.io/workflow/projects[RVM Project Workflow]. === Installation Using Bundler If you're using Bundler to manage the dependencies for your project (as recommended), simply add the [.app]*jekyll-asciidoc* gem to the `:jekyll_plugins` group in your [.path]_Gemfile_: [source,ruby] ---- group :jekyll_plugins do gem 'jekyll-asciidoc' end ---- Then, run the `bundle` command from Bundler to install the gem: $ bundle Jekyll will automatically activate any plugins listed in the `:jekyll_plugins` group. If you want to keep the installed gems inside the project, use this command instead: $ bundle --path=.bundle/gems TIP: Subsequent calls to `bundle` will retain the `path` setting. Keep in mind that the gems Bundler installs are linked to the current version of Ruby. If you switch Ruby versions, you'll need to run `bundle` again. === Manual Installation If you're not using Bundler to manage the dependencies for your Jekyll project, you'll need to install the gem manually: $ [sudo] gem install jekyll-asciidoc NOTE: The `sudo` prefix is only required if you are installing gems into your system. To avoid this bad practice, we recommend using RVM (or another Ruby version manager), which sets up Ruby safely in your home directory. Then add the [.app]*jekyll-asciidoc* gem to the list of gems for Jekyll to load in your site's {path-config} file: [source,yaml] ---- plugins: - jekyll-asciidoc ---- If you're running Jekyll < 3.5.0, you'll need to use `gems` in place of `plugins`: [source,yaml] ---- gems: - jekyll-asciidoc ---- == Creating Pages This plugin converts eligible AsciiDoc files located inside the source directory (by default, the project root) to HTML pages in the generated site. There are a few conditions that must be met in order for an AsciiDoc file to be eligible: . The file must have an AsciiDoc file extension (see <>). . The name of the file must not begin with a dot (`.`) or an underscore (`_`).footnote:excluded_files[Hidden files and folders are automatically excluded by Jekyll.] . The file must not be located in a folder whose name begins with a dot (`.`) or an underscore (`_`) (unless the folder is a designated collection, such as _posts).footnote:excluded_files[] . While you can use a Jekyll front matter header, it is not required. Here's a sample AsciiDoc file that meets these criteria: .sample.adoc [source,asciidoc] ---- --- layout: info permalink: /sample/ --- = Sample Page :url-asciidoctor: http://asciidoctor.org This is a sample page composed in AsciiDoc. Jekyll converts it to HTML using {url-asciidoctor}[Asciidoctor]. [source,ruby] puts "Hello, World!" ---- Alternatively, you can define the page variables directly in the AsciiDoc header, which we recommend: .sample.adoc [source,asciidoc] ---- = Sample Page :page-layout: info :page-permalink: /sample/ :url-asciidoctor: http://asciidoctor.org This is a sample page composed in AsciiDoc. Jekyll converts it to HTML using {url-asciidoctor}[Asciidoctor]. [source,ruby] puts "Hello, World!" ---- === Page Attributes Any AsciiDoc attribute defined in the AsciiDoc document header whose name begins with ``page-``footnote:[The prefix used to label page attributes can be customized.] gets promoted to a {url-variables}[page variables]. The part of the name after the `page-` prefix is _lowercased_ and used as the variable name (e.g., page-layout becomes layout). The value is processed as {url-yaml}[YAML] data (single-line form). Since the attribute value is processed as YAML data, you can build nested data structure using the inline YAML syntax. For example, here's how you can assign a value to the `page.header.image` page variable: [source,asciidoc] ---- :page-header: { image: logo.png } ---- To define a page attribute that contains multiple words, use either a hyphen or underscore character to connect the words. [source,asciidoc] ---- :page-short-name: slug ---- IMPORTANT: Page attributes must be defined in the document header. That means either putting them directly below the document title (the line beginning with a single equals sign in the sample above) or above all other AsciiDoc content if the document title is not defined in AsciiDoc. The AsciiDoc document header stops after the first blank line. For more details about the document header, see the http://asciidoctor.org/docs/user-manual/#doc-header[Document Header] chapter in the Asciidoctor User Manual. IMPORTANT: You may use include directives in the the document header. However, you must ensure that the file included _does not_ contain blank lines. === Specifying a Layout The most commonly defined page variable is layout, which determines which template is used to wrap the generated content. Jekyll will look for a template file inside the [.path]_{empty}_layouts_ folder whose root name matches the name of the layout. For example, if the layout variable has the value `info`, Jekyll looks for a layout template at the path [.path]__layout/info.html_. If the layout is empty, the auto-selected layout layout is used (documented in the list below). If the layout is unset or `false`, the AsciiDoc processor will generate a standalone document. In this case, the page will appear like an HTML file generated by the AsciiDoc processor directly (with the option `header_footer: true`). If the layout is ~, no layout is applied. To review, here are the different ways to specify a layout using the AsciiDoc attribute page-layout: * `:page-layout: info` -- use the layout named `info` (e.g., [.path]__layout/info.html_) * _not specified_, `:page-layout:` or `:page-layout: _auto` -- use the automatic layout (i.e., `page` for pages, `post` for posts, the singular form of the collection label for a document; if the auto-selected layout isn't available, the layout `default` is used) * `:!page-layout:` or `:page-layout: false` -- don't use a layout; instead, generate a standalone HTML document * `:page-layout: none` or `:page-layout: ~` -- don't use a layout or create a standalone HTML document (often produces an HTML fragment); use of the value `~` is discouraged; the value `none` is preferred === Disabling Publishing of a Page To prevent a page from being published, set the page attribute named `page-published` to `false` (which, in turn, sets the page variable named `published` to `false`. [source,asciidoc] ---- = Top Secret Info :page-published: false This page should not be published. ---- === Implicit Page Variables In addition to page attributes defined explicitly (e.g., layout, permalink, etc), the following implicit AsciiDoc attributes are also promoted to page variables: * doctitle (aka the document title) (becomes `title`) * id (becomes `docid`) * author * revdate (becomes `date`; value is converted to a DateTime object; not applied to pages) Although not an implicit page variable, another very common page variable to set is `page-description`, which becomes `description` in the model. ==== Showing the Document Title By default, when Asciidoctor converts your document, it does not include the document title in the body (aka `content`) part of the document that is passed to the layout. Instead, it skims off the document title and assigns it to the model as `page.title`. If you don't see the document title on the generated page at first, that's normal. There are two ways to have the document title included in the page: . Configure the layout to output the document title explicitly . Configure Asciidoctor to include the document title in the body The first option is the most typical. Somewhere in your layout, you should include the following statement: ----

{{ page.title }}

---- This approach gives you the most control over how the document title appears and what HTML is used to enclose it. If, instead, you want the document title to be included in the body, add the following configuration to your site's {path-config} file: [source,yaml] ---- asciidoctor: attributes: - showtitle=@ ---- It's also possible to enable or override this setting per page. [source,asciidoc] ---- = Page Title :showtitle: ---- Using either of these approaches, the document title will be shown on the generated page. ==== Giving Your Post the Time of Day By default, all posts are assigned a date that is computed from the file name (e.g., the date for 2016-03-20-welcome.adoc is 2016-03-20). If you want to give your post a specific time as well, you can set the `revdate` attribute in the AsciiDoc header. We recommend using the format `YYYY-MM-DD HH:MM:SS Z` as shown in this example: [source,asciidoc] ---- = Post Title Author Name :revdate: 2016-03-20 10:30:00 -0600 Lorem ipsum. ---- If you don't provide a time zone in the date, the date is assumed to be in the same time zone as the site (which is your local time zone by default). Alternatively, you can specify the date in the implicit revision line. In this case, you must substitute the colons in the time part with "h", "m", and "s", respectively, since the colon demarcates the revision remark. [source,asciidoc] ---- = Post Title Author Name 2016-03-20 10h30m00s -0600 Lorem ipsum. ---- Note that the revision line must be preceded by the implicit author line. ==== Classifying Your Post In Jekyll, you classify a post by assigning it to categories and/or tags. While you can define them in the front matter, as normal, it's also possible to omit the front matter and assign them in the AsciiDoc header instead. The AsciiDoc attributes to use to assign categories and tags to your post are `page-categories` and `page-tags`, respectively. The attribute value must be expressed using the inline Array syntax for YAML, which is a comma-separated list of items surrounded by square brackets. If you only have one item, you can omit the brackets. In this case, you can also drop the plural from the attribute name. [source,asciidoc] ---- = Introducing the Jekyll AsciiDoc Plugin Author Name :page-category: Tech :page-tags: [ruby, jekyll, asciidoctor, ssg] The Jekyll AsciiDoc plugin makes Jekyll awesome. Why? Because you can write posts like this one in AsciiDoc! ---- Recall that the value of page attributes is parsed as an inline YAML value. ==== Publishing a Draft Post You can defer adding a date to a post until it's ready to publish by making it a draft. To make a draft post, just place it in the [.path]_{empty}_drafts_ folder instead of the [.path]_posts_ folder. But don't include the date in the filename or AsciiDoc header. To include the drafts when building the site, pass the `--drafts` flag to the `jekyll` command: $ jekyll build --drafts The date of each draft post will be based on the file's last modification time. When you're ready to publish the post, move the file from the [.path]_{empty}_drafts_ folder to the [.path]_posts_ folder and assign a date to it either by adding it to the filename or by defining the `revdate` attribute in the AsciiDoc header. === Enabling Liquid Preprocessing Unlike other content files, the {url-liquid-templates}[Liquid template preprocessor] is not applied to AsciiDoc files by default (since version 2.0.0 of this plugin). If you want the Liquid template preprocessor to be applied to an AsciiDoc file (prior to the content being passed to the AsciiDoc processor), you must enable it by setting the `liquid` page variable (shown here defined using a page attribute). [source,asciidoc] ---- :page-liquid: ---- IMPORTANT: AsciiDoc files may include a {url-front-matter}[front matter header] for defining page variables. If present, the front matter header must be the very first character of the file. The front matter header won't be seen--and could distort conversion--if the front matter is preceded by whitespace or a Byte Order Mark (BOM). NOTE: Since version 2.0.0 of this plugin, you may exclude the front matter header, as shown in the second example above. Prior to version 2.0.0, you had to include at least an empty front matter header (except for posts). In these cases, you define all the page variables (e.g., layout) using AsciiDoc page attributes instead of in the front matter. You can also use a combination of both. When intermixed, the page attributes defined in the AsciiDoc header take precedence. Liquid processing does not extend to files included using the AsciiDoc include directive (see {url-issues}/166[#166]). If you're using the Liquid include tag to include HTML into the AsciiDoc document, you need to enclose it in a passthrough block. ---- ++++ {% include file.html %} ++++ ---- This is necessary since AsciiDoc will escape HTML by default. To pass it through raw requires enclosing it in a passthrough block. === Extracting Excerpts This plugin will extract an excerpt for any post or document in a collection if the `excerpt` page variable isn't set using the same logic as for Markdown files. By default, it will use the content between the header and the first blank line. If the `excerpt` page variable is set, that value will be used instead. The excerpt will automatically be converted from AsciiDoc to embedded HTML whereever the `excerpt` property is referenced in a Liquid template. ---- {% post.excerpt %} ---- IMPORTANT: Since version 3.0.0 of this plugin, you no longer have to run the excerpt through the `asciidocify` filter since the conversion is already done for you. In fact, if you do, the HTML in the converted excerpt will be escaped, which is not what you want. If you want to use a different excerpt separator for AsciiDoc files, set the `excerpt_separator` under the `asciidoc` key in the site configuration. For example, you can configure the plugin to use the line comment `//more` as the excerpt separator as follows: [source,yaml] ---- asciidoc: excerpt_separator: "\n//more\n" ---- If you're only working with AsciiDoc files in your site, you can go ahead and set this for all files by using the top-level property: [source,yaml] ---- excerpt_separator: "\n//more\n" ---- If the excerpt separator isn't found, the content of the whole document is used instead. By default, the excerpt is converted to HTML using the article doctype. If you want to use a different doctype, such as inline, you can set it in the site configuration as follows: [source,yaml] ---- asciidoc: excerpt_doctype: inline ---- You can also set the excerpt doctype per page using the page attribute named `page-excerpt_doctype`. == Building and Previewing Your Site You can build your site into the [.path]__site_ directory using: $ jekyll build If you're using Bundler, prefix each command with `bundle exec`: [subs=+quotes] $ *bundle exec* jekyll build You can preview your site at \http://localhost:4000 using: $ jekyll serve The `serve` command monitors the file system and rebuilds the site whenever a change is detected by default (i.e., watch mode). To disable watch mode, use the `--no-watch` flag: $ jekyll serve --no-watch You can also use the `--watch` flag with the `build` command: $ jekyll build --watch If you only want Jekyll to build files which have changed, and not the whole site, add the `--incremental` flag: $ jekyll serve --incremental or $ jekyll build --watch --incremental To see a report of all the files that are processed, add the `--verbose` flag: $ jekyll build --verbose IMPORTANT: If you add the `--safe` flag, third-party plugins such as this one are disabled by default. To reenable the plugin, you must add the name of the gem to the whitelist. See <> for details. == Configuration This section describes the configuration options for this plugin, which are _optional_. You should at least assign an empty Hash as a default (e.g., `{}`) to the `asciidoc` and `asciidoctor` keys in {path-config}, respectively, if you don't plan on making any further customizations. [source,yaml] ---- asciidoc: {} asciidoctor: {} ---- Using these placeholder values prevents initialization from being performed more than once when using watch mode (see https://github.com/jekyll/jekyll/issues/4858[issue jekyll#4858]). === AsciiDoc NOTE: Prior to version 2.0.0 of this plugin, the configuration keys in this section were defined as flat, top-level names (e.g., `asciidoc_ext`). These names are now deprecated, but still supported. By default, this plugin uses Asciidoctor to convert AsciiDoc files. Because Asciidoctor is currently the only option, the default setting is equivalent to the following configuration in {path-config}: [source,yaml] ---- asciidoc: processor: asciidoctor ---- IMPORTANT: The `asciidoc` block should only appear _once_ inside {path-config}. If you define any other options that are documented in this section, you should append them to the `asciidoc` block. To tell Jekyll which file extensions to match as AsciiDoc files, append the `ext` option to the `asciidoc` block of your {path-config}: [source,yaml] ---- asciidoc: ext: asciidoc,adoc,ad ---- The extensions shown in the previous listing are the default values, so you don't need to specify this option if those defaults are sufficient. AsciiDoc attributes defined in the document header whose names begin with `page-` are promoted to page variables. The part of the name after the `page-` prefix is used as the key (e.g., page-layout becomes layout). If you want to change this attribute prefix, append the `page_attribute_prefix` option to the `asciidoc` block of your {path-config}: [source,yaml] ---- asciidoc: page_attribute_prefix: jekyll ---- A hyphen is automatically added to the value of this configuration setting if the value is non-empty (e.g, jekyll-). Since version 2.0.0 of this plugin, all non-hidden AsciiDoc files are processed by default, even those without a front matter header. If you only want files containing a front matter header to be processed (as was the behavior prior to version 2.0.0), add the `require_front_matter_header` option to the `asciidoc` block of your {path-config}: [source,yaml] ---- asciidoc: require_front_matter_header: true ---- === Asciidoctor In addition to the built-in attributes in AsciiDoc, the following additional AsciiDoc attributes are automatically defined by this plugin and available to all AsciiDoc-based pages: .... site-root=(absolute path of root directory) site-source=(absolute path of source directory) site-destination=(absolute path of output directory) site-baseurl=(value of the baseurl config option) site-url=(value of the url config option) env=site env-site site-gen=jekyll site-gen-jekyll builder=jekyll builder-jekyll jekyll-version=(value of the Jekyll::VERSION constant) idprefix idseparator=- linkattrs=@ .... The following additional attributes are defined per page: .... outpath=(path of page relative to baseurl) .... You can pass custom attributes to AsciiDoc, or override default attributes provided by the plugin, using the `attributes` option of the `asciidoctor` block in your {path-config}. The value of this option can either be an Array containing key-value pairs: [source,yaml] ---- asciidoctor: attributes: - idprefix=_ - source-highlighter=pygments - pygments-css=style ---- or key-value pairs defined as a Hash: [source,yaml] ---- asciidoctor: attributes: idprefix: _ source-highlighter: pygments pygments-css: style ---- When using the Hash syntax, you must use an empty string value to set a valueless attribute such as `sectanchors`: [source,yaml] ---- asciidoctor: attributes: sectanchors: '' ---- By default, an attribute value defined in {path-config} overrides the same attribute set in the front matter or header of a document. For example, if you set `page-layout` in {path-config}, you won't be able to set it per page. [source,yaml] ---- asciidoctor: attributes: - page-layout=false ---- If you want to allow individual pages to be able to override the attribute, append the charcter `@` to the value in {path-config}: [source,yaml] ---- asciidoctor: attributes: - page-layout=false@ ---- You may use attribute references in the attribute value to reference any attribute that's already defined, including implicit attributes. For example, to set the `iconsdir` attribute based on the `imagesdir` attribute, use the following: [source,yaml] ---- asciidoctor: attributes: imagesdir: /images iconsdir: '{imagesdir}/icons' ---- CAUTION: If the value begins with an attribute reference, and you're defining the attributes using the Hash syntax, you must enclose the value in quotes. There are additional edge cases when the value must be enclosed in quotes, so it's generally recommended to use them. Since version 2.1.0 of this plugin, you can remove a previously defined attribute by prefixing the name with a minus sign (without any space between): [source,yaml] ---- asciidoctor: attributes: -idprefix: ---- In addition to `attributes`, you may define any other option key (e.g., `safe`) recognized by the {url-asciidoctor-manual}#ruby-api-options[Asciidoctor API]. One of those options is `base_dir`, which is covered in the next section. ==== Specifying the Base Directory In Asciidoctor, the base directory (i.e., `base_dir` option) is used as the root when resolving relative include paths in top-level documents. By default, this plugin does not specify a base directory when invoking the Asciidoctor API. Asciidoctor will therefore use the current working directory (i.e., the project root) as the base directory. If your source directory is not the project root, and you want Asciidoctor to use the source directory as the base directory, set the value of the `base_dir` option to `:source`. [source,yaml] ---- asciidoctor: base_dir: :source ... ---- If, instead, you want the base directory to track the directory of the document being processed, and you're using Jekyll 3 or better, you can set the value of the `base_dir` option to `:docdir`. This behavior matches how Asciidoctor works when running it outside of Jekyll. Since the base directory is also the jail, we also recommend setting the `safe` option to `unsafe` so that you can still resolve paths outside of this directory. [source,yaml] ---- asciidoctor: base_dir: :docdir safe: unsafe ... ---- You can also set the `base_dir` option to any relative or absolute path. In that case, the same value will be used for all documents. ==== Using AsciiDoc attributes in a Liquid template Let's say you want to reuse your AsciiDoc attributes in a Liquid template. This section describes how to do it. Liquid can only access simple data structures, not complex ones like the one used to store site-wide AsciiDoc attributes. (Site-wide AsciiDoc attributes are stored deep within the Jekyll configuration data as a Hash with symbol keys). This puts them out of the reach of Liquid templates by default. This plugin must store site-wide AsciiDoc attributes in this way due to how Jekyll is implemented and the lifecycle it exposes for plugins. That part can't be changed. The plugin is limited by Jekyll's design. However, YAML provides a mechanism that we can leverage to expose these attributes to our Liquid templates. First, you define your AsciiDoc attributes at the top level of your configuration file where Liquid is able to access them. If you also assign a YAML reference to this key, you can then pass that Hash to the attributes key in the asciidoctor block, thus allowing the configuration to be shared. [source,yaml] ---- asciidoc_attributes: &asciidoc_attributes imagesdir=/images asciidoctor: attributes: *asciidoc_attributes ... ---- You can now reference one of the site-wide AsciiDoc attributes in the Liquid template as follows: ---- {{ site.asciidoc_attributes.imagesdir }} ---- Keep in mind that the value of the attribute will be unmodified from the value defined in the configuration file. ==== Enabling Hard Line Breaks Globally Many Jekyll users are used to writing in GitHub-flavored Markdown (GFM), which preserves hard line breaks in paragraph content. Asciidoctor supports this feature for AsciiDoc files. (In fact, previous versions of this plugin enabled this behavior by default). If you want to enable this behavior for AsciiDoc files, add the `hardbreaks` attribute to the Asciidoctor attributes configuration in your site's {path-config} file: [source,yaml] ---- asciidoctor: attributes: - hardbreaks ---- If you still want to allow individual files to be able to override the attribute, append the charcter `@` to the value in the site configuration: [source,yaml] ---- asciidoctor: attributes: - hardbreaks=@ ---- If you already have AsciiDoc attributes defined in the {path-config}, the new attribute should be added as a sibling entry in the YAML collection. WARNING: Keep in mind, if you enable hard line breaks, you won't be able to use the {url-asciidoc-practices}#one-sentence-per-line[one sentence-per-line writing technique]. == Running in Safe Mode If you want to use this plugin when running Jekyll in safe mode, you must add the [.app]*jekyll-asciidoc* gem to the whitelist in your site's {path-config} file: [source,yaml] ---- whitelist: - jekyll-asciidoc ---- Safe mode is enabled either through the `--safe` flag: $ jekyll build --safe or the `safe` configuration option in your site's {path-config} file: [source,yaml] ---- safe: true ---- == Working with AsciiDoc Content in Templates Jekyll uses the Liquid templating language to process templates. This plugin defines two additional Liquid filters, `asciidocify` and `tocify_asciidoc`, for working with AsciiDoc content in those templates. === Converting a String from AsciiDoc You can use the `asciidocify` filter to convert an arbitrary AsciiDoc string anywhere in your template. This filter allows you to compose site-wide data in AsciiDoc, such your site's description or synopsis, then convert it to HTML for use in the page template(s). Let's assume you've defined a page variable named `synopsis` that you want treat as AsciiDoc. You can convert it in your template as follows: ---- {{ page.synopsis | asciidocify }} ---- By default, the AsciiDoc content is parsed as an embedded AsciiDoc document. If the content represents a single paragraph, and you only want to perform inline substitutions on that content, add the `inline` doctype as the filter's first argument: ---- {{ page.synopsis | asciidocify: 'inline' }} ---- === Generating a Table of Contents Since version 2.1.0 of this plugin, you can use the `tocify_asciidoc` filter to generate a table of contents from the content of any page that is generated from AsciiDoc. This filter gives you the ability to place this table of contents anywhere inside the page layout, but outside the main content. You apply the `tocify_asciidoc` filter to `page.document`, the page variable that resolves to the parsed AsciiDoc document, as shown here: ---- {{ page.document | tocify_asciidoc }} ---- The number of section levels (i.e., depth) shown in the table of contents defaults to the value defined by the `toclevels` attribute in the AsciiDoc document. To tune the number of levels, pass a numeric value as the filter's first argument. ---- {{ page.document | tocify_asciidoc: 3 }} ---- When you use the `tocify_asciidoc` filter, you'll also want to disable the `toc` attribute in your document. You can do this using a conditional preprocessor directive. [source,asciidoc] ---- = Guide ifndef::env-site[:toc: left] == Section A content == Section B content ---- == Customizing the Generated HTML You can use templates to customize the HTML output that Asciidoctor generates for your site. Template files can be composed in any templating language that is supported by {url-tilt}[Tilt]. Each template file corresponds to a node in the AsciiDoc document tree (aka AST). Below are the steps you need to take to configure Asciidoctor to use custom templates with your site. === Step {counter:step}: Add Required Gems You'll first need to add the thread_safe gem as well as the gem for the templating language you plan to use. We'll assume that you are using Slim. [source,ruby] ---- gem 'slim', '~> 3.0.7' gem 'thread_safe', '~> 0.3.5' ---- === Step {counter:step}: Install New Gems Now run the `bundle` command to install the new gems. $ bundle === Step {counter:step}: Create a Templates Folder Next, create a new folder in your site named [.path]__templates_ to store your templates. $ mkdir _templates === Step {counter:step}: Configure Asciidoctor to Load Templates In your site's {path-config} file, configure Asciidoctor to load the templates by telling it the location where the templates are stored. [source,yaml] ---- asciidoctor: template_dir: _templates attributes: ... ---- === Step {counter:step}: Compose a Template The final step is to compose a template. We'll be customizing the unordered list node. Name the file [.path]_ulist.html.slim_. .ulist.html.slim [source,slim] ---- - if title? figure.list.unordered id=id figcaption=title ul class=[style, role] - items.each do |_item| li span.primary=_item.text - if _item.blocks? =_item.content - else ul id=id class=[style, role] - items.each do |_item| li span.primary=_item.text - if _item.blocks? =_item.content ---- The next time you build your site, Asciidoctor will use your custom template to generate the HTML for unordered lists. TIP: You can find additional examples of custom templates in the {url-asciidoctor-backends}[asciidoctor-backends] repository. == Enabling Asciidoctor Extensions You enable Asciidoctor extensions in much the same way as this plugin. You just need to get Jekyll to load the source. If the extension you want to use is published as a gem, and you're using Bundler to manage the dependencies for your project (as recommended), then you simply add the gem to the `jekyll_plugins` group in your [.path]_Gemfile_: [source,ruby] ---- group :jekyll_plugins do gem 'asciidoctor-extension-xyz' end ---- Then, run the `bundle` command from Bundler to install the gem: $ bundle If you're not using Bundler to manage the dependencies for your Jekyll project, you'll need to install the gem manually. Once that's done, add the gem to the list gems for Jekyll to load in your site's {path-config} file: [source,ruby] ---- plugins: - asciidoctor-extension-xyz ---- If you're running Jekyll < 3.5.0, you'll need to use `gems` in place of `plugins`: [source,ruby] ---- gems: - asciidoctor-extension-xyz ---- If the extension you want to use is not published as a gem, or is something you're developing, then you'll load it like an ad-hoc Jekyll plugin. Add the file [.path]_asciidoctor-extensions.rb_ to the [.path]__plugins_ folder of your project root (creating the folder if it does not already exist) and populate the file with the following content: ._plugins/asciidoctor-extensions.rb [source,ruby] ---- require 'asciidoctor/extensions' Asciidoctor::Extensions.register do treeprocessor do process do |doc| doc end end end ---- Asciidoctor will automatically enable the extensions in this file when it is loaded by Jekyll. For a concrete example of using an Asciidoctor extension, refer to the next section. == Enabling Asciidoctor Diagram {url-asciidoctor-diagram}[Asciidoctor Diagram] is a set of extensions for Asciidoctor that allow you to embed diagrams generated by PlantUML, Graphviz, ditaa, Shaape, and other plain-text diagram tools inside your AsciiDoc documents. In order to use Asciidoctor Diagram in a Jekyll project successfully, *you must use a version of this plugin >= 2.0.0*. Other combinations are known to have issues. IMPORTANT: For Graphviz and PlantUML diagram generation, {url-graphviz}[Graphviz] must be installed (i.e., the `dot` utility must be available on your `$PATH`. TIP: To follow a start-to-finish tutorial that covers how to integrate Asciidoctor Diagram, see https://gist.github.com/mojavelinux/968623c493190dd61c059c2d85f9bdc3[this gist]. === Installation Using Bundler:: + -- Add the `asciidoctor-diagram` gem to your [.path]_Gemfile_: [source,ruby,subs=attributes+] ---- group :jekyll_plugins do gem 'asciidoctor-diagram', '~> 1.5.4' #{conum-guard}<1> gem 'jekyll-asciidoc' ... end ---- <1> Customize the version of Asciidoctor Diagram as needed. Then, run Bundler's install command to install the new gem: $ bundle -- Without Bundler:: + -- Install gems manually $ [sudo] gem install asciidoctor-diagram Then, add the `asciidoctor-diagram` gem to the list of plugins for Jekyll to load in your site's {path-config} file: [source,yaml] ---- plugins: - asciidoctor-diagram - jekyll-asciidoc ---- If you're running Jekyll < 3.5.0, you'll need to use `gems` in place of `plugins`: [source,yaml] ---- gems: - asciidoctor-diagram - jekyll-asciidoc ---- -- The preceding configurations are equivalent to passing `-r asciidoctor-diagram` to the `asciidoctor` command. === Generated Image Location Asciidoctor Diagram needs some context in order to write the images to the proper location. At a minimum, you must set the following configuration in {path-config}: [source,yaml] ---- asciidoctor: base_dir: :docdir safe: unsafe ---- With this configuration, Asciidoctor Diagram will generate images relative to the generated HTML page (i.e., in the same directory) within the destination folder. WARNING: Jekyll will *delete* the images Asciidoctor Diagram generates unless you follow the instructions in <>. You can use the following example to test your setup: ._posts/2016-01-01-diagram-sample.adoc [source,asciidoc] ---- = Diagram Sample [graphviz,dot-example,svg] .... digraph g { a -> b b -> c c -> d d -> a } .... ---- If you prefer to serve all images from the same folder, assign a value to the `imagesdir` attribute that is relative to the site root: [source,yaml] ---- asciidoctor: base_dir: :docdir safe: unsafe attributes: imagesdir: /images ---- With this configuration, Asciidoctor Diagram will generate images into the [.path]_images_ directory within the destination folder. WARNING: Jekyll will *delete* the images Asciidoctor Diagram generates unless you follow the instructions in <>. ==== Preserving Generated Images Since Asciidoctor Diagram writes to the output folder, you have to instruct Jekyll not to remove these generated files in the middle of the build process. One way to do this is to apply a "`monkeypatch`" to Jekyll. Add the file [.path]_jekyll-ext.rb_ to the [.path]__plugins_ folder of your project root (creating the folder if it does not already exist) and populate the file with the following content: ._plugins/jekyll-ext.rb [source,ruby] ---- class Jekyll::Cleaner def cleanup!; end end ---- An alternative to the monkeypath approach is to identify folders that contain generated images in the `keep_files` option in {path-config}: [source,yaml] ---- keep_files: - images asciidoctor: base_dir: :docdir safe: unsafe attributes: imagesdir: /images ---- == Enabling STEM Support Thanks to Asciidoctor, Jekyll AsciiDoc provides built-in support for processing STEM (Science, Technology, Engineering & Math) equations in your AsciiDoc documents. To enable this support, you just need to do a bit of configuration. === Activating the STEM processing The first thing you need to do is activate the STEM processing integration in the processor itself. To do that, set the `stem` attribute on the document. One way is to set the `stem` attribute in the document header: [source,asciidoc] ---- = Page Title :stem: ---- Alternatively, you can enable it the `stem` attribute globally for all AsciiDoc documents in your site by adding the following to your site's {path-config} file: [source,yaml] ---- asciidoctor: attributes: - stem ---- To learn more about the built-in STEM integration, see the https://asciidoctor.org/docs/user-manual/#activating-stem-support[STEM] chapter in the Asciidoctor User Manual. === Adding the STEM assets to the page Technically, Asciidoctor only prepares the STEM equations for interpretation by https://mathjax.org[MathJax]. That means you have to load MathJax on any page that contains STEM equations (or all pages, if that's easier). To do so requires some customization of the page layout. First, create the file [.path]__includes/mathjax.html_ and populate it with the following contents: [source,html] ---- ---- Then, include this file before the closing `` tag in your page layout. ---- {% include mathjax.html %} ---- With that configuration in place, the STEM equations in your AsciiDoc file will be presented beautifully using MathJax. == Adding Supplemental Assets Certain Asciidoctor features, such as icons, require additional CSS rules and other assets to work. These CSS rules and other assets do not get automatically included in the pages generated by Jekyll. This section documents how to configure these additional resources. TIP: If you want to take a shortcut that skips all this configuration, clone the {url-jaq}[Jekyll AsciiDoc Quickstart (JAQ)] repository and use it as a starting point for your site. JAQ provides a page layout out of the box configured to fully style body content generated from AsciiDoc. === Setup The Jekyll AsciiDoc plugin converts AsciiDoc to embeddable HTML. This HTML is then inserted into the page layout. You need to augment the layout to include resources typically present in a standalone HTML document that Asciidoctor produces. . Create a stylesheet in the [.path]_css_ directory named [.path]_asciidoc.css_ to hold additional CSS for body content generated from AsciiDoc. . Add this stylesheet to the HTML `` in [.path]_{empty}_includes/head.html_ under the main.css declaration: + [source,html] ---- ---- === Stylesheet for Code Highlighting Asciidoctor integrates with Pygments to provide code highlighting of source blocks in AsciiDoc content. To enable Pygments, you must install the `pygments.rb` gem. To do so, add the `pygments.rb` gem to your [.path]_Gemfile_: [source,ruby] ---- gem 'pygments.rb', '~> 1.1.2' ---- IMPORTANT: To use Pygments with Ruby >= 2.4 or JRuby, you must install pygments.rb >= 1.1.0. As part of this integration, Asciidoctor generates a custom stylesheet tailored specially to work with the HTML that Asciidocotor produces. Since this stylesheet is backed by the Pygments API, it provides access to all the themes in Pygments This plugin will automatically generate a stylesheet for Pygments into the source directory if the AsciiDoc attributes in your site's {path-config} are configured as follows: * `source-highlighter` has the value `pygments` * `pygments-css` has the value `class` or is not set * `pygments-stylesheet` is not unset (if set, it can have any value) By default, the stylesheet is written to `stylesdir` + `pygments-stylesheet`. If the `pygments-stylesheet` attribute is not specified, the value defaults to `asciidoc-pygments.css`. You can customize this value to your liking. The Pygments theme is selected by the value of the `pygments-style` attribute. If this attribute is not set, it defaults to `vs`. The stylesheet file will be created if it does not yet exist or the theme has been changed. Jekyll will handle copying the file to the output directory. You'll need to add a line to your template to link to this stylesheet, such as: [source,html] ---- ---- To disable this feature, either set the `pygments-css` to `style` (to enable inline styles) or unset the `pygments-stylesheet` attribute in your site's {path-config}. NOTE: It may still be necessary to make some tweaks to your site's stylesheet to accomodate this integration. === Font-based Admonition and Inline Icons To enable font-based admonition and inline icons, you first need to add Font Awesome to [.path]_{empty}_includes/head.html_ file under the asciidoc.css declaration: [source,html] ---- ---- NOTE: You can also link to a local copy of Font Awesome. Next, you need to add the following CSS rules from the default Asciidoctor stylesheet to the [.path]_css/asciidoc.css_ file: [source,css] ---- span.icon>.fa { cursor: default; } .admonitionblock td.icon { text-align: center; width: 80px; } .admonitionblock td.icon [class^="fa icon-"] { font-size: 2.5em; text-shadow: 1px 1px 2px rgba(0,0,0,.5); cursor: default; } .admonitionblock td.icon .icon-note:before { content: "\f05a"; color: #19407c; } .admonitionblock td.icon .icon-tip:before { content: "\f0eb"; text-shadow: 1px 1px 2px rgba(155,155,0,.8); color: #111; } .admonitionblock td.icon .icon-warning:before { content: "\f071"; color: #bf6900; } .admonitionblock td.icon .icon-caution:before { content: "\f06d"; color: #bf3400; } .admonitionblock td.icon .icon-important:before { content: "\f06a"; color: #bf0000; } ---- Feel free to modify the CSS to your liking. Finally, you need to enable the font-based icons in the header of the document: [source,asciidoc] ---- :icons: font ---- or in the site configuration: [source,yaml] ---- asciidoctor: attributes: - icons=font ... ---- Circled callout numbers are also linked to the `icons=font` setting, even though they don't rely on the Font Awesome font. To enable them, you need to add the following additional CSS to the [.path]_css/asciidoc.css_ file: [source,css] ---- .conum[data-value] { display: inline-block; color: #fff !important; background: rgba(0,0,0,.8); -webkit-border-radius: 1em; border-radius: 1em; text-align: center; font-size: .75em; width: 1.67em; height: 1.67em; line-height: 1.67em; font-family: "Open Sans", "DejaVu Sans", sans-serif; font-style: normal; font-weight: bold; } .conum[data-value] * { color: #fff !important; } .conum[data-value] + b { display: none; } .conum[data-value]::after { content: attr(data-value); } pre .conum[data-value] { position: relative; top: -.125em; } b.conum * { color: inherit !important; } .conum:not([data-value]):empty { display: none; } ---- === Image-based Admonition and Inline Icons As an alternative to font-based icons, you can configure Asciidoctor to use image-based icons. In this case, all you need to do is provide the icons at the proper location. First, enable image-based icons and configure the path to the icons in the header of the document: [source,asciidoc] ---- :icons: :iconsdir: /images/icons ---- or your site configuration: [source,yaml] ---- asciidoctor: attributes: - icons - iconsdir=/images/icons ---- Then, simply put the icon images that the page needs in the [.path]_images/icons_ directory. == Publishing Your Site This section covers several options you have available for publishing your site, including GitHub Pages and GitLab Pages. === Using this Plugin on GitHub Pages GitHub doesn't (yet) whitelist the AsciiDoc plugin, so you must run Jekyll either on your own computer or on a continuous integration (CI) server. [IMPORTANT] GitHub needs to hear from enough users that need this plugin to persuade them to enable it. Our recommendation is to https://github.com/contact[contact support] and keep asking for it. Refer to the help page https://help.github.com/articles/adding-jekyll-plugins-to-a-github-pages-site[Adding Jekyll Plugins to a GitHub Pages site] for a list of plugins currently supported on GitHub Pages. _But don't despair!_ You can still automate publishing of the generated site to GitHub Pages using a continuous integration job. Refer to the http://eshepelyuk.github.io/2014/10/28/automate-github-pages-travisci.html[Automate GitHub Pages publishing with Jekyll and Travis CI^] tutorial to find step-by-step instructions. You can also refer to the https://github.com/johncarl81/transfuse-site[Transfuse website build^] for an example in practice. In fact, if you're using Travis CI, it's even easier than that. Travis CI provides a https://docs.travis-ci.com/user/deployment/pages/[deployer for GitHub Pages]! Using this deployer, Travis CI can push your generated site to GitHub Pages after a successful build on your behalf, as long as you've completed these steps: . Create a personal access token on GitHub that has write access to your GitHub repository (public_repo or repo scope) . Define the token as a secure variable name GITHUB_TOKEN on the Travis CI settings page for your repository . Add a deploy configuration to your CI job configuration Here's a sample deploy configuration you can use: [source,yaml] ---- deploy: provider: pages github-token: $GITHUB_TOKEN local-dir: _site target-branch: gh-pages skip-cleanup: true keep-history: true on: branch: master ---- TIP: When using this setup, don't forget to add the [.path]_.nojekyll_ file to the root of the source directory to tell GitHub Pages not to waste time running Jekyll again on the server. ==== Jekyll AsciiDoc Quickstart If you want to take a shortcut that skips all the steps in the previously mentioned tutorial, clone the {url-jaq}[Jekyll AsciiDoc Quickstart (JAQ)] repository and use it as a starting point for your site. JAQ includes a Rake build that is preconfigured to deploy to GitHub Pages from Travis CI and also provides a theme (page layout and CSS) that properly styles body content generated from AsciiDoc. ==== Feeling Responsive If you're looking for a Jekyll theme that provides comprehensive and mature styles and layouts out of the box, check out the https://github.com/Phlow/feeling-responsive[Feeling Responsive] theme. It includes integration with this plugin, which you simply have to enable. Refer to the https://phlow.github.io/feeling-responsive/getting-started/[Getting Started] page for a step-by-step guide to get your site started and feeling responsive. === Using this Plugin on GitLab Pages Deployment to GitLab Pages is much simpler. That's because GitLab allows you to control the execution of Jekyll yourself. There's no need to mess around with CI jobs and authentication tokens. You can find all about how to use Jekyll with GitLab Pages in the tutorial https://about.gitlab.com/2016/04/07/gitlab-pages-setup/#option-b-gitlab-ci-for-jekyll-websites[Hosting on GitLab.com with GitLab Pages]. More in-depth information regarding setting up your repository for GitLab Pages can be found in the https://docs.gitlab.com/ee/pages/README.html[GitLab Enterprise Edition / Pages] documentation. Assuming the following are true: . The source of your site resides on the master branch (though you can use any branch for this purpose). . You're using Bundler to manage the dependencies for your project. You can then use the following [.path]_.gitlab-ci.yml_ file to get starting hosting your Jekyll site on GitLab Pages. .gitlab-ci.yml [source,yaml] ---- image: ruby:2.5 cache: paths: - .bundle before_script: - bundle --path .bundle/gems pages: script: - bundle exec jekyll build -d public --config _config.yml,_config-gitlab.yml -q artifacts: paths: - public only: - master ---- This script runs Jekyll on the official Ruby Docker container. You also need to add an additional configuration file, [.path]__config-gitlab.yml_, to set the `url` and `baseurl` options when deploying your site to GitLab Pages. ._config-gitlab.yml [source,yaml,subs=attributes+] ---- url: https://.gitlab.io #{conum-guard}<1> baseurl: / #{conum-guard}<2> ---- <1> Replace `` with your GitLab username or group. <2> Replace `` with the basename of your project repository. The next time you push to the master branch, the GitLab Pages runner will execute Jekyll and deploy your site to [.uri]_\https://.gitlab.io/_, where `` is your GitLab username or group and `` is the basename of your project repository. Like GitHub Pages, you can also have your site respond to a custom domain name, which is explained in the referenced tutorial. In this case, update the [.path]__config-gitlab.yml_ file with the appropriate values. CAUTION: At this time, GitLab Pages only works with projects hosted at GitLab.com or on self-hosted GitLab Enterprise Edition instances. GitLab Community Edition does not support continuous integration and cannot host pages. == Getting Help The Jekyll AsciiDoc plugin is developed to help you publish your content quickly and easily. But we can't achieve that goal without your input. Your questions and feedback help steer the project, so speak up! Activity drives progress. When seeking answers, always start with the official documentation for Jekyll, which can be found on the {url-jekyll}[Jekyll website]. If you have general questions about Jekyll, we recommend you visit the {url-jekyll-discuss}[Jekyll Talk] forum to get assistance. For questions related to this extension specifically, or general questions about AsciiDoc, please post to the {url-asciidoctor-discuss}[Asciidoctor discussion list]. You can also join us in the {url-chat}[asciidoctor/asciidoctor channel] on Gitter. For general information about AsciiDoc, look no further than the {url-asciidoctor-manual}[Asciidoctor User Manual]. === Filing Bug Reports and Feature Requests This project uses the {url-issues}[GitHub issue tracker] to manage bug reports and feature requests. If you encounter a problem, please {url-search-issues}[browse or search] the issues to find out if your problem has already been reported. If it has not, you may {url-issues}/new[submit a new issue]. The best way to get a timely response and quick fix for your issue is to write a detailed report and respond to replies in a timely manner. If you know Ruby (or you're willing to learn), we encourage you to submit a pull request. Please include an RSpec behavior that describes how your feature should work or demonstrates the problem you're encountering. Make sure to send your pull request from a branch in your fork. If the pull request resolves an issue, please name the branch using the issue number (e.g., issue-N, where N is the issue number). If you aren't able to submit a pull request, please provide a sample so that the developers can reproduce your scenario. == Development To help develop the Jekyll AsciiDoc plugin, or to simply use the development version, you need to retrieve the source from GitHub. Follow the instructions below to learn how to clone the source, run the tests and install the development version. === Retrieve the Source Code You can retrieve the source code from GitHub using git. Simply copy the URL of the {url-repo}[GitHub repository] and pass it to the `git clone` command: [subs=attributes+] .... git clone {url-repo} .... Next, switch to the project directory. $ cd jekyll-asciidoc === Install the Dependencies The dependencies needed to develop the Jekyll AsciiDoc plugin are defined in the [.path]_Gemfile_ at the root of the project. You'll use Bundler to install these dependencies. To check if you have Bundler installed, use the `bundle` command to query for the version: $ bundle --version If Bundler is not installed, use the `gem` command to install it. $ [sudo] gem install bundler Finally, invoke the `bundle` command (which is provided by the bundler gem) from the root of the project to install the dependencies into the project: $ bundle --path=.bundle/gems IMPORTANT: Since we've installed dependencies inside the project, it's necessary to prefix all commands (e.g., rake) with `bundle exec`. === Running the Tests The tests are based on RSpec. The test suite is located in the [.path]_spec_ directory. You can run the tests using Rake. $ bundle exec rake spec For more fine-grained control, you can also run the tests using RSpec directly. $ bundle exec rspec If you only want to run a selection of tests, you can do so by assigning those specifications a tag and filtering the test run accordingly. Start by adding the `focus` tag to one or more specifications: [source,ruby] ---- it 'should register AsciiDoc converter', focus: true do expect(site.converters.any? {|c| ::Jekyll::AsciiDoc::Converter === c }).to be true end ---- Then, run RSpec with the `focus` flag enabled: $ bundle exec rspec -t focus You should see that RSpec only runs the specifications that have this flag. === Generating Code Coverage To generate a code coverage report when running tests using simplecov, set the `COVERAGE` environment variable as follows when running the tests: $ COVERAGE=true bundle exec rake spec You'll see a total coverage score as well as a link to the HTML report in the output. The HTML report helps you understand which lines and branches were missed, if any. Despite being fast, the downside of using simplecov is that it misses branches. You can use deep-cover to generate a more thorough report. To do so, set the `COVERAGE` environment variable as follows when running the tests: $ COVERAGE=deep bundle exec rake spec You'll see a total coverage score, a detailed coverage report, and a link to HTML report in the output. The HTML report helps you understand which lines and branches were missed, if any. //// As an alternative to deep cover's native HTML reporter, you can also use istanbul / nyc. First, you'll need to have the `nyc` command available on your system: $ npm install -g nyc or $ yarn global add nyc Next, in addition to the `COVERAGE` environment variable, also set the `DEEP_COVER_REPORTER` environment variable as follows when running the tests: $ COVERAGE=deep DEEP_COVER_REPORTER=istanbul bundle exec rake spec You'll see a total coverage score, a detailed coverage report, and a link to HTML report in the output. The HTML report helps you understand which lines and branches were missed, if any. //// === Running the Code Linter Before you commit code, you should run it through the linter to make sure it adheres to the coding style. You can run the linter using the following command: $ bundle exec rake lint The coding style is enforced by Rubocop. The rules are defined in [.path]_.rubocop.yml_. These rules extend from the default rule set provided by Rubocop to match the style of the project. === Installing the Gem Locally You can install the development version of the gem as follows: $ bundle exec rake install This allows you to use an unreleased version of the gem to build your site. If you want to build the gem and install it yourself, use these commands instead: $ bundle exec rake build $ [sudo] gem install pkg/jekyll-asciidoc-*.dev.gem === Releasing the Gem When you are ready for a release, first set the version in the file [.path]_lib/jekyll-asciidoc/version.rb_. Then, commit the change using the following commit message template: Release X.Y.Z where `X.Y.Z` is the version number of the gem. Next, package, tag and release the gem to RubyGems.org, run the following rake task: $ bundle exec rake release IMPORTANT: Ensure you have the proper credentials setup as described in the guide {url-guide-publish-gem}[Publishing to RubyGems.org]. Once you finish the release, you should update the version to the next micro version in the sequence using the `.dev` suffix (e.g., 3.0.1.dev). == About the Project The Jekyll AsciiDoc plugin, a plugin for the static site generator {url-jekyll}[Jekyll], is a member project of the Asciidoctor organization. This plugin is developed and supported by volunteers in the Asciidoctor community. === Authors This plugin was created by Dan Allen and Paul Rayner and has received contributions from many other individuals in the Asciidoctor community. === Copyright and License Copyright (C) 2013-2018 Dan Allen, Paul Rayner, and the Asciidoctor Project. Free use of this software is granted under the terms of the MIT License. See <> for details. //// [glossary] == Glossary [glossary] page variable:: Data associated with a page, post or document. Page variables are defined in the front matter header or as page attributes in the AsciiDoc header. page attribute:: Any AsciiDoc attribute that gets promoted to a page variable by this plugin. Before being promoted, the designated prefix is removed from the name. The value of a page attribute is parse as YAML data. //// jekyll-asciidoc-3.0.0/Rakefile000066400000000000000000000001271353240764300162340ustar00rootroot00000000000000Dir['tasks/*.rake'].each {|rakefile| load rakefile } task default: %w(spec lint build) jekyll-asciidoc-3.0.0/appveyor.yml000066400000000000000000000011231353240764300171540ustar00rootroot00000000000000version: '{build}' skip_tags: true clone_depth: 2 environment: matrix: # see https://www.appveyor.com/docs/build-environment/#ruby for list of installed Ruby runtimes - ruby_version: '25' - ruby_version: '25-x64' - ruby_version: '24' - ruby_version: '24-x64' - ruby_version: '23' - ruby_version: '23-x64' init: - set PATH=C:\Ruby%ruby_version%\bin;%PATH:C:\Ruby193\bin;=% - echo %PATH% - ruby -v - gem -v - bundle version install: - bundle --jobs=3 --path=.bundle\gems build_script: - bundle exec rake build test_script: - cmd: bundle exec rake spec artifacts: - path: pkg\*.gem jekyll-asciidoc-3.0.0/coding-style-guide.adoc000066400000000000000000000113631353240764300211170ustar00rootroot00000000000000= Coding Style Guide This document describes the coding style used in this project. It also serves as an incubator for the coding style guide used throughout the Asciidoctor project. Note that these guidelines are still evolving. The coding style rules are as follows: * Indent using 2 spaces, generally. * Indent successive lines of conditions, method arguments or ternary expressions using 4 spaces (but not data structures or chained method calls). // Q: are we sure chained method calls should be an exception? * Don't indent `when` lines in a case block. * Wrap API docs at 120 characters. // 80 or 100 seems more comfortable to read * Leave a single space inside brackets of a Hash (let it breathe). { "key" => "value" } * Use JSON-style key-value pair when key is a Symbol. { key: "value" } * Fully qualify the class name (beginning with `::`) of any type not in the current namespace. ::File.extname path * Use triple equals to check for type, placing the type on the left hand side. ::Hash === attrs * Drop parentheses around method arguments of a method definition. def integrate document, collection_name = nil ... end * Drop parentheses around method arguments of an isolated method call. source = ::File.expand_path config['source'] + if key.start_with? '!' ... end * Don't surround expression value of variable assignment in parantheses. part = section.sectname == 'part' subs = format_mark == '`' ? BASIC_SUBS : NORMAL_SUBS * Drop parentheses when using fallback values for assignments. //Q: what about in method arguments or array entries? a, b = $1 || $3, $2 || $4 * When brackets are required for a method call, use lisp-style brackets (::File.dirname docfile) * For chained method calls, wrap parentheses around nested method call. (NOTE: This produces a warning in Ruby < 2). asciidoctor_config.replace (Utils.symbolize_keys asciidoctor_config) * Add `%r` prefix to inline regexp when used as the first argument of a method. files.grep %r/^spec\// * Use parentheses outside of a method call when parentheses are required. layout = collection_name ? (collection_name.chomp 's') : 'page' + if (::Jekyll::Utils.method dlg_method.name).arity == -1 ... end * Use parentheses where required, such as around the accumulator seed value for a collection predicate. hash.each_with_object({}) {|(key, val), accum| accum[key.to_sym] = val } * Don't put curly braces around entries in an options Hash (i.e., symbol keys). record_path_info document, source_only: true * Use a trailing condition for single-line statements. clear_path_info if Document === document * Put parentheses around a variable assignment inside a condition. if (imagesdir = attrs['imagesdir']) * Use variable reference to check for nil. if base * Use `%()` instead of double quotes around interpolated strings. %(--- #{val}) * Use single quotes around string if interpolation is not required. 'asciidoctor' * Name constants using pascal style. NewLine = %(\n) * Define each static regular expression (regexp) as a constant so it's precompiled. Append `Rx` suffix to name. ExtensionRx = /^\.adoc$/ * Place the regular expression (regexp) before the string when creating a match. ExtensionRx =~ ext + ExtensionRx.match ext * Use parentheses in traditional style when writing test assertions. expect(site.config['asciidoc']['processor']).to eql('asciidoctor') expect(result.key? 'icons').to be true expect(contents).to match('
') * Use `.size` to get the length of a collection and `.length` to get the length of a string. "abc".length [1, 2, 3].size * Use `+#[0]+` and `+#[-1]+` to get the first and last element of an Array, respectively, rather than `#first` and `#last`. NOTE: You still have to use `#first` and `#last` on an Enumerable object that's not an Array. a = [1, 2, 3] a[0] a[-1] * Pass symbol reference to `.map` when invoking no-args method on iteration variable (parens are required). lines.map(&:strip) * When calling `raise` to raise an exception, pass the exception class as the first argument and the message as the second. Write the message as a sentence, but exclude the period. raise ::ArgumentError, 'Not a valid argument' * Use name instead of symbol to alias a method. alias copy original * When only one private method, add keyword to method definition; otherwise use block form * Use `do...end` for multi-line blocks and `{ ... }` for single-line blocks (even when chained) * Use `{}.tap {|accum| arr.each {|v| accum[v] = v } }` to create a Hash from an Array or Hash * Use default_ as prefix instead of suffix //// * try to make assignments in condition if scoped to that block * close empty block on same line if empty - `rescue ::NameError; end` //// jekyll-asciidoc-3.0.0/jekyll-asciidoc.gemspec000066400000000000000000000036471353240764300212140ustar00rootroot00000000000000require File.absolute_path 'lib/jekyll-asciidoc/version', __dir__ require 'open3' unless defined? Open3 Gem::Specification.new do |s| s.name = 'jekyll-asciidoc' s.version = Jekyll::AsciiDoc::VERSION s.summary = 'A Jekyll plugin that converts the AsciiDoc source files in your site to HTML pages using Asciidoctor.' s.description = s.summary s.authors = ['Dan Allen', 'Paul Rayner'] s.email = ['dan.j.allen@gmail.com'] s.homepage = 'https://github.com/asciidoctor/jekyll-asciidoc' s.license = 'MIT' s.metadata = { 'bug_tracker_uri' => 'https://github.com/asciidoctor/jekyll-asciidoc/issues', 'changelog_uri' => 'https://github.com/asciidoctor/jekyll-asciidoc/blob/master/CHANGELOG.adoc', 'mailing_list_uri' => 'http://discuss.asciidoctor.org', 'source_code_uri' => 'https://github.com/asciidoctor/jekyll-asciidoc', } # NOTE the required ruby version is informational only # it tracks the minimum version required by Jekyll >= 3.0.0 (see https://jekyllrb.com/docs/installation/#requirements) # we don't enforce it because it can't be overridden and can cause builds to break #s.required_ruby_version = '>= 2.2.0' files = begin (result = Open3.popen3('git ls-files -z') {|_, out| out.read }.split ?\0).empty? ? Dir['**/*'] : result rescue ::SystemCallError Dir['**/*'] end s.files = files.grep %r/^(?:lib\/.+|Gemfile|(?:CHANGELOG|LICENSE|README)\.adoc|\.yardopts|jekyll-asciidoc\.gemspec)$/ #s.test_files = files.grep %r/^spec\/./ s.require_paths = ['lib'] s.add_runtime_dependency 'asciidoctor', '>= 1.5.0' s.add_runtime_dependency 'jekyll', '>= 3.0.0' s.add_development_dependency 'deep-cover-core', '~> 0.7.0' s.add_development_dependency 'pygments.rb', '~> 1.2.1' s.add_development_dependency 'rake', '~> 12.3.2' s.add_development_dependency 'rspec', '~> 3.8.0' s.add_development_dependency 'rubocop', '~> 0.74.0' s.add_development_dependency 'simplecov', '~> 0.17.0' end jekyll-asciidoc-3.0.0/lib/000077500000000000000000000000001353240764300153355ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc.rb000066400000000000000000000012001353240764300207210ustar00rootroot00000000000000module Jekyll module AsciiDoc jekyll_gem_version = ::Gem::Version.new ::Jekyll::VERSION Jekyll3_0 = (::Gem::Requirement.new '~> 3.0.0').satisfied_by? jekyll_gem_version Jekyll3_1 = !Jekyll3_0 && ((::Gem::Requirement.new '~> 3.1.0').satisfied_by? jekyll_gem_version) end end require_relative 'jekyll-asciidoc/core_ext' require_relative 'jekyll-asciidoc/jekyll_ext' require_relative 'jekyll-asciidoc/utils' require_relative 'jekyll-asciidoc/mixins' require_relative 'jekyll-asciidoc/excerpt' require_relative 'jekyll-asciidoc/converter' require_relative 'jekyll-asciidoc/integrator' require_relative 'jekyll-asciidoc/filters' jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/000077500000000000000000000000001353240764300204035ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/converter.rb000066400000000000000000000332201353240764300227370ustar00rootroot00000000000000module Jekyll module AsciiDoc class Converter < ::Jekyll::Converter DefaultAttributes = { 'idprefix' => '', 'idseparator' => '-', 'linkattrs' => '@', } DefaultFileExtensions = %w(asciidoc adoc ad) DefaultPageAttributePrefix = 'page' ImplicitAttributes = { 'env' => 'site', 'env-site' => '', 'site-gen' => 'jekyll', 'site-gen-jekyll' => '', 'builder' => 'jekyll', 'builder-jekyll' => '', 'jekyll-version' => ::Jekyll::VERSION, } MessageTopic = Utils::MessageTopic NewLine = Utils::NewLine AttributeReferenceRx = /\\?\{(\p{Word}[-\p{Word}]*)\}/ HeaderBoundaryRx = /(?<=\p{Graph}#{NewLine * 2})/ HeaderLineRx = /^=[ \t]+.|^:!?\w[-\w]*!?:(?:[ \t]+.)?/ # Enable plugin when running in safe mode; jekyll-asciidoc gem must also be declared in whitelist safe true # highlighter prefix/suffix not used by this plugin; defined only to avoid warning highlighter_prefix nil highlighter_suffix nil def initialize config @config = config @logger = ::Jekyll.logger @page_context = {} # NOTE jekyll-watch reinitializes plugins using a shallow clone of config, so no need to reconfigure # NOTE check for Configured only works if value of key is defined in _config.yml as Hash unless Configured === (asciidoc_config = (config['asciidoc'] ||= {})) if ::String === asciidoc_config @logger.warn MessageTopic, 'The AsciiDoc configuration should be defined using Hash on asciidoc key instead of discrete entries.' asciidoc_config = config['asciidoc'] = { 'processor' => asciidoc_config } else asciidoc_config['processor'] ||= 'asciidoctor' end old_asciidoc_ext = config.delete 'asciidoc_ext' asciidoc_ext = (asciidoc_config['ext'] ||= (old_asciidoc_ext || (DefaultFileExtensions * ','))) asciidoc_ext_re = asciidoc_config['ext_re'] = /^\.(?:#{asciidoc_ext.tr ',', '|'})$/ix old_page_attr_prefix_def = config.key? 'asciidoc_page_attribute_prefix' old_page_attr_prefix_val = config.delete 'asciidoc_page_attribute_prefix' unless (page_attr_prefix = asciidoc_config['page_attribute_prefix']) page_attr_prefix = old_page_attr_prefix_def ? old_page_attr_prefix_val || '' : (asciidoc_config.key? 'page_attribute_prefix') ? '' : DefaultPageAttributePrefix end asciidoc_config['page_attribute_prefix'] = (page_attr_prefix = page_attr_prefix.chomp '-').empty? ? '' : %(#{page_attr_prefix}-) asciidoc_config['require_front_matter_header'] = !!asciidoc_config['require_front_matter_header'] asciidoc_config.extend Configured if asciidoc_config['require_front_matter_header'] unless (::Jekyll::Utils.method :has_yaml_header?).owner == ::Jekyll::Utils # NOTE restore original method ::Jekyll::Utils.extend (::Module.new do define_method :has_yaml_header?, &(Utils.method :has_yaml_header?) end) end else ::Jekyll::Utils.extend (::Module.new do define_method :has_yaml_header?, (Utils.method :has_front_matter?).curry[Utils.method :has_yaml_header?][asciidoc_ext_re] end) end end if (@asciidoc_config = asciidoc_config)['processor'] == 'asciidoctor' unless Configured === (@asciidoctor_config = (config['asciidoctor'] ||= {})) asciidoctor_config = @asciidoctor_config asciidoctor_config.replace symbolize_keys asciidoctor_config source = ::File.expand_path config['source'] dest = ::File.expand_path config['destination'] case (base = asciidoctor_config[:base_dir]) when ':source' asciidoctor_config[:base_dir] = source when ':docdir' asciidoctor_config[:base_dir] = :docdir else asciidoctor_config[:base_dir] = ::File.expand_path base if base end asciidoctor_config[:safe] ||= 'safe' site_attributes = { 'site-root' => ::Dir.pwd, 'site-source' => source, 'site-destination' => dest, 'site-baseurl' => config['baseurl'], 'site-url' => config['url'], } attrs = asciidoctor_config[:attributes] = compile_attributes asciidoctor_config[:attributes], (compile_attributes asciidoc_config['attributes'], ((site_attributes.merge ImplicitAttributes).merge DefaultAttributes)) if (imagesdir = attrs['imagesdir']) && !(attrs.key? 'imagesoutdir') && (imagesdir.start_with? '/') attrs['imagesoutdir'] = ::File.join dest, (imagesdir.chomp '@') end asciidoctor_config.extend Configured end end load_processor end def load_processor case @asciidoc_config['processor'] when 'asciidoctor' begin require 'asciidoctor' unless defined? ::Asciidoctor::VERSION rescue ::LoadError @logger.error MessageTopic, 'You\'re missing a library required to convert AsciiDoc files. Install using:' @logger.error '', '$ [sudo] gem install asciidoctor' @logger.abort_with 'Bailing out; missing required dependency: asciidoctor' end else @logger.error MessageTopic, %(Invalid AsciiDoc processor given: #{@asciidoc_config['processor']}) @logger.error '', 'Valid options are: asciidoctor' @logger.abort_with 'Bailing out; invalid Asciidoctor processor.' end nil end def self.get_instance site site.find_converter_instance self end def matches ext @asciidoc_config['ext_re'].match? ext end def output_ext _ext '.html' end def self.before_render document, payload (get_instance document.site).before_render document, payload if Document === document || Excerpt === document end def self.after_render document (get_instance document.site).after_render document if Document === document || Excerpt === document end def before_render document, payload # NOTE Jekyll 3.1 incorrectly maps the page payload to document.data instead of payload['page'] @page_context[:data] = ::Jekyll::AsciiDoc::Jekyll3_1 ? document.data : payload['page'] record_paths document end def after_render _document @page_context.clear end def record_paths document, opts = {} @page_context[:paths] = paths = { 'docfile' => (docfile = ::File.join document.site.source, document.relative_path), 'docdir' => (::File.dirname docfile), 'docname' => (::File.basename docfile, (::File.extname docfile)), } paths.update( 'outfile' => (outfile = document.destination document.site.dest), 'outdir' => (::File.dirname outfile), 'outpath' => document.url ) unless opts[:source_only] end def clear_paths @page_context.delete :paths end def load_header document record_paths document, source_only: true case @asciidoc_config['processor'] when 'asciidoctor' opts = @asciidoctor_config.merge parse_header_only: true header = extract_header document if (paths = @page_context[:paths]) if opts[:base_dir] == :docdir opts[:base_dir] = paths['docdir'] # NOTE this assignment happens inside the processor anyway else paths.delete 'docdir' end opts[:attributes] = opts[:attributes].merge paths end if (layout_attr = resolve_default_layout document, opts[:attributes]) opts[:attributes] = opts[:attributes].merge layout_attr end # NOTE return instance even if header is empty since attributes may be inherited from config doc = ::Asciidoctor.load header, opts else @logger.warn MessageTopic, %(Unknown AsciiDoc processor: #{@asciidoc_config['processor']}. Cannot load document header.) doc = nil end clear_paths doc end def convert content # NOTE don't use nil_or_empty? since that's only provided only by Asciidoctor return '' unless content && !content.empty? case @asciidoc_config['processor'] when 'asciidoctor' opts = @asciidoctor_config.merge header_footer: (data = @page_context[:data] || {})['standalone'] if (paths = @page_context[:paths]) if opts[:base_dir] == :docdir opts[:base_dir] = paths['docdir'] # NOTE this assignment happens inside the processor anyway else paths.delete 'docdir' end opts[:attributes] = opts[:attributes].merge paths end if (doctype = data['doctype']) opts[:doctype] = doctype end (data['document'] = ::Asciidoctor.load content, opts).extend(Liquidable).convert else @logger.warn MessageTopic, %(Unknown AsciiDoc processor: #{@asciidoc_config['processor']}. Passing through unparsed content.) content end end private # Take up to the AsciiDoc document header (if present), then continue to the excerpt separator, if non-blank. def extract_header document if (content = document.content) header = (header_boundary = HeaderBoundaryRx =~ content) ? $` : content # NOTE at this point, excerpt is already set to an instance of Jekyll::Excerpt unless set in front matter if ::Jekyll::Page === document || !(::Jekyll::Excerpt === document.data['excerpt']) header = '' unless HeaderLineRx.match? header else document.data['excerpt'] = nil if (excerpt_separator = document.data['excerpt_separator'] || @asciidoc_config['excerpt_separator'] || @config['excerpt_separator']).to_s.empty? header = '' unless HeaderLineRx.match? header else header_boundary = 0 unless header_boundary && (HeaderLineRx.match? header) if (excerpt_boundary = content.index excerpt_separator, header_boundary) header = content.slice 0, excerpt_boundary else header = content end end end header else '' end end def symbolize_keys hash hash.each_with_object({}) {|(key, val), accum| accum[key.to_sym] = val } end def compile_attributes attrs, initial = {} if (is_array = ::Array === attrs) || ::Hash === attrs attrs.each_with_object(initial) do |entry, new_attrs| key, val = is_array ? (((entry.split '=', 2) + ['', '']).slice 0, 2) : entry if key.start_with? '!' new_attrs[key.slice 1, key.length] = nil elsif key.end_with? '!' new_attrs[key.chop] = nil # we're reserving -name to mean "unset implicit value but allow doc to override" elsif key.start_with? '-' new_attrs.delete key.slice 1, key.length else case val when ::String new_attrs[key] = resolve_attribute_refs val, new_attrs when ::Numeric new_attrs[key] = val.to_s when true new_attrs[key] = '' when nil, false # we may preserve false in the future to mean "unset implicit value but allow doc to override" # false already has special meaning for page-layout, so don't coerce it new_attrs[key] = key == 'page-layout' ? val : nil else new_attrs[key] = val end end end else initial end end def resolve_attribute_refs text, attrs if text.empty? text elsif text.include? '{' text.gsub AttributeReferenceRx do ($&.start_with? '\\') ? ($&.slice 1, $&.length) : ((attrs.fetch $1, $&).to_s.chomp '@') end else text end end def resolve_default_layout document, attributes layout_attr_name = %(#{@asciidoc_config['page_attribute_prefix']}layout) if attributes.key? layout_attr_name if ::String === (layout = attributes[layout_attr_name]) if layout == '~@' layout = 'none@' elsif (layout.end_with? '@') && ((document.data.key? 'layout') || document.data['layout']) layout = %(#{(layout = document.data['layout']).nil? ? 'none' : layout}@) else layout = nil end elsif layout.nil? layout = 'none' else layout = layout.to_s end elsif (document.data.key? 'layout') || document.data['layout'] layout = %(#{(layout = document.data['layout']).nil? ? 'none' : layout}@) else layout = '@' end layout ? { layout_attr_name => layout } : nil end # Register pre and post render callbacks for saving and clearing contextual AsciiDoc attributes, respectively. ::Jekyll::Hooks.tap do |hooks| hooks.register [:pages, :documents], :pre_render, &(method :before_render) hooks.register [:pages, :documents], :post_render, &(method :after_render) end end end end jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/core_ext.rb000066400000000000000000000000541353240764300225370ustar00rootroot00000000000000require_relative 'core_ext/regexp/is_match' jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/core_ext/000077500000000000000000000000001353240764300222135ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/core_ext/regexp/000077500000000000000000000000001353240764300235055ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/core_ext/regexp/is_match.rb000066400000000000000000000002131353240764300256150ustar00rootroot00000000000000# NOTE remove once minimum required Ruby version is at least 2.4 class Regexp alias match? === end unless Regexp.method_defined? :match? jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/excerpt.rb000066400000000000000000000030201353240764300223750ustar00rootroot00000000000000module Jekyll module AsciiDoc class Excerpt < ::Jekyll::Excerpt if Jekyll3_0 def_delegators :@doc, :destination, :url else def_delegators :@doc, :destination end def initialize primary_doc, excerpt_content excerpt_doc = primary_doc.dup excerpt_doc.content = excerpt_content excerpt_doc.extend NoLiquid unless primary_doc.data['liquid'] super excerpt_doc end def extract_excerpt content # NOTE excerpt_doctype has already been resolved from either the page attribute or front matter variable if (doctype = (excerpt_data = data)['excerpt_doctype'] || (inherited = doc.site.config['asciidoc']['excerpt_doctype'])) excerpt_data['doctype'] = doctype excerpt_data['excerpt_doctype'] = doc.data['excerpt_doctype'] = doctype if inherited end content end def output unless defined? @output renderer = ::Jekyll::Renderer.new doc.site, self, site.site_payload @output = renderer.run trigger_hooks :post_render end @output end def render_with_liquid? !(NoLiquid === doc) end # NOTE Jekyll 3.0 incorrectly maps to_liquid to primary doc alias to_liquid data if Jekyll3_0 def trigger_hooks hook_name, *args #::Jekyll::Hooks.trigger collection.label.to_sym, hook_name, self, *args if collection ::Jekyll::Hooks.trigger :documents, hook_name, self, *args end end end end jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/filters.rb000066400000000000000000000031561353240764300224050ustar00rootroot00000000000000module Jekyll module AsciiDoc module Filters # A Liquid filter for converting an AsciiDoc string to HTML using {Converter#convert}. # # @param input [String] the AsciiDoc String to convert. # @param doctype [String] the target AsciiDoc doctype. # # @example Convert the AsciiDoc page excerpt to inline HTML # {{ page.excerpt | asciidocify: 'inline' }} # # @return [String] the converted result as an HTML-formatted String. def asciidocify input, doctype = nil (@context.registers[:cached_asciidoc_converter] ||= (Converter.get_instance @context.registers[:site])) .convert(doctype ? %(:doctype: #{doctype}#{Utils::NewLine}#{input}) : (input || '')) end # A Liquid filter for generating an HTML table of contents from a parsed AsciiDoc document. # # @param document [Asciidoctor::Document] the parsed AsciiDoc document for which to generate an HTML table of # contents. # @param levels [Integer] the maximum section depth to use; if not specified, uses the value of toclevels document # attribute. # # @example Generate a table of contents from the document for the current page # {{ page.document | tocify_asciidoc: 3 }} # # @return [String] the table of contents as an HTML-formatted String. def tocify_asciidoc document, levels = nil ::Asciidoctor::Document === document ? (document.converter.convert document, 'outline', toclevels: (levels.nil_or_empty? ? nil : levels.to_i)) : nil end end ::Liquid::Template.register_filter Filters end end jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/integrator.rb000066400000000000000000000151511353240764300231110ustar00rootroot00000000000000module Jekyll module AsciiDoc # Promotes eligible AsciiDoc attributes to page variables and applies page-level settings to all documents handled # by the converter included with this plugin. It also copies the custom Pygments stylesheet if Pygments is the # source highlighter and configured to use class-based styling. class Integrator < ::Jekyll::Generator NewLine = Utils::NewLine PygmentsRootSelector = /^(.+?)\.pygments +{/ # Enable plugin when running in safe mode; jekyll-asciidoc gem must also be declared in whitelist safe true def self.get_instance site site.find_generator_instance self end # This method is triggered each time the site is generated, including after any file has changed when running in # watch mode (regardless of incremental setting). # # @param site [Jekyll::Site] the site being processed. # # @return [nil] Nothing def generate site @converter = converter = Converter.get_instance site site.pages.select! do |page| (converter.matches page.ext) ? (integrate page) : true end site.collections.each do |name, collection| collection.docs.select! do |doc| (converter.matches doc.extname) ? (integrate doc, name) : true end end if site.config['asciidoc']['processor'] == 'asciidoctor' attrs = site.config['asciidoctor'][:attributes] attrs['localdate'], attrs['localtime'] = (site.time.strftime '%Y-%m-%d %H:%M:%S %Z').split ' ', 2 if ((attrs['source-highlighter'] || '').chomp '@') == 'pygments' && ((attrs['pygments-css'] || '').chomp '@') != 'style' && (attrs.fetch 'pygments-stylesheet', '') generate_pygments_stylesheet site, attrs end end nil end # Integrate the page-related attributes from the AsciiDoc document header into the data Array of the specified # {::Jekyll::Page}, {::Jekyll::Post} or {::Jekyll::Document}. # # @param document [::Jekyll::Page, ::Jekyll::Post, ::Jekyll::Document] the page, post, or document to integrate. # @param collection_name [String] the name of the collection to which this document belongs. # # @return [Boolean] whether the document should be published. def integrate document, collection_name = nil return true unless (doc = @converter.load_header document) data = document.data data['asciidoc'] = true # NOTE id is already reserved in Jekyll for another purpose, so we'll map id to docid instead data['docid'] = doc.id if doc.id data['title'] = doc.doctitle if doc.header? data['author'] = doc.author if doc.author if collection_name && (doc.attr? 'revdate') data['date'] = ::Jekyll::Utils.parse_date doc.revdate, %(Document '#{document.relative_path}' does not have a valid revdate in the AsciiDoc header.) end page_attr_prefix = document.site.config['asciidoc']['page_attribute_prefix'] no_prefix = (prefix_size = page_attr_prefix.length) == 0 adoc_data = doc.attributes.each_with_object({}) do |(key, val), accum| if no_prefix || ((key.start_with? page_attr_prefix) && (key = key[prefix_size..-1])) accum[key] = ::String === val ? (parse_yaml_value val) : val end end data.update adoc_data unless adoc_data.empty? { 'category' => 'categories', 'tag' => 'tags' }.each do |sole_key, coll_key| if (sole_val = data[sole_key]) (coll_val = data[coll_key] ||= []).delete sole_val coll_val.unshift sole_val elsif (coll_val = data[coll_key]) data[sole_key] = coll_val[0] end end # NOTE excerpt must be set before layout is assigned since excerpt cannot have a layout (or be standalone) unless ::Jekyll::Page === document data['excerpt'] = Excerpt.new document, ((excerpt = data['excerpt']) || doc.source) data['excerpt_origin'] = excerpt ? ((adoc_data.key? 'excerpt') ? 'asciidoc-header' : 'front-matter') : 'body' end case data['layout'] when nil data['standalone'] = true unless data.key? 'layout' when '', '_auto' layout = collection_name ? (collection_name.chomp 's') : 'page' data['layout'] = (document.site.layouts.key? layout) ? layout : 'default' when false data['layout'] = 'none' data['standalone'] = true end document.extend Document document.extend NoLiquid unless data['liquid'] data.fetch 'published', true end def generate_pygments_stylesheet site, attrs css_base = site.source unless (css_dir = (attrs['stylesdir'] || '').chomp '@').empty? || (css_dir.start_with? '/') css_dir = %(/#{css_dir}) end css_name = attrs['pygments-stylesheet'] || 'asciidoc-pygments.css' css_file = ::File.join css_base, css_dir, css_name css_style = (attrs['pygments-style'] || 'vs').chomp '@' css = ::Asciidoctor::Stylesheets.instance.pygments_stylesheet_data css_style # NOTE apply stronger CSS rule for general text color css = css.sub PygmentsRootSelector, '\1.pygments, \1.pygments code {' if site.static_files.any? {|f| f.path == css_file } ::File.write css_file, css unless css == (::File.read css_file) else ::FileUtils.mkdir_p ::File.dirname css_file ::File.write css_file, css site.static_files << (::Jekyll::StaticFile.new site, css_base, css_dir, css_name) end end private # Parse the specified value as though it is a single-line value part of a YAML key/value pair. # # Attempt to parse the specified String value as though it is a single-line value part of a YAML key/value pair. # If the value fails to parse, wrap the value in single quotes (after escaping any single quotes in the value) and # parse it as a character sequence. If the value is empty, return an empty String. # # @param val [String] the value to parse. # # @return [Object, String] the value parsed from the string-based YAML value or an empty String if the specified # value is empty. def parse_yaml_value val if val.empty? '' else begin ::SafeYAML.load %(--- #{val}) rescue ::StandardError, ::SyntaxError val = val.gsub '\'', '\'\'' if val.include? '\'' ::SafeYAML.load %(--- \'#{val}\') end end end end end end jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/jekyll_ext.rb000066400000000000000000000002231353240764300230770ustar00rootroot00000000000000require_relative 'jekyll_ext/drops/drop' require_relative 'jekyll_ext/renderer/layouts' require_relative 'jekyll_ext/site/find_generator_instance' jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/jekyll_ext/000077500000000000000000000000001353240764300225555ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/jekyll_ext/drops/000077500000000000000000000000001353240764300237045ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/jekyll_ext/drops/drop.rb000066400000000000000000000005611353240764300251770ustar00rootroot00000000000000module Jekyll module Drops class Drop class << self # NOTE fixes "warning: instance variable @is_mutable not initialized" prepend (Module.new do def mutable? @is_mutable ||= nil # rubocop:disable Naming/MemoizedInstanceVariableName end end) end end end end if defined? Jekyll::Drops::Drop jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/jekyll_ext/renderer/000077500000000000000000000000001353240764300243635ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/jekyll_ext/renderer/layouts.rb000066400000000000000000000004331353240764300264100ustar00rootroot00000000000000module Jekyll class Renderer # NOTE fixes "warning: instance variable @layouts not initialized" prepend (Module.new do def layouts @layouts = nil unless defined? @layouts super end end) end end if Jekyll::Renderer.method_defined? :layouts jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/jekyll_ext/site/000077500000000000000000000000001353240764300235215ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/jekyll_ext/site/find_generator_instance.rb000066400000000000000000000005141353240764300307200ustar00rootroot00000000000000module Jekyll class Site # Introduce complement to {::Jekyll::Site#find_converter_instance} for generators. def find_generator_instance type generators.find {|candidate| type === candidate } || (raise %(No Generators found for #{type})) end end end unless Jekyll::Site.method_defined? :find_generator_instance jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/mixins.rb000066400000000000000000000004011353240764300222320ustar00rootroot00000000000000module Jekyll module AsciiDoc Configured = ::Module.new Document = ::Module.new module Liquidable def to_liquid self end end module NoLiquid def render_with_liquid? false end end end end jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/utils.rb000066400000000000000000000020021353240764300220620ustar00rootroot00000000000000module Jekyll module AsciiDoc module Utils MessageTopic = 'Jekyll AsciiDoc:' NewLine = ?\n module_function # Checks whether the file at the specified path has front matter. For AsciiDoc files, this method always returns # true. Otherwise, it delegates to {::Jekyll::Utils.has_yaml_header?}. # # @param dlg_method [Method] the delegate method to call if this path is not an AsciiDoc file. # @param asciidoc_ext_rx [Regexp] the regular expression to use to check if this path is an AsciiDoc file. # @param path [String] the path to check. # # @return [Boolean] whether the file at this path has front matter. def has_front_matter? dlg_method, asciidoc_ext_rx, path (asciidoc_ext_rx.match? ::File.extname path) || (dlg_method.call path) end # NOTE use define_method to match signature of original method (and avoid extra call) define_method :has_yaml_header?, &(::Jekyll::Utils.method :has_yaml_header?) end end end jekyll-asciidoc-3.0.0/lib/jekyll-asciidoc/version.rb000066400000000000000000000001001353240764300224040ustar00rootroot00000000000000module Jekyll module AsciiDoc VERSION = '3.0.0' end end jekyll-asciidoc-3.0.0/spec/000077500000000000000000000000001353240764300155215ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/000077500000000000000000000000001353240764300173725ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/alternate_page_attribute_prefix/000077500000000000000000000000001353240764300260055ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/alternate_page_attribute_prefix/_config.yml000066400000000000000000000001061353240764300301310ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoc: page_attribute_prefix: jekyll- jekyll-asciidoc-3.0.0/spec/fixtures/alternate_page_attribute_prefix/_layouts/000077500000000000000000000000001353240764300276445ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/alternate_page_attribute_prefix/_layouts/default.html000066400000000000000000000002441353240764300321560ustar00rootroot00000000000000 {{ page.title }}
{{ content }}
jekyll-asciidoc-3.0.0/spec/fixtures/alternate_page_attribute_prefix/explicit-permalink.adoc000066400000000000000000000001141353240764300324320ustar00rootroot00000000000000= Page With Explicit Permalink :jekyll-permalink: /permalink/ Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/asciidocify_filter/000077500000000000000000000000001353240764300232255ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/asciidocify_filter/_config.yml000066400000000000000000000000331353240764300253500ustar00rootroot00000000000000plugins: - jekyll-asciidoc jekyll-asciidoc-3.0.0/spec/fixtures/asciidocify_filter/_layouts/000077500000000000000000000000001353240764300250645ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/asciidocify_filter/_layouts/default.html000066400000000000000000000003461353240764300274010ustar00rootroot00000000000000 {{ page.title }}

{{ page.summary | asciidocify: 'inline' }}

{{ content }}
jekyll-asciidoc-3.0.0/spec/fixtures/asciidocify_filter/index.adoc000066400000000000000000000001321353240764300251600ustar00rootroot00000000000000--- summary: A *very* welcoming _welcome_ page. --- = Welcome Welcome, welcome, welcome! jekyll-asciidoc-3.0.0/spec/fixtures/attributes_as_array/000077500000000000000000000000001353240764300234415ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/attributes_as_array/_config.yml000066400000000000000000000001501353240764300255640ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoctor: attributes: - icons=font - sectanchors - table-caption! jekyll-asciidoc-3.0.0/spec/fixtures/attributes_as_hash/000077500000000000000000000000001353240764300232465ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/attributes_as_hash/_config.yml000066400000000000000000000002431353240764300253740ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoc: processor: asciidoctor attributes: icons: font asciidoctor: attributes: sectanchors: '' table-caption: null jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/000077500000000000000000000000001353240764300214775ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/_config.yml000066400000000000000000000000331353240764300236220ustar00rootroot00000000000000plugins: - jekyll-asciidoc jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/_layouts/000077500000000000000000000000001353240764300233365ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/_layouts/custom.html000066400000000000000000000003301353240764300255320ustar00rootroot00000000000000 {{ page.title }}
{{ content }}

Footer for custom layout.

jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/_layouts/page.html000066400000000000000000000004101353240764300251330ustar00rootroot00000000000000 {% if page.title %}{{ page.title }}{% else %}Site Title{% endif %}
{{ content }}

Footer for page layout.

jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/auto-layout.adoc000066400000000000000000000000651353240764300246130ustar00rootroot00000000000000= Auto Page Layout :page-layout: _auto Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/bare-header.adoc000066400000000000000000000000641353240764300244660ustar00rootroot00000000000000:page-permalink: /bare/ Just content. Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/custom-layout.adoc000066400000000000000000000000631353240764300251530ustar00rootroot00000000000000= Custom Layout :page-layout: custom Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/docid.adoc000066400000000000000000000000411353240764300234040ustar00rootroot00000000000000[#page-id] = Page Title content jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/empty-layout.adoc000066400000000000000000000000571353240764300250020ustar00rootroot00000000000000= Auto Page Layout :page-layout: Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/empty-page-attribute.adoc000066400000000000000000000000751353240764300264020ustar00rootroot00000000000000= Page Title :page-attribute-with-empty-value: Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/liquid-enabled-asciidoc-header.adoc000066400000000000000000000000611353240764300302050ustar00rootroot00000000000000= Liquid Enabled :page-liquid: {{ page.title }} jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/liquid-enabled-front-matter.adoc000066400000000000000000000000701353240764300276230ustar00rootroot00000000000000--- liquid: true --- = Liquid Enabled {{ page.title }} jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/nil-layout.adoc000066400000000000000000000000601353240764300244200ustar00rootroot00000000000000= Nil Page Layout :page-layout: ~ Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/no-doctitle.adoc000066400000000000000000000000331353240764300245440ustar00rootroot00000000000000Just content. Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/no-liquid.adoc000066400000000000000000000000361353240764300242270ustar00rootroot00000000000000= No Liquid {{ page.title }} jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/not-published.adoc000066400000000000000000000001131353240764300250770ustar00rootroot00000000000000= Not Published :page-published: false This page should not be published. jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/section-with-id-and-role.adoc000066400000000000000000000001031353240764300270270ustar00rootroot00000000000000= Page Title [#section-id.section-role] == Section Title content jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/standalone-a.adoc000066400000000000000000000000611353240764300246720ustar00rootroot00000000000000= Standalone Page A :page-layout!: Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/standalone-b.adoc000066400000000000000000000000661353240764300247000ustar00rootroot00000000000000= Standalone Page B :page-layout: false Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/subdir/000077500000000000000000000000001353240764300227675ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/subdir/page-in-subdir.adoc000066400000000000000000000001321353240764300264210ustar00rootroot00000000000000= Page In Subdir Lorem ipsum. * docfile={docfile} * docdir={docdir} * docname={docname} jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/with-front-matter-header-only.adoc000066400000000000000000000000561353240764300301300ustar00rootroot00000000000000--- title: Front Matter Only layout: page --- jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/with-front-matter-header.adoc000066400000000000000000000000761353240764300271530ustar00rootroot00000000000000--- title: Original Page Title --- = Page Title Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/with-header-only.adoc000066400000000000000000000000411353240764300255020ustar00rootroot00000000000000= Header Only :page-layout: page jekyll-asciidoc-3.0.0/spec/fixtures/basic_site/without-front-matter-header.adoc000066400000000000000000000000331353240764300276740ustar00rootroot00000000000000= Page Title Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/blank_page_attribute_prefix/000077500000000000000000000000001353240764300251155ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/blank_page_attribute_prefix/_config.yml000066400000000000000000000001001353240764300272330ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoc: page_attribute_prefix: ~ jekyll-asciidoc-3.0.0/spec/fixtures/blank_page_attribute_prefix/_layouts/000077500000000000000000000000001353240764300267545ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/blank_page_attribute_prefix/_layouts/default.html000066400000000000000000000002441353240764300312660ustar00rootroot00000000000000 {{ page.title }}
{{ content }}
jekyll-asciidoc-3.0.0/spec/fixtures/blank_page_attribute_prefix/explicit-permalink.adoc000066400000000000000000000001051353240764300315420ustar00rootroot00000000000000= Page With Explicit Permalink :permalink: /permalink/ Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/custom_excerpt_separator/000077500000000000000000000000001353240764300245165ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/custom_excerpt_separator/_config.yml000066400000000000000000000001501353240764300266410ustar00rootroot00000000000000plugins: - jekyll-asciidoc excerpt_separator: "" asciidoc: excerpt_separator: "\n//more\n" jekyll-asciidoc-3.0.0/spec/fixtures/custom_excerpt_separator/_layouts/000077500000000000000000000000001353240764300263555ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/custom_excerpt_separator/_layouts/post.html000066400000000000000000000005141353240764300302300ustar00rootroot00000000000000 {{ page.title }}

{{ page.title }}

{{ content }}

Footer for post layout.

jekyll-asciidoc-3.0.0/spec/fixtures/custom_excerpt_separator/_posts/000077500000000000000000000000001353240764300260255ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/custom_excerpt_separator/_posts/2018-01-01-markdown.md000066400000000000000000000002511353240764300312130ustar00rootroot00000000000000--- title: Excerpt Separator in Markdown layout: post --- This is part of the excerpt. This is also part of the excerpt. This is not part of the excerpt. jekyll-asciidoc-3.0.0/spec/fixtures/custom_excerpt_separator/_posts/2018-01-02-asciidoc.adoc000066400000000000000000000002131353240764300314540ustar00rootroot00000000000000= Excerpt Separator in AsciiDoc This is part of the excerpt. This is also part of the excerpt. //more This is not part of the excerpt. jekyll-asciidoc-3.0.0/spec/fixtures/custom_excerpt_separator/index.html000066400000000000000000000005271353240764300265170ustar00rootroot00000000000000--- --- Post Excerpts

Posts

jekyll-asciidoc-3.0.0/spec/fixtures/default_config/000077500000000000000000000000001353240764300223435ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/default_config/_config.yml000066400000000000000000000000331353240764300244660ustar00rootroot00000000000000plugins: - jekyll-asciidoc jekyll-asciidoc-3.0.0/spec/fixtures/explicit_site_time/000077500000000000000000000000001353240764300232555ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/explicit_site_time/_config.yml000066400000000000000000000001031353240764300253760ustar00rootroot00000000000000time: 2016-07-04T09:15:00 timezone: UTC plugins: - jekyll-asciidoc jekyll-asciidoc-3.0.0/spec/fixtures/explicit_site_time/_layouts/000077500000000000000000000000001353240764300251145ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/explicit_site_time/_layouts/default.html000066400000000000000000000002441353240764300274260ustar00rootroot00000000000000 {{ page.title }}
{{ content }}
jekyll-asciidoc-3.0.0/spec/fixtures/explicit_site_time/home.adoc000066400000000000000000000000551353240764300250350ustar00rootroot00000000000000= Home Page * localdatetime={localdatetime} jekyll-asciidoc-3.0.0/spec/fixtures/fallback_to_default_layout/000077500000000000000000000000001353240764300247345ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/fallback_to_default_layout/_blueprints/000077500000000000000000000000001353240764300272625ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/fallback_to_default_layout/_blueprints/blueprint.adoc000066400000000000000000000000321353240764300321110ustar00rootroot00000000000000= Blueprint Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/fallback_to_default_layout/_config.yml000066400000000000000000000001071353240764300270610ustar00rootroot00000000000000plugins: - jekyll-asciidoc collections: blueprints: output: true jekyll-asciidoc-3.0.0/spec/fixtures/fallback_to_default_layout/_layouts/000077500000000000000000000000001353240764300265735ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/fallback_to_default_layout/_layouts/default.html000066400000000000000000000003311353240764300311020ustar00rootroot00000000000000 {{ page.title }}
{{ content }}

Footer for default layout.

jekyll-asciidoc-3.0.0/spec/fixtures/fallback_to_default_layout/_posts/000077500000000000000000000000001353240764300262435ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/fallback_to_default_layout/_posts/2016-01-01-post.adoc000066400000000000000000000000421353240764300310760ustar00rootroot00000000000000= Post Henry Jekyll Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/fallback_to_default_layout/home.adoc000066400000000000000000000000251353240764300265110ustar00rootroot00000000000000= Page Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/front_matter_defaults/000077500000000000000000000000001353240764300237655ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/front_matter_defaults/_config.yml000066400000000000000000000002061353240764300261120ustar00rootroot00000000000000plugins: - jekyll-asciidoc defaults: - values: layout: general - scope: path: docs type: pages values: layout: docs jekyll-asciidoc-3.0.0/spec/fixtures/front_matter_defaults/_layouts/000077500000000000000000000000001353240764300256245ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/front_matter_defaults/_layouts/docs.html000066400000000000000000000003261353240764300274430ustar00rootroot00000000000000 {{ page.title }}
{{ content }}

Footer for docs layout.

jekyll-asciidoc-3.0.0/spec/fixtures/front_matter_defaults/_layouts/general.html000066400000000000000000000003311353240764300301240ustar00rootroot00000000000000 {{ page.title }}
{{ content }}

Footer for general layout.

jekyll-asciidoc-3.0.0/spec/fixtures/front_matter_defaults/docs/000077500000000000000000000000001353240764300247155ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/front_matter_defaults/docs/page.adoc000066400000000000000000000000431353240764300264560ustar00rootroot00000000000000= Docs Page Content of docs page. jekyll-asciidoc-3.0.0/spec/fixtures/front_matter_defaults/page.adoc000066400000000000000000000000511353240764300255250ustar00rootroot00000000000000= General Page Content of general page. jekyll-asciidoc-3.0.0/spec/fixtures/hybrid_config/000077500000000000000000000000001353240764300222005ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/hybrid_config/_config.yml000066400000000000000000000002511353240764300243250ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoc_ext: adoc asciidoc_page_attribute_prefix: jekyll asciidoc: processor: asciidoctor ext: asciidoc,adoc page_attribute_prefix: pg jekyll-asciidoc-3.0.0/spec/fixtures/imagesdir_relative_to_root/000077500000000000000000000000001353240764300247765ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/imagesdir_relative_to_root/_config.yml000066400000000000000000000001161353240764300271230ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoctor: attributes: imagesdir: /images@ jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_docdir/000077500000000000000000000000001353240764300247365ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_docdir/_child.adoc000066400000000000000000000000241353240764300270040ustar00rootroot00000000000000:name: value {name} jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_docdir/_config.yml000066400000000000000000000000741353240764300270660ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoctor: base_dir: :docdir jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_docdir/_layouts/000077500000000000000000000000001353240764300265755ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_docdir/_layouts/default.html000066400000000000000000000002161353240764300311060ustar00rootroot00000000000000 {{ page.title }}
{{ content }}
jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_docdir/about/000077500000000000000000000000001353240764300260505ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_docdir/about/_people.adoc000066400000000000000000000000321353240764300303160ustar00rootroot00000000000000* Doc Writer * Word Smith jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_docdir/about/index.adoc000066400000000000000000000003261353240764300300100ustar00rootroot00000000000000= About Us We provide content design services for open source tech companies. * docfile={docfile} * docdir={docdir} * outfile={outfile} * outdir={outdir} * outpath={outpath} == Our Team include::_people.adoc[] jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_docdir/parent.adoc000066400000000000000000000000271353240764300270560ustar00rootroot00000000000000include::_child.adoc[] jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_root/000077500000000000000000000000001353240764300244555ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_root/source/000077500000000000000000000000001353240764300257555ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_root/source/_config.yml000066400000000000000000000000351353240764300301020ustar00rootroot00000000000000plugins: - jekyll-asciidoc jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_root/source/_layouts/000077500000000000000000000000001353240764300276145ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_root/source/_layouts/default.html000066400000000000000000000002151353240764300321240ustar00rootroot00000000000000 {{ page.title }}
{{ content }}
jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_root/source/about/000077500000000000000000000000001353240764300270675ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_root/source/about/_people.adoc000066400000000000000000000000321353240764300313350ustar00rootroot00000000000000* Doc Writer * Word Smith jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_root/source/about/index.adoc000066400000000000000000000003431353240764300310260ustar00rootroot00000000000000= About Us We provide content design services for open source tech companies. * docfile={docfile} * docdir={docdir} * outfile={outfile} * outdir={outdir} * outpath={outpath} == Our Team include::source/about/_people.adoc[] jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_source/000077500000000000000000000000001353240764300247725ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_source/_config.yml000066400000000000000000000000741353240764300271220ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoctor: base_dir: :source jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_source/_layouts/000077500000000000000000000000001353240764300266315ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_source/_layouts/default.html000066400000000000000000000002161353240764300311420ustar00rootroot00000000000000 {{ page.title }}
{{ content }}
jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_source/about/000077500000000000000000000000001353240764300261045ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_source/about/_people.adoc000066400000000000000000000000321353240764300303520ustar00rootroot00000000000000* Doc Writer * Word Smith jekyll-asciidoc-3.0.0/spec/fixtures/include_relative_to_source/about/index.adoc000066400000000000000000000003341353240764300300430ustar00rootroot00000000000000= About Us We provide content design services for open source tech companies. * docfile={docfile} * docdir={docdir} * outfile={outfile} * outdir={outdir} * outpath={outpath} == Our Team include::about/_people.adoc[] jekyll-asciidoc-3.0.0/spec/fixtures/legacy_config/000077500000000000000000000000001353240764300221635ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/legacy_config/_config.yml000066400000000000000000000001531353240764300243110ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoc: asciidoctor asciidoc_ext: adoc asciidoc_page_attribute_prefix: jekyll jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/000077500000000000000000000000001353240764300235125ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_config.yml000066400000000000000000000000331353240764300256350ustar00rootroot00000000000000plugins: - jekyll-asciidoc jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_layouts/000077500000000000000000000000001353240764300253515ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_layouts/post.html000066400000000000000000000005141353240764300272240ustar00rootroot00000000000000 {{ page.title }}

{{ page.title }}

{{ content }}

Footer for post layout.

jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_posts/000077500000000000000000000000001353240764300250215ustar00rootroot000000000000002018-01-01-header-and-single-paragraph.adoc000066400000000000000000000001161353240764300340260ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_posts= Header and Single Paragraph Author Name This is the excerpt and body text. 2018-01-02-header-and-multiple-paragraphs.adoc000066400000000000000000000002041353240764300345620ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_posts= Header and Multiple Paragraphs Author Name This is the excerpt. This is the rest of the body text that comes after the excerpt. jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_posts/2018-01-03-single-paragraph-only.adoc000066400000000000000000000001011353240764300330720ustar00rootroot00000000000000--- title: Paragraph Only --- This is the excerpt and body text. 2018-01-04-multiple-paragraphs-only.adoc000066400000000000000000000002001353240764300335510ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_posts--- title: Multiple Paragraphs Only --- This is the _excerpt_. This is the rest of the body text that comes after the excerpt. jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_posts/2018-01-05-excerpt-in-header.adoc000066400000000000000000000002211353240764300322000ustar00rootroot00000000000000= Excerpt in Header :page-excerpt: This is the _excerpt_. This is the first paragraph, but not the excerpt. This is the rest of the body text. 2018-01-06-excerpt-in-front-matter.adoc000066400000000000000000000002231353240764300333160ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_posts--- excerpt: This is the _excerpt_. --- = Excerpt in Header This is the first paragraph, but not the excerpt. This is the rest of the body text. jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_posts/2018-01-07-blank-excerpt.adoc000066400000000000000000000002051353240764300314370ustar00rootroot00000000000000--- excerpt_separator: '' --- = Blank Excerpt Author Name This document has a blank excerpt because the excerpt_separator is blank. jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_posts/2018-01-08-header-only.adoc000066400000000000000000000000431353240764300311100ustar00rootroot00000000000000= AsciiDoc Header Only Author Name jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_posts/2018-01-09-no-liquid.adoc000066400000000000000000000001141353240764300306020ustar00rootroot00000000000000= No Liquid Author Name {{ page.title }} This is not part of the excerpt. jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_posts/2018-01-10-with-liquid.adoc000066400000000000000000000001341353240764300311330ustar00rootroot00000000000000= With Liquid Author Name :page-liquid: {{ page.title }} This is not part of the excerpt. jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/_posts/2018-01-11-standalone-layout.adoc000066400000000000000000000001701353240764300323370ustar00rootroot00000000000000= Standalone Author Name :page-layout: false Excerpt of post with standalone layout. This is not part of the excerpt. jekyll-asciidoc-3.0.0/spec/fixtures/posts_with_excerpts/index.html000066400000000000000000000005271353240764300255130ustar00rootroot00000000000000--- --- Post Excerpts

Posts

jekyll-asciidoc-3.0.0/spec/fixtures/pygments_code_highlighting/000077500000000000000000000000001353240764300247575ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/pygments_code_highlighting/_config.yml000066400000000000000000000001521353240764300271040ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoctor: attributes: - stylesdir=/css - source-highlighter=pygments@ jekyll-asciidoc-3.0.0/spec/fixtures/pygments_code_highlighting/_layouts/000077500000000000000000000000001353240764300266165ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/pygments_code_highlighting/_layouts/page.html000066400000000000000000000003761353240764300304260ustar00rootroot00000000000000 {{ page.title }}
{{ content }}
jekyll-asciidoc-3.0.0/spec/fixtures/pygments_code_highlighting/page-with-code.adoc000066400000000000000000000002571353240764300304100ustar00rootroot00000000000000= Code ```ruby class NilClass alias :nil_or_empty? :nil? end class String def nil_or_empty? alias :nil_or_empty? :empty? end end v = nil puts v.nil_or_empty? ``` jekyll-asciidoc-3.0.0/spec/fixtures/read_error/000077500000000000000000000000001353240764300215165ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/read_error/_config.yml000066400000000000000000000000331353240764300236410ustar00rootroot00000000000000plugins: - jekyll-asciidoc jekyll-asciidoc-3.0.0/spec/fixtures/read_error/unreadable.adoc000066400000000000000000000000401353240764300244420ustar00rootroot00000000000000= Unreadable Page Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/require_front_matter_header/000077500000000000000000000000001353240764300251425ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/require_front_matter_header/_config.yml000066400000000000000000000001111353240764300272620ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoc: require_front_matter_header: true jekyll-asciidoc-3.0.0/spec/fixtures/require_front_matter_header/_layouts/000077500000000000000000000000001353240764300270015ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/require_front_matter_header/_layouts/default.html000066400000000000000000000002441353240764300313130ustar00rootroot00000000000000 {{ page.title }}
{{ content }}
jekyll-asciidoc-3.0.0/spec/fixtures/require_front_matter_header/with-front-matter-header.adoc000066400000000000000000000000431353240764300326100ustar00rootroot00000000000000--- --- = Page Title Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/require_front_matter_header/without-front-matter-header.adoc000066400000000000000000000000331353240764300333370ustar00rootroot00000000000000= Page Title Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/safe_mode/000077500000000000000000000000001353240764300213145ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/safe_mode/_config.yml000066400000000000000000000001031353240764300234350ustar00rootroot00000000000000plugins: &plugins - jekyll-asciidoc safe: true whitelist: *plugins jekyll-asciidoc-3.0.0/spec/fixtures/safe_mode/_layouts/000077500000000000000000000000001353240764300231535ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/safe_mode/_layouts/home.html000066400000000000000000000003261353240764300247720ustar00rootroot00000000000000 {{ page.title }}
{{ content }}

Footer for home layout.

jekyll-asciidoc-3.0.0/spec/fixtures/safe_mode/home.adoc000066400000000000000000000001001353240764300230630ustar00rootroot00000000000000= Home Page :page-layout: home :imagesdir: images Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/site_wide_fallback_layout/000077500000000000000000000000001353240764300245625ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/site_wide_fallback_layout/_config.yml000066400000000000000000000001171353240764300267100ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoctor: attributes: - page-layout=default@ jekyll-asciidoc-3.0.0/spec/fixtures/site_wide_fallback_layout/_layouts/000077500000000000000000000000001353240764300264215ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/site_wide_fallback_layout/_layouts/default.html000066400000000000000000000003311353240764300307300ustar00rootroot00000000000000 {{ page.title }}
{{ content }}

Footer for default layout.

jekyll-asciidoc-3.0.0/spec/fixtures/site_wide_fallback_layout/_layouts/simple.html000066400000000000000000000003301353240764300305740ustar00rootroot00000000000000 {{ page.title }}
{{ content }}

Footer for simple layout.

jekyll-asciidoc-3.0.0/spec/fixtures/site_wide_fallback_layout/in-asciidoc-header.adoc000066400000000000000000000000601353240764300310160ustar00rootroot00000000000000= Page Title :page-layout: simple Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/site_wide_fallback_layout/in-front-matter.adoc000066400000000000000000000000621353240764300304360ustar00rootroot00000000000000--- layout: simple --- = Page Title Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/site_wide_fallback_layout/not-set.adoc000066400000000000000000000000331353240764300267770ustar00rootroot00000000000000= Page Title Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/site_wide_standalone_layout/000077500000000000000000000000001353240764300251535ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/site_wide_standalone_layout/_config.yml000066400000000000000000000001151353240764300272770ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoctor: attributes: page-layout: false jekyll-asciidoc-3.0.0/spec/fixtures/site_wide_standalone_layout/standalone.adoc000066400000000000000000000002271353240764300301340ustar00rootroot00000000000000--- layout: overridden --- // standalone because page-layout=false is set in site config = Standalone Page :page-layout: also-overridden Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/tocify_filter/000077500000000000000000000000001353240764300222345ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/tocify_filter/_config.yml000066400000000000000000000000331353240764300243570ustar00rootroot00000000000000plugins: - jekyll-asciidoc jekyll-asciidoc-3.0.0/spec/fixtures/tocify_filter/_layouts/000077500000000000000000000000001353240764300240735ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/tocify_filter/_layouts/default.html000066400000000000000000000004221353240764300264030ustar00rootroot00000000000000 {{ page.title }}
{{ content }}
{% if page.asciidoc %} {% endif %} jekyll-asciidoc-3.0.0/spec/fixtures/tocify_filter/index.adoc000066400000000000000000000003071353240764300241730ustar00rootroot00000000000000= Page Title == Major Section A content === Minor Section A.1 content == Major Section B content === Minor Section B.1 content ==== Micro Section B.1.1 content == Major Section C content jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_collection/000077500000000000000000000000001353240764300241525ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_collection/_blueprints/000077500000000000000000000000001353240764300265005ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_collection/_blueprints/blueprint-a.adoc000066400000000000000000000001041353240764300315450ustar00rootroot00000000000000= First Blueprint :revdate: 2018-01-01 :page-foo: bar Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_collection/_blueprints/blueprint-b.adoc000066400000000000000000000002301353240764300315460ustar00rootroot00000000000000= Second Blueprint :page-layout: default Lorem ipsum. * docfile={docfile} * docdir={docdir} * outfile={outfile} * outdir={outdir} * outpath={outpath} jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_collection/_config.yml000066400000000000000000000001501353240764300262750ustar00rootroot00000000000000plugins: - jekyll-asciidoc collections: blueprints: output: true asciidoctor: base_dir: :docdir jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_collection/_layouts/000077500000000000000000000000001353240764300260115ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_collection/_layouts/blueprint.html000066400000000000000000000003331353240764300307020ustar00rootroot00000000000000 {{ page.title }}
{{ content }}

Footer for blueprint layout.

jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_collection/_layouts/default.html000066400000000000000000000003311353240764300303200ustar00rootroot00000000000000 {{ page.title }}
{{ content }}

Footer for default layout.

jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_private_collection/000077500000000000000000000000001353240764300257045ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_private_collection/_config.yml000066400000000000000000000001241353240764300300300ustar00rootroot00000000000000plugins: - jekyll-asciidoc collections: tips: {} asciidoctor: base_dir: :docdir jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_private_collection/_tips/000077500000000000000000000000001353240764300270225ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_private_collection/_tips/current-branch.adoc000066400000000000000000000001111353240764300325600ustar00rootroot00000000000000= Current Branch :page-language: git $ git rev-parse --abbrev-ref HEAD jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_private_collection/_tips/needle-in-haystack.adoc000066400000000000000000000001601353240764300333140ustar00rootroot00000000000000= Needle In Haystack :page-language: js [source,js] ---- if (~haystack.indexOf(needle)) { /* present */ } ---- jekyll-asciidoc-3.0.0/spec/fixtures/with_custom_private_collection/index.html000066400000000000000000000003221353240764300276760ustar00rootroot00000000000000--- --- Tips {% for tip in site.tips %}

{{ tip.title }}

Language: {{ tip.language }}

{{ tip.content }} {% endfor %} jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/000077500000000000000000000000001353240764300215755ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_config.yml000066400000000000000000000003641353240764300237270ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoc: excerpt_doctype: inline asciidoctor: # base_dir is set to :docdir here to verify excerpt conversion doesn't break # we probably want to create a dedicated fixture for this scenario base_dir: :docdir jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_drafts/000077500000000000000000000000001353240764300232175ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_drafts/a-draft-post.adoc000066400000000000000000000000761353240764300263530ustar00rootroot00000000000000= A Draft Post Henry Jekyll :page-tags: [draft] Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_layouts/000077500000000000000000000000001353240764300234345ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_layouts/custom.html000066400000000000000000000003301353240764300256300ustar00rootroot00000000000000 {{ page.title }}
{{ content }}

Footer for custom layout.

jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_layouts/post.html000066400000000000000000000007411353240764300253110ustar00rootroot00000000000000 {{ page.title }}

{{ page.title }}

{{ content }}

Footer for post layout.

jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/000077500000000000000000000000001353240764300231045ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-01-01-welcome.adoc000066400000000000000000000001051353240764300264050ustar00rootroot00000000000000= Welcome, Visitor! Henry Jekyll Welcome to my Jekyll-powered blog! jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-01-02-empty-layout.adoc000066400000000000000000000000531353240764300274260ustar00rootroot00000000000000= Empty Layout :page-layout: Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-01-03-auto-layout.adoc000066400000000000000000000000601353240764300272370ustar00rootroot00000000000000= Auto Layout :page-layout: _auto Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-01-04-custom-layout.adoc000066400000000000000000000000631353240764300276050ustar00rootroot00000000000000= Custom Layout :page-layout: custom Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-01-05-nil-layout.adoc000066400000000000000000000000531353240764300270550ustar00rootroot00000000000000= Nil Layout :page-layout: ~ Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-02-01-post-with-categories.adoc000066400000000000000000000001121353240764300310320ustar00rootroot00000000000000= Post With Categories :page-categories: [code, javascript] Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-02-02-post-with-singular-vars.adoc000066400000000000000000000002151353240764300315070ustar00rootroot00000000000000= Post With Categories :page-category: code :page-categories: [node, javascript] :page-tag: syntax :page-tags: [tip, beginner] Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-03-01-post-with-excerpt.adoc000066400000000000000000000001251353240764300303640ustar00rootroot00000000000000= Post With Excerpt :page-excerpt: This is the _excerpt_ of this post. Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-03-02-post-with-excerpt-doctype.adoc000066400000000000000000000001111353240764300320250ustar00rootroot00000000000000= Post With Excerpt Doctype :page-excerpt_doctype: article Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-04-01-show-me-the-title.adoc000066400000000000000000000000561353240764300302360ustar00rootroot00000000000000= Show Me the Title :showtitle: Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-05-31-automatic-title.adoc000066400000000000000000000000151353240764300300660ustar00rootroot00000000000000Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-06-15-post-with-date.adoc000066400000000000000000000000751353240764300276430ustar00rootroot00000000000000= Post With Date :revdate: 2016-06-15 10:30:00 Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts/2016-07-15-post-with-date-and-tz.adoc000066400000000000000000000001211353240764300310270ustar00rootroot00000000000000= Post With Date and Time Zone :revdate: 2016-07-15 04:15:30 -0600 Lorem ipsum. 2016-07-20-post-with-date-in-revision-line.adoc000066400000000000000000000002631353240764300327450ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/_posts= Post With Date in Revision Line Author Name // NOTE cannot use colon in date because it's used as the delimiter for the revision remark 2016-07-20 05h45m25s -0600 Lorem ipsum. jekyll-asciidoc-3.0.0/spec/fixtures/with_posts/index.html000066400000000000000000000005241353240764300235730ustar00rootroot00000000000000--- --- Posts

Posts

    {% for post in site.posts %}
  • {{ post.title }} {% if post.excerpt != '' %}
    {{ post.excerpt }}
    {% endif %}
  • {% endfor %}
jekyll-asciidoc-3.0.0/spec/fixtures/xhtml_syntax/000077500000000000000000000000001353240764300221345ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/xhtml_syntax/_config.yml000066400000000000000000000001351353240764300242620ustar00rootroot00000000000000plugins: - jekyll-asciidoc asciidoctor: backend: xhtml attributes: - imagesdir=/images jekyll-asciidoc-3.0.0/spec/fixtures/xhtml_syntax/home.adoc000066400000000000000000000001211353240764300237060ustar00rootroot00000000000000= Home Page :imagesdir: images :!page-layout: image::sunset.jpg[Sunset,408,230] jekyll-asciidoc-3.0.0/spec/fixtures/xhtml_syntax/images/000077500000000000000000000000001353240764300234015ustar00rootroot00000000000000jekyll-asciidoc-3.0.0/spec/fixtures/xhtml_syntax/images/sunset.jpg000066400000000000000000000260441353240764300254320ustar00rootroot00000000000000JFIFC    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222@"=!1AQ"aq#2BRb$3%Cr#!1A"Qaq ?츛ۃb x-`T~HjfP< 2 Z8h-jEҵm!| oNݴzm7Lek(tJ L=)r\ړ +g@T;G~F@NVk@ZUsO1P Z($hԆ!T&IH!K%h)cxq JmuM[tr0IGHo5eI&LL߻dwϘˆ@Q~4-")K W;v.|8=)ܩ b+PJ@ݫ~B0v5{4[J$-IL ֱ*^)ͤTo!yA vk[4TQ}<5rA~lR%J=4R & 8jlUjڗ AO޲w%ԭ()JLͺ VBWLi_ϘP) ̙~J=BZvVJ1zrL]43)Lc-YmfCN$5TL Eݤ\ۚ7sv[X& ԩ&GfEHn-?xZi)Zcxbg皨e-RBԣ-\Mnl( ;kE-r%(e) p^Ζk]?+mJNy5XWH 6̉\9ϼөKA7];bOX[-3cpXe@DYmQHi*r6Ϩ㸨Hzյ-⑱G<i);M&ZB )6ii JTXsP9[a[w*&IZ*+Jr~j@ڑ/MgU.}/-. ;B9PojJ`J ӝZp) sG푌iXi ORzhڛ6ԏ1E)nKxP9_sՊ4$D uVkEOi)K}Vqe@ OR̡!&#)nPK?6 |Շ4vB C Z2Қ9PI,o#'v)'NSTDNn*4٤O%s z(sI4˶5[479dg+){S'BA !YzgZӞ.[ʍ?Hˍn/mQN8|`:<"Xm)eIQ++oi=waIi<l` < ժn du^Zy 4EǒRcnm?CSl|2ү(.2 "F'Ey|4[7/qbzp~we7 ?hYx3*h7 !$@=:suH}N4YFV w@VT<Ĩ647mdsqY}nkR  s7Pq۲mnڕ3y<`ԃ<2I*>[+|?@Ms+Pg}(ޝĪP?&[{){giy<7a%(TDsJ*H,kWJ~Ѡ\۹;AɇtuOO1ZaujNiO2t-E FA5Zivew!UU^%uN)*(Y:AU5.q˓utsIi |Yuq#]uk^i \R0DdV٤׮Cy#8~zgk 6EĶ$ 9爥Fmn tLDX-Iy\ !)[xrGjIל i[RJb  [hҮYmN|n80|UD&nٶV5?r j=hBK$!+Rcjzx$G~nnYTi.7nWqD8G ?{թtΚ tʄHb 'J D}zf՛Vnm*i!G?ZP)>br fcYh z AR:8E$~!I):%! PӘݾ*IˉABQXz5sd͕U]B*9O@g$iHh?OG Om e$B"@{tNZp *)SĚM|lNZjP+5R)_hLa6@9TiP4 K+'=?ȤK4_ܺT] =T]Z"LrơmSh%^&Je>{ U'jQ 'i ַ1 H)OqV4ХHW84eu5tyt6EM l`dRT`xz6h{WZZ)$D][lʼXRz*$%M7dKzI]ܥ)$:W$7opϥ ~j މr2QU'&Lr+F7f-wM8&q c"omH++>ɰۢ()D 3ΫbmrlHTw&Qn76; T썇y?{N).jJn鶁Ǧ7Ixڲ)n8VAJH&k͝B`8cmY$=yI0UPZs)XkNE B׹6qJZP$@kV␑)sXe-TK+}(La@N}8qm imV hJy^P^JPyꐧ$o9bAl 'b:p-Z_*Ԍ|U{e-7 2zs4qI$I9S ?PBHXgJbB)**;('dER6@By֫m~^S qBA!$wltn-)J6PTX]FԪS)Iɟ'3Tx$!D}@)epF+S$b2)fXLի@d(jKIujy hj 5e:6R€6<6#]FC픺VXX{RH]HKn2A+OB1'jf{徃lTvBŋ<ͩ}-\@m)Rp' Ռkzm#Ve䄜Е >ߵUx:*]Ķ'9#$u7FΥ\!՝[$1O8X;<8ֻ>NBOH s5WOvv%7b/j-%#xEk]WvEn ) =G'|=m:Ƙt04B\>ZQLx9oz͖,㰒/?]V[4Ǯ.ޑґz= v֫6ʙ.d9&?lvAmyPB6@3Gzk/Z^,ޅ-;vGS~l]2rQ}+ZX"*ܤT@&{ղl\n tVI=r>}7?v-[BQ6!C1VRaoA5kƗ*?ZnUB 8$g毓۵xR뭆֤!@N<+Oz-WopR҃*LwOΚ]i^HJm}꒝HO|{[hh8չmcJ~Tq]qJQQ[@$mX=rqP[˹+ZRS ڣW"ү4$L9QPDү,_rɻAJQdң]Z--␄ Twe AJJXRHG"^xy<:@8-!d>Zͥ63mrU͖!ͤH*Rg̰ yw̦eVRU9$WH=q^ZԀP\M%A Wڊ﮼ޔAS dWz0;]iol2˄|bh0)%>rS|x廖cej7V 5ygy4BRPU*@XW7->RF('~b)%&2q&Z/u$٧uIp&R9=zQVVIp%kڒI5 Vme[WqV7bU8RJtk[f7MB J d$UWIJ$li1צ+"9ws.(͙_t彪ZP)&q ~U)+X0` {NEոucaZn뎕+Ve'dz:bkD&QmO&Ml7x~]l.d Ig G_6v}6diҤ^.u-'Pv eL8dZK7T'3>|eR9ev9?i{{q]YϤڮ6..N+ S H # 'OH9jǶh@[]ܾko֥QyizK6;S@*p#)\n|z[Cl1GȧZѮmYfHJZ,c#ZJ-ה!*.O`rjd,* !; Po63ux^mH PY@g[ًd>[XH#W_pmQw TegD=@XNǐiHA=Y}:p8GPaIpGZ-7س^m Wp#5/w/ӭ 6I( >a*YuJA8횓6ƬrGRUfuٹByisIөYKcH2pzu33=?QͰLԂPB$VKkO¬}2㒗TxLlUk"N]nn68k]ONy]$I~gԤ*r:OfZrqrHHC A9{gIx.a\5pH# IWgk+F*[hybN ޱrwc.r+eBK|I^L-Wwl+Sn鋶WRHݰpDc tm/L4dSD dH":`t-ͻ% RR8 wpM9ua"*Uǜң%dOGҢ:\ki@Ͽҵz#lڽ?zNݲwiBTdHNl [%O7qBz^q>U- )Z^vo ;]}B֩J}7:Xܥ)m6H'3fy^:,(S--m#+2 #>\?gɮ[2Bc3MͳTˍ$Ulwq 9ڒj<>o? %*`@'?]$yro}CJ$=OjIhrmj'?U#9S+;RS0t=rTU\iAUJHQ~G$pkYV8ܾن](q &AMmtqjC;IRA10GcJ[l6熒Cn  b >*rq\W1G-K۞-dLOIٞXa=j'Wr"vI0 ?k[ī +]i@Q0rqI1jP< ݡ!M!$x{WqǴxbNRiQZIw2j\m+p A O5VN`c'[菴-Ty:wMǏVf7$yvvs­@im`V2~,4%O#Tǽ"^𾎄)P.ˡ-pb*Ը($zM98ae ":uQW:CGQ} JH@y6m N96 6ƚy?qN!i DA)$^M悝#GH.OSFqښr()xt="fi*VE2\Q1?46RM<ۑM8(6]1HXjUֈ] Vd67!'Q).V軸. Ip*2L P#KKݺG)ܣjŞ vIWf̠O@Msƻ> Qt_ל \'uX76 Twe%b1"MKhW4Ke*Hc\^ q$5DG>9'[>˥zNڔ>B.3JGzx$ִ\xՠvS 튣{z f7Ë3֒T8lKgk--) $,t^ZŇڂ'&E>GG]qunSod$'l@=er\- "Dӭ>jgQ%ޥelܛv Q>8?i5R%aJLE6ԅ9Yr/g▒RH<{Ujm(JAO8p{V}*Y4 G4yhɊC3G$QE'lChO5BDP R# Q8@Fh PGH{Ch)1G3]"U T <Ёڒ Cv( (3@B}3B{E(Lrh)34F ҆jO4Eq\b941QIG8B TNh 8z$ hQSֈ҈="=)B""b8Pɚ*ҁ9& Dv$СH ) $(3PS nil (expect (result.key? 'icons')).to be true (expect result['icons']).to be_nil end it 'should transform negated attribute with trailing ! to attribute with nil value' do result = converter.send :compile_attributes, 'icons!' => '' (expect (result.key? 'icons')).to be true (expect result['icons']).to be_nil end it 'should transform negated attribute with leading ! to attribute with nil value' do result = converter.send :compile_attributes, '!icons' => '' (expect (result.key? 'icons')).to be true (expect result['icons']).to be_nil end it 'should set existing attribute to nil when attribute is unset' do result = converter.send :compile_attributes, 'icons' => 'font', '!icons' => '' (expect (result.key? 'icons')).to be true (expect result['icons']).to be_nil end it 'should assign value to existing attribute when set again' do result = converter.send :compile_attributes, %w(!icons icons=font !source-highlighter source-highlighter=coderay) (expect result['icons']).to eql 'font' (expect result['source-highlighter']).to eql 'coderay' end it 'should resolve attribute references in attribute value' do result = converter.send :compile_attributes, 'foo' => 'foo', 'bar' => 'bar', 'bäz' => nil, 'foobar' => '{foo}{bar}{bäz}' (expect result['foobar']).to eql 'foobar' end it 'should drop trailing @ from value when resolving attribute reference' do result = converter.send :compile_attributes, 'foo' => 'foo@', 'bar' => 'bar@', 'baz' => '@', 'foobar' => '{foo}{bar}{baz}' (expect result['foobar']).to eql 'foobar' end it 'should not resolve escaped attribute reference' do result = converter.send :compile_attributes, 'foo' => 'foo', 'bar' => 'bar', 'foobar' => '{foo}\{bar}' (expect result['foobar']).to eql 'foo{bar}' end it 'should leave unresolved attribute reference in place' do result = converter.send :compile_attributes, 'foo' => 'foo', 'foobar' => '{foo}{bar}' (expect result['foobar']).to eql 'foo{bar}' end it 'should remove matching attribute if attribute starts with minus' do initial_attrs = { 'idseparator' => '-' } override_attrs = { '-idseparator' => '' } result = converter.send :compile_attributes, override_attrs, initial_attrs (expect result).to be_empty end it 'should not fail if attribute to be removed does not exist' do result = converter.send :compile_attributes, '-idseparator' => '' (expect result).to be_empty end it 'should assign empty string to attribute if value is true' do result = converter.send :compile_attributes, 'icons' => true (expect result['icons']).to eql '' end it 'should assign nil value to attribute if value is false' do result = converter.send :compile_attributes, 'icons' => false (expect (result.key? 'icons')).to be true (expect result['icons']).to be_nil end it 'should assign numeric value as string if value is numeric' do result = converter.send :compile_attributes, 'count' => 1 (expect result['count']).to eql'1' end it 'should pass through Date value to attribute if value is Date' do date = ::Date.parse '2016-01-01' result = converter.send :compile_attributes, 'localdate' => date (expect result['localdate']).to eql date end end describe 'attributes as hash' do use_fixture :attributes_as_hash before :each do site.object_id end it 'should merge attributes defined as a Hash into the attributes Hash' do (expect (asciidoctor_config = site.config['asciidoctor'])).to be_a ::Hash (expect (attrs = asciidoctor_config[:attributes])).to be_a ::Hash (expect attrs['env']).to eql 'site' (expect attrs['icons']).to eql 'font' (expect attrs['sectanchors']).to eql '' (expect (attrs.key? 'table-caption')).to be true (expect attrs['table-caption']).to be_nil end end describe 'attributes as array' do use_fixture :attributes_as_array before :each do site.object_id end it 'should merge attributes defined as an Array into the attributes Hash' do (expect (asciidoctor_config = site.config['asciidoctor'])).to be_a ::Hash (expect (attrs = asciidoctor_config[:attributes])).to be_a ::Hash (expect attrs['env']).to eql 'site' (expect attrs['icons']).to eql 'font' (expect attrs['sectanchors']).to eql '' (expect (attrs.key? 'table-caption')).to be true (expect attrs['table-caption']).to be_nil end end describe 'alternate page attribute prefix' do use_fixture :alternate_page_attribute_prefix before :each do site.process end it 'should strip trailing hyphen from page attribute prefix config value' do (expect site.config['asciidoc']).to be_a ::Hash (expect site.config['asciidoc']['page_attribute_prefix']).to eql 'jekyll-' end it 'should recognize page attributes with alternate page attribute prefix' do page = find_page 'explicit-permalink.adoc' (expect page).not_to be_nil (expect page.permalink).to eql '/permalink/' file = output_file 'permalink/index.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '
' (expect contents).not_to include %() end end describe 'blank page attribute prefix' do use_fixture :blank_page_attribute_prefix before :each do site.process end it 'should coerce null value for page attribute prefix to empty string' do (expect site.config['asciidoc']).to be_a ::Hash (expect site.config['asciidoc']['page_attribute_prefix']).to eql '' end it 'should recognize page attributes with no page attribute prefix' do page = find_page 'explicit-permalink.adoc' (expect page).not_to be_nil (expect page.permalink).to eql '/permalink/' file = output_file 'permalink/index.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '
' (expect contents).not_to include %() end end describe 'basic site' do use_fixture :basic_site before :each do site.process end it 'should add an implicit YAML header to a plain AsciiDoc file' do file = source_file 'without-front-matter-header.adoc' (expect (::Jekyll::Utils.has_yaml_header? file)).to be true end it 'should convert a plain AsciiDoc file' do file = output_file 'without-front-matter-header.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Lorem ipsum.

' end it 'should promote AsciiDoc document title to page title' do file = output_file 'without-front-matter-header.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include 'Page Title' end it 'should convert an AsciiDoc with no doctitle or AsciiDoc header' do page = find_page 'no-doctitle.adoc' (expect page).not_to be_nil (expect (page.data.key? 'title')).to be false file = output_file 'no-doctitle.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include 'Site Title' (expect contents).to include %(

Just content.\nLorem ipsum.

) end it 'should convert an AsciiDoc that has an AsciiDoc header, but no doctitle' do page = find_page 'bare-header.adoc' (expect page).not_to be_nil (expect (page.data.key? 'title')).to be false (expect page.permalink).to eql '/bare/' file = output_file 'bare/index.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include 'Site Title' (expect contents).to include %(

Just content.\nLorem ipsum.

) end it 'should report an AsciiDoc file with a front matter header as having a YAML header' do file = source_file 'with-front-matter-header.adoc' (expect (::Jekyll::Utils.has_yaml_header? file)).to be true end it 'should convert an AsciiDoc file with a front matter header' do file = output_file 'with-front-matter-header.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include 'Page Title' (expect contents).to include '

Lorem ipsum.

' end it 'should convert an AsciiDoc file that has only an AsciiDoc header, no body' do file = output_file 'with-header-only.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include 'Header Only' (expect contents).to include %(
\n\n
) end it 'should convert an AsciiDoc file that has only a front matter header, no body' do file = output_file 'with-front-matter-header-only.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include 'Front Matter Only' (expect contents).to include %(
\n\n
) end it 'should apply explicit id and role attributes on section titles' do file = output_file 'section-with-id-and-role.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include %(
\n

Section Title

) end it 'should assign AsciiDoc document id, if set, to docid page attribute' do page = find_page 'docid.adoc' (expect page).not_to be_nil (expect (page.data.key? 'docid')).to be true (expect page.data['docid']).to eq 'page-id' end it 'should not use Liquid preprocessor by default' do file = output_file 'no-liquid.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

{{ page.title }}

' end it 'should enable Liquid preprocessor if liquid page variable is set' do file = output_file 'liquid-enabled-front-matter.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Liquid Enabled

' end it 'should enable Liquid preprocessor if page-liquid page attribute is set' do file = output_file 'liquid-enabled-asciidoc-header.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Liquid Enabled

' end it 'should not publish a page if the published page variable is set in the AsciiDoc header' do file = output_file 'not-published.html' (expect ::File).not_to exist file end it 'should output a standalone HTML page if the page-layout attribute is unset' do file = output_file 'standalone-a.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include %() (expect contents).to include 'Standalone Page A' (expect contents).to include '

Standalone Page A

' end it 'should output a standalone HTML page if the page-layout attribute is false' do file = output_file 'standalone-b.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include %() (expect contents).to include 'Standalone Page B' (expect contents).to include '

Standalone Page B

' end it 'should apply layout named page to page content if page-layout attribute not specified' do file = output_file 'without-front-matter-header.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for page layout.

' end it 'should apply layout named page to page content if page-layout attribute is empty' do file = output_file 'empty-layout.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for page layout.

' end it 'should apply layout named page to page content if page-layout attribute has value _auto' do file = output_file 'auto-layout.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for page layout.

' end it 'should apply specified layout to page content if page-layout has non-empty string value' do file = output_file 'custom-layout.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for custom layout.

' end it 'should not apply a layout to page content if page-layout attribute is nil' do file = output_file 'nil-layout.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include(%(div class="paragraph">\n

Lorem ipsum.

\n
)) end it 'should convert an empty page attribute value to empty string' do page = find_page 'empty-page-attribute.adoc' (expect page).not_to be_nil (expect page.data['attribute-with-empty-value']).to eql '' end it 'should resolve docdir as base_dir if base_dir value is not :docdir' do src_file = source_file 'subdir/page-in-subdir.adoc' out_file = output_file 'subdir/page-in-subdir.html' (expect ::File).to exist out_file contents = ::File.read out_file (expect contents).to include %(docdir=#{::Dir.pwd}) (expect contents).to include %(docfile=#{src_file}) (expect contents).to include %(docname=#{::File.basename src_file, '.adoc'}) end it 'should only register pre and post render hooks once' do hooks_registry = ::Jekyll::Hooks.instance_variable_get :@registry owned_by_plugin = proc do |hooks| hooks.select {|it| it.source_location[0].end_with? '/jekyll-asciidoc/converter.rb' } end (expect owned_by_plugin[hooks_registry[:pages][:pre_render]].size).to eql 1 (expect owned_by_plugin[hooks_registry[:pages][:post_render]].size).to eql 1 (expect owned_by_plugin[hooks_registry[:documents][:pre_render]].size).to eql 1 (expect owned_by_plugin[hooks_registry[:documents][:post_render]].size).to eql 1 site.process (expect owned_by_plugin[hooks_registry[:pages][:pre_render]].size).to eql 1 (expect owned_by_plugin[hooks_registry[:pages][:post_render]].size).to eql 1 (expect owned_by_plugin[hooks_registry[:documents][:pre_render]].size).to eql 1 (expect owned_by_plugin[hooks_registry[:documents][:post_render]].size).to eql 1 end end describe 'use site-wide standalone layout' do use_fixture :site_wide_standalone_layout before :each do site.process end it 'should output a standalone HTML page if the page-layout attribute is false in site config' do file = output_file 'standalone.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include %() (expect contents).to include 'Standalone Page' (expect contents).to include '

Standalone Page

' end end describe 'use site-wide fallback layout' do use_fixture :site_wide_fallback_layout before :each do site.process end it 'should use layout defined in front matter if page-layout is soft set in site config' do file = output_file 'in-front-matter.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for simple layout.

' end it 'should use layout defined in AsciiDoc header if page-layout is soft set in site config' do file = output_file 'in-asciidoc-header.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for simple layout.

' end it 'should use layout defined in site config if not set in page' do file = output_file 'not-set.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for default layout.

' end end describe 'explicit site time' do use_fixture :explicit_site_time before :each do site.process end it 'should set localdatetime on AsciiDoc pages to match site time and time zone' do (expect (asciidoctor_config = site.config['asciidoctor'])).to be_a ::Hash (expect (attrs = asciidoctor_config[:attributes])).to be_a ::Hash (expect attrs['localdate']).to eql (site.time.strftime '%Y-%m-%d') (expect attrs['localtime']).to eql (site.time.strftime '%H:%M:%S %Z') file = output_file 'home.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include %(localdatetime=#{site.time.strftime '%Y-%m-%d %H:%M:%S %Z'}) end end describe 'safe mode' do use_fixture :safe_mode before :each do site.process end it 'should register converter and generator when running in safe mode' do (expect site.converters.any? {|c| ::Jekyll::AsciiDoc::Converter === c }).to be true (expect site.generators.any? {|g| ::Jekyll::AsciiDoc::Integrator === g }).to be true end it 'should convert AsciiDoc file when running in safe mode' do file = output_file 'home.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include 'Home Page' (expect contents).to include '

Footer for home layout.

' end end describe 'use default as fallback layout' do use_fixture :fallback_to_default_layout before :each do site.process end it 'should use default layout for page if page layout is not available' do file = output_file 'home.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for default layout.

' end it 'should use default layout for post if post layout is not available' do file = output_file '2016/01/01/post.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for default layout.

' end it 'should use default layout for document if layout for document collection is not available' do file = output_file 'blueprints/blueprint.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for default layout.

' end end describe 'use front matter defaults' do use_fixture :front_matter_defaults before :each do site.process end it 'should use the layout for the default scope when no layout is specified' do file = output_file 'page.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for general layout.

' end it 'should use the layout for the matching scope when no layout is specified' do file = output_file 'docs/page.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for docs layout.

' end end describe 'require front matter header' do use_fixture :require_front_matter_header before :each do site.process end it 'should consider an AsciiDoc file with a front matter header to have a YAML header' do file = source_file 'with-front-matter-header.adoc' (expect (::Jekyll::Utils.has_yaml_header? file)).to be true end it 'should not consider an AsciiDoc file without a front matter header to have a YAML header' do file = source_file 'without-front-matter-header.adoc' (expect (::Jekyll::Utils.has_yaml_header? file)).to be false end it 'should convert an AsciiDoc file with a front matter header' do file = output_file 'with-front-matter-header.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include 'Page Title' (expect contents).to include '

Lorem ipsum.

' end it 'should not convert an AsciiDoc file without a front matter header' do file = output_file 'without-front-matter-header.adoc' (expect ::File).to exist file end end describe 'site with posts' do use_fixture :with_posts before :each do site.show_drafts = true site.process end it 'should use document title as post title' do post = find_post '2016-01-01-welcome.adoc' (expect post).not_to be_nil (expect post.data['title']).to eql 'Welcome, Visitor!' file = output_file '2016/01/01/welcome.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include 'Welcome, Visitor!' (expect contents).not_to include '

Welcome, Visitor!

' end it 'should use automatic title if no document title is given' do post = find_post '2016-05-31-automatic-title.adoc' (expect post).not_to be_nil (expect post.data['title']).to eql 'Automatic Title' file = output_file '2016/05/31/automatic-title.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include 'Automatic Title' end it 'should set author of post to value defined in AsciiDoc header' do post = find_post '2016-01-01-welcome.adoc' (expect post).not_to be_nil (expect post.data['author']).to eql 'Henry Jekyll' end it 'should apply layout named post to post content if page-layout attribute not specified' do file = output_file '2016/01/01/welcome.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for post layout.

' end it 'should apply layout named post to post content if page-layout attribute is empty' do file = output_file '2016/01/02/empty-layout.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for post layout.

' end it 'should apply layout named post to post content if page-layout attribute has value _auto' do file = output_file '2016/01/03/auto-layout.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for post layout.

' end it 'should apply custom layout to post content if page-layout attribute has non-empty string value' do file = output_file '2016/01/04/custom-layout.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

Footer for custom layout.

' end it 'should not apply a layout to post content if page-layout attribute is nil' do file = output_file '2016/01/05/nil-layout.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include %(div class="paragraph">\n

Lorem ipsum.

\n
) end it 'should show the title above the content if the showtitle attribute is set' do file = output_file '2016/04/01/show-me-the-title.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include 'Show Me the Title' (expect contents).to include '

Show Me the Title

' (expect contents).to include '

Show Me the Title

' end it 'should interpret value of page attribute as YAML data' do post = find_post '2016-02-01-post-with-categories.adoc' (expect post).not_to be_nil (expect post.data['categories']).to eql %w(code javascript) file = output_file 'code/javascript/2016/02/01/post-with-categories.html' (expect ::File).to exist file end it 'should merge singular variables with collection variables' do post = find_post '2016-02-02-post-with-singular-vars.adoc' (expect post).not_to be_nil (expect post.data['category']).to eql 'code' (expect post.data['categories']).to eql %w(code node javascript) (expect post.data['tag']).to eql 'syntax' (expect post.data['tags']).to eql %w(syntax tip beginner) file = output_file 'code/node/javascript/2016/02/02/post-with-singular-vars.html' (expect ::File).to exist file end it 'should convert revdate to local Time object and use it as date of post' do # NOTE Time.parse without time zone assumes time zone of site date = ::Time.parse '2016-06-15 10:30:00' date = date.localtime slug = 'post-with-date' post = find_post %(#{date.strftime '%Y-%m-%d'}-#{slug}.adoc) (expect post).not_to be_nil (expect post.data['date']).to be_a ::Time (expect post.data['date'].to_s).to eql date.to_s file = output_file %(#{date.strftime '%Y/%m/%d'}/#{slug}.html) (expect ::File).to exist file contents = ::File.read file (expect contents).to include [ %(', ].join end it 'should convert revdate with time zone to local Time object and use it as date of post' do date = ::Time.parse '2016-07-15 04:15:30 -0600' date = date.localtime slug = 'post-with-date-and-tz' post = find_post %(#{date.strftime '%Y-%m-%d'}-#{slug}.adoc) (expect post).not_to be_nil (expect post.data['date']).to be_a ::Time (expect post.data['date'].to_s).to eql date.to_s file = output_file %(#{date.strftime '%Y/%m/%d'}/#{slug}.html) (expect ::File).to exist file contents = ::File.read file (expect contents).to include [ %(', ].join end it 'should convert revdate in revision line to local Time object and use it as date of post' do date = ::Time.parse '2016-07-20 05:45:25 -0600' date = date.localtime slug = 'post-with-date-in-revision-line' post = find_post %(#{date.strftime '%Y-%m-%d'}-#{slug}.adoc) (expect post).not_to be_nil (expect post.data['date']).to be_a ::Time (expect post.data['date'].to_s).to eql date.to_s file = output_file %(#{date.strftime '%Y/%m/%d'}/#{slug}.html) (expect ::File).to exist file contents = ::File.read file (expect contents).to include [ %(', ].join end it 'should process AsciiDoc header of draft post' do draft = find_draft 'a-draft-post.adoc' (expect draft).not_to be_nil (expect draft.data['author']).to eql 'Henry Jekyll' (expect draft.data['tags']).to eql ['draft'] file = output_file %(#{draft.date.strftime '%Y/%m/%d'}/a-draft-post.html) (expect ::File).to exist file end it 'should convert excerpt from AsciiDoc using site-wide doctype' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '
This is the excerpt of this post.
' end it 'should convert excerpt from AsciiDoc using page-specific doctype' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include %(
\n

Lorem ipsum.

\n
) end end describe 'posts with excerpts' do use_fixture :posts_with_excerpts before :each do site.process end it 'should use page contents as excerpt if excerpt separator not found after AsciiDoc header' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include '

    This is the excerpt and body text.

    ' end it 'should use first paragraph as excerpt if excerpt separator is found after AsciiDoc header' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include '

    This is the excerpt.

    ' (expect $1).not_to include '

    This is the rest of the body text that comes after the excerpt.

    ' end it 'should use page contents as excerpt if excerpt separator not found with no AsciiDoc header' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include '

    This is the excerpt and body text.

    ' end it 'should use first paragraph as excerpt if excerpt separator is found with no AsciiDoc header' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include '

    This is the excerpt.

    ' (expect $1).not_to include '

    This is the rest of the body text that comes after the excerpt.

    ' end it 'should use excerpt defined as page attribute in AsciiDoc header' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include '

    This is the excerpt.

    ' (expect $1).not_to include '

    This is the first paragraph, but not the excerpt.

    ' end it 'should use excerpt defined in front matter' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include '

    This is the excerpt.

    ' (expect $1).not_to include '

    This is the first paragraph, but not the excerpt.

    ' end it 'should set excerpt to blank if excerpt_separator is blank' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include '

    ' end it 'should set excerpt to blank if document only has a header' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include '

    ' end it 'should not process liquid in excerpt by default' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include '

    {{ page.title }}

    ' end it 'should process liquid in excerpt if liquid page variable is set' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include '

    With Liquid

    ' end it 'should extract excerpt correctly even when post uses standalone layout' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include '

    Excerpt of post with standalone layout.

    ' (expect $1).not_to include '

    This is not part of the excerpt.

    ' end end describe 'custom excerpt separator' do use_fixture :custom_excerpt_separator before :each do site.process end it 'should use excerpt_separator for markdown posts' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include 'This is also part of the excerpt' (expect $1).not_to include 'This is not part of the excerpt' end it 'should use page-excerpt_separator for AsciiDoc posts' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file contents =~ %r/
  • (.*?)<\/li>/m (expect $1).to include 'This is also part of the excerpt' (expect $1).not_to include 'This is not part of the excerpt' end end describe 'read error' do use_fixture :read_error before :each do ::File.chmod 0o0000, (source_file 'unreadable.adoc') site.process end after :each do ::File.chmod 0o0664, (source_file 'unreadable.adoc') end it 'should not fail when file cannot be read' do file = output_file 'unreadable.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to be_empty end end unless windows? describe 'site with include relative to docdir' do use_fixture :include_relative_to_docdir before :each do site.process end it 'should not expand base_dir when base_dir config key has value :docdir' do (expect site.config['asciidoctor'][:base_dir]).to eql :docdir end it 'should resolve include relative to docdir when base_dir config key has value :docdir' do src_file = source_file 'about/index.adoc' out_file = output_file 'about/index.html' (expect ::File).to exist out_file contents = ::File.read out_file (expect contents).to include 'Doc Writer' (expect contents).to include %(docfile=#{src_file}) (expect contents).to include %(docdir=#{::File.dirname src_file}) (expect contents).to include %(outfile=#{out_file}) (expect contents).to include %(outdir=#{::File.dirname out_file}) (expect contents).to include %(outpath=/about/) end it 'should resolve attribute defined in included file' do file = output_file 'parent.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

    value

    ' end end describe 'site with include relative to root' do use_fixture :include_relative_to_root let :config do (::Jekyll.configuration fixture_site_params name).merge('source' => (::File.join (source_dir name), 'source')) end before :each do @old_pwd = ::Dir.pwd ::Dir.chdir source_dir name site.process end after :each do ::Dir.chdir @old_pwd end it 'should not set base_dir if base_dir config key has no value' do (expect (site.config['asciidoctor'].key? :base_dir)).to be false end it 'should resolve include relative to root when base_dir is not set' do src_file = source_file 'about/index.adoc' out_file = output_file 'about/index.html' (expect ::File).to exist out_file contents = ::File.read out_file (expect contents).to include 'Doc Writer' (expect contents).to include %(docdir=#{::Dir.pwd}) (expect contents).to include %(docfile=#{src_file}) (expect contents).to include %(outfile=#{out_file}) (expect contents).to include %(outdir=#{::File.dirname out_file}) (expect contents).to include %(outpath=/about/) end end describe 'site with include relative to source' do use_fixture :include_relative_to_source before :each do site.process end it 'should expand base_dir to match site source when base_dir config key has value :source' do (expect site.config['asciidoctor'][:base_dir]).to eql site.source end it 'should resolve include relative to source when base_dir config key has value :source' do src_file = source_file 'about/index.adoc' out_file = output_file 'about/index.html' (expect ::File).to exist out_file contents = ::File.read out_file (expect contents).to include 'Doc Writer' (expect contents).to include %(docdir=#{site.source}) (expect contents).to include %(docfile=#{src_file}) (expect contents).to include %(outfile=#{out_file}) (expect contents).to include %(outdir=#{::File.dirname out_file}) (expect contents).to include %(outpath=/about/) end it 'should not process file that begins with an underscore' do file = output_file 'about/_people.html' (expect ::File).not_to exist file end end describe 'site with custom collection' do use_fixture :with_custom_collection before :each do site.process end it 'should decorate document in custom collection' do doc = find_doc 'blueprint-a.adoc', 'blueprints' (expect doc).not_to be_nil (expect doc.data['title']).to eql 'First Blueprint' (expect doc.data['date']).to be_a ::Time (expect doc.data['date'].strftime '%Y-%m-%d').to eql '2018-01-01' (expect doc.data['foo']).to eql 'bar' end it 'should select layout that is based on the collection label by default' do file = output_file 'blueprints/blueprint-a.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

    Footer for blueprint layout.

    ' end it 'should allow the layout to be customized' do file = output_file 'blueprints/blueprint-b.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

    Footer for default layout.

    ' end it 'should set docdir for document in custom collection when base_dir config key has the value :docdir' do src_file = source_file '_blueprints/blueprint-b.adoc' out_file = output_file 'blueprints/blueprint-b.html' (expect ::File).to exist out_file contents = ::File.read out_file (expect contents).to include %(docfile=#{src_file}) (expect contents).to include %(docdir=#{::File.dirname src_file}) (expect contents).to include %(outfile=#{out_file}) (expect contents).to include %(outdir=#{::File.dirname out_file}) (expect contents).to include %(outpath=/blueprints/blueprint-b.html) end end describe 'site with custom private collection' do use_fixture :with_custom_private_collection before :each do site.process end it 'should integrate pages in collection even when collection is not written' do current_branch_file = output_file 'tips/current-branch.html' (expect ::File).not_to exist current_branch_file index_file = output_file 'index.html' (expect ::File).to exist index_file index_contents = ::File.read index_file (expect index_contents).to include '

    Current Branch

    ' (expect index_contents).to include '

    Language: git

    ' (expect index_contents).to include '

    Needle In Haystack

    ' (expect index_contents).to include '

    Language: js

    ' end end describe 'pygments code highlighting' do use_fixture :pygments_code_highlighting before :each do ::Jekyll::StaticFile.reset_cache site.process end it 'should write the pygments stylesheet to the stylesdir' do src_file = source_file 'css/asciidoc-pygments.css' out_file = output_file 'css/asciidoc-pygments.css' begin (expect ::File).to exist src_file (expect ::File).to exist out_file src_content = ::File.read src_file out_content = ::File.read out_file (expect src_content).to eql out_content (expect src_content).to include '.pygments .tok-c' ensure if ::File.exist? src_file ::File.delete src_file ::Dir.rmdir ::File.dirname src_file end end end it 'should overwrite pygments stylesheet if style has changed' do src_file = source_file 'css/asciidoc-pygments.css' out_file = output_file 'css/asciidoc-pygments.css' begin src_content = ::File.read src_file out_content = ::File.read src_file attrs = site.config['asciidoctor'][:attributes] attrs['pygments-style'] = 'monokai' integrator.generate_pygments_stylesheet site, attrs (expect ::File.read src_file).not_to eql src_content ::Jekyll::StaticFile.reset_cache site.process new_out_content = ::File.read out_file (expect new_out_content).not_to eql out_content (expect new_out_content).to include 'background-color: #49483e' ensure if ::File.exist? src_file ::File.delete src_file ::Dir.rmdir ::File.dirname src_file end end end end describe 'xhtml syntax' do use_fixture :xhtml_syntax before :each do site.process end it 'should output xhtml if asciidoctor backend option is xhtml' do file = output_file 'home.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include 'Sunset' end end describe 'asciidocify filter' do use_fixture :asciidocify_filter before :each do site.process end it 'should run content through asciidocify filter using specified doctype' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file (expect contents).to include '

    A very welcoming welcome page.

    ' end end describe 'tocify filter' do use_fixture :tocify_filter before :each do site.process end it 'should generate document outline when tocify_asciidoc filter is applied to page.document' do file = output_file 'index.html' (expect ::File).to exist file contents = ::File.read file aside = (contents.match %r/