Sha256: 1e82f7845ff0dcc4da529165aaad8d327aba048c7bc2d04be32bc63fcc8f5056

Contents?: true

Size: 919 Bytes

Versions: 18

Compression:

Stored size: 919 Bytes

Contents

describe 'GH-954', site: true, stdio: true do
  before do
    File.write('content/foo.md', 'foo <a href="/">root</a>')
    File.write('content/bar.md', 'bar <a href="/">root</a>')
    File.write('content/bar-copy.md', '<%= @items["/bar.*"].compiled_content(snapshot: :last) %>')

    File.write('Rules', <<EOS)
compile '/foo.*' do
  filter :relativize_paths, type: :html unless rep.path.nil?
  write item.identifier.without_ext + '.html'
end

compile '/bar.*' do
  filter :relativize_paths, type: :html unless rep.path.nil?
end

compile '/bar-copy.*' do
  filter :erb
  write item.identifier.without_ext + '.html'
end
EOS
  end

  it 'properly filters foo.md' do
    Nanoc::CLI.run(%w(compile))

    # Path is relativized
    expect(File.read('output/foo.html')).to eq('foo <a href="./">root</a>')

    # Path is not relativized
    expect(File.read('output/bar-copy.html')).to eq('bar <a href="/">root</a>')
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
nanoc-4.7.5 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.7.4 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.7.3 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.7.2 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.7.1 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.7.0 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.6.4 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.6.3 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.6.2 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.6.1 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.6.0 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.5.4 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.5.3 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.5.2 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.5.1 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.5.0 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.4.7 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.4.6 spec/nanoc/regressions/gh_954_spec.rb