ALDashboard.validate_docx
CallAndDebugUndefined Objects
class CallAndDebugUndefined(DebugUndefined)
Handles Jinja2 undefined errors by printing the name of the undefined variable. Extended to handle callable methods.
__getitem__
type: ignore
get_jinja_template_validation
def get_jinja_template_validation(source: str) -> Dict[str, Any]
Parse Jinja source and return blocking errors and non-blocking warnings.
The validation reuses the docx validator's custom environment so AssemblyLine's common filters behave the same here as they do during DOCX validation. Unknown filters/tests are returned as warnings so callers can warn without blocking a save.
get_jinja_errors
def get_jinja_errors(the_file: str) -> Optional[str]
Just try rendering the DOCX file as a Jinja2 template and catch any errors. Returns a string with the errors, if any.
analyze_docx_template_markup
def analyze_docx_template_markup(
document: Union[docx.document.Document, str]) -> List[Dict[str, Any]]
Warn about likely-accidental docxtpl paragraph-tag usage patterns.
validate_docx_ooxml_schema
def validate_docx_ooxml_schema(the_file: str) -> Dict[str, Any]
Run strict XML checks and, when configured, OOXML schema validation.
detect_docx_automation_features
def detect_docx_automation_features(the_file: str) -> Dict[str, Any]
Detect non-plain-text DOCX constructs that often come from Word-centric automation systems.
strip_docx_problem_controls
def strip_docx_problem_controls(input_file: str,
output_file: str) -> Dict[str, Any]
Create a cleaned DOCX with risky SDTs and non-whitelisted simple fields removed.
Keeps page-number docpart SDTs and simple fields for page numbers/cross-references.