Sha256: e1e39894790af05040102f59b6f0866e561c2707dfb5e15448c98e82c0d1b216

Contents?: true

Size: 919 Bytes

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
nanoc-4.7.9 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.7.8 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.7.7 spec/nanoc/regressions/gh_954_spec.rb
nanoc-4.7.6 spec/nanoc/regressions/gh_954_spec.rb