A (oh horror!) .docx file in Libre Office |
In order to make a literature review I need to compile a MySQL table in the BibTex format.
Now I've got a file, that looks pretty much like a BibTex formatted file. It's compiled from a MySQL database and the output is formatted by PHP.
- file: byb2.php
In the php code this loop will format the output:
while($row = $result->fetch_assoc()){
$books[] = "\n@". $row['Type']
."{" . 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";
}
I made a simple markdown file and compiled it with pandoc. The result was a .docx file.
Here is the output from the database formatted via PHP:
@Book{ARIS_1958,
Author={Aristoteles},
Title={Poetik},
Publisher={Hans Reitzels Forlag},
Year=1958}
etc. etc. etc. etc. etc.
The markdown contains a reference to a book in the BibTex file:
[@ARIS_1958]
Finally the markdown is compiled via pandoc thus:
# pandoc --bibliography=libri.bib test.md -o test.docx
The image above is a screendump from the docx-file in Libre Office. I only refered to Aristoteles, and that's the only work in the list of sources.
Ergo: Q.E.D.
That is: this is just a toolbox. The next step is literature research for the WordPress and Open Source CMS Research Project @ Business Academy Aarhus. And perhaps: come up with title with > x-factor.
No comments:
Post a Comment