B4J Library [B4X][Web] MiniHtml

Version: 0.20

Yet the potential or use cases of this library may be unknown as you can literally write plain HTML and save it as a file.

Example 1:
B4X:
H1.Text("Hello, World!")

Output:
Hello, World!
HTML:
<h1>Hello, World!</h1>

Example 2:
B4X:
Paragraph.up(main1) _
.Text("This is a ") _
.add(Span.Text("red text").addClass("text-danger")) _
.Text(" in a ") _
.add(Bold.text("paragraph"))

Output:
This is a red text in a paragraph
HTML:
<p>This is a
    <span class="text-danger">red text</span> in a
    <b>paragraph</b>
</p>

Example using HTMX:
GitHub: https://github.com/pyhoon/MiniHtml-B4X
 

Attachments

  • MiniHtml.b4xlib
    37 KB · Views: 3
Last edited:

aeric

Expert
Licensed User
Longtime User
Version: 0.08
Minor updates.

What's New:
  1. Add Plain module
  2. Update Document module
    • Add Append2 sub
    • Update AppendDocType sub
  3. Update Tag module
    • Add multiline sub
    • Add small tag in Initialize sub
    • Update build2 sub
    • Update meta_preset sub
    • Update PrintInnerTags sub
 

aeric

Expert
Licensed User
Longtime User
Big updates!
Version: 0.20

What's New​

  1. Added ConvertToTag sub to MiniHtmlParser and improved from previous ConvertTagNodeToTag sub
  2. Added Snippets (33 snippets)
  3. Added Icon module
  4. Added Tfoot module
  5. Aded sub in Tag class
    • responsive
    • Tags
    • build3
    • build4
    • add
    • add2
    • add3
    • addTo
    • addTo2
    • addTo3
    • addSibling
    • addSibling2
    • addSibling3
    • addSibling4
    • down
    • down2
    • down3
    • up
    • up2
    • up3
    • sib
    • sib2
    • sib3
    • sib4
    • hrefOf
    • srcOf
    • typeOf
    • setAttributes
    • addAction
    • action
    • PrintMe
  6. Added property in Tag class
    • Parent
    • Children
    • Siblings
    • id
    • name
  7. Added sub in Html module
    • comment
    • comment2
  8. Added sub in Document module
    • mIndentString
    • setIndentString
    • AddIndent2

What's Updated​

  1. GenerateHtml sub test code in Main
  2. Create B4xlib macros in Main to include Snippets folder
  3. Added in most modules with following new subs
    • id
    • name
    • cls
    • sty
    • add
    • up
  4. Some subs removed in the modules
  5. New methods added Html module added
    • comment
    • comment2
  6. Added more tags for uniline for Initialize sub in Tag class
  7. Updated code for build and build2 subs to use new build3 sub in Tag sub
  8. Updated code in Tag class with new subs
  9. Updated code for required sub
  10. Updated example in README

What's Changed​

  1. Renamed variables in Document module
    • mTabs to mIndents
  2. Renamed subs in Document module
    • setTabs to setIndents
    • AddTabs to AddIndent
    • TabsIncrease to IndentMore
    • TabsDecrease to IndentLess
  3. Renamed subs in Tag class
    • innerTags to Children
    • innerTag to Child
    • innerTagById to ChildById
    • PrintInnerTags to PrintChildren
    • attribute to attr
    • attribute2 to attr2
    • attribute3 to attr3
    • setJsonAttributes to attr4
  4. Renamed property in Tag class
    • Name to TagName
  5. Renamed constant in tag class
    • mNormal to mMultiline
  6. Renamed modules name
    • Select to Dropdown
    • Table to HtmlTable
  7. Append sub returns as Document object
  8. Append2 sub does not return as Document object
  9. Renamed other local variables inside subs for standardization and avoid conflict
    • name
    • tagName
    • tagId
    • href

What's Removed​

  1. ConvertTagNodeToTag sub in Main
  2. Some suspected unused subs set to Private before remove in the future
    • innerText
    • TextInline
    • TextNextLine
Too many changes and I must have missed something.

Check the Snippets!
It maybe useful for creating web pages to be use in Pakai server framework.
 
Top