index.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. module.exports = {
  2. // Extend website resources and html
  3. website: {
  4. assets: "./book",
  5. js: [
  6. "test.js"
  7. ],
  8. css: [
  9. "test.css"
  10. ],
  11. html: {
  12. "html:start": function() {
  13. return "<!-- Start book "+this.options.title+" -->"
  14. },
  15. "html:end": function() {
  16. return "<!-- End of book "+this.options.title+" -->"
  17. },
  18. "head:start": "<!-- head:start -->",
  19. "head:end": "<!-- head:end -->",
  20. "body:start": "<!-- body:start -->",
  21. "body:end": "<!-- body:end -->"
  22. }
  23. },
  24. // Extend ebook resources and html
  25. website: {
  26. assets: "./book",
  27. js: [
  28. "test.js"
  29. ],
  30. css: [
  31. "test.css"
  32. ],
  33. html: {
  34. "html:start": function() {
  35. return "<!-- Start book "+this.options.title+" -->"
  36. },
  37. "html:end": function() {
  38. return "<!-- End of book "+this.options.title+" -->"
  39. },
  40. "head:start": "<!-- head:start -->",
  41. "head:end": "<!-- head:end -->",
  42. "body:start": "<!-- body:start -->",
  43. "body:end": "<!-- body:end -->"
  44. }
  45. },
  46. // Extend templating blocks
  47. blocks: {
  48. // Author will be able to write "{% myTag %}World{% endMyTag %}"
  49. myTag: {
  50. process: function(blk) {
  51. return "Hello "+blk.body;
  52. }
  53. }
  54. },
  55. // Extend templating filters
  56. filters: {
  57. // Author will be able to write "{{ 'test'|myFilter }}"
  58. myFilter: function(s) {
  59. return "Hello "+s;
  60. }
  61. },
  62. // Hook process during build
  63. hooks: {
  64. // For all the hooks, this represent the current generator
  65. // This is called before the book is generated
  66. "init": function() {
  67. console.log("init!");
  68. },
  69. // This is called after the book generation
  70. "finish": function() {
  71. console.log("finish!");
  72. }
  73. }
  74. };