Giter Site home page Giter Site logo

mathbin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mathbin's Issues

Error for some special characters when running `doi2pdf`

On my machine when running doi2pdf 10.1137/0803026

I get

usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]
Traceback (most recent call last):
  File "/Users/ronnber/Repositories/numapde/numapde-bibliography/mathbin/doi2pdfname.py", line 7, in <module>
    tree = etree.parse(sys.argv[1])
  File "src/lxml/etree.pyx", line 3521, in lxml.etree.parse
  File "src/lxml/parser.pxi", line 1859, in lxml.etree._parseDocument
  File "src/lxml/parser.pxi", line 1885, in lxml.etree._parseDocumentFromURL
  File "src/lxml/parser.pxi", line 1789, in lxml.etree._parseDocFromFile
  File "src/lxml/parser.pxi", line 1177, in lxml.etree._BaseParser._parseDocFromFile
  File "src/lxml/parser.pxi", line 615, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 654, in lxml.etree._raiseParseError
  File "/tmp/368219713", line 32
lxml.etree.XMLSyntaxError: Entity 'nbsp' not defined, line 32, column 60

which for me looks like an &nbsp; (nonbreaking space in html) is not properly handled/escaped when trying to generate the name?

Use bibtool to change the key in arxive2bib

The arxive2bib tool provides a bib entry with the arxive number as key. We can use bibtool to extract the author names and year automatically. The tool is available as packages on the major distributions Debian, Ubuntu, Fedora and Suse.

The code

#if we have bibtool (https://ctan.org/pkg/bibtool) we can use it to format the key
if [ -x "$(command -v bibtool)" ] ; then
        wget -O - $URL -q | xmllint  --xpath '//div[@id="biblatex"]/textarea/text()' - | bibtool -f "%n(author):%4d(year)" -- "new.entry.type {online}"
else
        wget -O - $URL -q | xmllint  --xpath '//div[@id="biblatex"]/textarea/text()' -
fi

also checks if the tool is available and then formats the bibfile accordingly. Please note the new entry type at the very end. The arxive-api provides the entry type "online", which is not known to bibtool.

Error with lxml on Mac OS Big Sur

I get an error when using doi2pdf on Mac OS Big Sur (Python 3.9.2, lxml installed via pip3,

  File "mathbin/doi2pdfname.py", line 9, in <module>
    tree = etree.parse(sys.argv[1], parser=parser)
  File "src/lxml/etree.pyx", line 3521, in lxml.etree.parse
  File "src/lxml/parser.pxi", line 1859, in lxml.etree._parseDocument
  File "src/lxml/parser.pxi", line 1885, in lxml.etree._parseDocumentFromURL
  File "src/lxml/parser.pxi", line 1789, in lxml.etree._parseDocFromFile
  File "src/lxml/parser.pxi", line 1177, in lxml.etree._BaseParser._parseDocFromFile
  File "src/lxml/parser.pxi", line 615, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 654, in lxml.etree._raiseParseError
  File "/tmp/81657250", line 47
lxml.etree.XMLSyntaxError: Entity 'nbsp' not defined, line 47, column 93

Also I get a print of the usage for grep (installed grep via homebrew) - is that intended?

My example call is doi2pdf 10.1016/j.cam.2016.07.018.

Problems with `doi2pdf` on Mac OS

I am having trouble using doi2pdf on Mac OS. With the python version

> python --version
Python 3.6.6 :: Anaconda, Inc.

I had to change line 50 of doi2pdfnames.py to

print(filename.encode("utf8"))

to make it work with python3, but then I get

Traceback (most recent call last):
  File "~/Work/Software/mathbin/doi2pdfname.py", line 3, in <module>
    from lxml import etree
ModuleNotFoundError: No module named 'lxml'

even before it fetches the pdf; still it stops after storing the temporary file without renaming.

Prohibited characters in filenames

The colon (:) should be also replaced in doi2pdfname.py (and probably other files?)
to be compatible with Mac OS Classic.

For Windows also these characters should be replaced:

< (less than)
> (greater than)
: (colon - sometimes works, but is actually NTFS Alternate Data Streams)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)

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.