<div dir="ltr">Leonard,<br><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><blockquote type="cite"><div dir="ltr">thanks Leonard, this looks great. I put the test scenes on
        github pages for easy viewing here:<br>
        <div>
          <div><br>
            <a href="http://andreasplesch.github.io/x3dv4/" target="_blank">http://andreasplesch.github.<wbr>io/x3dv4/</a><br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Thanks.<br>
    <br>
    Is there an automatic process to update these if I update (or add) a
    test file?<br>
    <br></div></blockquote><div><br></div><div>You could create a PR after an update. This lets me simply update my fork and the served pages.</div><div>It may be best if you could create your own github pages site. I left an issue in this regard. It is quite straightforward. Take a look at my fork. The tests could live in the gh-pages branch only to avoid a need for duplication. (If you want to keep all in the master branch, github now lets use a doc/ folder in the master branch as the ghpages source which is served).</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><blockquote type="cite">
      <div dir="ltr">
        <div>
          
          <div>Concerning the Macro node, what do you think about having
            a way to define defaults for the %parameters% in the Macro
            template for the case when not all or no parameters are
            provided with the Macro node ?<br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Providing defaults is a good idea. I like it.<br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div><br>
          </div>
          <div>A possible syntax would be perhaps to just add the
            default after an equal sign to where the parameter is used:
            %myparam=10% ?<br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Right now I am using JavaScript's RegExp parser on '\%'+name+'\%'. 
    I can see problems with backslashes or other RegEx control
    structures in name. Perhaps name should be limited to A-Za-z0-9\-_  </div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
    The loop is over the list of supplied name/value pairs where the
    name is the hash of the value in the array. Once all of the array
    values have been processed, another pass would need to be done to
    handle the defaults. Anything left as %<string>% would need to
    be processed for an '=' and replaced with the default value.<br>
    <br>
    Is that what you had in mind?<br>
    <br></div></blockquote><div><br></div><div>Yes, something like this. Let's see:</div><div>All params in the Macro template need a value in the Macro instance. The order of precedence would be instance value > template default value > x3d default value.</div><div><br></div><div>So looping over the supplied names first and replacing with the supplied value would take care of those. The regexp would need to ignore  =.* after the name until the second %, if there is a equal sign. Would  '(\%'+name+'\%) || '(\%'+name+'=.*\%)' work as regexp ? Perhaps ignore white space in front of the = as well ? With some testing it should be possible to figure out a good regexp.</div><div><br></div><div>Then what is left are param names which are not supplied. They may have a default value or not.</div><div>Not sure how to best look for those but let's try.</div><div><br></div><div>string.match(), <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match</a> could give you all the remaining param names between %, and their locations [though this does not quite work in case of multiple %par%s on one line]. Those which have an equal sign could be split at the equal sign, and replaced with the value after the equal sign. Those without an equal sign would have no value. This means probably a warning message, and replacement with an empty string (?) or removal of the whole field including the field name, so it can be assigned its x3d default during subsequent parsing.</div><div><br></div><div>There may be other, cleaner ways for a default value syntax although this seems intuitive and compact.</div><div><br></div><div>In any case, the node spec. probably needs to clarify what happens if there is a param in the template without a default value or supplied value in the instance. Undefined ? Fall back to x3d default values ?</div><div><br></div><div>I somewhat fear that in the end it may be necessary to deal with a parsed xml (html) tree for the macro expansion rather than simple string substitution.</div><div><br></div><div>Andreas</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
    <br>
    Leonard Daly<br>
    <br>
    <br>
    <br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div><br>
          </div>
          <div>-Andreas<br>
          </div>
          <div><br>
          </div>
          <div>
            <div class="gmail_extra"><br>
              <div class="gmail_quote">On Fri, Aug 26, 2016 at 10:39 PM,
                Leonard Daly <span dir="ltr"><<a href="mailto:web3d@realism.com" target="_blank">web3d@realism.com</a>></span>
                wrote:<br>
                <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                  <div bgcolor="#FFFFFF" text="#000000">
                    <p>For the last year I have been working on
                      advancing X3D to be standardized in HTML5/DOM
                      environment and support mobile and VR. I have just
                      completed alpha work on the Macro node. This node
                      provides the static definition capabilities of
                      PROTO in an HTML5 environment. It can perform
                      string substitution (name/value pairs) on X3D code
                      stored externally. The node documentation is at
                      <a href="http://tools.realism.com/specification/x3d-v40/abstract-specification/changes-additions-x3d-v33/macro" target="_blank">http://tools.realism.com/speci<wbr>fication/x3d-v40/abstract-<wbr>specification/changes-<wbr>additions-x3d-v33/macro</a>.
                      <br>
                    </p>
                    <p>I will continue to get to at least alpha stage
                      (basic functional implemented and working) for all
                      nodes I discussed during my presentations at
                      Web3D2016 & SIGGRAPH. The presentation is
                      online at <a href="http://realism.com/presentations/188?title=Extending-X3DOM-to-Mobile" target="_blank">http://realism.com/presentatio<wbr>ns/188?title=Extending-X3DOM-<wbr>to-Mobile</a>.</p>
                    <p>All of the code is up on Github at <a href="https://github.com/DrX3D/x3dv4" target="_blank">https://github.com/DrX3D/x3dv4</a>
                      with testing code.</p>
                    <p>I am interested in any bugs that are found or
                      new/revised direction for the nodes. I am
                      completely open to anyone who would like to help
                      code. <br>
                      <span><font color="#888888"> </font></span></p>
                    <span><font color="#888888"> <br>
                        <div>-- <br>
                          <font color="#333366"> <font size="+1"><b>Leonard
                                Daly</b></font><br>
                            3D Systems Architect<br>
                            Cloud Consultant<br>
                            President, Daly Realism - <i>Creating the
                              Future</i> </font></div>
                      </font></span></div>
                  <br>
                  ------------------------------<wbr>------------------------------<wbr>------------------<br>
                  <br>
                  ______________________________<wbr>_________________<br>
                  X3dom-users mailing list<br>
                  <a href="mailto:X3dom-users@lists.sourceforge.net" target="_blank">X3dom-users@lists.sourceforge.<wbr>net</a><br>
                  <a href="https://lists.sourceforge.net/lists/listinfo/x3dom-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/<wbr>lists/listinfo/x3dom-users</a><br>
                  <br>
                </blockquote>
              </div>
              <br>
              <br clear="all"><span class=""><font color="#888888">
              <br>
              -- <br>
              <div data-smartmail="gmail_signature">Andreas Plesch<br>
                39 Barbara Rd.<br>
                Waltham, MA 02453</div>
            </font></span></div><span class=""><font color="#888888">
          </font></span></div><span class=""><font color="#888888">
        </font></span></div><span class=""><font color="#888888">
      </font></span></div><span class=""><font color="#888888">
    </font></span></blockquote><span class=""><font color="#888888">
    <br>
    <p><br>
    </p>
    <div>-- <br>
      <font color="#333366">
        <font size="+1"><b>Leonard Daly</b></font><br>
        X3D Co-Chair<br>
        Cloud Consultant<br>
        President, Daly Realism - <i>Creating the Future</i>
      </font></div>
  </font></span></div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</div></div>