Comments (9)
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.
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.
https://github.com/larsgw/citation.js/tree/master#starting looks indeed very promising. It uses https://github.com/juris-m/citeproc-js
from relaxed.
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:
-
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.
-
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.
-
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.
@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.
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.
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.
We can mark this a closed, now that citation-js
is implemented by #64.
from relaxed.
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)
- masterToPDF fails on second run HOT 1
- Add support for running ReLaXed directly in NodeJS, without CLI HOT 8
- Passing JSON object to ReLaXed: wiki needs to be updated! HOT 5
- Documentation for 'headElements' says 'htmlHead' HOT 1
- Implementation of Knuth & Plass Algorithm
- [Question] Only last page footer text is showing with color. Other page footer text is existing but transparent. HOT 2
- Load JSON and listen to changes? HOT 3
- Using relaxedjs as a node module in AWS and run once HOT 2
- Vegalite SVG render broken HOT 6
- Hj
- Failed to install Relaxed on Ubuntu18.04 on EC2 HOT 1
- How to make pdf pages in horizontal orientation? HOT 1
- Any Ideas for better Debugging Support in the Browser? HOT 4
- Fix security vulnerabilities HOT 1
- Is relaxedjs still under active development? HOT 6
- Math Typeface Not Rendering Properly HOT 1
- Unable to use ReLaXed with Node v16 HOT 3
- Please publish current version (0.2.5) to npmjs.com HOT 1
- Error: Failed to launch the browser process HOT 3
- Sign PDF with digital certificate
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from relaxed.