Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Citation and legend display #5

Open
pickledgator opened this issue Sep 28, 2011 · 2 comments
Open

Citation and legend display #5

pickledgator opened this issue Sep 28, 2011 · 2 comments

Comments

@pickledgator
Copy link

As promised, here are the code snippets for the citations that I recreated. They most closely resemble IEEE format citations (where we publish most of our results). There is some error handling integrated (e.g. if you leave out certain common fields like page numbers) but I only suited the error handling to our needs and not for every possible case.

I'll paste the code here since I'm not sure what else to do with it. We'll see how gitHub handles to formatting...

    inproceedings: function(entryData) {
        var year;
        if(entryData.year=='T.A.'){year="To appear";}
        else{year=entryData.year;}
        return this.authors2html(entryData.author)+", \""+entryData.title+",\" In <em>" +
            entryData.booktitle + "<\/em>, " + year + ((entryData.address)?", " +
            entryData.address+"":"") + ((entryData.pages)?", pp. " + entryData.pages+"":"") + "." ;
    },
            article: function(entryData) {
        var year;
        if(entryData.year=='T.A.'){year="To appear";}
        else{year=entryData.year;}
        return this.authors2html(entryData.author) + ", \"" + entryData.title + ",\" <em>" +
            entryData.journal+"<\/em>" + ((entryData.volume)?", Vol. " + entryData.volume+"":"") +
            ((entryData.number)?"("+entryData.number+")":"") + ((entryData.pages)?", pp. " +
            entryData.pages+"":"") + ((entryData.address)?", " + entryData.address + " ":"") + ", "+year+".";
    },
    book: function(entryData) {
        var year;
        if(entryData.year=='T.A.'){year="To appear";}
        return this.authors2html(entryData.author) + ", <em>" + entryData.title + "<\/em>, " +
            entryData.publisher + ", " + year + ((entryData.issn)?", ISBN: " + entryData.issn + ".":".");
    },
    inbook: function(entryData) {
        return this.authors2html(entryData.author) + ", \"" + entryData.chapter +
            "\" in <em>" + entryData.title + "<\/em>, " +
            ((entryData.editor)?"Edited by " + entryData.editor + ", ":"") +
            entryData.publisher + ", pp. " + entryData.pages + ", " +
            ((entryData.series)?"<em>" + entryData.series + "<\/em>, ":"") +
            ((entryData.volume)?"Vol. " + entryData.volume + ", ":"") +
            entryData.year + ((entryData.issn)?", ISBN: " + entryData.issn + ".":".");
    },

I also changed the stats2html function a little bit which prints the legend. I had some css conflicts with other style tags in my site so I just coded the raw style into the paragraph tag.

    var stats2html = function(item) {
        var str='<p style=\'margin: 0px; font-size: 11px; font-weight: bold; maring-bottom: 10px; border-bottom:1px solid lightGray;\'>'+item.year+' (total '+item.count+')<\/p>';
        str+='<ul>';
        $.each(item.types, function(type,value) {
            str+='<li>'+bib2html.labels[type]+' '+value+'<\/li>';
        });
        return str+'<\/ul>';
    };

You can see the changes here: http://ncr.mae.ufl.edu/index.php?id=publications_searchable

@pickledgator
Copy link
Author

Whoops, left out a line in the book switch case:
else{year=entryData.year;}

@vkaravir
Copy link
Owner

Thanks for the code. I'm not sure what to do with it, though :) In the end, I'd like to include it as an alternative style that could be easily selected when creating the list. Is it okay with you if I include your code in the library?

As for the stats2html function, I changed it a bit to sort the legend entries. I did not include the inline style, though. If you can change the style of the page, you should be able to target the h3 element in the legend with selector #pubyeardetails h3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants