Yesterday and today I made a BibTex compiler for WordPress. I have to make a litterature review. By now I'm inspired by Umberto Eco's cardboard file cards. However, nowadays I think that a MySQL database is better suited for the storage.
Here is the system:
- https://github.com/asathoor/libri
Today the final pieces came together. The database has all entries from my bibtex file. Via PHP I can convert the MySQL data to a bibtex format. Here's the trick:
while($row = $result->fetch_assoc()){ print "\n@Book{" . strtoupper( substr($row['Author'], 0,4)) . "_" . $row['Year'] . ",\n Author={" . $row['Author'] . "},\n" . "Title={" . $row['Title'] . "},\n" . "Publisher={" . $row['Where'] . "},\n" . "Year=" . $row['Year'] . "}\n"; }
Some formatting may be done via SQL, here's a sample from my Github repo:
SELECT '@Book{' as 'Book',
concat(left(`Author`,3),`Year`,',') as 'slug',
concat('Author={{' , `Author`, '}},') as 'Author',
concat('Title={{' ,`Title`, '}},') as 'Title',
concat('Year=',`Year`,'}')
FROM `libri`
So the environment for developing the project is almost there.
Some formatting may be done via SQL, here's a sample from my Github repo:
SELECT '@Book{' as 'Book',
concat(left(`Author`,3),`Year`,',') as 'slug',
concat('Author={{' , `Author`, '}},') as 'Author',
concat('Title={{' ,`Title`, '}},') as 'Title',
concat('Year=',`Year`,'}')
FROM `libri`
So the environment for developing the project is almost there.
No comments:
Post a Comment