Code Monkey home page Code Monkey logo

cardmaker-2's Introduction

Card Maker

OmniGraffle template and script to generate cards from data.

Features:

  • merge data property values with graphic's text
  • style graphics based on a data property from visual style prototype
  • export individual cards as individual files

Installation and Requirements

Requires OmniGraffle version ≥ 7.18.

To install the script in OmniGraflle do the following steps:

  1. open OmniGraffle
  2. Select menu AutomationConfigure…
  3. Select Add Linked Folder
  4. Select the CardMaker folder in this repository containing the scripting files.

Creating Cards

  1. Open the CardMaker.graffle document
  2. Select menu AutomationCreate Cards
  3. Cards are generated in the sheet named sheet

You can export cards as PDFs or any other format individually:

  1. Select the canvas named sheet
  2. Menu FileExport… or Cmd+Opt+E
  3. Chose your format: PNG, PDF, ...
  4. Check ✅ Export from artboards only

This will generate one file per card with filename being the card's name.

Template Document

The template document has a specific content.

  • Document MUST contain sheet named template
  • Sheet named template MUST contain an object with name card and it MUST be a group
  • Document MUST contain sheet named card. Content will be replaced
  • Document MUST contain sheet named sheet. Content will be replaced.
    • Sheet named sheet must contain a layer layer named sheet
    • Sheet named sheet must contain an artboard layer named artboard

Cards Data

Cards data are read from a JSON file. The JSON file is a dictionary.

Keys:

  • cards: array of cards represented as dictionaries

Card

Card structure is left to the author of the template and the cards. The following properties are expected by the provided template:

  • name – card name/label
  • type – card type
  • text – card body text

Card Template and Data Merging

Card template is stored in a sheet named template. It is a group of graphics that has name card.

Card Template Properties

Card template graphic objects name denotes which field will be used as the graphic's text. For example, if the template has a text object with name label it will be replaced by value of card's property label.

Graphic's user data:

  • styleProperty – name of card’s property that contains name of the style to be applied to the object (see more about styles below)

Styles

Objects can be styled based on value of card's property. Style is specified by creating another object with that style. This approach makes it visually explicit how the styles look like instead of hiding it in an obscure textual representation.

The objects representing styles are objects in the canvas template. They are identified by having a user property type set to style. Their name denotes the style name.

Styles Example

Cards have a property type that can be either action or resource. We want to have action cards to have a red border and resource cards to have a green border. We create two border-like templates: one red and one green. Canvas will have the following style objects:

  • red rectangle with name action and type set to style
  • green rectangle with name resource and type set to style

The card template would have a rectangle object with styleProperty set to type. It can be styled in some default style that will be used when the cards type contains unknown type or a type that is not to be styled differently.

Authors

License

  • Template: Attribution-ShareAlike 4.0
  • Code: MIT

cardmaker-2's People

Contributors

stiivi avatar

Watchers

 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.