umonolang

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2025 License: MIT Imports: 8 Imported by: 1

README

UmonoLang

A domain-specific language to provide Umono's users to create page contents.

Go Report Card MIT license

Features

  • CommonMark compatibility
  • HTML output
  • Components able to nested for reusability
package main

import (
	ul "github.com/umono-cms/umono-lang"
	"github.com/umono-cms/umono-lang/converters"
)

func main() {
	umonoLang := ul.New(converters.NewHTML())
	umonoLang.SetGlobalComponent("HEADER", "This is a *global* component example.")

	input := `HEADER

CONTENT

{{ LINK text="click me!" url="https://github.com/umono-cms/umono" new-tab=true }}

~ CONTENT
This is a **local** component example.`

  output := umonoLang.Convert(input)
  // <p>This is a <em>global</em> component example.</p><p>This is a <strong>local</strong> component example.</p><p><a href="https://github.com/umono-cms/umono" target="_blank" rel="noopener noreferrer">click me!</a></p>
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call added in v0.2.0

type Call struct {
	// contains filtered or unexported fields
}

func NewCall added in v0.2.0

func NewCall(component interfaces.Component, start int, end int) *Call

func (*Call) Component added in v0.2.0

func (c *Call) Component() interfaces.Component

func (*Call) End added in v0.2.0

func (c *Call) End() int

func (*Call) ParameterByName added in v0.2.0

func (c *Call) ParameterByName(name string) interfaces.Parameter

func (*Call) Parameters added in v0.2.0

func (c *Call) Parameters() []interfaces.Parameter

func (*Call) Start added in v0.2.0

func (c *Call) Start() int

type Parameter added in v0.2.0

type Parameter struct {
	// contains filtered or unexported fields
}

func NewParam added in v0.2.0

func NewParam(name string, value any) *Parameter

func (*Parameter) Name added in v0.2.0

func (p *Parameter) Name() string

func (*Parameter) SetValue added in v0.2.0

func (p *Parameter) SetValue(val any)

func (*Parameter) Value added in v0.2.0

func (p *Parameter) Value() any

type UmonoLang

type UmonoLang struct {
	// contains filtered or unexported fields
}

func New

func New(converter interfaces.Converter) *UmonoLang

func (*UmonoLang) Convert

func (ul *UmonoLang) Convert(raw string) string

func (*UmonoLang) RemoveGlobalComponent

func (ul *UmonoLang) RemoveGlobalComponent(name string) error

func (*UmonoLang) SetGlobalComponent

func (ul *UmonoLang) SetGlobalComponent(name, content string) error

Directories

Path Synopsis
arguments
utils

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL