private Optional < IncludeAllPageWithOutput > addOutputInformation ( IncludeAllPage pages , FileResource baseResource , Path includeAllBasePath , Locale locale ) { // depth = 0 is the file that has the include-all directive if ( pages . depth == 0 ) { return of ( new IncludeAllPageWithOutput ( pages , pages . files . get ( 0 ) , pages . files . get ( 0 ) . getPath ( ) , locale ) ) ; } Path baseResourceParentPath = baseResource . getPath ( ) . getParent ( ) ; Optional < FileResource > virtualResource = pages . files . stream ( ) . findFirst ( ) . map ( fr -> new VirtualPathFileResource ( baseResourceParentPath . resolve ( includeAllBasePath . relativize ( fr . getPath ( ) ) . toString ( ) ) , fr ) ) ; return virtualResource . map ( vr -> { Path finalOutputPath = outputPathExtractor . apply ( vr ) . normalize ( ) ; return new IncludeAllPageWithOutput ( pages , vr , finalOutputPath , locale ) ; } ) ; }
generate the final output path