convert html to titanium object
##Note This project is a work in progress, so use advisedly. Raise an issue for any problems or suggestions you have.
Note this project now uses attributed strings on iOS and Android, so must be built using Ti SDK 4.0.0 or above.
This project was inspired by Fokke Zandberg's HTML 2 AttributedString converter for Titanium and uses some code/ideas from that project.
##Installation
- Open a terminal prompt
- Type
npm install - Then type
gruntThis will build the module and run the example project in the iOS simulator. Rungrunt androidto run on a connected Android device or emulator.
##How it works ###Components The module is built using titaniumifier and uses the following npm components;
###Process
- Create a whitelist of html tags and attributes that you wish to support in your app. See here for information on how to create a whitelist or look at the example project for details.
- Note that embedded tags are currently styled as the parent. Embedded tag styling will be added when attributed strings is supported for Android in Titanium 4.x
- Save the whitelist as a JSON document or JSON object in your app.
- Create a .tss file that defines the tags you have whitelisted, plus the following;
- label
- tableView
- tableViewSection
- tableViewRow
- imageView
- Look at the example app for details of how to use the module. Note the module uses $.createStyle extensively, so you need to use
.call($)when invoking the createHTML function.