def as_list(cls, config): entities = list() for ent in cls.objects.exclude(published_at__isnull=True): meta = { "title": ent.title, "layout": "post", "date": ent.published_at } entity = DrupanEntity(config) entity.meta = meta entity.raw = ent.content.strip() entities.append(entity) return entities
def setup_content(engine): for stored in Entity.objects.filter(draft=False): entity = DrupanEntity(engine.config) meta = stored.meta_fields meta["layout"] = stored.layout meta["date"] = stored.created meta["title"] = stored.name entity.meta = meta entity.raw = stored.content engine.site.entities.append(entity)
def parse_file(self, raw): """ create an entity from a read file Arguments: raw: input """ (header, separator, content) = raw.partition("---") meta = yaml.load(header) entity = Entity(self.config) entity.meta = meta entity.raw = content.strip() self.site.entities.append(entity)
def parse_file(self, raw): """ create an entity from a read file Arguments: raw: input """ (header, seperator, content) = raw.partition("---") meta = yaml.load(header) entity = Entity(self.config) entity.meta = meta entity.raw = content.strip() self.site.entities.append(entity)