assemble / grunt-assemble-permalinks

Permalinks middleware for Assemble, the static site generator for Grunt.js and Yeoman. This plugin enables powerful and configurable URI replacement patterns, presets, uses Moment.js for parsing dates, and much more.
MIT License
43 stars 11 forks source link

Remove check against index basename #47

Closed ain closed 8 years ago

ain commented 10 years ago

Provide PR for #46 research.

jonschlinkert commented 10 years ago

did you run all of the tests? doesn't appear so. this looks like it will break everything we described in the other issues I linked.

ain commented 10 years ago

I'd expect so. Just brought attention to the topic in the related ticket.

ain commented 10 years ago

At least running the default task on the PR succeeded, no failures.

ain commented 10 years ago
Running "jshint:all" (jshint) task
>> 1 file lint free.

Running "clean:actual" (clean) task
Cleaning test/actual...OK

Running "assemble:no_opts_files" (assemble) task
Assembling test/actual/no_opts_files/articles/bar.html OK
Assembling test/actual/no_opts_files/articles/baz.html OK
Assembling test/actual/no_opts_files/articles/index.html OK
Assembling test/actual/no_opts_files/articles/nested/quux.html OK
Assembling test/actual/no_opts_files/foo.html OK
Assembling test/actual/no_opts_files/index.html OK
>> 6 pages assembled.

Running "assemble:no_opts_flatten" (assemble) task
Assembling test/actual/no_opts_flatten/bar.html OK
Assembling test/actual/no_opts_flatten/baz.html OK
Assembling test/actual/no_opts_flatten/index.html OK
Assembling test/actual/no_opts_flatten/quux.html OK
Assembling test/actual/no_opts_flatten/foo.html OK
Assembling test/actual/no_opts_flatten/index.html OK
>> 6 pages assembled.

Running "assemble:preset_flatten" (assemble) task
Assembling test/actual/preset_flatten/blog/bar/index.html OK
Assembling test/actual/preset_flatten/blog/baz/index.html OK
Assembling test/actual/preset_flatten/blog/index/index.html OK
Assembling test/actual/preset_flatten/blog/quux/index.html OK
Assembling test/actual/preset_flatten/plugins/foo/index.html OK
Assembling test/actual/preset_flatten/plugins/index/index.html OK
>> 6 pages assembled.

Running "assemble:digits_specified" (assemble) task
Assembling test/actual/digits_specified/articles/blog/bar-0001.html OK
Assembling test/actual/digits_specified/articles/blog/baz-0002.html OK
Assembling test/actual/digits_specified/articles/blog/index-0003.html OK
Assembling test/actual/digits_specified/articles/nested/blog/quux-0004.html OK
Assembling test/actual/digits_specified/plugins/foo-0005.html OK
Assembling test/actual/digits_specified/plugins/index-0006.html OK
>> 6 pages assembled.

Running "assemble:digits_auto" (assemble) task
Assembling test/actual/digits_auto/articles/blog/bar-1.html OK
Assembling test/actual/digits_auto/articles/blog/baz-2.html OK
Assembling test/actual/digits_auto/articles/blog/index-3.html OK
Assembling test/actual/digits_auto/articles/nested/blog/quux-4.html OK
Assembling test/actual/digits_auto/plugins/foo-5.html OK
Assembling test/actual/digits_auto/plugins/index-6.html OK
>> 6 pages assembled.

Running "assemble:random" (assemble) task
Assembling test/actual/random/articles/blog/ZgYCXn8Ld-bar.html OK
Assembling test/actual/random/articles/blog/kYiJDdKBY-baz.html OK
Assembling test/actual/random/articles/blog/1qQS3kgMs-index.html OK
Assembling test/actual/random/articles/nested/blog/cD8DVuXDo-quux.html OK
Assembling test/actual/random/plugins/fDPIJrqJS-foo.html OK
Assembling test/actual/random/plugins/GO9zSLYrY-index.html OK
>> 6 pages assembled.

Running "assemble:preset_pretty" (assemble) task
Assembling test/actual/preset_pretty/articles/bar/index.html OK
Assembling test/actual/preset_pretty/articles/baz/index.html OK
Assembling test/actual/preset_pretty/articles/index/index.html OK
Assembling test/actual/preset_pretty/articles/nested/quux/index.html OK
Assembling test/actual/preset_pretty/foo/index.html OK
Assembling test/actual/preset_pretty/index/index.html OK
>> 6 pages assembled.

