margin-top: 20px;
padding: 20px 10px 0 10px;
}
+
+ .codeBox {
+ border: 1px solid {@$__wcf->getStyleHandler()->getStyle()->getVariable('wcfContentBorderInner')};
+ border-radius: 3px;
+ margin: 10px 0;
+ }
+ .codeBoxHeader {
+ border-bottom: 1px solid {@$__wcf->getStyleHandler()->getStyle()->getVariable('wcfContentBorderInner')};
+ font-size: larger;
+ padding: 5px 10px;
+ }
+ .codeBoxCode {
+ margin: 0;
+ max-height: 300px;
+ overflow: auto;
+ padding: 10px;
+ }
</style>
{literal}<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>{/literal}
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
*}{assign var='lineNumber' value=$lineNumber+1}{*
*}{/foreach}</code></pre>
</div>
- {if $lines > 10}
+ {if !$isAmp && $lines > 10}
<span class="toggleButton" data-title-collapse="{lang}wcf.bbcode.button.collapse{/lang}" data-title-expand="{lang}wcf.bbcode.button.showAll{/lang}">{lang}wcf.bbcode.button.showAll{/lang}</span>
{/if}
</div>
-{if !$__wcfCodeBBCodeJavaScript|isset}
+{if !$isAmp && !$__wcfCodeBBCodeJavaScript|isset}
{assign var='__wcfCodeBBCodeJavaScript' value=true}
<script data-relocate="true">
require(['Language', 'WoltLabSuite/Core/Bbcode/Collapsible', 'WoltLabSuite/Core/Bbcode/Code'], function (Language, BbcodeCollapsible, BbcodeCode) {
<?php
namespace wcf\system\html\output;
use wcf\system\bbcode\HtmlBBCodeParser;
+use wcf\system\html\output\node\AmpHtmlOutputNodeProcessor;
use wcf\util\DOMUtil;
/**
return $badElements;
}
+
+ /**
+ * @inheritDoc
+ */
+ protected function getHtmlOutputNodeProcessor() {
+ if ($this->htmlOutputNodeProcessor === null) {
+ $this->htmlOutputNodeProcessor = new AmpHtmlOutputNodeProcessor();
+ }
+
+ return $this->htmlOutputNodeProcessor;
+ }
+
}
--- /dev/null
+<?php
+namespace wcf\system\html\output\node;
+
+/**
+ * Wrapper class to signal the AMP format to meta codes.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2019 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\Html\Output\Node
+ * @since 5.2
+ */
+class AmpHtmlOutputNodeProcessor extends HtmlOutputNodeProcessor {
+}
'highlighter' => $element->getAttribute('data-highlighter'),
'line' => $element->hasAttribute('data-line') ? $element->getAttribute('data-line') : 1,
'skipInnerContent' => true,
- 'prefix' => $prefix
+ 'prefix' => $prefix,
+ 'isAmp' => ($htmlNodeProcessor instanceof AmpHtmlOutputNodeProcessor),
]);
$htmlNodeProcessor->renameTag($element, 'wcfNode-' . $nodeIdentifier);
'language' => $highlighter,
'filename' => $file,
'title' => $title,
- 'lines' => count($splitContent)
+ 'lines' => count($splitContent),
+ 'isAmp' => $data['isAmp'],
]);
return WCF::getTPL()->fetch('codeMetaCode');