Skip to content

Commit

Permalink
[feature #11] Allow to customize authors style
Browse files Browse the repository at this point in the history
  • Loading branch information
martinec committed May 7, 2021
1 parent af49bfe commit e9717bb
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.2.0
## 05/07/2021

1. [](#new)
* Allow to customize authors style using CSS (feature-request #11)

# v1.1.1
## 04/24/2018

Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Grav BibTeXify Plugin

![](assets/bibtexify.png)
Expand Down Expand Up @@ -90,6 +91,26 @@ Options can be passed as attributes of the shortcode, a summary of the current o
</tbody>
</table>

# Cookbook

## Show only the first n authors

Starting `v1.2.0`, this can be achieved using CSS.

```css
.bibtexify-authors li {
display:none;
}

.bibtexify-authors li:nth-child(-n+2) {
display: inline;
}

.bibtexify-authors .bibtexify-author-etal:before {
content: ", et al.";
}
```

# Known issues

- [bib-publication-list](https://github.com/vkaravir/bib-publication-list) have some issues dealing with escaped characters. A possible workaround is to use [JabRef](http://www.jabref.org) to convert the LaTeX encodings to Unicode characters as follows: `Menu Edit > Select All` then `Menu Quality > Cleanup entries`, finally add a new formatter for `all-text-fields` with the operation `Latex to Unicode` and click OK.
Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: BibTeXify
version: 1.1.1
version: 1.2.0
description: "This plugin turn a list of BibTeX references into an interactive page"
icon: book
author:
Expand Down
25 changes: 19 additions & 6 deletions css/bibtexify.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ span.undefined {
text-align: center;
width: 100%;
font-size: small;
-webkit-transform: rotate(-90deg); //Chrome, Safari
-moz-transform: rotate(-90deg); //Firefox
-o-transform: rotate(-90deg); //Opera
-ms-transform: rotate(-90deg); //IE
transform: rotate(-90deg); //браузеры без префексов
-webkit-transform: rotate(-45deg); //Chrome, Safari
-moz-transform: rotate(-45deg); //Firefox
-o-transform: rotate(-45deg); //Opera
-ms-transform: rotate(-45deg); //IE
transform: rotate(-45deg); //браузеры без префексов
}

.pub {
Expand Down Expand Up @@ -92,7 +92,7 @@ transform: rotate(-90deg); //браузеры без префексов

.legend {
margin-bottom: 20px;
margin-top: 40px;
margin-top: 60px;
text-align: center;
width: 100%;
}
Expand Down Expand Up @@ -266,3 +266,16 @@ a.bibtexify-link-bibtex {
a.bibtexify-link-bibtex:hover {
background-position: 0 -16px;
}

.bibtexify-authors {
display:inline;
list-style-type: none;
margin: 0;
padding: 0;
}

.bibtexify-authors li {
display:inline;
margin: 0;
padding: 0;
}
9 changes: 5 additions & 4 deletions js/bibtexify.js
Original file line number Diff line number Diff line change
Expand Up @@ -2517,12 +2517,13 @@ var bibtexify = (function($) {
},
// converts the given author data into HTML
authors2html: function(authorData) {
var authorsStr = '';
var authorsHtml = '';
for (var index = 0; index < authorData.length; index++) {
if (index > 0) { authorsStr += ", "; }
authorsStr += authorData[index].last;
authorSep = index > 0 ? ", " : "";
authorsHtml = authorsHtml + '<li>' + '<span class="bibtexify-author-separator">' + authorSep + '<\/span>' + '<span class="bibtexify-author"><span class="bibtexify-author-lastname">' + htmlify(authorData[index].last) + '<\/span><\/span>' + '<\/li>';
}
return authorData ? '<span class="bibtexify-author">' + htmlify(authorsStr) + '<\/span>' : '';
var etalHtml = authorData.length > 2 ? '<span class="bibtexify-author-etal"><\/span>' : '';
return authorData ? '<ul class="bibtexify-authors">' + authorsHtml + etalHtml + '<\/ul>' : '';
},
// converts the given year data into HTML
year2html: function(yearData) {
Expand Down

0 comments on commit e9717bb

Please sign in to comment.