Sha256: 8df3fc1305335013cd35f7ac3357101772cc76d4f48bc6380e8bc307332f1fab
Contents?: true
Size: 886 Bytes
Versions: 2
Compression:
Stored size: 886 Bytes
Contents
# frozen_string_literal: true module Liquid class InlineComment < Tag def initialize(tag_name, markup, options) super # Semantically, a comment should only ignore everything after it on the line. # Currently, this implementation doesn't support mixing a comment with another tag # but we need to reserve future support for this and prevent the introduction # of inline comments from being backward incompatible change. # # As such, we're forcing users to put a # symbol on every line otherwise this # tag will throw an error. if markup.match?(/\n\s*[^#\s]/) raise SyntaxError, options[:locale].t("errors.syntax.inline_comment_invalid") end end def render_to_output_buffer(_context, output) output end def blank? true end end Template.register_tag('#', InlineComment) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
liquid-5.5.1 | lib/liquid/tags/inline_comment.rb |
liquid-5.5.0 | lib/liquid/tags/inline_comment.rb |