Generate a new html valid id from a String.

Property definitions

markdown $ Decorator :: strip_id
	# Generate a new html valid id from a `String`.
	fun strip_id(txt: String): String is abstract
lib/markdown/markdown.nit:708,2--709,46

markdown $ MdDecorator :: strip_id
	redef fun strip_id(txt) do
		# strip id
		var b = new FlatBuffer
		for c in txt do
			if c == ' ' then
				b.add '_'
			else
				if not c.is_letter and
				   not c.is_digit and
				   not allowed_id_chars.has(c) then continue
				b.add c
			end
		end
		var res = b.to_s
		var key = res
		# check for multiple id definitions
		if headlines.has_key(key) then
			var i = 1
			key = "{res}_{i}"
			while headlines.has_key(key) do
				i += 1
				key = "{res}_{i}"
			end
		end
		return key
	end
lib/markdown/decorators.nit:159,2--184,4

markdown $ HTMLDecorator :: strip_id
	redef fun strip_id(txt) do
		# strip id
		var b = new FlatBuffer
		for c in txt do
			if c == ' ' then
				b.add '_'
			else
				if not c.is_letter and
				   not c.is_digit and
				   not allowed_id_chars.has(c) then continue
				b.add c
			end
		end
		var res = b.to_s
		var key = res
		# check for multiple id definitions
		if headlines.has_key(key) then
			var i = 1
			key = "{res}_{i}"
			while headlines.has_key(key) do
				i += 1
				key = "{res}_{i}"
			end
		end
		return key
	end
lib/markdown/markdown.nit:891,2--916,4