31 lines
		
	
	
	
		
			677 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			677 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
{{- $lang := "" -}}
 | 
						|
{{- $text := "" -}}
 | 
						|
 | 
						|
{{- if eq (len .Params) 2 -}}
 | 
						|
  {{- $lang = .Get 0 -}}
 | 
						|
  {{- $text = .Get 1 -}}
 | 
						|
{{- else if eq (len .Params) 1 -}}
 | 
						|
  {{- $text = .Get 0 -}}
 | 
						|
{{- else -}}
 | 
						|
  {{
 | 
						|
    errorf "%s: Invalid number of parameters to %s: Expected 1 or 2, got %d."
 | 
						|
           .Position .Name (len .Params)
 | 
						|
  }}
 | 
						|
{{- end -}}
 | 
						|
 | 
						|
{{- with $parent := .Parent -}}
 | 
						|
  {{- "" -}}
 | 
						|
  <rp>(</rp>
 | 
						|
  {{- "" -}}
 | 
						|
  <rt
 | 
						|
    {{- with $lang }} lang="{{ . }}"{{ end -}}
 | 
						|
  >{{ $text }}</rt>
 | 
						|
  {{- "" -}}
 | 
						|
  <rp>)</rp>
 | 
						|
  {{- "" -}}
 | 
						|
{{- else -}}
 | 
						|
  {{
 | 
						|
    errorf "%s: The %q shortcode is not meant to be called outside of a parent ruby shortcode."
 | 
						|
           .Position .Name
 | 
						|
  }}
 | 
						|
{{- end -}}
 |