Giter Club home page Giter Club logo

Comments (9)

benperiton avatar benperiton commented on May 17, 2024 1

am not sure if bibliography supports needs to be part of the core relaxed project or could be a side project, something that you just import and it gives you bibliography support.

I think that would be pretty awesome, also having some hooks that would allow people to write plugins for certain actions, pre-parse, post-parse, post-render etc

from relaxed.

afhoffman92 avatar afhoffman92 commented on May 17, 2024

Please forgive me if I'm being ignorant...I'm not a JS programmer. It looks like a JS project exists for parsing BibTeX databases already. I'll try to poke at it a little bit, but it looks like this would be a good start for adding citation/bibliography capability.

I think it'd be a good idea if whatever citation capability that's added can directly parse BibTeX databases since most users interested in this feature are probably coming to ReLaXed from LaTeX and are likely already generating their bibliography database files with something like JabRef or Mendeley.

Edit: It looks like https://citation.js.org/ may be a better choice? I've been in C++ and Python for years and I've never touched JS or NodeJS before.

from relaxed.

DanielRuf avatar DanielRuf commented on May 17, 2024

https://github.com/larsgw/citation.js/tree/master#starting looks indeed very promising. It uses https://github.com/juris-m/citeproc-js

from relaxed.

afhoffman92 avatar afhoffman92 commented on May 17, 2024

I agree. Citation.js looks like it'll do the job. I have some downtime so I'll play with it a little and see what I can come up with.

Edit:
I did a little exploration just with using citation-js (again, I'll be slow at this. Someone more competent with NodeJS will probably end up writing this feature), but I have just a few notes:

  1. Citation-JS can create citations directly from DOI numbers. It may be useful for some users to specify their bibliography database as a list of keys and DOI's rather than formatting a BibTeX database.

  2. Citation-JS seems to get upset when parsing BibTeX entries that have math characters in them. For example, I tested with a BibTeX database containing a single entry generated by Mendeley. Some fields have LaTeX control sequences (specificially \backslash, \textless, \textgreater in my case) that cause citation-js to throw a syntax error for "Escape sequence not recognized". In the end I bet it's possible to sanitize this input to prevent errors, but it may be better to throw a descriptive error message so the user can make a more intelligent fix based on the situation.

  3. Citation-JS doesn't recognize all possible fields that can be specified in a BibTeX database. Mendeley likes to put the article abstract in the BibTeX database which citation-js ignores. Citation-JS ignores the abstract field, which really isn't an issue for this case. I'm not sure why having the full abstract in a BibTeX database is useful in the first place.

Anyway, after looking at it a little, I think citation-js will be a good way forward. For instance it would be possible to read in BibTeX and parse the entries to JSON and a function could use that JSON to format citations.

from relaxed.

Zulko avatar Zulko commented on May 17, 2024

@afhoffman thanks for the exploration. Some thoughts of this:

  • It is great stuff and confirms my thoughts that web techs are progressing faster than latex, even for non-mainstream usecases.
  • I am not too optimistic that ReLaXed can fully replace LaTeX any time soon for people wanting to write a full thesis. I would still encourage everyone who has to deal with Bibliography to use LaTeX (that includes me :P)
  • The question here is how to make bibliography as easy as LaTeX in Pug. I have an intuition that a lot could be achieved using Pug mixins, as they allow javascript execution. So you would have +cite and +bibliogrpahy and +bibitem mixins and then your code would look like this:
p The Pug language has been praised in the past (+cite(Zulko2017), +cite(McPugface2015)).

// end of page
+bibliography
  • I am not sure if bibliography supports needs to be part of the core relaxed project or could be a side project, something that you just import and it gives you bibliography support.

To answer your question @afhoffman some (old) bibliography managers allow you to browse Bibtex files like if they were databases, so having the full abstract was a way to explore and identify the papers you want to cite. This has been made obsolete by Mendeley which connects to the Internet.

from relaxed.

afhoffman92 avatar afhoffman92 commented on May 17, 2024

I agree. I think ReLaXed has a ways to go before it could fully replace LaTeX in those cases, but it seems like it'll be much, much easier to use than LaTeX. I don't think anyone will argue that sometimes doing simple things in LaTeX can be too difficult and/or time-consuming. ReLaXed seems like it'll be much more straightforward, even when it's more mature.

I like the usage example you show there, I think that's exactly what users would want to see when it comes to citation support.

Keeping the bibliography support separate may be a good idea. It'd help you keep the core ReLaXed source code small and users who don't care about bibliography support wouldn't be bothered with it.

from relaxed.

Drew-S avatar Drew-S commented on May 17, 2024

I was able to accomplish a bibliography using citation-js. It is not a built in solution for relaxed yet, since I got a working example, I will clone the repo and see if I can make it into a built in system. Bibliography setup. Made a quick forked version with bibliography support: Drew-S/ReLaXed

from relaxed.

Drew-S avatar Drew-S commented on May 17, 2024

We can mark this a closed, now that citation-js is implemented by #64.

from relaxed.

Zulko avatar Zulko commented on May 17, 2024

I noticed that the bibliography system has no footprint (=extra duration) at all even on documents with a HUGE dom, that's pretty remarkable. Thanks @Drew-S ! Next step will be to add proper documentation.

from relaxed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.