Browse Source

Artiklite eksport: VÕTMESÕNAD JA MEETODID

Ardo Kubjas 3 months ago
parent
commit
be19b6482b
1 changed files with 28 additions and 21 deletions
  1. 28 21
      save_articles_to_pdf.py

+ 28 - 21
save_articles_to_pdf.py

@@ -522,27 +522,34 @@ def create_pdf_from_articles(articles, output_filename):
             elements.append(Spacer(1, 12))
 
         # VÕTMESÕNAD JA MEETODID
-        tags_data = []
-        if article['key_concepts']:
-            concepts_text = ", ".join(article['key_concepts'][:10])  # Piirang: 10 mõiste
-            tags_data.append(['Võtmesõnad:', concepts_text])
-        if article['methods_used']:
-            methods_text = ", ".join(article['methods_used'])
-            tags_data.append(['Meetodid:', methods_text])
-
-        if tags_data:
-            tags_table = Table(tags_data, colWidths=[2*cm, 12*cm])
-            tags_table.setStyle(TableStyle([
-                ('FONTNAME', (0, 0), (-1, -1), 'Helvetica'),
-                ('FONTSIZE', (0, 0), (-1, -1), 9),
-                ('BOTTOMPADDING', (0, 0), (-1, -1), 4),
-                ('TOPPADDING', (0, 0), (-1, -1), 4),
-                ('VALIGN', (0, 0), (-1, -1), 'TOP'),
-                ('TEXTCOLOR', (0, 0), (0, -1), colors.HexColor('#5d6d7e')),
-                ('LEFTPADDING', (0, 0), (0, -1), 0),
-            ]))
-            elements.append(tags_table)
-            elements.append(Spacer(1, 12))
+        if article['key_concepts'] or article['methods_used']:
+            
+            # Luua väike pealkiri stiil
+            small_label_style = ParagraphStyle(
+                'SmallLabel',
+                parent=styles['Normal'],
+                fontSize=8,
+                textColor=colors.HexColor('#7f8c8d'),
+                spaceAfter=2,
+            )
+            
+            content_style = ParagraphStyle(
+                'TagContent',
+                parent=styles['Normal'],
+                fontSize=9,
+                spaceAfter=4,
+            )
+            
+            if article['key_concepts']:
+                concepts_text = ", ".join(article['key_concepts'][:10])
+                elements.append(Paragraph("<b>Võtmesõnad:</b> " + concepts_text, content_style))
+            
+            if article['methods_used']:
+                methods_text = ", ".join(article['methods_used'][:8])
+                elements.append(Paragraph("<b>Meetodid:</b> " + methods_text, content_style))
+            
+            elements.append(Spacer(1, 6))
+
 
         # ABSTRAKT (inglise keeles)
         if article['abstract_en']: