Ejemplo n.º 1
0
    def _export_with_performance(
        document,
        export_options: ExportOptions,
        document_tree,
        traceability_index,
        link_renderer,
    ):
        document_meta: DocumentMeta = document.meta
        full_output_path = os.path.join(export_options.strictdoc_src_path,
                                        document_meta.get_html_doc_path())

        # If file exists we want to check its modification path in order to skip
        # its generation in case it has not changed since the last generation.
        if os.path.isfile(full_output_path):
            output_file_mtime = get_file_modification_time(full_output_path)
            sdoc_mtime = get_file_modification_time(
                document_meta.input_doc_full_path)

            if (sdoc_mtime < output_file_mtime and
                    export_options.strictdoc_last_update < output_file_mtime):
                with measure_performance("Skip: {}".format(document.name)):
                    return

        with measure_performance("Published: {}".format(document.name)):
            HTMLGenerator._export(
                export_options.export_mode,
                document,
                document_tree,
                traceability_index,
                link_renderer,
            )
        return None
Ejemplo n.º 2
0
    def processing(document_triple):
        file_tree, doc_file, file_tree_mount_folder = document_triple
        doc_full_path = doc_file.get_full_path()

        with measure_performance("Reading SDOC: {}".format(
                os.path.basename(doc_full_path))):
            reader = SDReader()
            document = reader.read_from_file(doc_full_path)
            assert isinstance(document, Document)

        document._tx_parser = None
        document._tx_attrs = None
        document._tx_metamodel = None
        document._tx_peg_rule = None
        document._tx_model_params = None
        return doc_file, document