@ -17,9 +17,16 @@ from .metadata import MetaTree
from . processchain import ProcessorChains
from . processchain import ProcessorChains
from . processors . processors import PassthroughException
from . processors . processors import PassthroughException
from . pygments import pygments_get_css , pygments_markup_contents_html
from . pygments import pygments_get_css , pygments_markup_contents_html
from . template_tools import ( date_iso8601 , file_content , file_list ,
from . template_tools import (
file_list_hier , file_metadata , file_name ,
date_iso8601 ,
file_raw , time_iso8601 )
file_content ,
file_list ,
file_list_hier ,
file_metadata ,
file_name ,
file_raw ,
time_iso8601 ,
)
logger = logging . getLogger ( )
logger = logging . getLogger ( )
@ -38,12 +45,11 @@ def get_args(args: List[str]) -> argparse.Namespace:
" -c " , " --clean " , help = " Remove the target tree before proceeding (by renaming to .bak). " , action = " store_true "
" -c " , " --clean " , help = " Remove the target tree before proceeding (by renaming to .bak). " , action = " store_true "
)
)
parser . add_argument ( " -s " , " --safe " , help = " Abort if the target directory already exists. " , action = " store_true " )
parser . add_argument ( " -s " , " --safe " , help = " Abort if the target directory already exists. " , action = " store_true " )
parser . add_argument ( " -f " , " --follow-links " , help = " Follow symbolic links in the input tree. " , action = " store_true " )
parser . add_argument ( " -t " , " --template " , help = " The template directory (default: root/templates) " , default = None )
parser . add_argument ( " -t " , " --template " , help = " The template directory (default: root/templates) " , default = None )
parser . add_argument ( " -d " , " --dry-run " , help = " Perform a dry-run. " , action = " store_true " )
parser . add_argument ( " -d " , " --dry-run " , help = " Perform a dry-run. " , action = " store_true " )
parser . add_argument ( " -v " , " --verbose " , help = " Output verbosely. " , action = " store_true " )
parser . add_argument ( " -v " , " --verbose " , help = " Output verbosely. " , action = " store_true " )
parser . add_argument ( " --processors " , help = " Specify a path to a processor configuration file. " , default = None )
parser . add_argument ( " --processors " , help = " Specify a path to a processor configuration file. " , default = None )
# parser.add_argument("--prescript", help="Specify one or more prescripts to run (in order specified) with context of the compile.", default=[], action="append")
# parser.add_argument("--postscript", help="Specify one or more postsscripts to run (in order specified) with context of the compile.", default=[], action="append")
result = parser . parse_args ( args )
result = parser . parse_args ( args )
# validate arguments
# validate arguments
@ -102,7 +108,7 @@ def main() -> int:
" pygments_markup_contents_html " : pygments_markup_contents_html ,
" pygments_markup_contents_html " : pygments_markup_contents_html ,
}
}
for root , _ , files in os . walk ( args . root ) :
for root , _ , files in os . walk ( args . root , followlinks = args . follow_links ) :
workroot = os . path . relpath ( root , args . root )
workroot = os . path . relpath ( root , args . root )
if workroot == " . " :
if workroot == " . " :
workroot = " "
workroot = " "