Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convertToDocx and convertToEpub not working #220

Closed
w-wong opened this issue Oct 27, 2018 · 6 comments · Fixed by #1137
Closed

convertToDocx and convertToEpub not working #220

w-wong opened this issue Oct 27, 2018 · 6 comments · Fixed by #1137
Assignees
Milestone

Comments

@w-wong
Copy link

w-wong commented Oct 27, 2018

Expected behavior and actual behavior.

docToolchain/bin/doctoolchain . convertToDocx
The above command works until after the commit 552a123 on scripts/pandoc.gradle

I made a small change onto the file under task convertToDocx as follow:
-def sourceFilesDocx = sourceFiles.findAll { 'docx' in it.formats }
+def sourceFilesDocx = sourceFiles.findAll { 'docbook' in it.formats }

It works again. Please confirm and fix the master file if it is correct.

However, there is another similar issue on running convertToEpub, which is related to the same file but it isn't able to fix by changing docx to docbook under convertToEpub task

-def sourceFilesEpub = sourceFiles.findAll { 'epub' in it.formats }
+def sourceFilesEpub = sourceFiles.findAll { 'dockbook' in it.formats }

Always get the below error
Execution failed for task ':convertToEpub'.

execCommand == null!

Steps to reproduce the problem.

checkout out docToolchain project
run ./gradlew -b init.gradle initArc42EN -PnewDocDir=/tmp/Arc42EN
cd /tmp/Arc42EN
${docToolchain_home}/bin/doctoolchain . convertToDocx

Specifications like the version of the project, operating system, or hardware.

The latest version
I am on fedora 28 but it should be the same problem on other OS platforms

@rdmueller
Copy link
Member

thanx for reporting this issue. I will check this out later today...

@rdmueller
Copy link
Member

hm. I think the problem in this case is the Config.groovy

it containts the inputFile Map

inputFiles = [
        [file: 'manual.adoc',       formats: ['html','pdf']],
]

The goal of this map is to define

  • the files to be converted
  • to which formats they should be converted

Not all files in a project are suitable for all output formats.

So, for the ePub and docx conversion, we even have a special case: pandoc converts the target format from docbook. As a result, we first have to convert to docbook and then to ePub and docx and all those formats have to be specified:

inputFiles = [
        [file: 'manual.adoc',       formats: ['html','pdf','docbook','docx','epub']],
]

should do the trick.

@w-wong can you please verify this?

I think we have to create a better user experience here... I could imagine the following changes:

  • if a target is called without finding a configured source file, all source files should be selected and a warning should be output
  • if docx or epub is configured, docbook should be automatically configured

what do you think?

@w-wong
Copy link
Author

w-wong commented Oct 27, 2018

Thanks rdmueller. It works.

Regarding user experience, I think the format missing in Config.groovy should be warned if a specific task is called, otherwise, the task should try run with its best effort by ignoring the config formats. After all, task should run the way as the name means to be.
We normally use config to provide further information such as format when the task name is generic such as "generateDoc" for instance.

It is just my opinion.

I am happy as long as it works and you did a great job indeed.

@rdmueller
Copy link
Member

thanx for the feedback!
I will leave this ticket open until the user experience is fixed.

@dr460neye
Copy link
Contributor

Except from that you mentioned that the order is relevant, i am wondering if pandoc is part of the current existing container.

pandoc -r docbook -t docx -o ../docx/text.docx test.xml

Ends up for me in File not found exceptions. A look into the container also looks like it is missing.

@rdmueller
Copy link
Member

@dr460neye yes, it is currently not part of the container.
Let's link to your issue which you've created: #433

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants