Compare commits

...

2 Commits

Author SHA1 Message Date
Rob Muhlestein a938f46b2e
Drop BUILD 1 year ago
Rob Muhlestein b6992b4430
Add support for backtick instead of pre 1 year ago

17
BUILD

@ -1,17 +0,0 @@
When releasing any new version the following should be immediately
updated to use the latest version so as to not force multiple, redundant
versions of compiled bonzai package to be linked into Bonzai command
tree binaries. The order matters because of interdepdencies:
1. rwxrob/compcmd
2. rwxrob/compfile
3. rwxrob/help
4. rwxrob/vars
5. rwxrob/conf
6. rwxrob/bonzai-example
7. rwxrob/bon
8. rwxrob/z
(others as needed)
This process has not yet been updated, but should be.

@ -69,7 +69,7 @@ func (s *Block) String() string { return string(s.V) }
// a BonzaiMark document. This simplicity and clarity of 4-space tokens
// far outweighs the advantages of alternatives (such as fences).
//
// PEGN Spefication
// PEGN Specification
//
// Grammar <-- Block*
// Block <-- Bulleted / Numbered / Verbatim / Paragraph
@ -173,6 +173,8 @@ var begBold = regexp.MustCompile(`^\*{2}\p{L}`)
var endBold = regexp.MustCompile(`^\p{L}\*{2}`)
var begItalic = regexp.MustCompile(`^\*\p{L}`)
var endItalic = regexp.MustCompile(`^\p{L}\*`)
var begCode = regexp.MustCompile(`^` + "`" + `\p{L}`)
var endCode = regexp.MustCompile(`^\p{L}` + "`")
// Emph renders BonzaiMark emphasis spans specifically for
// VT100-compatible terminals (which almost all are today):
@ -180,7 +182,8 @@ var endItalic = regexp.MustCompile(`^\p{L}\*`)
// *Italic*
// **Bold**
// ***BoldItalic***
// <under> (keeping brackets)
// <Under> (keeping brackets)
// `Code`
//
// See Mark for block formatting and term for terminal rendering.
func Emph[T string | []byte | []rune](buf T) string {
@ -256,6 +259,21 @@ func Emph[T string | []byte | []rune](buf T) string {
continue
}
// `Code`
if s.Match(begCode) > 0 {
nbuf = append(nbuf, []rune(term.Under)...)
for s.Scan() {
if s.Match(endCode) > 0 {
nbuf = append(nbuf, s.R)
nbuf = append(nbuf, []rune(term.Reset)...)
s.E++
break
}
nbuf = append(nbuf, s.R)
}
continue
}
nbuf = append(nbuf, s.R)
} // end main scan loop

@ -167,6 +167,16 @@ func ExampleEmph_italic() {
// * Italic *
}
func ExampleEmph_code() {
term.Under = `<code>`
term.Reset = `<reset>`
fmt.Println(Z.Emph("`Code`"))
fmt.Println(Z.Emph("` Code `"))
// Output:
// <code>Code<reset>
// ` Code `
}
func ExampleEmph_basics() {
// Emph observes the term escapes

Loading…
Cancel
Save