1
0
mirror of https://github.com/lise-henry/crowbook synced 2024-11-18 00:13:55 +01:00
Commit Graph

281 Commits

Author SHA1 Message Date
Elisabeth Henry
14f659e4bb Add support for embedding additional files in EPUB document
This is done with the `resources.files` options. These files will be
placed in the `resources.path` directory in the EPUB.

Solves #6
2016-03-04 18:30:34 +01:00
Elisabeth Henry
7c2bb73bb1 Add resources.path and resources.files options 2016-03-04 18:04:52 +01:00
Elisabeth Henry
3229af9a8f Remove unused import in epub.rs 2016-03-04 18:03:09 +01:00
Elisabeth Henry
39cebebd5c Use mime_guess library to guess mime types from extension
EPUB renderer needs to specify a mime type for each file in the
manifest. For images, it previously used a simple function which only
worked currently on png, jpg and gif extensions. Using this library
should be more reliable.

It is also a first step in adressing #6.
2016-03-04 17:41:24 +01:00
Elisabeth Henry
568fe89511 Fix a typo in lib.rs documentation 2016-03-03 21:19:02 +01:00
Elisabeth Henry
6109570ccf Deny missing docs 2016-03-03 21:14:32 +01:00
Elisabeth Henry
54ca041d5a Clean Book constructors API
- Book::new takes an additional `options` parameter.
- Book::new_from_file_with_options becomes `new_from_file`, which got
  deleted.

This way, each constructor takes an `options` parameter (which can
be set to `&[]` for default options), allowing derived constructors to
not replicate the setting options code.
2016-03-03 20:56:28 +01:00
Elisabeth Henry
e197b82add Remove Bugs.md file 2016-03-03 18:26:07 +01:00
Elisabeth Henry
cc7747f20f Fix typos in ChangeLog.md 2016-03-03 18:23:28 +01:00
Elisabeth Henry
d0a491c332 Use github's issue tracker instead of maintaining a Bugs.md file 2016-03-03 18:13:23 +01:00
Elisabeth Henry
b58b73eb02 Render CSS differently according to lang
This is currently only used to display "–" for list items if lang is
set to "fr", and to default bullets otherwise, but it is now possible
to add more variations.
2016-03-03 17:57:38 +01:00
Elisabeth Henry
7b93cb4479 Bump preventively version to 0.5.0-unreleased for semantic versioning 2016-03-03 17:40:38 +01:00
Elisabeth Henry
4b22f9a339 Add enable_yaml_mode option
This option activates or disables the parsing of YAML block. If
disabled, YAML blocks will be ignored and won't be used to try to set
Crowbook's options.

enable_yaml_mode is false by defaut, but set to true when crowbook is
called with `--single`.
2016-03-02 20:38:35 +01:00
Elisabeth Henry
f561cf855d Add babel correspondences to more languages codes 2016-03-02 18:37:45 +01:00
Elisabeth Henry
981a8fab07 Fix typo in helpers.rs 2016-03-02 16:54:10 +01:00
Elisabeth Henry
1ad7a5d847 Set book options before parsing chapters
When run with --set, Crowbook now sets book options before chapters
are set. This allows to set book_path (or its variants) with --set
(previously it had no effect because it was only in place after the
chapters were parsed.)

Should fix #5.
2016-03-02 16:40:03 +01:00
Elisabeth Henry
7af8e1b633 Update ChangeLog.md 2016-03-02 04:10:59 +01:00
Elisabeth Henry
38a0656f9f Add new option tex.short
This option makes LaTeX uses the article class instead of book, and
uses the default \maketitle command for it. This option is set to
false by default, but automatically enabled when runned with
--single.

(This commit also fixes a bug for path resolution when crowbook
is runned in single. Thiss should have been a separate commit, ooops.)

Resolves: #3
2016-03-02 03:58:42 +01:00
Elisabeth Henry
e1aab90f11 Fix indentation in templates/template.html 2016-03-02 03:57:57 +01:00
Elisabeth Henry
0495791072 Fix commentary indentation in book.rs 2016-03-02 02:33:40 +01:00
Elisabeth Henry
d0f006f81d Add base_path, base_path.links and base_path.images options
By default, links are computed relatively to the Markdown file that
uses them. Setting `base_path` allows to override this behaviour: in
this case, links will be relative to this path.

`base_path` sets the paths both for images and links, but it is
possible to set them independently, respectively with base_path.images
and base_path.links. Note that if base_path is set, these two options
won't be looked at.

Should fix issue #5.
2016-03-02 02:12:23 +01:00
Elisabeth Henry
bc459cfd3b Bump version preventively to 0.4.1-unreleased 2016-03-02 01:42:15 +01:00
Elisabeth Henry
3a5f16a94a Bump version to 0.4.0 v0.4.0 2016-03-01 21:51:14 +01:00
Elisabeth Henry
aa6cc9f3a7 Update documentation 2016-03-01 21:41:23 +01:00
Elisabeth Henry
690cdb76ac Hide --list-options-md from the --help message 2016-03-01 21:25:49 +01:00
Elisabeth Henry
7ca0b8f26a Clean help message 2016-03-01 20:29:11 +01:00
Elisabeth Henry
f0600a1f3f Remove commented javascript lines in template.html 2016-03-01 19:56:13 +01:00
Elisabeth Henry
b8b6fe68dd Fix EPUB rendering issues
- Remove the need to have named chapter titles in EPUB

