Skip to content

DjangoTemplateParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/parsers/backend/django-template.parser.ts

Django Template Parser

Extracts entities and relationships from Django template files.

Implements: IParser

Methods

MethodSignatureReturns
initializeinitialize(config: { rootDir: string })Promise<void>
canParsecanParse(filePath: string)boolean
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>
parseFilesparseFiles(files: ParseFileInput[])Promise<ParseResult[]>
destroydestroy()Promise<void>

Properties

PropertyType
nameany
versionany
supportedPatternsany

Where it refuses work

  • DjangoTemplateParser stops the work with an early return when fs.existsSync(managePy).
  • DjangoTemplateParser stops the work with an early return when !this.projectHasDjango.
  • DjangoTemplateParser stops the work with an early return when !filePath.endsWith('.html').
  • DjangoTemplateParser stops the work with an early return when templatesIndex !== -1 && templatesIndex < parts.length - 1.
  • DjangoTemplateParser stops the work with an early return when match.

When something fails

  • DjangoTemplateParser handles failure in 1 place: it turns it into a return value in all 1.

Was this page helpful?

Download as PDF