Advertisement
ladyDia

Markup language parser

Jan 24th, 2025 (edited)
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.30 KB | None | 0 0
  1. --[[
  2.     Markup language parser -  takes in a string and parses the tags and data in it into a
  3.     displayable page for users to view. A lot of this will have similarities with HTML, CSS, and JS
  4.     just because I have worked with them before.
  5.  
  6.     Used for network site browser
  7.     Takes in a string and processes it into a visual for a device to display
  8.     Uses a basic markup language with tags for defining sections
  9.     Uses opening and closing tags like HTML.
  10.     Text is automatically wrapped to a new line if it extends too far
  11.     Page has scroll functionality
  12.     Buttons/clickable items to run code or changes to the site
  13.    
  14.     Tag list:
  15.     <head></head>     - The head of the file where variables are defined
  16.     <body></body>     - Where the text and sections are defined
  17.     <text></text>     - Where text is displayed
  18.     <image></image>   - Displays an image on screen (not working on v1)
  19.     <style></style>   - Defines style information for the page
  20.     <script></script> - Defines scripting on the page (not working on v1)
  21.  
  22.     Modifiers on tags:
  23.     id              - Gives an id to a section, can be used to give it a color or other modifiers
  24.     align:left      - Aligns it to the left
  25.     align:center    - Aligns it to the center
  26.     align:right     - Aligns it to the right
  27.     onClick:id      - Runs a function with an ID when clicked on
  28.     show:true/false - If true, the tag is rendered. If false, the tag is not rendered
  29.     href:string     - Holds a link to a page, has different behaviors depending on the tag
  30.  
  31.     Styling for tags (like CSS but not):
  32.     backgroundColor = color - Sets the background color of the section to the specified color. Can only use the
  33.                               colors that computer craft screens supports
  34.     textColor = color       - Sets the text color to the specified color. Can only use the colors that
  35.                               computer craft screens supports
  36.     textSize = number       - Sets the text to the size listed, only uses numbers from 0.5 to 5 (Only has support on monitors)
  37.     borderColor = color     - Sets a border of a color to the section. Can only use the colors that computer craft
  38.                               screens supports. None is an option to disable the border
  39.    
  40.    
  41. --]]
  42. version = "1.0"
  43. dataString = ""
  44. defaultStyling = {
  45.     ["backgroundColor"] = colors.black,
  46.     ["textColor"] = colors.white,
  47.     ["borderColor"] = "none",
  48.     ["textSize"] = 1
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement