Closed Bug 973678 Opened 10 years ago Closed 4 years ago

Wiki preview can't process KumaScript macros that use environment variables

Categories

(developer.mozilla.org Graveyard :: KumaScript, defect, P3)

All
Other
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: rillian, Unassigned)

References

Details

(Whiteboard: [specification][type:bug][points=3])

What did you do?
================
1. Edited https://developer.mozilla.org/en-US/docs/Web/API/HTMLTrackElement
2. Pressed preview to check macro changes


What happened?
==============
The Preview version reports and error and doesn't expand the macros:



There are scripting messages on this page:

    TemplateExecutionError at document offset 3 in macro DOMRef ([]) ( edit ):

    Problem executing template DOMRef:
        1 | <p>{{DOMRef}}<br>The&nbsp;<strong><code style="font-size: 14px;">HTMLTrackElement</code></strong>&nbsp;interface provides access to the properties of {{HTMLElement("track")}} elements, as well as methods to manipulate them.<br></p><h2 id="Properties" name="Properties">Properties</h2><p><em>Inherits properties from its parent, {{domxref("HTMLElement")}}.</em></p><table class="standard-table cke_show_border"><tbody><tr><th scope="col">Name</th><th scope="col">Type</th><th scope="col">Description</th></tr><tr><td>kind</td><td>{{domxref("DOMString")}}</td><td>Reflects the {{htmlattrxref("kind", "track")}}&nbsp;HTML attribute,&nbsp;indicating&nbsp;how the text track is meant to be used. Possible values are: subtitles, captions, descriptions, chapters, metadata. See&nbsp;{{htmlattrxref("kind", "track")}}&nbsp;attribute documentation for details.</td></tr><tr><td>src</td><td>{{domxref("DOMString")}}</td><td>Reflects the&nbsp;{{htmlattrxref("src", "track")}}&nbsp;HTML attribute, indicating the address of the text track data.</td></tr><tr><td>srclang</td><td>{{domxref("DOMString")}}</td><td>Reflects the&nbsp;{{htmlattrxref("srclang", "track")}}&nbsp;HTML attribute,&nbsp;indicating the language of the text track data.</td></tr><tr><td>label</td><td>{{domxref("DOMString")}}</td><td>Reflects the&nbsp;{{htmlattrxref("label", "track")}}&nbsp;HTML attribute,&nbsp;indicating&nbsp;a user-readable title for the track.</td></tr><tr><td>default</td><td>{{domxref("Boolean")}}</td><td>Reflects the&nbsp;{{htmlattrxref("default", "track")}}&nbsp;HTML attribute,&nbsp;indicating&nbsp;that the track is to be enabled if the user's preferences do not indicate that another track would be more appropriate.</td></tr><tr><td>readyState {{ReadOnlyInline}}</td><td><code>unsigned short</code></td><td><p style="margin: 0px 0px 1.286em; padding: 0px; line-height: 1.5em;">The readiness state of the track.</p><table class="standard-table cke_show_border" style="border-spacing: 0px; margin: 0px 0px 1.286em;"><tbody><tr><td class="header">Constant</td><td class="header">Value</td><td class="header">Description</td></tr><tr><td><code style="font-size: 14px;">NONE</code></td><td>0</td><td>Indicates that the text track's cues have not been obtained.</td></tr><tr><td><code style="font-size: 14px;">LOADING</code></td><td>1</td><td>Indicates that the text track is loading and there have been no fatal errors encountered so far. Further cues might still be added to the track by the parser.</td></tr><tr><td><code style="font-size: 14px;">LOADED</code></td><td>2</td><td>Indicates that the text track has been loaded with no fatal errors.</td></tr><tr><td><code style="font-size: 14px;">ERROR</code></td><td>3</td><td>Indicates that the text track was enabled, but when the user agent attempted to obtain it, this failed in some way. Some or all of the cues are likely missing and will not be obtained.</td></tr></tbody></table></td></tr><tr><td>track {{ReadOnlyInline}}</td><td>{{Domxref("TextTrack")}}</td><td>The track element's text track data.</td></tr></tbody></table><h2 id="Methods">Methods</h2><p><em>No specific method; inherits methods from its parent, {{domxref("HTMLElement")}}.</em></p><h2 id="Specifications">Specifications</h2><table class="standard-table cke_show_border"><tbody><tr><th scope="col">Specification</th><th scope="col">Status</th><th scope="col">Comment</th></tr><tr><td>{{SpecName('HTML WHATWG', "the-video-element.html#the-track-element", "HTMLTrackElement")}}</td><td>{{Spec2('HTML WHATWG')}}</td><td>No change from {{SpecName("HTML5 W3C")}}.</td></tr><tr><td>{{SpecName('HTML5 W3C', "embedded-content-0.html#the-track-element", "HTMLTrackElement")}}</td><td>{{Spec2('HTML5 W3C')}}</td><td>Initial definition.</td></tr></tbody></table><h2 id="Browser_compatibility">Browser compatibility</h2><p>{{CompatibilityTable}}</p><div id="compat-desktop"><table class="compat-table cke_show_border"><tbody><tr><th>Feature</th><th>Chrome</th><th>Firefox (Gecko)</th><th>Internet Explorer</th><th>Opera</th><th>Safari (WebKit)</th></tr><tr><td>Basic support</td><td>{{CompatUnknown}}</td><td>{{CompatGeckoDesktop("28.0")}}</td><td>{{CompatUnknown}}</td><td>{{CompatUnknown}}</td><td>{{CompatUnknown}}</td></tr></tbody></table></div><div id="compat-mobile"><table class="compat-table cke_show_border"><tbody><tr><th>Feature</th><th>Android</th><th>Firefox Mobile (Gecko)</th><th>IE Phone</th><th>Opera Mobile</th><th>Safari Mobile</th></tr><tr><td>Basic support</td><td>{{CompatUnknown}}</td><td>{{CompatGeckoMobile("28.0")}}</td><td>{{CompatUnknown}}</td><td>{{CompatUnknown}}</td><td>{{CompatUnknown}}</td></tr></tbody></table></div><h2 id="See_also">See also</h2><ul><li>The HTML element implementing this interface: {{ HTMLElement("track") }}.</li></ul><p><br></p>
    -----------^

    TypeError: ejs:50
        48| 
        49| %><%- result %></span>
     >> 50| <%
        51| function containsTag(tagList, tag) {
        52|     if (!tagList || typeof tagList == 'undefined') return 0;
        53|     if (!tag || typeof tag == 'undefined') return 0;

    Cannot call method 'split' of undefined
        at eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1)
        at /data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:201:15
        at /data/www/developer.mozilla.org/kuma/kumascript/lib/kumascript/templates.js:75:30

