Commit 43c11dab authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Add --eg-iframe option to allow non-extjs inline examples.

The special iframe for Touch 2 is now specified through this option,
but more importantly users of JSDuck can now use inline examples
for their own components by simply writing a custom iframe.html and
linking the needed JS and CSS files from it.
parent 7ca9090c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -280,6 +280,7 @@ class JsDuckRunner
      "--external=google.maps.Map,google.maps.LatLng",
      "--builtin-classes",
      "--img", "<p class='screenshot'><img src='%u' alt='%a'><span>%a</span></p>",
      "--eg-iframe", "template/touch-iframe.html",
      "#{@sdk_dir}/touch/resources/themes/stylesheets/sencha-touch/default",
    ]

+3 −0
Original line number Diff line number Diff line
@@ -96,6 +96,9 @@ module JsDuck
          FileUtils.rm(@opts.output_dir+"/index.php")
          FileUtils.cp(@opts.output_dir+"/template.html", @opts.output_dir+"/index.html")
        end
        if @opts.eg_iframe
          FileUtils.cp(@opts.eg_iframe, @opts.output_dir+"/eg-iframe.html")
        end
        write_src(parsed_files)
        format_classes
        write_app_data
+8 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ module JsDuck
    attr_accessor :img_tpl
    attr_accessor :export
    attr_accessor :seo
    attr_accessor :eg_iframe

    # Debugging
    attr_accessor :processes
@@ -95,6 +96,7 @@ module JsDuck
      @img_tpl = '<p><img src="%u" alt="%a"></p>'
      @export = nil
      @seo = false
      @eg_iframe = nil

      # Debugging
      # Turn multiprocessing off by default in Windows
@@ -259,6 +261,12 @@ module JsDuck
          @seo = true
        end

        opts.on('--eg-iframe=PATH',
          "An HTML file to use inside an iframe",
          "to display inline examples.", " ") do |path|
          @eg_iframe = canonical(path)
        end

        opts.separator "Debugging:"
        opts.separator ""

+2 −2
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ Ext.define('Docs.view.examples.InlinePreview', {
                    iframe.contentWindow.refreshPage(code, options);
                }, 100);
            };
            iframe.src = Docs.touchExamplesUi ? "touchIframe.html" : "extIframe.html";
            iframe.src = "eg-iframe.html";
        }
    },

@@ -69,7 +69,7 @@ Ext.define('Docs.view.examples.InlinePreview', {
    getIframeId: function() {
        if (!this.iframeId) {
            this.statics().iframeId += 1;
            this.iframeId = "egIframe" + this.statics().iframeId;
            this.iframeId = "eg-iframe" + this.statics().iframeId;
        }
        return this.iframeId;
    },
+0 −0

File moved.

Loading