Browse Source

Partial BibTeX support

pjc 5 years ago
parent
commit
3dd513832a
1 changed files with 21 additions and 18 deletions
  1. 21
    18
      sections/torrents/details.php

+ 21
- 18
sections/torrents/details.php View File

639
     if (!empty($Description)) {
639
     if (!empty($Description)) {
640
         echo "\n<blockquote>".Text::full_format($Description).'</blockquote>';
640
         echo "\n<blockquote>".Text::full_format($Description).'</blockquote>';
641
     }
641
     }
642
-    if (!empty($MediaInfo)) {
642
+    if (!empty($MediaInfo) && $MediaInfo === 'nil') { # Kludge
643
         $parsed = MediaInfo::parse($MediaInfo);
643
         $parsed = MediaInfo::parse($MediaInfo);
644
         echo "\n<blockquote>";
644
         echo "\n<blockquote>";
645
         if (!empty($parsed)) {
645
         if (!empty($parsed)) {
649
   <div class="spoilerContainer hideContainer">
649
   <div class="spoilerContainer hideContainer">
650
     <input type="button" class="spoilerButton" value="Show BibTeX" /><blockquote class="spoiler hidden">
650
     <input type="button" class="spoilerButton" value="Show BibTeX" /><blockquote class="spoiler hidden">
651
 <?php
651
 <?php
652
-            echo 'Coming Soon!';
653
-            /*
654
-            # @todo Seriously consider another way to do this
655
-            $bibtex .= '<pre>';
656
-            $bibtex .= "@misc{ BioTorrents.de-$TorrentID,";
657
-            $bibtex .= "  author = \"$Artist1 and $Artist2 and $ArtistN and $UserID\",";
658
-            $bibtex .= "  title  = \"$Title\",";
659
-            $bibtex .= "  year   = \"2019\",";
660
-            $bibtex .= "  url    = \"https://biotorrents.de/torrents.php?torrentid=$TorrentID\",";
661
-            $bibtex .= "  note   = \"Online; accessed $Y-m-d\",";
662
-            $bibtex = '}';
663
-            $bibtex .= '</pre>';
664
-
665
-            echo $bibtex;
666
-            #echo Text::full_format($MediaInfo);
667
-            */
668
-        ?>
652
+
653
+# Make a BibTeX citation
654
+$bibtex = "
655
+<pre>
656
+@misc{ BioTorrents.de-$TorrentID,";
657
+
658
+  foreach ($Artists as $Num => $Artist) {
659
+    $bibtex .= "\n  author = '".Artists::display_artist($Artist)."',";
660
+  }
661
+  
662
+$bibtex .= "
663
+  title  = '$GroupName',
664
+  year   = '$GroupYear',
665
+  url    = 'https://biotorrents.de/torrents.php?torrentid=$TorrentID',
666
+  note   = 'Online; accessed ".strftime('%Y-%m-%d')."',
667
+}";
668
+
669
+echo $bibtex;
670
+?>
671
+
669
     </blockquote>
672
     </blockquote>
670
   </div>
673
   </div>
671
 <?php
674
 <?php

Loading…
Cancel
Save