Giter VIP home page Giter VIP logo

string-divert's Introduction

String::Divert
==============

ABSTRACT

String::Divert is small Perl 5 module providing a scalar-like string
object with some overloaded operators, supporting the concept of Fold-
ing and Diversion. This allows nested generation of structured output.
The idea is to decouple the sequential generation of output from the
nested and non-sequential structure of the output.

The two most prominent examples are the generation of code in SGML/XML
based languages like [X]HTML (where large and deeply nested structures
occur) and the generation of code in typed 3GL procedural languages
like C/C++ (where symbols have to be declared before usage). Here
String::Divert allows you to generate the code in steps from the outer
to the inner level or to append code to already generated previous or
later inserted parts.

This is achieved by leveraging two basic concepts: content folding and
operation diversion.

Content Folding

The concept of content folding allows you to fold the content at the
current output position by inserting a placeholder corresponding to a
sub-output and just proceeding with the output generation. The sub-out-
put initially is empty. Once output is appended to it (see diversion
below), it will occur at the placeholder position if the content is
unfolded later. Folding can be applied to the sub-object again and this
way allowing arbitrary nested structures. A sub-output even can be
unfolded into multiple placeholder positions.

Operation Diversion

The concept of operation diversion allows you to automatically divert
an operation to one object to another object. Usually this is used for
diverting output generation operations on a top-level string object to
folded sub-objects without having to deal with multiple object vari-
ables and without having to know that you are actually operating on a
sub-object. Diversions are applied in a stacked fashion, allowing the
stepping back to the previous active diversion.

INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

string-divert's People

Contributors

rse avatar

Watchers

 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.