I would like to be able to set a date format for the footer (which currently displays as "Last updated 2015-01-29 12:35:40 CET") and also set the date format for built-in attribute "{localdate}". Is there a way to do this? I am using the Maven plugin to generate the html if that matters.
|
Administrator
|
It's possible to change the date by forcefully setting the docdatetime attribute in the Maven configuration (or, outside of Maven, by passing the attribute to the asciidoctor command or API) The date format is currently hard coded if the docdatetime attribute is not explicitly specified {1}. Modifying the format was not considered in the original requirements (since it wasn't in AsciiDoc Python). We've grown up now and it's probably time to get serious about handling these dates correctly. We should provide proper parsing of dates and a way to specify the date format used when assigning the implicit values. :1: https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor/document.rb#L393 On Thu, Jan 29, 2015 at 4:41 AM, wimdeblauwe [via Asciidoctor :: Discussion] <[hidden email]> wrote: I would like to be able to set a date format for the footer (which currently displays as "Last updated 2015-01-29 12:35:40 CET") and also set the date format for built-in attribute "{localdate}". Is there a way to do this? I am using the Maven plugin to generate the html if that matters. -- Dan Allen | http://google.com/profiles/dan.j.allen |
Sort of related question to 'datetime'.
If 'datetime' works and I see many others in the linked code... Does that mean that the rest of parameters explained here http://asciidoc.org/userguide.html#X60 do work? I always get confused about ruby/python/Js implementations. |
In reply to this post by mojavelinux
"It's possible to change the date by forcefully setting the docdatetime attribute in the Maven configuration (or, outside of Maven, by passing the attribute to the asciidoctor command or API)"
Does this mean I have to hardcode the date in my Maven pom? Or would there be a way to format it properly from the current date there? |
Administrator
|
> Does this mean I have to hardcode the date in my Maven pom? Or would
there be a way to format it properly from the current date there? You can use a Maven variables reference to make it dynamic. There are lots of approaches to how to get the variable set in Maven. Then you do something like:<docdatetime>${docdatetime}</docdatetime> Obviously, this is a bit forced, so consider this a workaround for the ultimate goal of custom formatting the date is possible :) On Mon, Feb 2, 2015 at 12:33 AM, wimdeblauwe [via Asciidoctor :: Discussion] <[hidden email]> wrote: "It's possible to change the date by forcefully setting the docdatetime attribute in the Maven configuration (or, outside of Maven, by passing the attribute to the asciidoctor command or API)" -- Dan Allen | http://google.com/profiles/dan.j.allen |
Administrator
|
In reply to this post by abelsromero
On Mon, Feb 2, 2015 at 12:33 AM, abelsromero [via Asciidoctor :: Discussion] <[hidden email]> wrote: I always get confused about ruby/python/Js implementations. Ultimately, the Asciidoctor user guide should cover everything you need to know. We're inching our way there. http://asciidoctor.org/docs/user-manual/#asciidoctor-vs-asciidoc (That table definitely needs to be refined and focused. Currently it reads more like a laundry list :)) The Ruby and JavaScript implementations should be exactly the same (if not, we treat it like a bug). -Dan |
In reply to this post by mojavelinux
Seems this Maven plugin can give a formatted date: http://mojo.codehaus.org/build-helper-maven-plugin/timestamp-property-mojo.html
|
Free forum by Nabble | Edit this page |