Skip to content

RELATIVE_INCLUDE variable breaking Antora builds #156

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

Closed
scphantm opened this issue Jun 8, 2021 · 4 comments
Closed

RELATIVE_INCLUDE variable breaking Antora builds #156

scphantm opened this issue Jun 8, 2021 · 4 comments
Labels
stale Issue has not been active for 60 days

Comments

@scphantm
Copy link

scphantm commented Jun 8, 2021

This is basically a reopen of #118

I am having the identical error with an Antora build. I have tried every combination i can think of and everything fails. using the

!include C4_Context.puml

fails with the error

Skipping plantuml block. Preprocessing of PlantUML include failed, because reading the referenced local file '%get_variable_value("RELATIVE_INCLUDE")/C4.puml' caused an error:
Error: ENOENT: no such file or directory, open '%get_variable_value("RELATIVE_INCLUDE")/C4.puml'

switching to
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml

gives me the same error.

Switching it to

!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/v2.0.1/C4.puml

finally worked, but obviously is a bad solution.

the problem is in this if statement

' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
  !include %get_variable_value("RELATIVE_INCLUDE")/C4.puml
!else
  !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4.puml
!endif

in Antora, the concept of a file path is murky at best because antora loads the file system into kinda like an in memory graph (trying to be simple here, be gentle). the previous 2.0.1 version didn't have these if statements and work flawlessly.

Im running the latest and greatest of everything so let me know what i can do to help debug this. Maybe all it needs is something like this

' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
  !if %file_exists(%get_variable_value("RELATIVE_INCLUDE")/C4.puml)
     !include %get_variable_value("RELATIVE_INCLUDE")/C4.puml
  !else
     !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4.puml
  !endif
!else
  !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4.puml
!endif

if a file_exists is even possible. I don't know. just an idea.

@kirchsth
Copy link
Member

I think it is solved with asciidoctor/asciidoctor-kroki#49
Can we close it?

@kirchsth
Copy link
Member

kirchsth commented Jun 18, 2021

Hi @scphantm
PlantUml offers additional to !include an !include_many statement. The idea is that Antora does not support '!include_many' and therefore ignores it. Do you think that following implementation could help?

' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
  ' use !include_many that Kroki and Antora ignores the not supported calculated !include  
  !include_many %get_variable_value("RELATIVE_INCLUDE")/C4_Context.puml
!else
  !include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Context.puml
!endif

My extended branch is updated with !include_many. You can include it in your source like

!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Context.puml

Can you try it?
BR Helmut

@kirchsth
Copy link
Member

kirchsth commented Jul 4, 2021

@scphantm, @Potherca: I created a new plantuml-stdlib PR 42 that all new v.2.3.0 features can be used via stdlib too.

BR Helmut

@stale
Copy link

stale bot commented Sep 2, 2021

This issue has been automatically marked as stale because it has not had activity in the past 60 days. It will be closed in seven days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Issue has not been active for 60 days label Sep 2, 2021
@stale stale bot closed this as completed Sep 10, 2021
@Potherca Potherca moved this to Todo in All Projects Jul 3, 2022
@Potherca Potherca moved this from Todo to Done in All Projects Jul 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issue has not been active for 60 days
Projects
Status: Done
Development

No branches or pull requests

2 participants