Giter VIP home page Giter VIP logo

layar's Introduction

#Layar

Layar Sequestered string mapping layer with modular manipulation contexts designed for flixibility and analytical advantages.

##What is Layar

[$TODO ~]

  • String statistics without the need for analysis
  • A middleman processor that both imports and outputs in a variety of markups

##Why did we create Layar

###History

Formatting text is tricky. If we store as richtext HTML we alienate our data, removing cross-platform useability in environments that don't render HTML.

A far more modern approach is to store as Markdown which is both lightweight and far more logical to parse.

###Issues

Whilst Markdown is more advantageous over HTML, it still requires a level of analysis prior to manipulation. To retrieve the second paragraph of a body of text you must either store paragraphs seperately, or apply a markdown-parsing method to get the first and last caret position of the required substring.

###Concept

Rather than storing text with formatting of any kind, Layar stores simple JSON. You can still store as markdown, or html (if you must) but you'll never lose the raw formatting rules. The need to parse your markup text to retrieve elements, lengths, links, quotes etc goes. Layar is a map.

String

"This is a string with some bold text. There are two paragraphs here."

JSON example

{
  "type": "b",
  "start": 27,
  "end": 37,
  "level": 1
},
{
  "type": "p",
  "start": 37,
  "end": 68,
  "level": 0
},
{
  "type": "p",
  "start": 0,
  "end": 37,
  "level": 0
}

Result

This is a string with some bold text.

There are two paragraphs here.

Example found here

##Roadmap

###Example Functions

Basic

//Number of paragraphs
layar.get("paragraphs").count()

//Length of first paragraph
layar.get("paragraphs", 0).length()

//Acummulative length of the first 6 paragraphs
layar.get("paragraphs", 0).to(5).length()

//Everything between paragraph 1 and 5
layar.get().from("paragraphs", 0).to(4);

Advanced

//Only paragraph text, without nested formatting, from paragraph 2 to 4
layar.get("paragraphs").from(1).to(3);

//Get all links from the first 3 paragraphs
layar.get("links").from("paragraphs", 0).to(2);

//Get the first quote from each (useful for pullquotes)
layar.get("quotes", 0).from("paragraphs", 0).to();


//All text between the second link and the third bold text
layar.get().from("link", 1).to("bold", 2);

layar's People

Contributors

mingard avatar eduardoboucas avatar

Watchers

Jean-Luc Thiebaut avatar Joseph Denne avatar James Cloos avatar  avatar  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.