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

hugo-academic-cli bibtex import is broken with hugo v0.89.0 #104

Closed
ostaadt opened this issue Nov 3, 2021 · 3 comments
Closed

hugo-academic-cli bibtex import is broken with hugo v0.89.0 #104

ostaadt opened this issue Nov 3, 2021 · 3 comments
Labels

Comments

@ostaadt
Copy link
Contributor

ostaadt commented Nov 3, 2021

academic import --bibtex publications.bib is creating a malformed path for markown_path in parse_bibtex_entry, which is defined in academic/import_bibtex.py.

markdown_path starts with content/..., but the subprocess call to hugo new {markdown_path} --kind publication } already prepends the path with content automatically.

BibTeX entries are parsed correctly, and cite.bibis created in the correct directory (e.g., content/publication/some-publication-id/cite.bib). The markdown entry, however, is created in content/content/publication/some-publication-id/index.md. Subsequently, parse_bibtex_entry throws an error, because it cannot find index.md in content/publication/some-publication-id.

I don't know if this a bug in hugo new --publication or a change in archetypes behavior in the latest hugo

I was able to fix the problem in academic by changing markdown_path from

markdown_path = os.path.join(bundle_path, "index.md")

to

markdown_path = f"{pub_dir}/{slugify(entry['ID'])}/index.md"

This fix works for hugo v.0.89.0, but it might break older versions...

@cornish
Copy link

cornish commented Nov 6, 2021

confirmed as having the same issue; haven't tried the fix yet

@gcushen
Copy link
Collaborator

gcushen commented Nov 21, 2021

Hugo v.0.89 is a new release with major changes. There are often bugs in the very latest major Hugo versions. Consider reporting Hugo bugs in the Hugo repo so that the relevant team are aware of them and can help address them...Or better yet, help contribute a Hugo fix since it's also an open source initiative that's driven by the community ;)

In this case, it appears the Hugo 0.89.0 CLI bugs were fixed in Hugo 0.89.4 (e.g. gohugoio/hugo#9177).

With Hugo 0.89.4, the command you referred to, hugo new content/publication/test/index.md --kind publication, works fine.

@gcushen
Copy link
Collaborator

gcushen commented Nov 21, 2021

Also, if anyone wants to help submit a PR for #85 (removing the dependency on hugo new), that would be appreciated by a large number of users in the community who don't want to install Hugo locally or rely on Hugo to generate publications!

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

No branches or pull requests

3 participants