Humans-of-Julia / Bibliography.jl

General bibliography manager in pure Julia
MIT License
65 stars 13 forks source link

Stripping out { curly } braces? #9

Open ali-ramadhan opened 4 years ago

ali-ramadhan commented 4 years ago

Was wondering if it's possible to strip out curly braces { and } from titles (or apply the formatting) in Bibliography.xtitle?

Example:

julia> using Bibliography

julia> bib = import_bibtex("example.bib")

julia> [Bibliography.xtitle(entry) for entry in values(bib)]
3-element Array{String,1}:
 "Walking with coffee: { Why } does it spill?"
 "Principia { Mathematica }"
 "Fourth-order \$2N\$-storage Runge--Kutta schemes"

Bibliography file:

@article{Mayer2012,
  title = {Walking with coffee: {Why} does it spill?},
  author = {Mayer, H. C. and Krechetnikov, R.},
  journal = {Physical Review E},
  volume = 85,
  issue = 4,
  pages = {046117},
  numpages = 7,
  year = 2012,
  doi = {10.1103/PhysRevE.85.046117}
}

@book{useful_proof,
    author = {Alfred North Whitehead and Bertrand Russell},
    title = {Principia {Mathematica}},
    volume = 1,
    year = 1925,
    address = {Cambridge},
    publisher = {Cambridge {University} {Press}},
    isbn = {978-0521067911},
    url = {https://archive.org/details/PrincipiaMathematicaVolumeI}
}

@techreport{CK1994,
  author = {Carpenter, Mark H and Kennedy, Christopher A},
  title = {Fourth-order $2N$-storage Runge--Kutta schemes},
  institution = {National Aeronautics and Space Administration},
  year = {1994},
  number = {NASA TM-109112},
  address = {Langley Research Center, Hampton, VA},
  url={https://ntrs.nasa.gov/api/citations/19940028444/downloads/19940028444.pdf}
}
Azzaare commented 4 years ago

Yes, it should not be hard.

I will check in a couple of days the implications of doing so. Maybe I will make it default with a warning when braces are deleted automatically.

That should be enough for people who need those braces to pay attention.

Give me a couple of days though ;)

EDIT: also, we can make a separate export formating for documenter. Instead of hacking the one for StaticWebPages.jl. Not that it is really required at the moment, but don't feel dependent of the needs of other packages

Azzaare commented 4 years ago

I hacked the function to remove '{' and '}' in the title. However, it is just a temporary measure (I won't tag it), as I need to make something robust (with possibilities to escape and such).

Azzaare commented 3 years ago

I will try to go back to this issue in next version!

LazyScholar commented 3 years ago

Not sure if the bracket removal should be done before a tex2unicode conversion which is done in DocumenterCitation.jl. Wouldn't it be better to do that there or to move the conversion to Bibliograph.jl (as the tex escape codes rely on those brackets)?

Azzaare commented 3 years ago

I think it should be done in Bibliography. Of course meanwhile a temporary hack in DocumenterCitations can be useful.

I will try to have a global solution for Tex2Unicode during summer.

aramirezreyes commented 2 years ago

Has there been any improvement on this? I am trying to use Bibliography in my academic website (built with Franklin). But when building I end up with these strings:

Spontaneous {{Cyclogenesis}} without {{Radiative}} and {{Surface-Flux Feedbacks}}

Argel Ram{\'i}rez Reyes, Da Yang

instead of

Spontaneous Cyclogenesis without Radiative and Surface-Flux Feedbacks

Argel Ramírez Reyes, Da Yang