@@ -4822,6 +4822,41 @@ def html(xml, pub_file, stringparams, xmlid_root, file_format, extra_xsl, out_fi
48224822 time_logger .log ("build completed" )
48234823
48244824
4825+ def html_incremental (xml , pub_file , stringparams , xmlid_root , extra_xsl , dest_dir ):
4826+ """Update an HTML incrementally in place.
4827+ Depends on _static and generated files already being in the destination directory.
4828+ Caller must supply:
4829+ * stringparams supplemented with:
4830+ * rs-js, rs-css, and rs-version (can use _set_runestone_stringparams to set)
4831+ * publisher: path to publisher file for use by xsltproc
4832+ """
4833+ if not "rs-js" in stringparams :
4834+ log .error ("Incremental build missing needed stringparam(s). Unable to complete build." )
4835+ return False
4836+
4837+ # to ensure provided stringparams aren't mutated unintentionally
4838+ stringparams = stringparams .copy ()
4839+
4840+ log_time_info = stringparams .get ("profile-py" , False ) == "yes"
4841+ time_logger = Stopwatch ("html_incremental()" , log_time_info )
4842+
4843+ # support publisher file, and subtree argument
4844+ if pub_file :
4845+ stringparams ["publisher" ] = pub_file
4846+ if xmlid_root :
4847+ stringparams ["subtree" ] = xmlid_root
4848+
4849+ # Optional extra XSL could be None, or sanitized full filename
4850+ if extra_xsl :
4851+ extraction_xslt = extra_xsl
4852+ else :
4853+ extraction_xslt = os .path .join (get_ptx_xsl_path (), "pretext-html.xsl" )
4854+
4855+ log .info ("incremental convertsion of {} to HTML in {}" .format (xml , dest_dir ))
4856+ xsltproc (extraction_xslt , xml , None , dest_dir , stringparams )
4857+ time_logger .log ("xsltproc complete" )
4858+
4859+
48254860def revealjs (
48264861 xml , pub_file , stringparams , xmlid_root , file_format , extra_xsl , out_file , dest_dir
48274862):
0 commit comments