1 /************************************************************************** 2 * 3 * Copyright (c) 2016-2020 Yawg project contributors. 4 * 5 **************************************************************************/ 6 7 package com.varmateo.yawg.spi; 8 9 import java.nio.file.Path; 10 import java.util.Optional; 11 12 13 /** 14 * Information to be used by a baker when baking a file. 15 */ 16 public interface PageContext { 17 18 19 /** 20 * The URL of the directory containing the current page relative 21 * to the top of the document tree. 22 */ 23 String dirUrl(); 24 25 26 /** 27 * Template to be used when generating the target page. 28 */ 29 Optional<Template> templateFor(Path path); 30 31 32 /** 33 * Additional variables made available to the template. 34 */ 35 PageVars pageVars(); 36 37 38 /** 39 * The URL of the top of the baked site relative to the current 40 * page. Useful for refering to resources at the top of the 41 * document tree. 42 */ 43 String rootRelativeUrl(); 44 45 46 /** 47 * Randomly generated unique bake identifier. Each bake will have 48 * a different identifier. 49 */ 50 String bakeId(); 51 52 }