{
    "content": [
        {
            "type": "text",
            "text": "# Template::Tools::ttree (perldoc)\n\n## NAME\n\nTemplate::Tools::ttree - Process entire directory trees of templates\n\n## SYNOPSIS\n\nttree [options] [files]\n\n## DESCRIPTION\n\nThe ttree script is used to process entire directory trees containing template files. The\nresulting output from processing each file is then written to a corresponding file in a\ndestination directory. The script compares the modification times of source and destination\nfiles (where they already exist) and processes only those files that have been modified. In\nother words, it is the equivalent of 'make' for the Template Toolkit.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (5 subsections)\n- **AUTHORS**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Template::Tools::ttree",
        "section": "",
        "mode": "perldoc",
        "summary": "Template::Tools::ttree - Process entire directory trees of templates",
        "synopsis": "ttree [options] [files]",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 12,
                "subsections": [
                    {
                        "name": "The .ttreerc Configuration File",
                        "lines": 82
                    },
                    {
                        "name": "Directory Options",
                        "lines": 46
                    },
                    {
                        "name": "File Options",
                        "lines": 30
                    },
                    {
                        "name": "Template Dependencies",
                        "lines": 66
                    },
                    {
                        "name": "Template Toolkit Options",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "AUTHORS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Template::Tools::ttree - Process entire directory trees of templates\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "ttree [options] [files]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The ttree script is used to process entire directory trees containing template files. The\nresulting output from processing each file is then written to a corresponding file in a\ndestination directory. The script compares the modification times of source and destination\nfiles (where they already exist) and processes only those files that have been modified. In\nother words, it is the equivalent of 'make' for the Template Toolkit.\n\nIt supports a number of options which can be used to configure behaviour, define locations and\nset Template Toolkit options. The script first reads the .ttreerc configuration file in the HOME\ndirectory, or an alternative file specified in the TTREERC environment variable. Then, it\nprocesses any command line arguments, including any additional configuration files specified via\nthe \"-f\" (file) option.\n",
                "subsections": [
                    {
                        "name": "The .ttreerc Configuration File",
                        "content": "When you run ttree for the first time it will ask you if you want it to create a .ttreerc file\nfor you. This will be created in your home directory.\n\n$ ttree\nDo you want me to create a sample '.ttreerc' file for you?\n(file: /home/abw/.ttreerc)   [y/n]: y\n/home/abw/.ttreerc created.  Please edit accordingly and re-run ttree\n\nThe purpose of this file is to set any *global* configuration options that you want applied\n*every* time ttree is run. For example, you can use the \"ignore\" and \"copy\" option to provide\nregular expressions that specify which files should be ignored and which should be copied rather\nthan being processed as templates. You may also want to set flags like \"verbose\" and \"recurse\"\naccording to your preference.\n\nA minimal .ttreerc:\n\n# ignore these files\nignore = \\b(CVS|RCS)\\b\nignore = ^#\nignore = ~$\n\n# copy these files\ncopy   = \\.(gif|png|jpg|pdf)$\n\n# recurse into directories\nrecurse\n\n# provide info about what's going on\nverbose\n\nIn most cases, you'll want to create a different ttree configuration file for each project\nyou're working on. The \"cfg\" option allows you to specify a directory where ttree can find\nfurther configuration files.\n\ncfg = /home/abw/.ttree\n\nThe \"-f\" command line option can be used to specify which configuration file should be used. You\ncan specify a filename using an absolute or relative path:\n\n$ ttree -f /home/abw/web/example/etc/ttree.cfg\n$ ttree -f ./etc/ttree.cfg\n$ ttree -f ../etc/ttree.cfg\n\nIf the configuration file does not begin with \"/\" or \".\" or something that looks like a MS-DOS\nabsolute path (e.g. \"C:\\\\etc\\\\ttree.cfg\") then ttree will look for it in the directory specified\nby the \"cfg\" option.\n\n$ ttree -f test1          # /home/abw/.ttree/test1\n\nThe \"cfg\" option can only be used in the .ttreerc file. All the other options can be used in the\n.ttreerc or any other ttree configuration file. They can all also be specified as command line\noptions.\n\nRemember that .ttreerc is always processed *before* any configuration file specified with the\n\"-f\" option. Certain options like \"lib\" can be used any number of times and accumulate their\nvalues.\n\nFor example, consider the following configuration files:\n\n/home/abw/.ttreerc:\n\ncfg = /home/abw/.ttree\nlib = /usr/local/tt2/templates\n\n/home/abw/.ttree/myconfig:\n\nlib = /home/abw/web/example/templates/lib\n\nWhen ttree is invoked as follows:\n\n$ ttree -f myconfig\n\nthe \"lib\" option will be set to the following directories:\n\n/usr/local/tt2/templates\n/home/abw/web/example/templates/lib\n\nAny templates located under /usr/local/tt2/templates will be used in preference to those located\nunder /home/abw/web/example/templates/lib. This may be what you want, but then again, it might\nnot. For this reason, it is good practice to keep the .ttreerc as simple as possible and use\ndifferent configuration files for each ttree project.\n"
                    },
                    {
                        "name": "Directory Options",
                        "content": "The \"src\" option is used to define the directory containing the source templates to be\nprocessed. It can be provided as a command line option or in a configuration file as shown here:\n\nsrc = /home/abw/web/example/templates/src\n\nEach template in this directory typically corresponds to a single web page or other document.\n\nThe \"dest\" option is used to specify the destination directory for the generated output.\n\ndest = /home/abw/web/example/html\n\nThe \"lib\" option is used to define one or more directories containing additional library\ntemplates. These templates are not documents in their own right and typically comprise of\nsmaller, modular components like headers, footers and menus that are incorporated into pages\ntemplates.\n\nlib = /home/abw/web/example/templates/lib\nlib = /usr/local/tt2/templates\n\nThe \"lib\" option can be used repeatedly to add further directories to the search path.\n\nA list of templates can be passed to ttree as command line arguments.\n\n$ ttree foo.html bar.html\n\nIt looks for these templates in the \"src\" directory and processes them through the Template\nToolkit, using any additional template components from the \"lib\" directories. The generated\noutput is then written to the corresponding file in the \"dest\" directory.\n\nIf ttree is invoked without explicitly specifying any templates to be processed then it will\nprocess every file in the \"src\" directory. If the \"-r\" (recurse) option is set then it will\nadditionally iterate down through sub-directories and process and other template files it finds\ntherein.\n\n$ ttree -r\n\nIf a template has been processed previously, ttree will compare the modification times of the\nsource and destination files. If the source template (or one it is dependant on) has not been\nmodified more recently than the generated output file then ttree will not process it. The -a\n(all) option can be used to force ttree to process all files regardless of modification time.\n\n$ ttree -a\n\nAny templates explicitly named as command line argument are always processed and the\nmodification time checking is bypassed.\n"
                    },
                    {
                        "name": "File Options",
                        "content": "The \"ignore\", \"copy\" and \"accept\" options are used to specify Perl regexen to filter file names.\nFiles that match any of the \"ignore\" options will not be processed. Remaining files that match\nany of the \"copy\" regexen will be copied to the destination directory. Remaining files that then\nmatch any of the \"accept\" criteria are then processed via the Template Toolkit. If no \"accept\"\nparameter is specified then all files will be accepted for processing if not already copied or\nignored.\n\n# ignore these files\nignore = \\b(CVS|RCS)\\b\nignore = ^#\nignore = ~$\n\n# copy these files\ncopy   = \\.(gif|png|jpg|pdf)$\n\n# accept only .tt2 templates\naccept = \\.tt2$\n\nThe \"suffix\" option is used to define mappings between the file extensions for source templates\nand the generated output files. The following example specifies that source templates with a\n\".tt2\" suffix should be output as \".html\" files:\n\nsuffix tt2=html\n\nOr on the command line,\n\n--suffix tt2=html\n\nYou can provide any number of different suffix mappings by repeating this option.\n"
                    },
                    {
                        "name": "Template Dependencies",
                        "content": "The \"depend\" and \"dependfile\" options allow you to specify how any given template file depends\non another file or group of files. The \"depend\" option is used to express a single dependency.\n\n$ ttree --depend foo=bar,baz\n\nThis command line example shows the \"--depend\" option being used to specify that the foo file is\ndependant on the bar and baz templates. This option can be used many time on the command line:\n\n$ ttree --depend foo=bar,baz --depend crash=bang,wallop\n\nor in a configuration file:\n\ndepend foo=bar,baz\ndepend crash=bang,wallop\n\nThe file appearing on the left of the \"=\" is specified relative to the \"src\" or \"lib\"\ndirectories. The file(s) appearing on the right can be specified relative to any of these\ndirectories or as absolute file paths.\n\nFor example:\n\n$ ttree --depend foo=bar,/tmp/baz\n\nTo define a dependency that applies to all files, use \"*\" on the left of the \"=\".\n\n$ ttree --depend *=header,footer\n\nor in a configuration file:\n\ndepend *=header,footer\n\nAny templates that are defined in the \"preprocess\", \"postprocess\", \"process\" or \"wrapper\"\noptions will automatically be added to the list of global dependencies that apply to all\ntemplates.\n\nThe \"dependfile\" option can be used to specify a file that contains dependency information.\n\n$ ttree --dependfile=/home/abw/web/example/etc/ttree.dep\n\nHere is an example of a dependency file:\n\n# This is a comment. It is ignored.\n\nindex.html: header footer menubar\n\nheader: titlebar hotlinks\n\nmenubar: menuitem\n\n# spanning multiple lines with the backslash\nanother.html: header footer menubar \\\nsidebar searchform\n\nLines beginning with the \"#\" character are comments and are ignored. Blank lines are also\nignored. All other lines should provide a filename followed by a colon and then a list of\ndependant files separated by whitespace, commas or both. Whitespace around the colon is also\noptional. Lines ending in the \"\\\" character are continued onto the following line.\n\nFiles that contain spaces can be quoted. That is only necessary for files after the colon (':').\nThe file before the colon may be quoted if it contains a colon.\n\nAs with the command line options, the \"*\" character can be used as a wildcard to specify a\ndependency for all templates.\n\n* : config,header\n"
                    },
                    {
                        "name": "Template Toolkit Options",
                        "content": "ttree also provides access to the usual range of Template Toolkit options. For example, the\n\"--prechomp\" and \"--postchomp\" ttree options correspond to the \"PRECHOMP\" and \"POSTCHOMP\"\noptions.\n\nRun \"ttree -h\" for a summary of the options available.\n"
                    }
                ]
            },
            "AUTHORS": {
                "content": "Andy Wardley <abw@wardley.org>\n\n<http://www.wardley.org>\n\nWith contributions from Dylan William Hardison (support for dependencies), Bryce Harrington\n(\"absolute\" and \"relative\" options), Mark Anderson (\"suffix\" and \"debug\" options), Harald Joerg\nand Leon Brocard who gets everywhere, it seems.\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved.\n\nThis module is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "Template::Tools::tpage\n",
                "subsections": []
            }
        }
    }
}