middleman / middleman-asciidoc

:beginner: AsciiDoc support for Middleman 4. (In Middleman 3, AsciiDoc support is provided by a core extension).
https://middlemanapp.com
Other
27 stars 12 forks source link

Change file extension #87

Closed supsup closed 6 years ago

supsup commented 6 years ago

Is there a property to change the output from .html, to .xyz? for different lang backed systems like java etc? ( .jsp / .gsp )

mojavelinux commented 6 years ago

Have you tried to set the outfilesuffix in the global AsciiDoc attribute?

https://github.com/middleman/middleman-asciidoc#activation-and-configuration

supsup commented 6 years ago

Think so:

# Configure the AsciiDoc renderer
activate :asciidoc, 
    attributes: { 
        'header_footer' => false, 
        'toc' => false,
        'outfilesuffix' => ".gsp", 
    },
    layout: "layout.erb"
mojavelinux commented 6 years ago

That's supposed to work. However, I notice there's no test for it. I'll add a test and see if it actually does what it's supposed to do.

On Mon, Apr 16, 2018, 16:41 supsup notifications@github.com wrote:

Think so:

Configure the AsciiDoc renderer

activate :asciidoc, attributes: { 'header_footer' => false, 'toc' => false, 'outfilesuffix' => ".gsp", }, layout: "layout.erb"

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/middleman/middleman-asciidoc/issues/87#issuecomment-381772749, or mute the thread https://github.com/notifications/unsubscribe-auth/AAE19-2CCNnxEs_bGsqBJTy-Fi-X0aIiks5tpR4fgaJpZM4TXKhH .

supsup commented 6 years ago

is outfilesuffix also suppose to fix references to other linked .adoc files to be that value instead of .html?

mojavelinux commented 6 years ago

Nope. For that you need to set relfilesuffix. relfilesuffix is used for links. outfilesuffix is (supposed to be) used for the file itself.

supsup commented 6 years ago

relfilesuffix does not seem to work either.

supsup commented 6 years ago

Oddly in MM3, if you set :outfilesuffix: .gsp in an .adoc file it does convert other .adoc links in that file to have .gsp extensions.

ultimately trying to get MM4 to work tho, was just comparing.

mojavelinux commented 6 years ago

relfilesuffix is coming in 1.5.7. I should have said "you will have to set"

mojavelinux commented 6 years ago

I just submitted a PR with a slight change and more tests.

Here are the new rules:

mojavelinux commented 6 years ago

Let's handled the file extension for interdoc xrefs in a separate issue.

mojavelinux commented 6 years ago

There's now a test in place to prove that outfilesuffix can be set (either the global AsciiDoc attributes or per page). I also added docs to the README.