HEX
Server: Apache
System: Linux webd004.cluster130.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: frenchy (106757)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/frenchy/www/french-american.org/current/fractal.js
"use strict";

/* Create a new Fractal instance and export it for use elsewhere if required */
const fractal = (module.exports = require("@frctl/fractal").create());

/* Set the title of the project */
fractal.set("project.title", "Guide de style");

/* Tell Fractal where the components will live */
fractal.components.set("path", __dirname + "/app/views/components");
fractal.components.set('label', 'Composants'); // titre des composants dans le menu

/* Tell Fractal where the documentation pages will live */
fractal.docs.set("path", __dirname + "/app/docs");
fractal.docs.set('indexLabel', 'Accueil'); // titre de la page d'accueil dans le menu

// Voir doc : https://fractal.build/guide/web/#static-assets
fractal.web.set("static.path", __dirname + "/public/wp-content/themes/biig/");

fractal.web.set("builder.dest", __dirname + "/public/styleguide");

// Désactive les status WIP/DONE...
fractal.components.set("default.status", null);

/*
 * Custom Thème
 */
const mandelbrot = require("@frctl/mandelbrot");

const myCustomisedTheme = mandelbrot({
  favicon: "/images/favicons/favicon.ico",
  nav: ["docs", "components"],
  styles: ["default", "/assets/css/styleguide-fractal.min.css"],
  panels: ["html", "notes"],
  lang: "fr"
});

fractal.web.theme(myCustomisedTheme);

/*
 * Require the Twig adapter
 */
// const twigAdapter = require('@frctl/twig')();

/*
 * Require the Twig adapter
 */
const twigAdapter = require("@frctl/twig")({
  // if pristine is set to true, bundled filters, functions, tests
  // and tags are not registered.
  // default is false
  pristine: false,

  // if importContext is set to true, all include calls are passed
  // the component's context
  // default is false
  importContext: false,

  // use custom handle prefix
  // this will change your includes to {% include '%button' %}
  // default is '@'
  handlePrefix: "%",

  // register custom filters
  filters: {
    // usage: {{ label|capitalize }}
    capitalize: function(str) {
      if (!str) return "";

      return str.charAt(0).toUpperCase() + str.slice(1);
    }
  },

  // register custom functions
  functions: {
    // usage: {{ capitalize(label) }}
    capitalize: function(str) {
      if (!str) return "";

      return str.charAt(0).toUpperCase() + str.slice(1);
    }
  },

  // register custom tests
  tests: {
    // usage: {% if label is equalToNull %}
    equalToNull: function(param) {
      return param === null;
    }
  },

  // register custom tags
  tags: {
    flag: function(Twig) {
      // usage: {% flag "ajax" %}
      // all credit to https://github.com/twigjs/twig.js/wiki/Extending-twig.js-With-Custom-Tags
      return {
        // unique name for tag type
        type: "flag",
        // regex match for tag (flag white-space anything)
        regex: /^flag\s+(.+)$/,
        // this is a standalone tag and doesn't require a following tag
        next: [],
        open: true,

        // runs on matched tokens when the template is loaded. (once per template)
        compile: function(token) {
          var expression = token.match[1];

          // Compile the expression. (turns the string into tokens)
          token.stack = Twig.expression.compile.apply(this, [
            {
              type: Twig.expression.type.expression,
              value: expression
            }
          ]).stack;

          delete token.match;
          return token;
        },

        // Runs when the template is rendered
        parse: function(token, context, chain) {
          // parse the tokens into a value with the render context
          var name = Twig.expression.parse.apply(this, [token.stack, context]),
            output = "";

          flags[name] = true;

          return {
            chain: false,
            output: output
          };
        }
      };
    }
  }
});

fractal.components.engine(twigAdapter);
fractal.components.set("ext", ".twig");