Running "assemble:preset_dayname" (assemble) task
Assembling test/actual/preset_dayname/articles/2013/10/03/bar/index.html OK
Assembling test/actual/preset_dayname/articles/2013/10/03/baz/index.html OK
Assembling test/actual/preset_dayname/articles/2013/10/02/index/index.html OK
Assembling test/actual/preset_dayname/articles/nested/2013/04/11/quux/index.html OK
Assembling test/actual/preset_dayname/2013/10/03/foo/index.html OK
Assembling test/actual/preset_dayname/2013/10/01/index/index.html OK
>> 6 pages assembled.

Running "assemble:preset_monthname" (assemble) task
Assembling test/actual/preset_monthname/articles/2013/10/bar/index.html OK
Assembling test/actual/preset_monthname/articles/2013/10/baz/index.html OK
Assembling test/actual/preset_monthname/articles/2013/10/index/index.html OK
Assembling test/actual/preset_monthname/articles/nested/2013/04/quux/index.html OK
Assembling test/actual/preset_monthname/2013/10/foo/index.html OK
Assembling test/actual/preset_monthname/2013/10/index/index.html OK
>> 6 pages assembled.

Running "assemble:structure_basename" (assemble) task
Assembling test/actual/structure_basename/articles/bar.html OK
Assembling test/actual/structure_basename/articles/baz.html OK
Assembling test/actual/structure_basename/articles/index.html OK
Assembling test/actual/structure_basename/articles/nested/quux.html OK
Assembling test/actual/structure_basename/foo.html OK
Assembling test/actual/structure_basename/index.html OK
>> 6 pages assembled.

Running "assemble:dates" (assemble) task
Assembling test/actual/dates/articles/2013/10/03/bar/index.html OK
Assembling test/actual/dates/articles/2013/10/03/baz/index.html OK
Assembling test/actual/dates/articles/2013/10/02/index/index.html OK
Assembling test/actual/dates/articles/nested/2013/04/11/quux/index.html OK
Assembling test/actual/dates/2013/10/03/foo/index.html OK
Assembling test/actual/dates/2013/10/01/index/index.html OK
>> 6 pages assembled.

Running "assemble:date_collision" (assemble) task
Assembling test/actual/date_collision/articles/2013/10/03/bar/index.html OK
Assembling test/actual/date_collision/articles/2013/10/03/baz/index.html OK
Assembling test/actual/date_collision/articles/2013/10/02/index/index.html OK
Assembling test/actual/date_collision/articles/nested/2013/04/11/quux/index.html OK
Assembling test/actual/date_collision/2013/10/03/foo/index.html OK
Assembling test/actual/date_collision/2013/10/01/index/index.html OK
>> 6 pages assembled.

Running "assemble:structure_date" (assemble) task
Assembling test/actual/structure_date/articles/2013/10/03/index.html OK
Assembling test/actual/structure_date/articles/2013/10/03/index.html OK
Assembling test/actual/structure_date/articles/2013/10/02/index.html OK
Assembling test/actual/structure_date/articles/nested/2013/04/11/index.html OK
Assembling test/actual/structure_date/2013/10/03/index.html OK
Assembling test/actual/structure_date/2013/10/01/index.html OK
>> 6 pages assembled.

Running "assemble:builtin_property_from_context" (assemble) task
Assembling test/actual/built_in_property/articles/bar/index.html OK
Assembling test/actual/built_in_property/articles/baz/index.html OK
Assembling test/actual/built_in_property/articles/index/index.html OK
Assembling test/actual/built_in_property/articles/nested/quux/index.html OK
Assembling test/actual/built_in_property/foo/index.html OK
Assembling test/actual/built_in_property/index/index.html OK
>> 6 pages assembled.

Running "assemble:index_pages" (assemble) task
Assembling test/actual/index_pages/articles/bar/index.html OK
Assembling test/actual/index_pages/articles/baz/index.html OK
Assembling test/actual/index_pages/articles/index/index.html OK
Assembling test/actual/index_pages/articles/nested/quux/index.html OK
Assembling test/actual/index_pages/foo/index.html OK
Assembling test/actual/index_pages/index/index.html OK
>> 6 pages assembled.

Running "assemble:collections_pretty" (assemble) task
Assembling test/actual/collections_pretty/articles/bar/index.html OK
Assembling test/actual/collections_pretty/articles/baz/index.html OK
Assembling test/actual/collections_pretty/articles/index/index.html OK
Assembling test/actual/collections_pretty/articles/nested/quux/index.html OK
Assembling test/actual/collections_pretty/foo/index.html OK
Assembling test/actual/collections_pretty/index/index.html OK
>> 6 pages assembled.

