Skip to content

Latest commit

 

History

History
65 lines (56 loc) · 1.91 KB

File metadata and controls

65 lines (56 loc) · 1.91 KB

Planned SHP 2.0 changes

These changes are breaking compatibility with SHP 1

General

  • All functional characters can be escaped with a \
  • Automatic detection whether a tag is scoped. Tags are prefixed with a $.
    $body {
      $img[src="path/to/img.png"] // not scoped
      $script[src="path/to/script.js"] // scoped
    }
    
  • Standard preformatted tags are detected automatically. To explicitly enable preformatted feature use a % prefix. Content of preformatted tags (both auto-detected and explicit) is not parsed as SHP.
    $pre {
      $some[shp=code] {that is ignored\}
      until unescaped close bracked is encountered
    }
    %style { // explicit preform.
      html {margin: 0\}
    }
    
  • Add an option to add a space after otherwise not preformatted tags with a _ suffix. By default the tags are not separated by spaces.
    $b_ {Hello} world // <b>hello</b> world
    $b {Ban} ana // <b>Ban</b>ana
    
  • Automatically escape HTML functional characters
    $p {In <p> you can define paragraphs}
    // <p>In &lt;p&gt; you can define paragraphs</p>
    

Tag attributes

  • Restore equal sign = in attributes without quick prefix
    $img[#BannerLogo src="path/to/img.png"]
    
  • Literals are now exclusively created with " double quotes
  • Quick flags can be set as true or false with + and ! prefixes respectively
    $div[+hidden] // hidden = true
    $video[!controls] // controls = false
    

Functions

  • Functions now accept variables for easier formatting, example
    @define[#MySection ?sectionID] {
      $section[#?[sectionID]]
    }
    
  • New pair of functions was added: @slot / @insert, define a slot once and insert into it many times, example
    $head {@slot[#head]}
    @insert[#head] {$meta[charset='utf-8']}
    @insert[#head] {$title {My webpage}}
    
    When no content is inserted into the slot there should be a way to provide a default value