Welcome to mirror list, hosted at ThFree Co, Russian Federation.

asciidoctor_patch.rb « initializers « config - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b7da50db77c866e6f9ebac396b28ec1a7b9f66d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

# Ensure that locked attributes can not be changed using a counter.
# TODO: this can be removed once `asciidoctor` gem is > 2.0.12
#       and https://github.com/asciidoctor/asciidoctor/issues/3939 is merged
module Asciidoctor
  module DocumentPatch
    def counter(name, seed = nil)
      return @parent_document.counter(name, seed) if @parent_document   # rubocop: disable Gitlab/ModuleWithInstanceVariables

      unless attribute_locked? name
        super
      end
    end
  end
end

class Asciidoctor::Document
  prepend Asciidoctor::DocumentPatch
end