plugin.tx_restdoc_pi1 {
	# Needed for pibase-based plugin using namespaces
	userFunc = Causal\Restdoc\Controller\Pi1\Pi1Controller->main

	## baseWrap supports stdWrap properties, if set will replace the default wrap
	## around the plugin: <div class="tx-restdoc-pi1"> ... </div>
	#baseWrap {
	#	wrap = <div> | </div>
	#}

	path = {$plugin.tx_restdoc.path}
	defaultFile = {$plugin.tx_restdoc.defaultFile}
	mode = {$plugin.tx_restdoc.mode}
	rootPage = {$plugin.tx_restdoc.rootPage}
	showPermanentLink = {$plugin.tx_restdoc.showPermanentLink}
	pathSeparator = {$plugin.tx_restdoc.pathSeparator}
	fallbackPathSeparators = {$plugin.tx_restdoc.fallbackPathSeparators}
	documentStructureMaxDocuments = {$plugin.tx_restdoc.documentStructureMaxDocuments}
	advertiseSphinx = {$plugin.tx_restdoc.advertiseSphinx}
	addHeadPagination = {$plugin.tx_restdoc.addHeadPagination}
	publishSources = {$plugin.tx_restdoc.publishSources}

	setup.BODY {
		image {
			renderObj = IMAGE
			renderObj {
				file.import.field = src
				file.maxW < tt_content.image.20.maxW
				altText.field = alt
				titleText.field = alt
				params.field = style
				params.wrap = style="|"
				params.required = 1

				layoutKey = sphinx
				layout {
					sphinx {
						element = <img src="###SRC###" ###PARAMS######ALTPARAMS######BORDER######SELFCLOSINGTAGSLASH###>
					}
				}

				# imageLinkWrap is deactivated by default because it prevents
				# external links to be put onto images in reStructuredText
				# see https://forge.typo3.org/issues/75292
				imageLinkWrap = 0
				imageLinkWrap {
					enable.cObject = TEXT
					enable.cObject {
						value = 0
						override = 1
						override.if {
							value < tt_content.image.20.maxW
							equals.data = TSFE:lastImageInfo|0
						}
					}
					bodyTag = <body bgColor="#ffffff" style="margin:0;">
					wrap = <a href="javascript:close();"> | </a>
					width = 800m
					height = 600
					JSwindow = 1
					JSwindow {
						newWindow = 1
						expand = 0,0
					}
				}
			}
		}
	}

	setup.TOC {
		renderObj = COA
		renderObj {
			10 = HMENU
			10 {
				special = userfunction
				special.userFunc = Causal\Restdoc\Controller\Pi1\Pi1Controller->makeMenuArray
				special.userFunc.type = menu

				1 = TMENU
				1 {
					wrap = <ul> | </ul>
					noBlur = 1
					NO.wrapItemAndSub = <li> | </li>

					CUR = 1
					CUR.wrapItemAndSub = <li class="current"> | </li>
				}
				2 < .1

				stdWrap.preCObject = TEXT
				stdWrap.preCObject.data = LLL:EXT:restdoc/Resources/Private/Language/locallang.xlf:header_toc
				stdWrap.preCObject.wrap = <h2> | </h2>
			}

			20 < .10
			20.stdWrap.preCObject.data = LLL:EXT:restdoc/Resources/Private/Language/locallang.xlf:header_previous_topic
			20.stdWrap.preCObject.wrap = <h3> | </h3>
			20.stdWrap.required = 1
			20.special.userFunc.type = previous

			30 < .20
			30.stdWrap.preCObject.data = LLL:EXT:restdoc/Resources/Private/Language/locallang.xlf:header_next_topic
			30.special.userFunc.type = next
		}
	}

	setup.MASTER_TOC {
		renderObj = HMENU
		renderObj {
			special = userfunction
			special.userFunc = Causal\Restdoc\Controller\Pi1\Pi1Controller->makeMenuArray
			special.userFunc.type = master_menu

			1 = TMENU
			1 {
				wrap = <ul> | </ul>
				noBlur = 1
				NO.wrapItemAndSub = <li> | </li>

				CUR = 1
				CUR.wrapItemAndSub = <li class="current"> | </li>
			}
			2 < .1
			3 < .2
		}
	}

	setup.RECENT {
		renderObj = HMENU
		renderObj {
			special = userfunction
			special {
				userFunc = Causal\Restdoc\Controller\Pi1\Pi1Controller->makeMenuArray
				userFunc.type = updated
				# chapters must have been updated within the last 60 days (3600*24*60)
				maxAge = 3600*24*60
				limit = 10
				# comma-separated list of chapters to exclude
				excludeChapters = genindex/
			}
			wrap = <ul> | </ul>

			1 = TMENU
			1 {
				noBlur = 1
				NO {
					wrapItemAndSub = <li> | </li>

					# Prepend the date
					before.field = SYS_LASTCHANGED
					before.strftime = %d.%m.%Y
					before.noTrimWrap = |<span class="tx-restdoc-date">|:</span> |
				}
			}
		}
	}

	setup.QUICK_NAVIGATION {
		renderObj = COA
		renderObj {
			10 = TEXT
			10 {
				data = LLL:EXT:restdoc/Resources/Private/Language/locallang.xlf:quicknavigation_home
				typolink.parameter.field = home_uri_absolute
			}
			11 = TEXT
			11.value = |
			11.noTrimWrap = | | |

			20 = TEXT
			20 {
				data = LLL:EXT:restdoc/Resources/Private/Language/locallang.xlf:quicknavigation_previous_topic
				typolink.parameter.field = previous_uri_absolute
				typolink.title.field = previous_title
				if.isTrue.field = has_previous
			}
			21 < .11
			21.if {
				isTrue.field = has_previous
				value.field = has_next
				equals = 1
			}

			30 = TEXT
			30 {
				data = LLL:EXT:restdoc/Resources/Private/Language/locallang.xlf:quicknavigation_next_topic
				typolink.parameter.field = next_uri_absolute
				typolink.title.field = next_title
				if.isTrue.field = has_next
			}
			31 < .11
			31.if.isTrue.field = has_index

			40 = TEXT
			40 {
				data = LLL:EXT:restdoc/Resources/Private/Language/locallang.xlf:quicknavigation_index
				typolink.parameter.field = index_uri_absolute
				typolink.title.data < .data
				if.isTrue.field = has_index
			}

		}
	}

	setup.BREADCRUMB {
		renderObj = HMENU
		renderObj {
			special = userfunction
			special.userFunc = Causal\Restdoc\Controller\Pi1\Pi1Controller->makeMenuArray
			special.userFunc.type = breadcrumb

			1 = TMENU
			1 {
				noBlur = 1
				NO.linkWrap = | &raquo; |*||*| |
				NO.stdWrap.noTrimWrap = | | |

				CUR < .NO
				CUR = 1
				CUR.doNotLinkIt = 1
			}
		}
	}

}

plugin.tx_restdoc_pi1._CSS_DEFAULT_STYLE (
	ul.tx-restdoc-references {
		list-style       : none;
		margin           : 0;
		font-weight      : bold;
	}

	ul.tx-restdoc-references dl {
		font-weight      : normal;
		margin-left      : 2em;
	}

	ul.tx-restdoc-references dl dt {
		float            : left;
		width            : 20em;
	}
)