├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CREDIT.md ├── H5.cpp ├── H5maker.cpp ├── LICENSE ├── Makefile ├── README.md ├── changelog.md ├── contributing.md ├── documentation └── README.md ├── exemple ├── simple-extends │ ├── H5maker │ ├── base.html │ ├── present.html │ └── support.html ├── simple-inclusion │ ├── H5maker │ ├── index.html │ └── navbar.html └── simple-repeat │ ├── H5maker │ └── index.html ├── h5a ├── h5lex.l ├── h5mlex.l ├── h5mparse.y ├── h5parse.y └── share ├── icon.png ├── social.png └── social.svg /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: christ118 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ "main" ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ "main" ] 20 | schedule: 21 | - cron: '23 9 * * 0' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'cpp', 'javascript' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v3 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v2 46 | with: 47 | languages: ${{ matrix.language }} 48 | # If you wish to specify custom queries, you can do so here or in a config file. 49 | # By default, queries listed here will override any specified in a config file. 50 | # Prefix the list here with "+" to use these queries and those in the config file. 51 | 52 | # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs 53 | # queries: security-extended,security-and-quality 54 | 55 | 56 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 57 | # If this step fails, then you should remove it and run the build manually (see below) 58 | - name: Autobuild 59 | uses: github/codeql-action/autobuild@v2 60 | 61 | # ℹ️ Command-line programs to run using the OS shell. 62 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun 63 | 64 | # If the Autobuild fails above, remove it and uncomment the following three lines. 65 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. 66 | 67 | # - run: | 68 | # echo "Run, Build Application using script" 69 | # ./location_of_script_within_repo/buildscript.sh 70 | 71 | - name: Perform CodeQL Analysis 72 | uses: github/codeql-action/analyze@v2 73 | 74 | - name: HashiCorp's Link Checker 75 | # You may pin to the exact commit or the version. 76 | # uses: hashicorp/gh-action-check-broken-links@9da9ec2d83f88fe981a856c3f03aca64e68af90c 77 | uses: hashicorp/gh-action-check-broken-links@v1 78 | with: 79 | # The base URL that links will be resolved against 80 | baseUrl: 81 | # A list of files that will be scanned for the presence of links 82 | files: # optional 83 | # A newline delmited list of URLs that will be ignored 84 | whitelist: # optional 85 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # object or binary# 3 | *.class 4 | *.exe 5 | *.o 6 | *.so 7 | 8 | # compiled flex and bison 9 | *.cxx 10 | *.hpp 11 | *.hh 12 | *.hxx 13 | 14 | # Ignore IDE specific files 15 | .idea/ 16 | .vscode/ 17 | build/ 18 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | mail. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /CREDIT.md: -------------------------------------------------------------------------------- 1 | ## H5assembler changelog 2 | 3 | h5assembler's team started to write a changelog since the 0.1.3 version 4 | 5 | -------------------------------------------------------------------------------- /H5.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | copyright 2022 @elodream 4 | H5assembler is a software made by elodream which help all frontend devellopper and integrator to 5 | create a static page in html without any repetitions 6 | it will guarantee you to be able to easily interer your frontend designs in websites 7 | */ 8 | 9 | typedef void *yyscan_t; 10 | 11 | #include "h5parse.hxx" 12 | #include "h5lex.hpp" 13 | 14 | #include 15 | #include 16 | 17 | using namespace std; 18 | typedef void *yyscan_t; 19 | 20 | extern string initialdata; 21 | extern string pdata; 22 | extern string basedir; 23 | 24 | extern bool loop; 25 | 26 | string compile(string content); 27 | string compilefile(string path); 28 | 29 | int runwithargs(int argc, char **argv); 30 | int compilewithh5m(char **argv, int argc); 31 | int runwithoutarg(char **argv); 32 | int saveoutput(string compileddata, string outputpath = ""); 33 | // our main function 34 | int main(int argc, char **argv) 35 | { 36 | 37 | int c = (argc > 1) ? runwithargs(argc, argv) : runwithoutarg(argv); // if there are arguments run with them 38 | // don't quit the app at the end of assembly 39 | return (c); 40 | } 41 | 42 | // run h5A by using arguments 43 | int runwithargs(int argc, char **argv) 44 | { 45 | if (string(argv[1]) == "-m") 46 | { 47 | if (argc < 3) 48 | { 49 | // will not assemble a file using a H5maker file 50 | cout << "no H5maker file specified" << endl; 51 | } 52 | else 53 | { 54 | compilewithh5m(argv, argc); 55 | } 56 | } 57 | else 58 | { 59 | if (argc > 2) 60 | { 61 | for (int i = 2; i < argc; i++) 62 | saveoutput(compilefile(argv[1]), argv[i]); 63 | } 64 | else 65 | saveoutput(compilefile(argv[1])); 66 | } 67 | system("pause"); 68 | return EXIT_SUCCESS; 69 | } 70 | 71 | // assemble a string 72 | string compile(string content) 73 | { 74 | do 75 | { 76 | loop = false; 77 | yyscan_t *scan = new yyscan_t; 78 | pdata.clear(); 79 | 80 | yylex_init(scan); 81 | YY_BUFFER_STATE buf = yy_scan_bytes(content.c_str(), strlen(content.c_str()), *scan); 82 | yyparse(*scan); 83 | yylex_destroy(*scan); 84 | content = pdata; 85 | 86 | } while (loop == true); 87 | pdata.erase(); 88 | return content; 89 | } 90 | 91 | // assemble file 92 | string compilefile(string path) 93 | { 94 | string data; 95 | ifstream inputfile(path, ios::in | ios::binary | ios::ate); 96 | if (inputfile.is_open()) 97 | { 98 | int length = inputfile.tellg(); 99 | inputfile.seekg(0, std::ios::beg); 100 | char *buffer = new char[length + 1]; // allocate memory for a buffer of appropriate dimension 101 | inputfile.read(buffer, length); // read the whole file into the buffer 102 | inputfile.close(); 103 | cout << "start assembly : " << path << endl; 104 | 105 | const size_t last_slash_idx = path.rfind('\\'); 106 | if (std::string::npos != last_slash_idx) 107 | { 108 | basedir = path.substr(0, last_slash_idx); 109 | } 110 | cout << "directory is :" << basedir << endl; 111 | string data = buffer; 112 | free(buffer); 113 | inputfile.close(); 114 | return compile(data); 115 | } 116 | cout << "cannot find file (" << path << ")" << endl; 117 | return ""; 118 | } 119 | 120 | // save assembled file to a specified path 121 | int saveoutput(string compileddata, string outputpath) 122 | { 123 | 124 | outputpath = (outputpath == "") ? "output.html" : outputpath; 125 | ofstream outputfile(outputpath, ios::out | ios::binary); 126 | outputfile.write(compileddata.c_str(), compileddata.size()); 127 | 128 | cout 129 | << "\noperation terminated successfuly , output at : " 130 | << outputpath << endl; 131 | 132 | outputfile.close(); 133 | return 0; 134 | } 135 | -------------------------------------------------------------------------------- /H5maker.cpp: -------------------------------------------------------------------------------- 1 | #include "h5mparse.hxx" 2 | #include "h5mlex.hpp" 3 | #include 4 | using namespace std; 5 | 6 | int runwithoutarg(char **argv) 7 | { 8 | FILE *maker = fopen("h5maker", "r"); 9 | if (maker) 10 | { 11 | yyin = maker; 12 | yyparse(); 13 | fclose(maker); 14 | return EXIT_SUCCESS; 15 | } 16 | return EXIT_FAILURE; 17 | } 18 | 19 | int compilewithh5m(char **argv, int argc) 20 | { 21 | int mk = 0; 22 | for (int i = 2; i < argc; i++) 23 | { 24 | FILE *maker = fopen(argv[i], "r"); 25 | if (maker) 26 | { 27 | yyin = maker; 28 | yyparse(); 29 | fclose(maker); 30 | mk++; 31 | } 32 | else 33 | { 34 | cout << "cannot find maker file :" << argv[i] << endl; 35 | } 36 | } 37 | return (mk) ? EXIT_SUCCESS : EXIT_FAILURE; 38 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 elodream 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | H5assembler: 2 | bison -d h5parse.y -o h5parse.cxx 3 | flex -o h5lex.cxx h5lex.l 4 | bison -d h5mparse.y -o h5mparse.cxx 5 | flex -o h5mlex.cxx h5mlex.l 6 | g++ h5lex.cxx h5parse.cxx h5mlex.cxx h5mparse.cxx H5maker.cpp H5.cpp -o H5A.exe 7 | 8 | debian: 9 | #!/bin/bash 10 | bison -d h5parse.y -o h5parse.cxx 11 | flex -o h5lex.cxx h5lex.l 12 | bison -d h5mparse.y -o h5mparse.cxx 13 | flex -o h5mlex.cxx h5mlex.l 14 | g++ h5lex.cxx h5parse.cxx h5mlex.cxx h5mparse.cxx H5maker.cpp H5.cpp -o h5a 15 | sudo cp ./H5A /usr/bin/ 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ![](https://github.com/ngdream/H5assembler/blob/8b52dca1f889ab0f93dc8b1d9cc7f0c92155ca85/share/social.png) 3 | # H5 Assembler 4 | its made for all web developer who doesn't like to write the same code in different file which his currency : ***`` don't repeat yourself ``***
5 | you will never need to rewrite the same text again 6 | 7 | ## state 8 | the H5A repository is on github 9 | the current version is the 1.0.2 10 | 11 | ## building 12 | 1. ### on window 13 | if you want to build H5assembler on window 14 | - download msys64 15 | - download mingw64 or mingw32 toolchains 16 | 17 | - download flex , bison and make 18 | in msys64 type 19 | ```shell 20 | pacman -S flex 21 | pacman -S bison 22 | pacman -S make 23 | ``` 24 | -run the make command throw msys shell in the project directory 25 | ``` make``` 26 | 27 | 28 | 1. ### on linux debian 29 | if you want to build H5assembler on window 30 | - download flex , bison and make 31 | in msys64 type 32 | ```shell 33 | sudo apt-get update 34 | sudo apt install make 35 | sudo apt-get install flex bison 36 | 37 | ``` 38 | -run the make command 39 | ``` make debian``` 40 | ## exemple of use 41 | h5assembler offers you a technology allowing you to reduce your html code and guarantees you an easy integration in frameworks such as (laravel, django) 42 | 43 | **navbar.html** 44 | 45 | ```html 46 | 51 | ``` 52 | **index.html** 53 | ```html 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | simple include H5assembler 62 | 63 | 64 | @include("navbar.html") 65 | 66 | 67 | 68 | ``` 69 | 70 | in in the same directory than index.html run command ``H5A index.html output.html``. 71 | this command will generate an output.html file with the following content 72 | **output.html** 73 | 74 | ```html 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | simple include H5assembler 83 | 84 | 85 | 90 | 91 | 92 | 93 | ``` 94 | 95 | for more information about h5 using read the [``documentation``](documentation) 96 | 97 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | - add extend function 3 | ### 1.0.1 4 | - change output message for syntax error 5 | ### 1.0.2 6 | 7 | - fix bug with parenthese 8 | - add some comment in codes 9 | 10 | -------------------------------------------------------------------------------- /contributing.md: -------------------------------------------------------------------------------- 1 | # how to contribute 2 | 3 | 4 | h5assembler is a software made to help 5 | html developer to make a good website without repetitions (check the documentation for more details ) 6 | 7 | there are many ways to contribute to this project : 8 | 9 | - if you don't want to use yacc or lex you can could compile a precompiled version of h5assembler at and test it if you have some recommendations or other raise an issue at the h5assembler main repository 10 | 11 | - you can to improve h5assembler's website at 12 | 13 | ## contact 14 | 15 | if you have some question about h5assembler write it on our discord channel 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /documentation/README.md: -------------------------------------------------------------------------------- 1 | documentation 2 | === 3 | 4 | - [about](#about) 5 | - [functions](#functions-in-h5a) 6 | - [include](#the-include-function) 7 | - [repeat](#the-repeat-function) 8 | - [how to use](#how-to-use-h5-commands) 9 | - [h5maker language](#about-the-h5maker-language) 10 | ## about 11 | 12 | H5A helps frontend developers write html without repetition 13 | it is also designed so that web designers can create designs that can be easily integrated into frameworks such as (laravel, django and others) 14 | 15 | ## functions in H5A 16 | 17 | h5a have functions that is started by '@' and must be included in the file you want to assemble 18 | ### the include function 19 | 20 | this function is used to include the contents of the file in another 21 | 22 | #### exemble of use * 23 | if you have these two files in the same directory 24 | **index.html** 25 | ```html 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | simple include H5assembler 34 | 35 | 36 | @include("navbar.html") 37 | include page 1 38 | 39 | 40 | ``` 41 | 42 | **navbar.html** 43 | 44 | ```html 45 | 50 | ``` 51 | launch the terminal in the same directory and type ``h5A index.html output.html`` 52 | h5A will generate the following file 53 | 54 | **output.html** 55 | ```html 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | simple include H5assembler 64 | 65 | 66 | 71 | include page 1 72 | 73 | 74 | ``` 75 | 76 | ### the repeat function 77 | 78 | this function is used to include the contents of the file in another 79 | 80 | #### exemble of use * 81 | if you have these two files in the same directory 82 | **index.html** 83 | ```html 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | simple include H5assembler 92 | 93 | 94 | @repeat("3"){ 95 |
this is h5 assembler
96 | } 97 | 98 | 99 | ``` 100 | 101 | 102 | launch the terminal in the same directory and type ``h5A index.html output.html`` 103 | h5A will generate the following file 104 | 105 | **output.html** 106 | ```html 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | simple include H5assembler 115 | 116 | 117 |
this is h5 assembler
118 |
this is h5 assembler
119 |
this is h5 assembler
120 | 121 | 122 | ``` 123 | 124 | 125 | ## how to use h5 commands 126 | 127 | 128 | if you type ``h5a {{your file path}} `` 129 | h5a will build your file and the output will be at **output.html** 130 | 131 | you can also specify one or many build paths in h5A 132 | if you type ``h5a {{your file path}} {{build_path1}} {{build_path2}} {{build_path4}} ..... .... {{build_pathX}} `` 133 | h5a the build files will be at all specified build paths 134 | 135 | 136 | ## about the h5maker language 137 | 138 | **H5MAKER language is the most owerful functionnality of H5** 139 | by default when you use h5A you can just build one file but with h5maker its possible to build many files and deploy your project for every one 140 | 141 | 142 | 143 | ## bugs 144 | 145 | **H5 assembler is a new software so it has some bugs:** 146 | 147 | 1. stranger strings writed at the end of output file when you build many file by using h5maker language 148 | 2. you must specify the output to a folder that exists 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /exemple/simple-extends/H5maker: -------------------------------------------------------------------------------- 1 | "present.html" = {"prensent_build.html "}; 2 | "support.html" = {"support_build.html "}; 3 | -------------------------------------------------------------------------------- /exemple/simple-extends/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | @field("content") 10 | 11 | -------------------------------------------------------------------------------- /exemple/simple-extends/present.html: -------------------------------------------------------------------------------- 1 | @extends("base.html") 2 | @layout("content"){ 3 |

HI i'm ngdream

4 | } 5 | -------------------------------------------------------------------------------- /exemple/simple-extends/support.html: -------------------------------------------------------------------------------- 1 | @extends("base.html") 2 | @layout("content"){ 3 |

Support our works on github

4 | } 5 | -------------------------------------------------------------------------------- /exemple/simple-inclusion/H5maker: -------------------------------------------------------------------------------- 1 | "index.html" = {"index_build.html "}; 2 | -------------------------------------------------------------------------------- /exemple/simple-inclusion/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | simple include H5assembler 9 | 10 | 11 | @include("navbar.html") 12 | 13 |

yoooooooo

14 | include page 1 15 | 16 | -------------------------------------------------------------------------------- /exemple/simple-inclusion/navbar.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exemple/simple-repeat/H5maker: -------------------------------------------------------------------------------- 1 | "index.html" = {"index_build.html"}; -------------------------------------------------------------------------------- /exemple/simple-repeat/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | simple repeat H5assembler 10 | 11 | 12 | @repeat("10000"){ 13 |

bonjour

14 | } 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /h5a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngdream/H5assembler/8f0a4ab983bf1700d1e0b6a028f475a3de27e5d9/h5a -------------------------------------------------------------------------------- /h5lex.l: -------------------------------------------------------------------------------- 1 | 2 | %option stack noyywrap reentrant bison-bridge 3 | %option header-file="h5lex.hpp" 4 | %{ 5 | extern int lineNumber; // definie dans prog.y, utilise par notre code pour \n 6 | #include "h5parse.hxx" 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | string val; 13 | 14 | 15 | %} 16 | /*reentrant bison-bridge*/ 17 | /* doesn’t need yywrap() */ 18 | 19 | %x strenv 20 | 21 | 22 | i_command @include 23 | e_command @extends 24 | l_command @layout 25 | f_command @field 26 | r_command @repeat 27 | 28 | command {i_command}|{e_command}|{l_command}|{f_command}|{r_command} 29 | 30 | %% 31 | "\"" { val.clear(); BEGIN(strenv); } 32 | "\"" { BEGIN(INITIAL);yylval->str=new char[val.size()+1];sprintf(yylval->str,"%s",val.c_str());return(STRING); } 33 | <> { BEGIN(INITIAL);yylval->str=new char[val.size()+1]; sprintf(yylval->str,"%s",val.c_str());return(STRING); } 34 | . { val+=yytext[0]; } 35 | {command} {yylval->str=new char[strlen(yytext)+1]; sprintf(yylval->str,"%s",yytext);return (COMMAND);} 36 | "(" {yylval->c=yytext[0]; return LPAREN; } 37 | ")" {yylval->c=yytext[0]; return RPAREN; } 38 | "{" { yylval->c=yytext[0];return LBRACE; } 39 | "}" { yylval->c=yytext[0];return RBRACE; } 40 | .|\n {yylval->c=yytext[0];return TXT; } 41 | 42 | %% 43 | 44 | -------------------------------------------------------------------------------- /h5mlex.l: -------------------------------------------------------------------------------- 1 | /*made by elodream copyright elodream 2022*/ 2 | /*scanner for h5maker file */ 3 | %option noyywrap 4 | %option header-file="h5mlex.hpp" 5 | %{ 6 | #include "h5mparse.hxx" 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | string location; 13 | 14 | %} 15 | 16 | %x locenv 17 | var [a-zA-Z]+[0-9]* 18 | 19 | %% 20 | "\"" { location.clear(); BEGIN(locenv); } 21 | "\"" { BEGIN(INITIAL);yylval.str=(char*)malloc(sizeof(char)*location.size());sprintf(yylval.str,"%s",location.c_str());return(PATH); } 22 | <> { BEGIN(INITIAL);yylval.str=new char[location.size()+1] ;sprintf(yylval.str,"%s",location.c_str());return(PATH); } 23 | . { location+=yytext[0]; } 24 | ";" {return SEMI;} 25 | "=" {return EQUAL;} 26 | {var} {yylval.str=new char[strlen(yytext)]; return VAR;} 27 | 28 | "{" {return LBRACE;} 29 | "}" {return RBRACE;} 30 | "\n" {} 31 | 32 | 33 | 34 | %% 35 | 36 | -------------------------------------------------------------------------------- /h5mparse.y: -------------------------------------------------------------------------------- 1 | /*made by elodream copyright elodream 2022*/ 2 | /* 3 | parser for h5maker file 4 | */ 5 | 6 | %{ 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include "h5mlex.hpp" 12 | 13 | using namespace std; 14 | 15 | 16 | map variables; 17 | vector l; 18 | void yyerror (const char *msg); 19 | int saveoutput(string compileddata, string outputpath = ""); 20 | 21 | string compile(string content); 22 | string compilefile(string path); 23 | int yylex(); 24 | 25 | %} 26 | /* token definition */ 27 | %token VAR ASSIGN SEMI EQUAL 28 | %token PATH COMA 29 | %token RBRACE LBRACE 30 | 31 | %union { char * str ;} 32 | %type PATH VAR pathlistargs pathlist; 33 | %start program 34 | %% 35 | program:instructions ; 36 | 37 | 38 | assign: VAR EQUAL PATH { 39 | variables[$1]=(void*) $3; 40 | }; 41 | | VAR EQUAL VAR 42 | {variables[$1]=(void*) $3;}; 43 | pathlist: LBRACE pathlistargs RBRACE {$$=$2; } 44 | pathlistargs: pathlistargs PATH {char *str = (char*) malloc(strlen($1) + strlen($2) + 1); 45 | strcpy(str, $1); 46 | strcat(str, ","); 47 | strcat(str, $2); 48 | free($2); 49 | free($1); 50 | $$ = str; 51 | } 52 | | PATH 53 | 54 | buildpath:PATH EQUAL pathlist { 55 | char * token = strtok($3, ","); 56 | // loop through the string to extract all other tokens 57 | while( token != NULL ) { 58 | l.push_back(token); //printing each token 59 | saveoutput(compilefile($1),token); 60 | token = strtok(NULL, ","); 61 | 62 | } 63 | 64 | } 65 | instruction:assign SEMI | buildpath SEMI | pathlist SEMI | pathlistargs SEMI; 66 | instructions:instruction instructions |instruction 67 | 68 | %% 69 | 70 | void yyerror (const char *msg) 71 | { 72 | cerr<<"error in h5maker file"; 73 | } 74 | 75 | void inith5m() 76 | { 77 | variables["BUILD_PATH"]=new char [100]; 78 | variables["BUILD_PATH"]=(void*)"build"; 79 | } -------------------------------------------------------------------------------- /h5parse.y: -------------------------------------------------------------------------------- 1 | %define api.pure full 2 | %lex-param {yyscan_t scanner} 3 | %parse-param {yyscan_t scanner} 4 | 5 | %{ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | using namespace std; 12 | typedef void* yyscan_t; 13 | int lineNumber; // notre compteur de lignes 14 | typedef union YYSTYPE YYSTYPE; 15 | 16 | map layout_data; 17 | void yyerror ( yyscan_t scan,char const *msg); 18 | int yylex(YYSTYPE *c,yyscan_t scanner); 19 | 20 | 21 | bool loop; 22 | 23 | string basedir; 24 | string pdata=""; 25 | %} 26 | /* token definition */ 27 | 28 | %token STRING 29 | %token COMMAND 30 | %token LPAREN RPAREN LBRACE RBRACE 31 | %token TXT 32 | 33 | 34 | %union { char c; char *str ; double real; int integer; } 35 | %type TXT RPAREN LPAREN RBRACE LBRACE; 36 | %type STRING COMMAND command_call content content_part tail tails ; 37 | %start program 38 | %% 39 | 40 | 41 | program:content ; 42 | 43 | // call command 44 | command_call : COMMAND LPAREN STRING RPAREN { 45 | string dir=basedir; 46 | if(dir!="") 47 | dir+='\\'; 48 | dir+=$3; 49 | if(string($1)=="@field") 50 | { 51 | cout<<"define field :"<<$3< 2 | 3 | 4 | 16 | 36 | 38 | 44 | 45 | 49 | 56 | 61 | HTML 72 | 76 | 80 | don't repeat yourself 93 | 94 | 95 | --------------------------------------------------------------------------------