mirror of
				https://github.com/alecthomas/chroma.git
				synced 2025-10-30 23:57:49 +02:00 
			
		
		
		
	Analysre for PHP.
This commit is contained in:
		| @@ -1,6 +1,8 @@ | ||||
| package circular | ||||
|  | ||||
| import ( | ||||
| 	"strings" | ||||
|  | ||||
| 	. "github.com/alecthomas/chroma" // nolint | ||||
| 	"github.com/alecthomas/chroma/lexers/h" | ||||
| 	"github.com/alecthomas/chroma/lexers/internal" | ||||
| @@ -81,4 +83,9 @@ var PHP = internal.Register(DelegatingLexer(h.HTML, MustNewLexer( | ||||
| 			{`[${\\]`, LiteralStringDouble, nil}, | ||||
| 		}, | ||||
| 	}, | ||||
| ))) | ||||
| ).SetAnalyser(func(text string) float32 { | ||||
| 	if strings.Contains(text, "<?php") { | ||||
| 		return 0.5 | ||||
| 	} | ||||
| 	return 0.0 | ||||
| }))) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user