use table render hook instead of refactor
This commit is contained in:
		
							
								
								
									
										39
									
								
								layouts/_default/_markup/render-table.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								layouts/_default/_markup/render-table.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| <div class="table-wrapper"> | ||||
|   <table | ||||
|     {{- range $k, $v := .Attributes }} | ||||
|       {{- if $v }} | ||||
|         {{- printf " %s=%q" $k $v | safeHTMLAttr }} | ||||
|       {{- end }} | ||||
|     {{- end }}> | ||||
|     <thead> | ||||
|       {{- range .THead }} | ||||
|         <tr> | ||||
|           {{- range . }} | ||||
|             <th | ||||
|               {{- with .Alignment }} | ||||
|                 {{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }} | ||||
|               {{- end -}} | ||||
|             > | ||||
|               {{- .Text -}} | ||||
|             </th> | ||||
|           {{- end }} | ||||
|         </tr> | ||||
|       {{- end }} | ||||
|     </thead> | ||||
|     <tbody> | ||||
|       {{- range .TBody }} | ||||
|         <tr> | ||||
|           {{- range . }} | ||||
|             <td | ||||
|               {{- with .Alignment }} | ||||
|                 {{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }} | ||||
|               {{- end -}} | ||||
|             > | ||||
|               {{- .Text -}} | ||||
|             </td> | ||||
|           {{- end }} | ||||
|         </tr> | ||||
|       {{- end }} | ||||
|     </tbody> | ||||
|   </table> | ||||
| </div> | ||||
| @@ -1,13 +1,5 @@ | ||||
| {{ $content := .Content }} | ||||
|  | ||||
| <!-- Handle tables --> | ||||
| {{ if findRE `<table` $content }} | ||||
|   {{ $content = replace $content `<table` `<div class="table-wrapper"><table` }} | ||||
|   {{ $content = replace $content `</table>` `</table></div>` }} | ||||
|   {{ $content = replace $content `<code><div class="table-wrapper">` `<code>` }} | ||||
|   {{ $content = replace $content `</table></div></code>` `</table></code>` }} | ||||
| {{ end }} | ||||
|  | ||||
| <!-- Change checkbox icons --> | ||||
| {{ if findRE `<input.*type="checkbox"` $content }} | ||||
|   <!-- first replace the li with task-list-item class --> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 geekifan
					geekifan