PHP Classes

File: README.md

Recommend this page to a friend!
  Packages of Christos Drogidis   JML to HTML Renderer   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: JML to HTML Renderer
Convert documents in JML format to HTML
Author: By
Last change:
Date: 4 months ago
Size: 2,458 bytes
 

Contents

Class file image Download

Converting JML Code to HTML

This case study demonstrates how Ascoos OS takes a clean, small, safe .jml file and automatically converts it into complete and valid HTML5.

Purpose

  • Automatic conversion of JML to HTML5
  • Reduction of code compared to manual HTML

JML Documentation

Main Classes of Ascoos OS

  • THTML : JML parser + HTML generator
  • TFilesHandler : Secure writing of the generated HTML to a file

File Structure

The implementation is contained in a single PHP file: - jml_to_html_renderer.php

It includes all the logic: interpreting JML, converting to HTML, and saving to an HTML file.

Prerequisites

  1. PHP ? 8.2
  2. Installed Ascoos OS or AWES 26

Execution Flow

  1. Configure operational properties.
  2. Initialize the classes.
  3. Declare the `JML` string.
  4. Parse the JML string into HTML.
  5. Manually add the DOCTYPE.
  6. Save the generated HTML to a file.
  7. Display the generated HTML code.
  8. Release resources and handlers.

Code Example

html:lang('en') {
  head {
    title {`Untitled-1`}
    meta:charset('utf-8')
    meta:name('description'),content('')
    link:rel('icon'),type('image/x-icon'),href('./favicon.ico')
  }
  body {
    h1{`Hello JML World`}
  }
}

Expected Result

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Untitled-1</title>
    <meta name="description" content="">
    <link rel="icon" type="image/x-icon" href="./favicon.ico">
</head>
<body>
    <h1>Hello JML World</h1>
</body>
</html>

Resources

License

This study is covered by the Ascoos General License (AGL). See LICENSE.md.