- Cover was previously listed twice in content.opf, fixed that
2016-03-01 19:12:16 +01:00
Elisabeth Henry
677ed2b04c Fix typo in epub stylesheet 2016-03-01 19:10:57 +01:00
Elisabeth Henry
87dc6e0638 Update documentation 2016-03-01 18:46:59 +01:00
Elisabeth Henry
b310d762c5 Improve the way --help is displayed 2016-03-01 18:46:42 +01:00
Elisabeth Henry
6e99258062 Set book's path when creating with new_from_markdown_file
This should allow a single markdown file to link to e.g. a cover file
and still be rendered correctly even if crowbook is called from
another directory.
2016-03-01 18:28:49 +01:00
Elisabeth Henry
81180d39cf Update ChangeLog.md 2016-03-01 18:08:06 +01:00
Elisabeth Henry
7be4af4264 Add option --single to the binary
This option allows Crowbook to parse a single MarkDown file,
defaulting to hide the chapters' headings. This should allow to get
ride of `.book` file for short stories.

Resolves: #2, #3
2016-03-01 17:43:40 +01:00
Elisabeth Henry
61f4dabff5 Add Book::new_from_markdown_file method
This method allows to create a book from a single markdown file.
2016-03-01 17:36:47 +01:00
Elisabeth Henry
05cb43bc1d Update libs/tests/book.rs to use real YAML multiline syntax 2016-03-01 17:28:31 +01:00
Elisabeth Henry
9a181f9663 Parse book configuration file with yaml-rust
The first part of a `.book` file, setting book options, is now parsed
as true YAML by the yaml-rust library instead of using a custom
parser.
2016-03-01 17:23:03 +01:00
Elisabeth Henry
0a39bee213 Make Book parse inline yaml blocks, not just ignoring them. 2016-03-01 16:00:43 +01:00
Elisabeth Henry
98517c243b Make Book::remove_yaml issues a warning when yaml block isn't valid
Previously, it was a debug message, but since it is probable the user
would actually want this to be seen as YAML it's better if the message
is more visible.
2016-03-01 15:42:27 +01:00
Elisabeth Henry
ae2f43193c Make BookOptions::set returns the previous option, if already set
This way, it is possible to display a debug message or a warning when
an option is overriden with a new setting.
2016-03-01 15:33:24 +01:00
Elisabeth Henry
60564c2793 Update ChangeLog.md 2016-03-01 15:12:03 +01:00
Elisabeth Henry
6dd8a970d5 Move BookOptions to its own module, bookoptions.rs 2016-03-01 15:09:50 +01:00
Elisabeth Henry
c23b353d2c Use yaml_rust for BookOptions
`BookOptions` now internally uses the yaml_rust library. This should
not change much for an end-user perspective, but should make easy to
allow to configure a `Book` with a YAML block inside a markdown file.

Since the "old" Crowbooks's config format was similar, but somewhat
different, to markdown, this might cause some bugs,
though. Particularly, strings should now be escaped with "" in some
casess (e.g. if it contains special characters). On the other hand, it
*allows* to optionally espace a string with these quotes, which wasn't
possible until then and might be useful in some cases.
2016-03-01 15:01:25 +01:00
Elisabeth Henry
4299ee5eea Added doc-pak to .gitignore
This file gets generated automatically by `checkinstall`, so there is
no need to include it in the repository.
2016-03-01 04:09:39 +01:00
Elisabeth Henry
086932a0ab Added description-pak file (useful for checkinstall).
This way, anyone can use `make package` to create a .deb package of
the binary.
2016-03-01 04:07:09 +01:00
Elisabeth Henry
8b8d847a7d Consider it is a YAML block only if first line is at the beginning of a
doc or preceded by an empty line, to avoid the case where
Foo
---

Bar
---

gets counted as a YAML block. The only ambiguous case left is if you had wanted to make two rules,
but can easily be avoided by using either *** for rules, or by using more dashes.
2016-03-01 04:02:49 +01:00
Elisabeth Henry
fa5393641b Crowbook now ignores YAML blocks (i.e., delimited by two lines containing ---, must contain valid YAML) in Markdown files 2016-03-01 01:28:36 +01:00
Elisabeth Henry
f60693416f updated Bugs and Changelog 2016-02-29 14:12:47 +01:00
Elisabeth Henry
32f50f831c Fixed an espacing error in Makefile 2016-02-29 14:05:29 +01:00
Elisabeth Henry
67bc26aaa8 made more clear in debug mode that what is printed is the output of latex/zip command 2016-02-29 01:52:26 +01:00