Shortcode para renderizar ficheros csv, pensado para la parrilla
This commit is contained in:
		
							parent
							
								
									2bd8c46431
								
							
						
					
					
						commit
						67add2e383
					
				
							
								
								
									
										13
									
								
								README.md
								
								
								
								
							
							
						
						
									
										13
									
								
								README.md
								
								
								
								
							| 
						 | 
					@ -50,3 +50,16 @@ Ejemplo:
 | 
				
			||||||
        <tr><td>Una tabla</td></tr>
 | 
					        <tr><td>Una tabla</td></tr>
 | 
				
			||||||
    </table>
 | 
					    </table>
 | 
				
			||||||
    {{< /rawHTML >}}
 | 
					    {{< /rawHTML >}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### csvTable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Renderiza un csv como una tabla HTML. Hay que pasarle dos parámetros, el path
 | 
				
			||||||
 | 
					del csv relativo a la raíz del proyecto y la clase css que se le asignará a la
 | 
				
			||||||
 | 
					tabla.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Hay que generar un fichero csv separado por comas.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Ejemplo, para un fichero `content/2019/nodos/parrilla_viernes.csv':
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {{< csvTable file="/content/2019/nodos/parrilla_viernes.csv" class="parrilla" >}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,90 +16,7 @@ listas.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Viernes 20
 | 
					## Viernes 20
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{{< rawHTML >}}
 | 
					{{< csvTable file="/content/2019/nodos/parrilla_viernes.csv" class="parrilla" >}}
 | 
				
			||||||
<table class="wikitable">
 | 
					 | 
				
			||||||
    <tbody>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="col"></th>
 | 
					 | 
				
			||||||
            <th scope="col"> ____Gizartetxe____ </th>
 | 
					 | 
				
			||||||
            <th scope="col"> ____Gaztetxe__ </th>
 | 
					 | 
				
			||||||
            <th scope="col"> ____Cine___________ </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 09:00 </th>
 | 
					 | 
				
			||||||
            <th scope="row" colspan="3" rowspan="2"> DESAYUNO / BREAKFAST </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 10:00 </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 11:00 </th>
 | 
					 | 
				
			||||||
            <th scope="row" colspan="3" rowspan="2"> ASAMBLEA PREPARATORIA HACKMEETING </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 12:00 </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 13:00 </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 14:00 </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="2" colspan="3"> COMIDA </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 15:00 </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th> 16:00 </th>
 | 
					 | 
				
			||||||
            <th scope="row" colspan="3" rowspan="2"> ASAMBLEA GENERAL HACKMEETING </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 17:00 </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 18:00 </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> Audio en el fediverso: Introducción a Funkwhale  [<a rel="nofollow" class="external autonumber" href="https://es.hackmeeting.org/hm/index.php?title=Nodos2019#Audio_en_el_fediverso:_Introducci.C3.B3n_a_Funkwhale">[1]</a>] </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 19:00 </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> Cómo funciona internet [<a rel="nofollow" class="external autonumber" href="https://es.hackmeeting.org/hm/index.php?title=Nodos2019#C.C3.B3mo_funciona_internet">[2]</a>] </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="2"> Mesa redonda. Características del software para que empodere nuestras comunidades [<a rel="nofollow" class="external autonumber" href="https://es.hackmeeting.org/hm/index.php?title=Nodos2019#Mesa_redonda._Caracter.C3.ADsticas_del_software_para_que_empodere_nuestras_comunidades">[3]</a>] </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="2"> Ruidismo DIY | Live Coding: Generación de música a través de algoritmos [<a rel="nofollow" class="external autonumber" href="https://es.hackmeeting.org/hm/index.php?title=Nodos2019#Ruidismo_DIY_.7C_Live_Coding:_Generaci.C3.B3n_de_m.C3.BAsica_a_trav.C3.A9s_de_algoritmos">[4]</a>] </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 20:00 </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 21:00 </th>
 | 
					 | 
				
			||||||
            <th scope="row" colspan="3" rowspan="1">  CENA </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 22:30 </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> 10 minutes Talks:
 | 
					 | 
				
			||||||
                <p>Host a radical wordpress MU, tech stuffs of noblogs.org [<a rel="nofollow" class="external autonumber" href="https://es.hackmeeting.org/hm/index.php?title=Nodos2019#Host_a_radical_wordpress_MU.2C_tech_stuffs_of_noblogs.org">[5]</a>]
 | 
					 | 
				
			||||||
                </p>
 | 
					 | 
				
			||||||
            </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 23:00 </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> </th>
 | 
					 | 
				
			||||||
            <th scope="row" rowspan="1"> </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
        <tr>
 | 
					 | 
				
			||||||
            <th scope="row"> 24:00 </th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					 | 
				
			||||||
    </tbody>
 | 
					 | 
				
			||||||
</table>
 | 
					 | 
				
			||||||
{{< /rawHTML >}}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Sábado 21
 | 
					## Sábado 21
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,17 @@
 | 
				
			||||||
 | 
					,Gizartetxe,Gaztetxe,Cine
 | 
				
			||||||
 | 
					09:00:00,DESAYUNO / BREAKFAST,DESAYUNO / BREAKFAST,DESAYUNO / BREAKFAST
 | 
				
			||||||
 | 
					10:00:00,,,
 | 
				
			||||||
 | 
					11:00:00,ASAMBLEA PREPARATORIA HACKMEETING,ASAMBLEA PREPARATORIA HACKMEETING,ASAMBLEA PREPARATORIA HACKMEETING
 | 
				
			||||||
 | 
					12:00:00,,,
 | 
				
			||||||
 | 
					13:00:00,,,
 | 
				
			||||||
 | 
					14:00:00,COMIDA,COMIDA,COMIDA
 | 
				
			||||||
 | 
					15:00:00,,,
 | 
				
			||||||
 | 
					16:00:00,ASAMBLEA GENERAL HACKMEETING,ASAMBLEA GENERAL HACKMEETING,ASAMBLEA GENERAL HACKMEETING
 | 
				
			||||||
 | 
					17:00:00,,,
 | 
				
			||||||
 | 
					18:00:00,Audio en el fediverso: Introducción a Funkwhale [[1]] ,,
 | 
				
			||||||
 | 
					19:00:00,Cómo funciona internet [[2]] ,Mesa redonda. Características del software para que empodere nuestras comunidades [[3]] ,Ruidismo DIY | Live Coding: Generación de música a través de algoritmos [[4]]
 | 
				
			||||||
 | 
					20:00:00,,,
 | 
				
			||||||
 | 
					21:00:00,CENA,CENA,CENA
 | 
				
			||||||
 | 
					22:30:00,,"10 minutes Talks: Host a radical wordpress MU, tech stuffs of noblogs.org [[5]] ",
 | 
				
			||||||
 | 
					23:00:00,,,
 | 
				
			||||||
 | 
					24:00:00,,,
 | 
				
			||||||
		
		
			
  | 
| 
						 | 
					@ -0,0 +1,16 @@
 | 
				
			||||||
 | 
					{{ $class := .Get "class" }}
 | 
				
			||||||
 | 
					{{ $file := .Get "file" }}
 | 
				
			||||||
 | 
					{{ $data := getCSV "," $file }}
 | 
				
			||||||
 | 
					<table class="{{ $class }}">
 | 
				
			||||||
 | 
					{{ range $row, $columns := $data }}
 | 
				
			||||||
 | 
					    <tr>
 | 
				
			||||||
 | 
					    {{ range $columns }}
 | 
				
			||||||
 | 
					        {{ if eq $row 0 }}
 | 
				
			||||||
 | 
					            <th> {{ . }}</th>
 | 
				
			||||||
 | 
					        {{ else }}
 | 
				
			||||||
 | 
					            <td> {{ . }}</td>
 | 
				
			||||||
 | 
					        {{ end }}
 | 
				
			||||||
 | 
					    {{ end }}
 | 
				
			||||||
 | 
					    </tr>
 | 
				
			||||||
 | 
					{{ end }}
 | 
				
			||||||
 | 
					</table>
 | 
				
			||||||
| 
						 | 
					@ -47,3 +47,29 @@ aside a {
 | 
				
			||||||
main {
 | 
					main {
 | 
				
			||||||
    flex: 1;
 | 
					    flex: 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table {
 | 
				
			||||||
 | 
					    border-collapse: collapse;
 | 
				
			||||||
 | 
					    border: 1px solid black;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table th, table td {
 | 
				
			||||||
 | 
					    border: 1px solid black;
 | 
				
			||||||
 | 
					    padding: 0.25em;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table.parrilla td:first-child {
 | 
				
			||||||
 | 
					    font-weight: bold;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table.parrilla td:nth-child(2) {
 | 
				
			||||||
 | 
					    background-color: #ddd;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table.parrilla td:nth-child(3) {
 | 
				
			||||||
 | 
					    background-color: #ccc;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table.parrilla td:nth-child(4) {
 | 
				
			||||||
 | 
					    background-color: #eee
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue