Include properties file and make them document attributes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Include properties file and make them document attributes

eshepelyuk
Is it possible to include properties file, i.e. comprised of name / value pairs and after include turn those kye/value pairs into document attributes ?

Let's assume we have my.properties file with

prop1=value1

So, after include I'd like my document to have attribute prop1 set to value1, like I used following

:prop1: value1
Reply | Threaded
Open this post in threaded view
|

Re: Include properties file and make them document attributes

mojavelinux
Administrator
This idea is closely related to the following issue:


This can be accomplished today using a preprocessor. The preprocessor would read the file, convert the values to a map, assign those values to the document object and return the reader (or null) to proceed.

Could be a good extension for the extension lab.

See https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/lib/front-matter-preprocessor/extension.rb for an example of a similar extension. (The main difference is that this preprocessor would never touch the reader since it is getting information from a separate file).

-Dan

On Thu, Apr 21, 2016 at 6:59 AM, eshepelyuk [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Is it possible to include properties file, i.e. comprised of name / value pairs and after include turn those kye/value pairs into document attributes ?

Let's assume we have my.properties file with

prop1=value1

So, after include I'd like my document to have attribute prop1 set to value1, like I used following

:prop1: value1


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Include-properties-file-and-make-them-document-attributes-tp4629.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Include properties file and make them document attributes

eshepelyuk

My main concern  - will such extension be working on GitHub ?

21 квіт. 2016 22:40 "mojavelinux [via Asciidoctor :: Discussion]" <[hidden email]> пише:
This idea is closely related to the following issue:


This can be accomplished today using a preprocessor. The preprocessor would read the file, convert the values to a map, assign those values to the document object and return the reader (or null) to proceed.

Could be a good extension for the extension lab.

See https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/lib/front-matter-preprocessor/extension.rb for an example of a similar extension. (The main difference is that this preprocessor would never touch the reader since it is getting information from a separate file).

-Dan

On Thu, Apr 21, 2016 at 6:59 AM, eshepelyuk [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Is it possible to include properties file, i.e. comprised of name / value pairs and after include turn those kye/value pairs into document attributes ?

Let's assume we have my.properties file with

prop1=value1

So, after include I'd like my document to have attribute prop1 set to value1, like I used following

:prop1: value1


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Include-properties-file-and-make-them-document-attributes-tp4629.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Include-properties-file-and-make-them-document-attributes-tp4629p4632.html
To unsubscribe from Include properties file and make them document attributes, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Include properties file and make them document attributes

mojavelinux
Administrator

eshepelyuk wrote:
My main concern  - will such extension be working on GitHub ?

No, it won't. But until GitHub changes their position, the processor can't read secondary files anyway. Not even a change to core would allow the idea to work on GitHub. GitHub only allows the processor to convert an input string with no file access.

-Dan


--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Include properties file and make them document attributes

mojavelinux
Administrator
In reply to this post by eshepelyuk
But to clarify, if you are using this with Jekyll AsciiDoc, and you run the build on your own CI server (or Travis), then yes, you can use the extension.

-Dan

On Thu, Apr 21, 2016 at 6:32 PM, Dan Allen <[hidden email]> wrote:

eshepelyuk wrote:
My main concern  - will such extension be working on GitHub ?

No, it won't. But until GitHub changes their position, the processor can't read secondary files anyway. Not even a change to core would allow the idea to work on GitHub. GitHub only allows the processor to convert an input string with no file access.

-Dan


--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Include properties file and make them document attributes

eshepelyuk
In reply to this post by mojavelinux

Thank you for detailled reply, Dan.

22 квіт. 2016 03:33 "mojavelinux [via Asciidoctor :: Discussion]" <[hidden email]> пише:

eshepelyuk wrote:
My main concern  - will such extension be working on GitHub ?

No, it won't. But until GitHub changes their position, the processor can't read secondary files anyway. Not even a change to core would allow the idea to work on GitHub. GitHub only allows the processor to convert an input string with no file access.

-Dan


--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Include-properties-file-and-make-them-document-attributes-tp4629p4637.html
To unsubscribe from Include properties file and make them document attributes, click here.
NAML