/* <INCLUDE_TYPOSCRIPT:source="file:fileadmin/layout/flra/rteTSConfig.ts">
 * $Id$
 * coding: utf-8 (äöü), tab:4
 *
 */

lib.mb.hi = hi

	## do set in CONSTANTS:
# allowTags = {$styles.content.links.allowTags}

	## looks like this in css_styled_content-static-constants.ts:
DUMMY.styles.content.links {
	keep = path
	# cat=content/links; type=small; label= Target for external links
	extTarget = _blank
	target = {$PAGE_TARGET}
	allowTags = b,i,u,a,img,br,div,center,pre,font,hr,sub,sup,p,strong,em,li,ul,ol,blockquote,strike,span,h1,h2,h3,h4,h5,h6
}
#	[compatVersion = 4.2.0]
#	DUMMY.styles.content.links.allowTags := addToList(address)
#	[global]

	## aus css_styled_content-static-setup.ts:
# *********************************************************************
# "lib." objects are preserved from unsetting after template parsing
# *********************************************************************
# Creates persistent ParseFunc setup for non-HTML content. This is recommended to use (as a reference!)
DUMMY.lib.parseFunc {
	makelinks = 1
	makelinks.http.keep = {$styles.content.links.keep}
	makelinks.http.extTarget = {$styles.content.links.extTarget}
	makelinks.mailto.keep = path
	tags {
		link = TEXT
		link {
			current = 1
			typolink.parameter.data = parameters : allParams
			typolink.extTarget = {$styles.content.links.extTarget}
			typolink.target = {$styles.content.links.target}
			parseFunc.constants =1
		}
	}
	allowTags = {$styles.content.links.allowTags}
	denyTags = *
	sword = <span class="csc-sword">|</span>
	constants = 1

	nonTypoTagStdWrap.HTMLparser = 1
	nonTypoTagStdWrap.HTMLparser {
		keepNonMatchedTags = 1
		htmlSpecialChars = 2
	}
}

# good old parsefunc in "styles.content.parseFunc" is created for backwards compatibility. Don't use it, just ignore.
DUMMY.styles.content.parseFunc < lib.parseFunc

# Creates persistent ParseFunc setup for RTE content (which is mainly HTML) based on the "ts_css" transformation.
DUMMY.lib.parseFunc_RTE < lib.parseFunc
DUMMY.lib.parseFunc_RTE {
	//  makelinks >
	# Processing <table> and <blockquote> blocks separately
	externalBlocks = table, blockquote, ol,ul
	externalBlocks {
		# The blockquote content is passed into parseFunc again...
		blockquote.stripNL=1
		blockquote.callRecursive=1
		blockquote.callRecursive.tagStdWrap.HTMLparser = 1
		blockquote.callRecursive.tagStdWrap.HTMLparser.tags.blockquote.overrideAttribs = style="margin-bottom:0;margin-top:0;"

		ol.stripNL=1
		ol.stdWrap.parseFunc = < lib.parseFunc

		ul.stripNL=1
		ul.stdWrap.parseFunc = < lib.parseFunc

		table.stripNL=1
		table.stdWrap.HTMLparser = 1
		table.stdWrap.HTMLparser.tags.table.fixAttrib.class {
			default = contenttable
			always = 1
			list = contenttable
		}
		table.stdWrap.HTMLparser.keepNonMatchedTags = 1
		table.HTMLtableCells=1
		table.HTMLtableCells {
			default.callRecursive=1
			addChr10BetweenParagraphs=1
		}
	}
	nonTypoTagStdWrap.encapsLines {
		encapsTagList = div,p,pre,h1,h2,h3,h4,h5,h6
		remapTag.DIV = P
		nonWrappedTag = P
		innerStdWrap_all.ifBlank = &nbsp;
		addAttributes.P.class = bodytext
		addAttributes.P.class.setOnly=blank
	}
	nonTypoTagStdWrap.HTMLparser = 1
	nonTypoTagStdWrap.HTMLparser {
		keepNonMatchedTags = 1
		htmlSpecialChars = 2
	}
}

######################################
	## Ergo:

# [compatVersion = 4.2.0]
# styles.content.links.allowTags := addToList(dl,dt,dd)
# [global]

	## DB -> FE, For Example:
## lib.parseFunc.allowTags = a,abbr,acronym,address,b,bdo,blockquote,br,cite,code,del,div,em,h1,h2,h3,h4,h5,h6,hr,i,img,li,ol,p,span,strike,strong,sub,sup,u,ul
## lib.parseFunc_RTE.allowTags = a,abbr,acronym,address,b,bdo,blockquote,br,cite,code,del,div,em,h1,h2,h3,h4,h5,h6,hr,i,img,li,ol,p,span,strike,strong,sub,sup,u,ul


	## Let TABLE have classes. We assume "css_styled_content" is being used.
	## The class "contenttable" will then be added only if no class is specified for the table.
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class.list >

	## The table class will not be changed.
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class >

	## remove bodytext
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.addAttributes.P.class >

	## DB -> FE
## lib.parseFunc.allowTags = a,abbr,acronym,address,b,bdo,blockquote,br,cite,code,del,div,em,h1,h2,h3,h4,h5,h6,hr,i,img,li,ol,p,span,strike,strong,sub,sup,u,ul
## lib.parseFunc_RTE.allowTags = a,abbr,acronym,address,b,bdo,blockquote,br,cite,code,del,div,em,h1,h2,h3,h4,h5,h6,hr,i,img,li,ol,p,span,strike,strong,sub,sup,u,ul

	## avoid unwanted p-elements in th/td on the way to FE
	## http://www.sk-typo3.de/Unterdruecken-der-p-Tags-in-Tabelle.138.0.html NEE
	##http://dev.datenwolken.de/index.php?id=195 JA
lib.parseFunc_RTE.externalBlocks.table.HTMLtableCells.default >
lib.parseFunc_RTE.externalBlocks.table.HTMLtableCells.default.stdWrap.parseFunc =< lib.parseFunc

	## Zelleninhalte wrappen ... tuts!
## lib.parseFunc_RTE.externalBlocks.table.HTMLtableCells.default.stdWrap.wrap = | 


## ## wirkt nicht - warum? sowieso nur als test, da immer alle p entfernt werden
## lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.removeTags = p


## ## Steffens Lösung
## # nochmaliges parsen von tabellenzellen auschalten, damit inhalte nicht wieder in p gepackt werden
## lib.parseFunc_RTE.externalBlocks.table.HTMLtableCells.default.callRecursive = 0
## 
## # nachträgliches Ermöglichen von Links in Tabellenzellen
## lib.parseFunc_RTE.externalBlocks.table.HTMLtableCells.default.stdWrap.parseFunc {
## 	makelinks = 1
## 	makelinks.http.keep = scheme,path,query
## 	makelinks.mailto.keep = path
## 	tags {
## 		link = TEXT
## 		link {
## 			current = 1
## 			typolink.parameter.data = parameters : allParams
## 		}
## 	}
## }