YUI compressor in AEM removes % signs from colour values - aem

When using zero values, YUICompressor assumes that the units of measure are not required, so the YUICompressor will strip them.
But it causes issues in our compressed CSS file as follow:
YUICompressor compressed this:
hsla(0, 0%, 100%, 0)
to this:
hsla(0, 0, 100%, 0)
But by removing the % from the second value for hsla (saturation), YUICompressor generates an invalid css statement.
Is it possible to configure YUICompressor settings to correct this behaviour?

You can configure YUI compressor, although I am not sure if you can explicitly fix your issue.
The compressor can be configured in the OSGi configuration called Adobe Granite HTML Library Manager that you can find in /system/console/configMgr. This configuration should contain a JS Processor Default Configs configuration, that you can change.
But please be aware that this configuration is used for the whole AEM installation. If you want to change settings on the client library level, you can do so in the .content.xml where you define the cq:ClientLibraryFolder of the client library you want to change the settings.
More information on the YUI compressor can be found here:
https://yui.github.io/yuicompressor/
The --disable-optimizations might be what you are looking for.

Related

Have VSCode ignore specific reference links in markdown validation

In Visual Studio Code with Markdown validation enabled (markdown.validate.enabled: true), I can ignore links to specific files that may not exist in the current context via the markdown.validate.ignoredLinks setting. However, that setting does not seem to apply to reference links (e.g. [link]: some-reference), nor can I find a corresponding setting specific to reference links.
Why do I want this? My specific use-case involves an extension the "standard" (CommonMark) markdown format to auto-generate a table-of-contents using the following syntax (and no, I don't expect VSCode to generate a preview of that TOC):
[[_TOC_]]
<!-- or -->
[TOC]
VScode happily generates a warning for such links, namely:
No link definition found: 'TOC' (link.no-such-reference)
Somewhat obviously, I can make the warning disappear I define a (bogus) TOC reference, such as:
[toc]: bogus
I can also disable validation of all reference links ("markdown.validate.referenceLinks.enabled": false), but I don't want to do that. I want to ignore the error for a specific reference, much like one can ignore a GLOB pattern for file links (markdown.validate.ignoredLinks).
Does anyone know of a such a setting before I submit a bug/missing-feature report?

Can exams2moodle export additional metainfo such as idnumber and tags?

When I export the xml file of a multiple choice question, it contains the following lines:
<idnumber>arbitrary_id_set_by_user</idnumber>
<answernumbering>ABCD</answernumbering>
<tag></tag>
Is there a way to add idnumber, answernumbering and tag to the metainformation section of the question so that r-exams can export to moodle XML as <idnumber>idnumber</idnumber>,<answernumbering>ABCD</answernumbering>, <tag>tag1</tag>, and <tag>tag2</tag> etc?
The <answernumbering> tag can be set in exams2moodle() via the answernumbering= argument, see ?exams2moodle. The reason for this is that this is set in the same way for all exercises in a quiz. This is more consistent than setting it individually and potentially inconsistently in the meta-information of the different exercises.
The <idnumber> tag appears to be used by Moodle only for internal purposes. It is also not mentioned in the official Moodle XML documentation at https://docs.moodle.org/311/en/Moodle_XML_format. Hence we did not implement it in exams2moodle().
The <tag> is currently not supported in exams2moodle() because we felt that it would be more important to have tags in the Rmd (or Rnw) exercise itself and not the Moodle version of the exercise. For structuring the content on the Moodle side the exsection meta-information can be used, see boxhist for a worked example.
Finally, you can add arbitrary metainformation by using the exextra tag. This is used, for example, in the essayreg exercise template. However, there is no general way of using this extra metainformation to insert additional XML code in the exams2moodle() output. To do that, the source code underlying exams2moodle() would have to be adapted correspondingly.

How to activate changes changed in constants

Sorry, I'm not familiar with typo3...
I have a typo3 6.2.14 installation (cannot be updated due to needed extensions) where the constants for click-enlarged images had to be adjusted.
I've cleared the cache, but nothing changed. What do I need to do?
plugin.tx_kjimagelightbox2.lightBoxMaxW = 1600 //(was 800)
plugin.tx_kjimagelightbox2.lightBoxMaxH = 1200 //(was 600)
Nothing changed. Thanks
Wow,
that's some very old TYPO3 with loads of security issues and outdatet PHP as well! Consider forking the extensions and make them work in at least 8.7.
Back to your question.
Where did you set this? Do you use files or do you just edit in the backend? You might need to gather some more information about the order your extensions are beeing loaded.
You might set your values too early and the extensions' defaults overwrite your "changes" (which have actually been declarations)
Maybae you could provide some more information of your setup.
the problem is:
the maximum sizes for images can be influenced in multiple places with multiple values.
Even if you have set the correct value, this value may be overwritten later with the smaller values.
1st:
are your original images at least big enough? normaly there is no enlargement of images.
2nd:
inspect the values in the TSOB. Are your values active in the setup?
your changes in constants may be overwritten in the setup easily and only setup is relevant for rendering.
3rd:
there are global maximum values about image rescaling in content elements. maybe these also influence your image rendering in that plugin

Mezzanine/TinyMCE filtering script type

I'm building a website using brython and I came by a problem that has nothign to do with it.
My problem is with Mezzanine or TinyMCE editor (I'm not sure which). To make brython work I need the script tag to be "text/python". But the editor filters it automatically to "text/javascript".
I disabled the filtering already, both in the admin panel and in the actual source code, I tried adding "text/python" to the RICHTEXT_ALLOWED defaults in the mezzanine configuration too.
Just to be clear, security is not an issue, this particular feature won't go online in the final version of the website.
Although the HTML specification does allow one to put any value other than "text/javascript" in script's type attribute, few projects do that, and Brython is one of those few. It is likely the "text/javascript" value is simply hardcoded in the editor and it won't allow you to change that.
(There is probably a big chance of having an issue closed as "won't fix/not a bug" or equivalent if you try to report this to the editor's issue tracker).
I think the workaround in this case is to write some javascript to change the text on the attribute on the relevant script tags to "text/python" prior to calling Brython. i.e., instead of triggering Brython on your page with
<body onload="brython()" >
Do something along
<body onload="function (){var x = document.getElementsByName("python"); for(var i=0; i < x.length; x++){x.type="text/python"};brython()}()" >
(and of course, add the attribute name='python' to all your python script tags)

How can you debug a DITA transformation?

I know XSLT in general can be debugged, but how exactly would one go about debugging a DITA transformation, considering its modular XSLT structure and the fact that stylesheets are pointed to by the catalog.xml file?
I want to be able to step through the code during runtime, and be able to set break points, etc.
If you are using the Oxygen editor, you can debug Toolkit transforms using the technique described here (from the Oxygen 14.2 documentation):
Debugging PDF Transformations
To debug a DITA PDF transformation scenario using the XSLT Debugger follow these steps:
Go to Options > Preferences > XML > XML Catalog, click Add and select the file located at [Oxygen Install Directory]\ frameworks\dita\DITA-OT\plugins\org.dita.pdf2\cfg\catalog.xml;
Open the map in the DITA Maps Manager and create a DITA Map PDF transformation scenario;
Edit the scenario, go to the Parameters tab and change the value of the clean.temp parameter to no;
Run the transformation scenario;
Open in Oxygen XML the stage1.xml file located in the temporary directory and format and indent it;
Create a transformation scenario for this XML file by associating the topic2fo_shell.xsl stylesheet located at OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/plugins/org.dita.pdf2/xsl/fo/topic2fo_shell_fop.xsl;
In the transformation scenario edit the Parameters list and set the parameter locale with the value en_GB and the parameter customizationDir.url to point either to your customization directory or to the default DITA OT customization directory. It's value should have an URL syntax like:file://c:/path/to/OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/plugins/org.dita.pdf2/cfg.
Debug the transformation scenario.
I found this topic by searching for "debug toolkit" in the Oxygen online help.
These instructions are specifically for PDF, but you should be able to adapt these instructions to HTML-based transforms as well.
There is always the good old trick of adding print statements around in the code, which is xslt translates to <xsl:message>. Here is a snippet from my frontmatter transformation:
<!--
<xsl:message>createFrontMatter_1.0</xsl:message>
<xsl:message>artworkPrefix=<xsl:copy-of select="$artworkPrefix"/></xsl:message>
<xsl:message>customizationDir.url=<xsl:value-of select="$customizationDir.url"/></xsl:message>
<xsl:message>imageLogoPath=<xsl:value-of select="$imageLogoPath"/></xsl:message>
<xsl:message>imageNotePath=<xsl:value-of select="$imageNotePath"/></xsl:message>
<xsl:message>imageWatermarkPath=<xsl:value-of select="$imageWatermarkPath"/></xsl:message>
<xsl:message>page-width=<xsl:value-of select="$page-width"/></xsl:message>
<xsl:message>page-height=<xsl:value-of select="$page-height"/></xsl:message>
-->
If I uncomment this, I get a nice debugging block of text in the output log, showing the various values for the settings I use.