Running "assemble:collections_complex" (assemble) task
Assembling test/actual/collections_complex/articles/2013/10/03/bar/index.html OK
Assembling test/actual/collections_complex/articles/2013/10/03/baz/index.html OK
Assembling test/actual/collections_complex/articles/2013/10/02/index/index.html OK
Assembling test/actual/collections_complex/articles/nested/2013/04/11/quux/index.html OK
Assembling test/actual/collections_complex/2013/10/03/foo/index.html OK
Assembling test/actual/collections_complex/2013/10/01/index/index.html OK
>> 6 pages assembled.

Running "assemble:yfm_custom_property" (assemble) task
Assembling test/actual/yfm_custom_property/articles/this-is-a-custom-prop/index.html OK
Assembling test/actual/yfm_custom_property/articles/custom-prop/index.html OK
Assembling test/actual/yfm_custom_property/articles/category-page/index.html OK
Assembling test/actual/yfm_custom_property/articles/nested/quux/index.html OK
Assembling test/actual/yfm_custom_property/custom/path/index.html OK
Assembling test/actual/yfm_custom_property/home-page/index.html OK
>> 6 pages assembled.

Running "assemble:assets_path" (assemble) task
Assembling test/actual/yfm_custom_property/articles/this-is-a-custom-prop/index.html OK
Assembling test/actual/yfm_custom_property/articles/custom-prop/index.html OK
Assembling test/actual/yfm_custom_property/articles/category-page/index.html OK
Assembling test/actual/yfm_custom_property/articles/nested/quux/index.html OK
Assembling test/actual/yfm_custom_property/custom/path/index.html OK
Assembling test/actual/yfm_custom_property/home-page/index.html OK
>> 6 pages assembled.

Running "assemble:custom_replacement_pattern" (assemble) task
Assembling test/actual/replacement_pattern/articles/assemble-contrib-permalinks/jon-schlinkert/bar/index.html OK
Assembling test/actual/replacement_pattern/articles/assemble-contrib-permalinks/jon-schlinkert/baz/index.html OK
Assembling test/actual/replacement_pattern/articles/assemble-contrib-permalinks/jon-schlinkert/index/index.html OK
Assembling test/actual/replacement_pattern/articles/nested/assemble-contrib-permalinks/jon-schlinkert/quux/index.html OK
Assembling test/actual/replacement_pattern/assemble-contrib-permalinks/jon-schlinkert/foo/index.html OK
Assembling test/actual/replacement_pattern/assemble-contrib-permalinks/jon-schlinkert/index/index.html OK
>> 6 pages assembled.

Running "assemble:debug_option" (assemble) task
Assembling test/actual/collections_complex/articles/2013/10/03/bar/index.html OK
Assembling test/actual/collections_complex/articles/2013/10/03/baz/index.html OK
Assembling test/actual/collections_complex/articles/2013/10/02/index/index.html OK
Assembling test/actual/collections_complex/articles/nested/2013/04/11/quux/index.html OK
Assembling test/actual/collections_complex/2013/10/03/foo/index.html OK
Assembling test/actual/collections_complex/2013/10/01/index/index.html OK
>> 6 pages assembled.

