Git Product home page Git Product logo

htmldecoratorsparsercplusplus's Introduction

htmldecoratorsparser c++

This class parses decorator annotations from html and replaces variable placeholders.

This is the parser of the htmldecorators project

Example

Data: test3 = hello, text = Lorem ipsum

@DecoratorName
@Decorator2()
@Decorator3
<ul></ul>

@DecWithParamVariable(
    path=${test3},
    text="Hello World",
    textWithoutQuotes=Without yes
)
<p>Hello World</p>

<h1>${text}</h1>

The result will be in html:

<ul data-dec-id="htmldec162403918934013120955"></ul>

<p data-dec-id="htmldec16240391893388115993">Hello World</p>

<h1>Lorem ipsum</h1>

The definition would look like this:

-------
Id=htmldec162403918934013120955
Name=DecoratorName
-------
Id=htmldec162403918934013120955
Name=Decorator2
-------
Id=htmldec162403918934013120955
Name=Decorator3
-------
Id=htmldec16240391893388115993
Name=DecWithParamVariable
Key=path, Value=hello // note that the variable was set into the definition and was not replaced in the html
Key=text, Value=hello world
Key=textWithoutQuotes, Value=Without yes

Usage

#include "src/Parser.h"

using HTMLDecorators::IdMap;
using HTMLDecorators::Parser;
...
IdMap GenIds {};

Parser parser = Parser{GenIds};

// without data
string htmlOutput = parser.Parse(htmlstring);
parser.DecoratorList; // The list of extracted decorators

// with data
unordered_map<string,string> data {};
data.insert({"value1","Value 1"});
data.insert({"headline","Headline"});

string htmlOutput = parser.Parse(htmlstring, data);
parser.DecoratorList;

htmldecoratorsparsercplusplus's People

Contributors

hendrik-weiler avatar

Watchers

 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.