Ongoing effort for LibreOffice/Packt backend

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

Ongoing effort for LibreOffice/Packt backend

gregturn
I took Dan's pull request, merged it, and have since made considerable headway.

To see how to use it, visit and read https://github.com/gregturn/asciidoc-packt#asciidoctor-support.

For a listing of outstanding issues, checkout https://github.com/gregturn/asciidoc-packt#asciidoctor-issues.

This had definitely been easier than what it took me to get ramped up on AsciiDoc! Thanks Dan!
Greg Turnquist (@gregturn)
Author of Darklight and Hacking with Spring Boot 2.3
Sign up for my newsletter and get a FREE e-book
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

mojavelinux
Administrator
That's great news! I've seen a lot of queries about the OpenDocument backend, so I'm sure this will be of interest to a lot of authors.

I'm curious now to see how the output looks. I'll update and check it out!

-Dan


On Wed, Jun 18, 2014 at 12:43 AM, gregturn [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I took Dan's pull request, merged it, and have since made considerable headway.

To see how to use it, visit and read https://github.com/gregturn/asciidoc-packt#asciidoctor-support.

For a listing of outstanding issues, checkout https://github.com/gregturn/asciidoc-packt#asciidoctor-issues.

This had definitely been easier than what it took me to get ramped up on AsciiDoc! Thanks Dan!


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Ongoing-effort-for-LibreOffice-Packt-backend-tp1823.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

mojavelinux
Administrator
In reply to this post by gregturn
The problem you are having with the image attributes is due to not using the correct inline syntax.

I recommend looking at the slim docbook backend when you get stuck.


If you just want the path in the attribute, then you'd type:

 xlink:href=image_uri(attr :target)

If you need to surround the path with round brackets (if I understand what you are doing correctly, you need to use interpolation).

 xlink:href="(#{image_uri(attr :target)})"

That should get images to work. The image_uri function handles all aspects of resolving the path to the image, taking into account the imagesdir and data-uri embedding.

NOTE: The target for block images is (oddly) stored in the target attribute, not the node's target property. Inline images store the target in the target property. In the future, I may align these.

-Dan



On Wed, Jun 18, 2014 at 12:43 AM, gregturn [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I took Dan's pull request, merged it, and have since made considerable headway.

To see how to use it, visit and read https://github.com/gregturn/asciidoc-packt#asciidoctor-support.

For a listing of outstanding issues, checkout https://github.com/gregturn/asciidoc-packt#asciidoctor-issues.

This had definitely been easier than what it took me to get ramped up on AsciiDoc! Thanks Dan!


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Ongoing-effort-for-LibreOffice-Packt-backend-tp1823.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

mojavelinux
Administrator
In reply to this post by gregturn
To help other developers contribute, it might be helpful if you put a sample book in AsciiDoc format in the repository for testing the backend. Include content that the backend can handle and add content as you implement more of the syntax.

-Dan


On Wed, Jun 18, 2014 at 12:43 AM, gregturn [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I took Dan's pull request, merged it, and have since made considerable headway.

To see how to use it, visit and read https://github.com/gregturn/asciidoc-packt#asciidoctor-support.

For a listing of outstanding issues, checkout https://github.com/gregturn/asciidoc-packt#asciidoctor-issues.

This had definitely been easier than what it took me to get ramped up on AsciiDoc! Thanks Dan!


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Ongoing-effort-for-LibreOffice-Packt-backend-tp1823.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

gregturn
In reply to this post by gregturn
Dan

I partially fixed the image.fodt.slim so that it embeds the image. The hangup I'm having is mixing the @target attribute with some hard coded text in a "Layout" message placed afterwards.

You can see my edit at https://github.com/gregturn/asciidoc-packt/pull/10.

P.S. I created https://github.com/gregturn/asciidoc-packt/blob/master/example.adoc based on your example, to provide a nice showcase of what this backend does, and to also help test outcomes.
Greg Turnquist (@gregturn)
Author of Darklight and Hacking with Spring Boot 2.3
Sign up for my newsletter and get a FREE e-book
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

gregturn
I ran into a pesky issue with one of my styles, used to wrap a **bolded** chunk of text.

For some reason, the styles double-underscore is the culprit.

See https://github.com/gregturn/asciidoc-packt/pull/12
Greg Turnquist (@gregturn)
Author of Darklight and Hacking with Spring Boot 2.3
Sign up for my newsletter and get a FREE e-book
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

mojavelinux
Administrator
In reply to this post by gregturn

On Wed, Jun 18, 2014 at 4:15 PM, gregturn [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I partially fixed the image.fodt.slim so that it embeds the image. The hangup I'm having is mixing the @target attribute with some hard coded text in a "Layout" message placed afterwards.

You can see my edit at https://github.com/gregturn/asciidoc-packt/pull/10.

I submitted a pull request with a proposed syntax.
 

P.S. I created https://github.com/gregturn/asciidoc-packt/blob/master/example.adoc based on your example, to provide a nice showcase of what this backend does, and to also help test outcomes.

For those following along, this example now seems to be the main README.adoc file.

 $ asciidoctor -T slim -b packt README.adoc
    oowriter README.fodt

It's really looking good Greg!

-Dan

--
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

mojavelinux
Administrator
In reply to this post by gregturn
This pesky issue has to do with the fact that inline parsing in AsciiDoc / Asciidoctor is done using sequential regular expression across the whole line. The double underscores in the style name get interpreted as (unconstrained) emphasis markup. We'll eventually fix this problem in Asciidoctor by using a proper parser for inline formatting. Until then, we have to work around it.

One workaround is to escape the double underscore. To know when to escape output, you need to be aware of the order in which the markup is parsed. See the following collection for that order:


As you can see, the unconstrained emphasis follows the processing of strong.

You may run into cases that are chicken-egg. In that case, you might want to use placeholder style names and then come back and replace them...or you can post-process the output to remove any backslashes left behind in style names. There's always a cure :)

-Dan


On Wed, Jun 18, 2014 at 6:35 PM, gregturn [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I ran into a pesky issue with one of my styles, used to wrap a **bolded** chunk of text.

For some reason, the styles double-underscore is the culprit.

See https://github.com/gregturn/asciidoc-packt/pull/12


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Ongoing-effort-for-LibreOffice-Packt-backend-tp1823p1837.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

mojavelinux
Administrator
In reply to this post by gregturn
Although it may not be your focus right now, ideally you want to maintain the integrity of the AsciiDoc document independent of the PACKT backend. That means using a proper document title, author line, etc. You should be able to tweak the backend so it only emits what the PACKT publishing toolchain expects. We don't want to encourage writers to use specialized document structures for different publishing houses. (Of course, there will be some constraints, but they should be minimally invasive).

I'll cite two examples:

Quotes in block quotes::
The double quotes around the text in a block quote is technically a formatting concern. The content in the block quote is already assumed to be quoted, so the quotes shouldn't be necessary. They can be added by the backend.

Document header::
We should encourage the use of a standard document header. The chapter title should be the document title. The chapter number should be calculated automatically. When combining chapters into a book, the :leveloffset: attribute can be used to push the headings down a level.

The document header is a bit of a tricky requirement because we are still missing support in Asciidoctor (and AsciiDoc Python) for proper combining of subdocuments. The only way to combine documents atm is to use the preprocessor include directive, which works, but lacks the context to parse the document headers in each subdocument. A properly subdocument block macro is planned. Until then, the recommended way to do individual chapters as standalone documents is to leave off the implicit author line or define the author using an explicit attribute:

```asciidoc

:author: Greg Turnquist
:firstname: Greg
:lastname: Turquist
= Chapter Title

content

```

Obviously, we want to get that cleaned up in Asciidoctor asap. For now, it just is.

-Dan


On Wed, Jun 18, 2014 at 4:15 PM, gregturn [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Dan

I partially fixed the image.fodt.slim so that it embeds the image. The hangup I'm having is mixing the @target attribute with some hard coded text in a "Layout" message placed afterwards.

You can see my edit at https://github.com/gregturn/asciidoc-packt/pull/10.

P.S. I created https://github.com/gregturn/asciidoc-packt/blob/master/example.adoc based on your example, to provide a nice showcase of what this backend does, and to also help test outcomes.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Ongoing-effort-for-LibreOffice-Packt-backend-tp1823p1836.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

mojavelinux
Administrator
In reply to this post by gregturn
...I'll admit these points can seem rather picky. I'm describing an ideal world. We often have to make concessions, but we want to gravitate towards portable content whenever possible.

-Dan


On Thu, Jun 19, 2014 at 12:42 AM, Dan Allen <[hidden email]> wrote:
Although it may not be your focus right now, ideally you want to maintain the integrity of the AsciiDoc document independent of the PACKT backend. That means using a proper document title, author line, etc. You should be able to tweak the backend so it only emits what the PACKT publishing toolchain expects. We don't want to encourage writers to use specialized document structures for different publishing houses. (Of course, there will be some constraints, but they should be minimally invasive).

I'll cite two examples:

Quotes in block quotes::
The double quotes around the text in a block quote is technically a formatting concern. The content in the block quote is already assumed to be quoted, so the quotes shouldn't be necessary. They can be added by the backend.

Document header::
We should encourage the use of a standard document header. The chapter title should be the document title. The chapter number should be calculated automatically. When combining chapters into a book, the :leveloffset: attribute can be used to push the headings down a level.

The document header is a bit of a tricky requirement because we are still missing support in Asciidoctor (and AsciiDoc Python) for proper combining of subdocuments. The only way to combine documents atm is to use the preprocessor include directive, which works, but lacks the context to parse the document headers in each subdocument. A properly subdocument block macro is planned. Until then, the recommended way to do individual chapters as standalone documents is to leave off the implicit author line or define the author using an explicit attribute:

```asciidoc

:author: Greg Turnquist
:firstname: Greg
:lastname: Turquist
= Chapter Title

content

```

Obviously, we want to get that cleaned up in Asciidoctor asap. For now, it just is.

-Dan


On Wed, Jun 18, 2014 at 4:15 PM, gregturn [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Dan

I partially fixed the image.fodt.slim so that it embeds the image. The hangup I'm having is mixing the @target attribute with some hard coded text in a "Layout" message placed afterwards.

You can see my edit at https://github.com/gregturn/asciidoc-packt/pull/10.

P.S. I created https://github.com/gregturn/asciidoc-packt/blob/master/example.adoc based on your example, to provide a nice showcase of what this backend does, and to also help test outcomes.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Ongoing-effort-for-LibreOffice-Packt-backend-tp1823p1836.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML






--
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

gregturn
Cool! Things are really moving along. I actually have a LOT of the needed functionality.

I managed to fix that Keyword issue. I simply moved case :emphasis to the bottom of things, and it clicked. The rendered document looks almost perfect.

I have been able to take a code block and break it up into separate lines, applying "Code" styling to each line, except the last line which gets "Code End". (That's how Packt likes it). I was also able to spot when I am putting in a [source] block vs. having a plain console output block, and hence I applied Packt's "Command Line"/"Command Line End" styling with the same paradigm.

I took into consideration your comments about chapter numbers. So I have a PR where I have modified README.adoc to have :chapter_number: where I can hand write the chapter number, and if it doesn't exist, default to "1". The one issue pointed out in that PR is that I can't seem to grab the title in my newly crafted preamble.fodt.slim. If you could look at https://github.com/gregturn/asciidoc-packt/pull/17 that would certainly help.

The other thing I will mend are the quotes.
Greg Turnquist (@gregturn)
Author of Darklight and Hacking with Spring Boot 2.3
Sign up for my newsletter and get a FREE e-book
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

gregturn
BTW, I moved quotation marks surrounding quotes into the backend and removed them from the README.adoc example.
Greg Turnquist (@gregturn)
Author of Darklight and Hacking with Spring Boot 2.3
Sign up for my newsletter and get a FREE e-book
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

gregturn
I've cut over to asciidoctor fully! Awesome. And I've caught the attention of an editor at Packt.

Thanks Dan!
Greg Turnquist (@gregturn)
Author of Darklight and Hacking with Spring Boot 2.3
Sign up for my newsletter and get a FREE e-book
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing effort for LibreOffice/Packt backend

gregturn
Dan,

I'm trying to grok how asciidoctor handles filters. I guess I got the impression you could embed the code directly into the doc via http://discuss.asciidoctor.org/Finally-a-draft-of-the-Asciidoctor-extension-API-has-landed-td455.html. But apparently, that's not the case.
Greg Turnquist (@gregturn)
Author of Darklight and Hacking with Spring Boot 2.3
Sign up for my newsletter and get a FREE e-book