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

Switch to reStructuredText + sphinx #371

Merged
merged 84 commits into from
Jul 13, 2020
Merged

Switch to reStructuredText + sphinx #371

merged 84 commits into from
Jul 13, 2020

Conversation

multun
Copy link
Contributor

@multun multun commented Jun 7, 2020

This pull request does the following:

  • convert the book from org-mode to reStructuredText
  • switch from emacs-org-mode to sphinx
  • add support for i18n with collaborative translation
  • split the book to get one file per chapter
  • update the CI to build ebooks + a website version in addition to the pdf, both in French and English (the French version has no translated strings yet)

Moving to rst + sphinx has a number of avantages:

  • ease of translation: sphinx can generate .pot files, which can be exported into a number of collaborative translation tools. I did setup a transifex organisation, but pretty much any other tool would work. Adding a language is as easy as pulling in new translation files, and adding the language to the build script. Any update to the source file can be pushed into the translation tool, people can translate the new strings, which can then be pulled into the repository.
  • rst has a far better editor support than org-mode
  • sphinx can convert rst to many file formats, including html, latex and epub

As this pull request touches every single line of source in the repository, it probably broke something. It really needs some testing.

You can preview an html build at https://crypto101.multun.net/

I also intend to help translate the book into french.

Known issues:

  • with latex, bibliography entries don't have backlinks to their references, due to a bug of pagebackref
  • the single page html build has incorrect links due to sphinx not handling merging multiple documents into one properly
  • the margins aren't the same as the org-mode version
  • the advanced warnings could look better
  • add subfigures support to sphinx and ditch the static matrix-illustration.tex (needed to translate subfigure captions)
  • a translation guide is still missing
  • references to the glossary are gone, they must be added back using :term:

Thanks @lvh for your amazing book! Do you want the ownership of the crypto101 transifex organisation?

Fixes #62
Related to #362 #348

@multun
Copy link
Contributor Author

multun commented Jun 17, 2020

@lvh I think it's ready!

@lvh
Copy link
Member

lvh commented Jun 22, 2020

@multun Hey, just a heads up with a little luck I'll be reviewing this today. Thanks again for all the work you've put in here.

@lvh
Copy link
Member

lvh commented Jun 26, 2020

@multun I think ownership of the Transifex organization makes sense.

@multun
Copy link
Contributor Author

multun commented Jun 27, 2020

@lvh cool! send me your username, and I'll do just that

@lvh
Copy link
Member

lvh commented Jun 27, 2020

Bizarrely, lvh was taken but ostensibly not by me; https://www.transifex.com/user/profile/lvh_/ is me though :)

@lvh
Copy link
Member

lvh commented Jun 27, 2020

@multun Do you have any examples of this issue:

  • the single page html build has incorrect links due to sphinx not handling merging multiple documents into one properly

The links I found appeared to mostly work?

@multun
Copy link
Contributor Author

multun commented Jun 27, 2020

It only occurs with auto-numbered footnotes ([#]) / figures, all links with a name work fine
@lvh your profile is private, I can't invite you :(

@lvh
Copy link
Member

lvh commented Jun 28, 2020

@multun oops, sorry, try again :)

@multun
Copy link
Contributor Author

multun commented Jun 29, 2020

@lvh you now are administrator and maintainer of the crypto101 organization! It's pretty empty for now, but I'm pretty sure it'll change soon :)

@lvh
Copy link
Member

lvh commented Jun 30, 2020

Thanks!

I've been hitting a snag with the build via docker:

Writing index file crypto101.idx 
! Undefined control sequence.
\csq@main@language ->\xpg@main@language 
                                        
l.124 \begin{document}

I'll try and figure out what's up with that. I imagine it's a dirty build dir.

@lvh
Copy link
Member

lvh commented Jun 30, 2020

I think what might have happened is that I was using the wrong language code. I used en_US instead of en. Could we add the style of language code to the README please? Are other styles of codes allowed? Could I stuff $LANG in there and expect it to work?

@multun
Copy link
Contributor Author

multun commented Jun 30, 2020

Here's the list, I'll update the readme soon
Unfortunately sphinx's language codes aren't like LANG's

@multun
Copy link
Contributor Author

multun commented Jul 8, 2020

@lvh I added some documentation about language codes, sorry for the delay

@lvh
Copy link
Member

lvh commented Jul 9, 2020

There should probably be a ticket for caching the docker build, since right now it downloads a lot of stuff every time.

@multun
Copy link
Contributor Author

multun commented Jul 9, 2020

I pushed a built image to the docker hub, you can get it with docker pull multun/crypto101:1.0
Once you either built the image once or got it from the hub, it shouldn't be needed to rebuild anything ever.

@lvh
Copy link
Member

lvh commented Jul 13, 2020

This is enough of an improvement (and has been open long enough) that I'm just going to merge it, and we'll deal with any remaining issues as they come.

Thanks @multun!!!

@lvh lvh merged commit f82123a into crypto101:master Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EPUB format
2 participants