If I go ahead and commit the change the macro seems to be processed. At least, there's a reference to the DOM API index page in the left-hand nav bar and the other macros are expanded properly. There is some broken <p> insertion causing extra whitespace before the first content.

What should have happened?
==========================
I would like the macro to expand or not the same as in the final render.

Is there anything else we should know?
======================================
I was able to fix the spacing issue by wrapping {{domref}} in a <div> in the source view. Still get the same error.
Kumascript sometimes erroneously returns error. Most of the time regenerating the page a few minutes later fix the problem.
Hmm. This seems quite repeatable. I can still go to https://developer.mozilla.org/en-US/docs/Web/API/HTMLTrackElement$edit click 'preview' and get the error, including on a different machine.
Yes, you currently cannot see macros rendered out in preview mode.
In preview mode, Kuma does not provide these env variables to KumaScript:
https://developer.mozilla.org/en-US/docs/MDN/Contribute/Tools/KumaScript#Environment_variables
Summary: Preview can't process {{domref}} macro → Preview can't process macros that use environment variables
See Also: → 1325352
Summary: Preview can't process macros that use environment variables → Wiki preview can't process KumaScript macros that use environment variables
See Also: → 1398052
See Also: → 1329357
See Also: → 1439961
Component: General → KumaScript
No longer blocks: 1329357
Priority: -- → P3
Blocks: 1329357
Whiteboard: [specification][type:bug] → [specification][type:bug][points=3]
MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.