#51749HTML5 fixes for css_styled_content header rendering
Description
Currently there are some issues with the lib.stdheader in HTML5 version:
1) ‘hgroup’ is depreciated for HTML5. Reason: Non-semantic, each Hx tag should cover a section of information, therefore the use of any double H-tag should be avoided.
2) The date format used doesn’t localize well.
English: June 4, 2013
German: Juni 4, 2013 (which is no valid german format)
better use ‘strftime = %x’, which localizes in any language
(yes, I know that it’s possible to override, but the default should be reasonable)
3) The code is bloated without reason. See example code, which saves 100 lines and some microseconds.
Best idea would be to separate HTML5 setup from the regular one. Tags are different, markup is different. Keeping everything in one setup leads to the current chaos.
# Content header:
# This is a html5-only version for Twitter Bootstrap
lib.stdheader >
lib.stdheader = COA
lib.stdheader {
# Determine <Hx> size
1 = LOAD_REGISTER
1.headerType.cObject = TEXT
1.headerType.cObject {
field = header_layout
ifEmpty = {$content.defaultHeaderType}
ifEmpty.override.data = register: defaultHeaderType
}
# This TEXT cObject renders the header content:
# Value is set to the header data, possibly wrapped in link-tags.
# optional subheader is appended to the header/link - if present
# alternate Version for subheader: noTrimWrap = |<br><span class="subheader">|</span>|
10 = TEXT
10 {
field = header
trim = 1
required = 1
htmlSpecialChars = 1
typolink.parameter.field = header_link
append = TEXT
append {
field = subheader
trim = 1
required = 1
htmlSpecialChars = 1
noTrimWrap = | <small>|</small>|
# noTrimWrap = |<br><span class="subheader">|</span>|
}
outerWrap.cObject = COA
outerWrap.cObject {
5 = TEXT
5.noTrimWrap = |<h{register:headerType}| |
5.insertData = 1
# Create class attributes for <Hx> tags
10 = COA
10 {
10 = TEXT
10 {
# Create alignment class for <Hx> tags
field = header_position
required = 1
noTrimWrap = |text-| |
}
# Create "csc-firstHeader" class for <Hx> tags
20 = TEXT
20 {
value = csc-firstHeader
if {
value = 1
equals.data = cObj:parentRecordNumber
}
}
stdWrap {
required = 1
wrap = class="|"
}
}
20 = TEXT
20.value = >|</h{register:headerType}>
20.insertData = 1
}
}
# HTML5 Date
40 = TEXT
40 {
field = date
fieldRequired = date
# June 4, 2013
# strftime = %B %e, %Y This doesn't localize well, the next one does better
strftime = %x
innerWrap.cObject = TEXT
innerWrap.cObject {
field = date
strftime = %Y-%m-%d
wrap = <time datetime="|">
append = |</time>
}
wrap = <p class="csc-header-date">|</p>
}
# Pops the used registers off the stack:
98 = RESTORE_REGISTER
# Post-processing:
stdWrap {
if {
equals.field = header_layout
value = 100
negate = 1
}
fieldRequired = header
dataWrap = <header class="csc-header csc-header-n{cObj:parentRecordNumber}">|</header>
prefixComment = 2 | Header:
editIcons = tt_content : header, [header_layout | header_position], [header_link|date]
editIcons.beforeLastTag = 1
editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.header
}
}Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.