Running "prettify:defaults" (prettify) task
>> File "test/actual/built_in_property/articles/bar/index.html" prettified.
>> File "test/actual/built_in_property/articles/baz/index.html" prettified.
>> File "test/actual/built_in_property/articles/index/index.html" prettified.
>> File "test/actual/built_in_property/articles/nested/quux/index.html" prettified.
>> File "test/actual/built_in_property/foo/index.html" prettified.
>> File "test/actual/built_in_property/index/index.html" prettified.
>> File "test/actual/collections_complex/2013/10/01/index/index.html" prettified.
>> File "test/actual/collections_complex/2013/10/03/foo/index.html" prettified.
>> File "test/actual/collections_complex/articles/2013/10/02/index/index.html" prettified.
>> File "test/actual/collections_complex/articles/2013/10/03/bar/index.html" prettified.
>> File "test/actual/collections_complex/articles/2013/10/03/baz/index.html" prettified.
>> File "test/actual/collections_complex/articles/nested/2013/04/11/quux/index.html" prettified.
>> File "test/actual/collections_pretty/articles/bar/index.html" prettified.
>> File "test/actual/collections_pretty/articles/baz/index.html" prettified.
>> File "test/actual/collections_pretty/articles/index/index.html" prettified.
>> File "test/actual/collections_pretty/articles/nested/quux/index.html" prettified.
>> File "test/actual/collections_pretty/foo/index.html" prettified.
>> File "test/actual/collections_pretty/index/index.html" prettified.
>> File "test/actual/date_collision/2013/10/01/index/index.html" prettified.
>> File "test/actual/date_collision/2013/10/03/foo/index.html" prettified.
>> File "test/actual/date_collision/articles/2013/10/02/index/index.html" prettified.
>> File "test/actual/date_collision/articles/2013/10/03/bar/index.html" prettified.
>> File "test/actual/date_collision/articles/2013/10/03/baz/index.html" prettified.
>> File "test/actual/date_collision/articles/nested/2013/04/11/quux/index.html" prettified.
>> File "test/actual/dates/2013/10/01/index/index.html" prettified.
>> File "test/actual/dates/2013/10/03/foo/index.html" prettified.
>> File "test/actual/dates/articles/2013/10/02/index/index.html" prettified.
>> File "test/actual/dates/articles/2013/10/03/bar/index.html" prettified.
>> File "test/actual/dates/articles/2013/10/03/baz/index.html" prettified.
>> File "test/actual/dates/articles/nested/2013/04/11/quux/index.html" prettified.
>> File "test/actual/digits_auto/articles/blog/bar-1.html" prettified.
>> File "test/actual/digits_auto/articles/blog/baz-2.html" prettified.
>> File "test/actual/digits_auto/articles/blog/index-3.html" prettified.
>> File "test/actual/digits_auto/articles/nested/blog/quux-4.html" prettified.
>> File "test/actual/digits_auto/plugins/foo-5.html" prettified.
>> File "test/actual/digits_auto/plugins/index-6.html" prettified.
>> File "test/actual/digits_specified/articles/blog/bar-0001.html" prettified.
>> File "test/actual/digits_specified/articles/blog/baz-0002.html" prettified.
>> File "test/actual/digits_specified/articles/blog/index-0003.html" prettified.
>> File "test/actual/digits_specified/articles/nested/blog/quux-0004.html" prettified.
>> File "test/actual/digits_specified/plugins/foo-0005.html" prettified.
>> File "test/actual/digits_specified/plugins/index-0006.html" prettified.
>> File "test/actual/index_pages/articles/bar/index.html" prettified.
>> File "test/actual/index_pages/articles/baz/index.html" prettified.
>> File "test/actual/index_pages/articles/index/index.html" prettified.
>> File "test/actual/index_pages/articles/nested/quux/index.html" prettified.
>> File "test/actual/index_pages/foo/index.html" prettified.
>> File "test/actual/index_pages/index/index.html" prettified.
>> File "test/actual/no_opts_files/articles/bar.html" prettified.
>> File "test/actual/no_opts_files/articles/baz.html" prettified.
>> File "test/actual/no_opts_files/articles/index.html" prettified.
>> File "test/actual/no_opts_files/articles/nested/quux.html" prettified.
>> File "test/actual/no_opts_files/foo.html" prettified.
>> File "test/actual/no_opts_files/index.html" prettified.
>> File "test/actual/no_opts_flatten/bar.html" prettified.
>> File "test/actual/no_opts_flatten/baz.html" prettified.
>> File "test/actual/no_opts_flatten/foo.html" prettified.
>> File "test/actual/no_opts_flatten/index.html" prettified.
>> File "test/actual/no_opts_flatten/quux.html" prettified.
>> File "test/actual/preset_dayname/2013/10/01/index/index.html" prettified.
>> File "test/actual/preset_dayname/2013/10/03/foo/index.html" prettified.
>> File "test/actual/preset_dayname/articles/2013/10/02/index/index.html" prettified.
>> File "test/actual/preset_dayname/articles/2013/10/03/bar/index.html" prettified.
>> File "test/actual/preset_dayname/articles/2013/10/03/baz/index.html" prettified.
>> File "test/actual/preset_dayname/articles/nested/2013/04/11/quux/index.html" prettified.
>> File "test/actual/preset_flatten/blog/bar/index.html" prettified.
>> File "test/actual/preset_flatten/blog/baz/index.html" prettified.
>> File "test/actual/preset_flatten/blog/index/index.html" prettified.
>> File "test/actual/preset_flatten/blog/quux/index.html" prettified.
>> File "test/actual/preset_flatten/plugins/foo/index.html" prettified.
>> File "test/actual/preset_flatten/plugins/index/index.html" prettified.
>> File "test/actual/preset_monthname/2013/10/foo/index.html" prettified.
>> File "test/actual/preset_monthname/2013/10/index/index.html" prettified.
>> File "test/actual/preset_monthname/articles/2013/10/bar/index.html" prettified.
>> File "test/actual/preset_monthname/articles/2013/10/baz/index.html" prettified.
>> File "test/actual/preset_monthname/articles/2013/10/index/index.html" prettified.
>> File "test/actual/preset_monthname/articles/nested/2013/04/quux/index.html" prettified.
>> File "test/actual/preset_pretty/articles/bar/index.html" prettified.
>> File "test/actual/preset_pretty/articles/baz/index.html" prettified.
>> File "test/actual/preset_pretty/articles/index/index.html" prettified.
>> File "test/actual/preset_pretty/articles/nested/quux/index.html" prettified.
>> File "test/actual/preset_pretty/foo/index.html" prettified.
>> File "test/actual/preset_pretty/index/index.html" prettified.
>> File "test/actual/random/articles/blog/1qQS3kgMs-index.html" prettified.
>> File "test/actual/random/articles/blog/ZgYCXn8Ld-bar.html" prettified.
>> File "test/actual/random/articles/blog/kYiJDdKBY-baz.html" prettified.
>> File "test/actual/random/articles/nested/blog/cD8DVuXDo-quux.html" prettified.
>> File "test/actual/random/plugins/GO9zSLYrY-index.html" prettified.
>> File "test/actual/random/plugins/fDPIJrqJS-foo.html" prettified.
>> File "test/actual/replacement_pattern/articles/assemble-contrib-permalinks/jon-schlinkert/bar/index.html" prettified.
>> File "test/actual/replacement_pattern/articles/assemble-contrib-permalinks/jon-schlinkert/baz/index.html" prettified.
>> File "test/actual/replacement_pattern/articles/assemble-contrib-permalinks/jon-schlinkert/index/index.html" prettified.
>> File "test/actual/replacement_pattern/articles/nested/assemble-contrib-permalinks/jon-schlinkert/quux/index.html" prettified.
>> File "test/actual/replacement_pattern/assemble-contrib-permalinks/jon-schlinkert/foo/index.html" prettified.
>> File "test/actual/replacement_pattern/assemble-contrib-permalinks/jon-schlinkert/index/index.html" prettified.
>> File "test/actual/structure_basename/articles/bar.html" prettified.
>> File "test/actual/structure_basename/articles/baz.html" prettified.
>> File "test/actual/structure_basename/articles/index.html" prettified.
>> File "test/actual/structure_basename/articles/nested/quux.html" prettified.
>> File "test/actual/structure_basename/foo.html" prettified.
>> File "test/actual/structure_basename/index.html" prettified.
>> File "test/actual/structure_date/2013/10/01/index.html" prettified.
>> File "test/actual/structure_date/2013/10/03/index.html" prettified.
>> File "test/actual/structure_date/articles/2013/10/02/index.html" prettified.
>> File "test/actual/structure_date/articles/2013/10/03/index.html" prettified.
>> File "test/actual/structure_date/articles/nested/2013/04/11/index.html" prettified.
>> File "test/actual/yfm_custom_property/articles/category-page/index.html" prettified.
>> File "test/actual/yfm_custom_property/articles/custom-prop/index.html" prettified.
>> File "test/actual/yfm_custom_property/articles/nested/quux/index.html" prettified.
>> File "test/actual/yfm_custom_property/articles/this-is-a-custom-prop/index.html" prettified.
>> File "test/actual/yfm_custom_property/custom/path/index.html" prettified.
>> File "test/actual/yfm_custom_property/home-page/index.html" prettified.

Running "readme" task
>> Created README.md

Done, without errors.
jonschlinkert commented 10 years ago

Unfortunately passing doesn't actually show if the file paths are mutated from expected behavior. I'll have to pull this down and run it in a little bit. thanks

ain commented 10 years ago

Thanks, that's what I just wanted to comment. It's a rough removal, I think you need to write a few more tests against the scenarios linked earlier.

jonschlinkert commented 10 years ago

:+1:

hariadi commented 10 years ago

I think it will broke other project configuration:

permalinks: {
    preset: 'pretty'
 },

templates/pages/index.hbs

Result: index/index.html

jonschlinkert commented 10 years ago

I haven't had a chance to look yet, but I think this will require an option.