@@ -119,7 +119,8 @@ def convert_to_html(data: Dict[str, Any], apply_amendments: bool = False, up_to_
119119 ikraft_datum = format_datetime (data .get ('ikraftDateTime' ))
120120
121121 # Extract other metadata
122- forarbeten = clean_text (data .get ('forarbeten' , '' ))
122+ register_data = data .get ('register' , {})
123+ forarbeten = clean_text (register_data .get ('forarbeten' , '' ))
123124 celex_nummer = data .get ('celexnummer' )
124125 eu_direktiv = data .get ('eUdirektiv' , False )
125126 organisation_data = data .get ('organisation' , {})
@@ -169,54 +170,68 @@ def convert_to_html(data: Dict[str, Any], apply_amendments: bool = False, up_to_
169170 html_doc = create_html_head (rubrik_original , beteckning )
170171 html_doc += "\n <body>"
171172
172- html_doc += f"""
173- <div class="metadata">
174- <dl>
173+ # Build metadata in two columns
174+ column1_items = []
175+ column2_items = []
176+
177+ # Column 1: Basic document info
178+ column1_items .append (f"""
175179 <dt>Beteckning:</dt>
176- <dd property="eli:id_local" datatype="xsd:string">{ html .escape (beteckning )} </dd>"""
177-
180+ <dd property="eli:id_local" datatype="xsd:string">{ html .escape (beteckning )} </dd>""" )
181+
178182 if organisation :
179- html_doc += f"""
183+ column1_items . append ( f"""
180184 <dt>Departement:</dt>
181- <dd property="eli:passed_by" datatype="xsd:string">{ html .escape (organisation )} </dd>"""
182-
183- if publicerad_datum :
184- html_doc += f"""
185- <dt>Publicerad:</dt>
186- <dd property="eli:date_publication" datatype="xsd:date">{ html .escape (publicerad_datum )} </dd>"""
187-
188- if utfardad_datum :
189- html_doc += f"""
190- <dt>Utfärdad:</dt>
191- <dd property="eli:date_document" datatype="xsd:date">{ html .escape (utfardad_datum )} </dd>"""
192-
193- if ikraft_datum :
194- html_doc += f"""
195- <dt>Ikraft:</dt>
196- <dd property="eli:date_entry-into-force" datatype="xsd:date">{ html .escape (ikraft_datum )} </dd>"""
197-
185+ <dd property="eli:passed_by" datatype="xsd:string">{ html .escape (organisation )} </dd>""" )
186+
187+ if pdf_url :
188+ column1_items .append (f"""
189+ <dt>PDF-fil:</dt>
190+ <dd><a href="{ html .escape (pdf_url )} " property="eli:is_realized_by" datatype="xsd:anyURI">PDF-fil</a></dd>""" )
191+
198192 if forarbeten :
199- html_doc += f"""
193+ column1_items . append ( f"""
200194 <dt>Förarbeten:</dt>
201- <dd property="eli:preparatory_act" datatype="xsd:string">{ html .escape (forarbeten )} </dd>"""
202-
195+ <dd property="eli:preparatory_act" datatype="xsd:string">{ html .escape (forarbeten )} </dd>""" )
196+
203197 if celex_nummer :
204- html_doc += f"""
198+ column1_items . append ( f"""
205199 <dt>CELEX:</dt>
206- <dd property="eli:related_to" resource="{ html .escape (celex_nummer )} " datatype="xsd:string">{ html .escape (celex_nummer )} </dd>"""
207-
200+ <dd property="eli:related_to" resource="{ html .escape (celex_nummer )} " datatype="xsd:string">{ html .escape (celex_nummer )} </dd>""" )
201+
208202 if eu_direktiv :
209- html_doc += """
203+ column1_items . append ( """
210204 <dt>EU-direktiv:</dt>
211- <dd property="eli:type_document" resource="http://data.europa.eu/eli/ontology#directive" datatype="xsd:boolean">Ja</dd>"""
212-
213- if pdf_url :
214- html_doc += f"""
215- <dt>PDF-fil:</dt>
216- <dd><a href="{ html .escape (pdf_url )} " property="eli:is_realized_by" datatype="xsd:anyURI">PDF-fil</a></dd>"""
217-
218- html_doc += """
219- </dl>
205+ <dd property="eli:type_document" resource="http://data.europa.eu/eli/ontology#directive" datatype="xsd:boolean">Ja</dd>""" )
206+
207+ # Column 2: Dates and links
208+ if publicerad_datum :
209+ column2_items .append (f"""
210+ <dt>Publicerad:</dt>
211+ <dd property="eli:date_publication" datatype="xsd:date">{ html .escape (publicerad_datum )} </dd>""" )
212+
213+ if utfardad_datum :
214+ column2_items .append (f"""
215+ <dt>Utfärdad:</dt>
216+ <dd property="eli:date_document" datatype="xsd:date">{ html .escape (utfardad_datum )} </dd>""" )
217+
218+ if ikraft_datum :
219+ column2_items .append (f"""
220+ <dt>Ikraft:</dt>
221+ <dd property="eli:date_entry-into-force" datatype="xsd:date">{ html .escape (ikraft_datum )} </dd>""" )
222+
223+ html_doc += f"""
224+ <div class="metadata">
225+ <div class="metadata-column">
226+ <dl>
227+ { '' .join (column1_items )}
228+ </dl>
229+ </div>
230+ <div class="metadata-column">
231+ <dl>
232+ { '' .join (column2_items )}
233+ </dl>
234+ </div>
220235 </div>"""
221236
222237 # Add the rest of the HTML document
@@ -592,10 +607,25 @@ def get_common_styles() -> str:
592607 padding: 15px;
593608 border-radius: 5px;
594609 margin-bottom: 20px;
610+ display: grid;
611+ grid-template-columns: 1fr 1fr;
612+ gap: 20px;
613+ }}
614+
615+ .metadata-column {{
616+ display: flex;
617+ flex-direction: column;
595618 }}
596619
597620 .metadata dt {{ font-weight: bold; }}
598621 .metadata dd {{ margin-left: 20px; margin-bottom: 5px; }}
622+
623+ @media (max-width: 768px) {{
624+ .metadata {{
625+ grid-template-columns: 1fr;
626+ gap: 10px;
627+ }}
628+ }}
599629
600630 h1 {{
601631 color: var(--selex-dark-blue);
0 commit comments