Commit 85839d9b authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Syntax highlighting for guides.

Moved syntax highlighting to separate class, so it can be called from
multiple places.
parent 547db9a2
Loading
Loading
Loading
Loading

template/app/Syntax.js

0 → 100644
+20 −0
Original line number Diff line number Diff line
/**
 * Utility for performing syntax highlighting.
 */
Ext.define("Docs.Syntax", {
    singleton: true,

    /**
     * Marks all code blocks with "prettyprint" class and then calls
     * the prettify library function to highlight them.
     *
     * @param {HTMLElement/Ext.core.Element} root HTML element inside
     * which to perform the highlighting.
     */
    highlight: function(root) {
        Ext.Array.forEach(Ext.query("pre > code", root.dom || root), function(el) {
            Ext.get(el).addCls("prettyprint");
        });
        prettyPrint();
    }
});
+1 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ Ext.define('Docs.controller.Classes', {
            success: function(json) {
                Ext.getCmp("guide").update(json.guide);
                Ext.getCmp('container').layout.setActiveItem(2);
                Docs.Syntax.highlight(Ext.get("guide"));
            },
            scope: this
        });
+1 −10
Original line number Diff line number Diff line
@@ -48,16 +48,7 @@ Ext.define('Docs.view.class.Overview', {
        this.addDocked(this.toolbar);

        this.update(this.renderClass(docClass));
        this.syntaxHighlight();
    },

    // Marks all code blocks with "prettyprint" class and then calls
    // the prettify library function to highlight them.
    syntaxHighlight: function() {
        Ext.Array.forEach(Ext.query("pre > code"), function(el) {
            Ext.get(el).addCls("prettyprint");
        });
        prettyPrint();
        Docs.Syntax.highlight(this.getEl());
    },

    renderClass: function(cls) {
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
  <script type="text/javascript" src="app/controller/Classes.js"></script>
  <script type="text/javascript" src="app/controller/Search.js"></script>
  <script type="text/javascript" src="app/History.js"></script>
  <script type="text/javascript" src="app/Syntax.js"></script>

  <script type="text/javascript" src="output/tree.js"></script>
  <script type="text/javascript" src="output/members.js"></script>
+1 −1
Original line number Diff line number Diff line
@@ -371,7 +371,7 @@ a:hover {
  border: 0; }


#doc-overview, #api-guide {
#doc-overview, #guide {
  pre {
    background-color: #f7f7f7;
    border: solid 1px #e8e8e8;