Ejemplo n.º 1
0
    def __init__(self, name, count=1, doc_type='html'):
        """
		@param name: Tag name
		@type name: str
		@param count:  How many times this tag must be outputted
		@type count: int
		@param doc_type: Document type (xsl, html)
		@type doc_type: str
		"""
        name = name.lower()

        abbr = get_abbreviation(doc_type, name)

        if abbr and abbr.type == stparser.TYPE_REFERENCE:
            abbr = get_abbreviation(doc_type, abbr.value)

        self.name = abbr and abbr.value['name'] or name.replace('+', '')
        self.count = count
        self.children = []
        self.attributes = []
        self.multiply_elem = None
        self.__attr_hash = {}
        self._abbr = abbr
        self.__content = ''
        self.repeat_by_lines = False
        self._res = zen_settings.has_key(
            doc_type) and zen_settings[doc_type] or {}
        self.parent = None

        # add default attributes
        if self._abbr and 'attributes' in self._abbr.value:
            for a in self._abbr.value['attributes']:
                self.add_attribute(a['name'], a['value'])
Ejemplo n.º 2
0
	def __init__(self, name, count=1, doc_type='html'):
		"""
		@param name: Tag name
		@type name: str
		@param count:  How many times this tag must be outputted
		@type count: int
		@param doc_type: Document type (xsl, html)
		@type doc_type: str
		"""
		name = name.lower()
		
		abbr = get_abbreviation(doc_type, name)
		
		if abbr and abbr.type == stparser.TYPE_REFERENCE:
			abbr = get_abbreviation(doc_type, abbr.value)
		
		self.name = abbr and abbr.value['name'] or name.replace('+', '')
		self.count = count
		self.children = []
		self.attributes = []
		self.multiply_elem = None
		self.__attr_hash = {}
		self._abbr = abbr
		self.__content = ''
		self.repeat_by_lines = False
		self._res = zen_settings.has_key(doc_type) and zen_settings[doc_type] or {}
		self.parent = None
		
		# add default attributes
		if self._abbr and 'attributes' in self._abbr.value:
			for a in self._abbr.value['attributes']:
				self.add_attribute(a['name'], a['value'])
Ejemplo n.º 3
0
def get_settings_resource(res_type, abbr, res_name):
	"""
	Returns resurce value from data set with respect of inheritance
	@param res_type: Resource type (html, css, ...)
	@type res_type: str
	@param abbr: Abbreviation name
	@type abbr: str
	@param res_name: Resource name ('snippets' or 'abbreviation')
	@type res_name: str
	@return dict, None
	"""

	if zen_settings.has_key(res_type):
		resource = zen_settings[res_type];
		if (has_deep_key(resource, [res_name, abbr])):
			return resource[res_name][abbr]
		elif 'extends' in resource:
	#		find abbreviation in ancestors
			for v in resource['extends']:
				if has_deep_key(zen_settings, [v, res_name, abbr]):
					return zen_settings[v][res_name][abbr]
	return None;
Ejemplo n.º 4
0
def get_settings_resource(res_type, abbr, res_name):
    """
	Returns resurce value from data set with respect of inheritance
	@param res_type: Resource type (html, css, ...)
	@type res_type: str
	@param abbr: Abbreviation name
	@type abbr: str
	@param res_name: Resource name ('snippets' or 'abbreviation')
	@type res_name: str
	@return dict, None
	"""

    if zen_settings.has_key(res_type):
        resource = zen_settings[res_type]
        if (has_deep_key(resource, [res_name, abbr])):
            return resource[res_name][abbr]
        elif 'extends' in resource:
            #		find abbreviation in ancestors
            for v in resource['extends']:
                if has_deep_key(zen_settings, [v, res_name, abbr]):
                    return zen_settings[v][res_name][abbr]
    return None