GithubHelp home page GithubHelp logo

bellyabc123 / gilbert Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 954 KB

Code generator for mobile views. Currently creates Objective-C and HTML views from JSON

HTML 11.84% JavaScript 84.34% CSS 3.83%

gilbert's Introduction

#Gilbert App#

##Purpose## Gilbert is your personal assistant when it comes to creating views for mobile devices. By writing some simple JSON, you can generate code that renders the describe view in native iOS and HTML / CSS.

##Example## To add something like a label to a view, we could do the following:

  {
    "myLabel" : {
      "class" : "label",
      "backgroundColor" : "clear",
      "text" : "My Label",
      "textColor" : "blue",
      "font" : "Helvetica",
      "fontSize" : 18
    }
  }

In the above example, only the Objective-C parser will use the "class" key. Since each language has specific attributes, the parser will handle the keys accordingly. For example the "clear" color keyword will translate to [UIColor clearColor] in Objective-C and transparent in CSS.

##Supported Keywords##

###Both###

####Keys####

align
backgroundColor
backgroundImage
font
fontSize
text
textAlignment
textColor

####Colors#### You can use any hexcode value or one of the predefined colors below:

  • red
  • orange
  • yellow
  • green
  • blue
  • purple
  • brown
  • black
  • gray
  • lightGray
  • darkGray
  • white
  • magenta
  • cyan
  • magenta
  • clear

###Objective-C###

class
relativeTo ("window")
self (key)
class-specific properties

####Class-specific properties####

The parser will include calls to set class-specific properties. For example, if we had a UITextField, we could set different properties on it by defining which properties will be set, and then using those property names as keys. For example,

{
  "myTextField" : {
    "class" : "UITextField",
    "properties" : ["placeholder", "clearsOnBeginEditing"],
    "placeholder" : "Placeholder Text",
    "clearsOnBeginEditing" : true
  }
}

Notice that we defined our class as "UITextField" in this example. If you know you are going to target Objective-C, you can just give the class name you want directly and the parser will handle it accordingly. Also notice that the clearsOnBeginEditing value is true. For properties that take BOOL values, we provide it with the JSON equivalent and the parser will take care of conversion.

####self keyword####

If the self key is set as a "subview" of the view being created, the parser handles this as a special case and allows the user to change view properties such as backgroundImage, backgroundColor, etc.

###HTML / CSS###

class (i.e. button, div, label/span, input/textfield, textarea)
height
margin (can be universal or specific: topMargin, rightMargin, bottomMargin, leftMargin)
padding (can be universal or specific: topPadding, rightPadding, bottomPadding, leftPadding)
boxShadowColor
boxShadowOffset
boxShadowBlur (optional)
textShadowColor
textShadowOffset
width

gilbert's People

Contributors

thedrick avatar

Watchers

AAA avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.