Giter Club home page Giter Club logo

dissemia / disseminate Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 3.54 MB

Render textbooks, book, articles, reports and essays in html, pdf and ebook formats

Home Page: https://docs.dissemia.org/projects/disseminate/en/latest

License: GNU Affero General Public License v3.0

Python 90.09% DM 0.61% HTML 2.34% CSS 2.43% TeX 4.37% Makefile 0.12% Asymptote 0.01% Dockerfile 0.02%
text-processing academic converter markup markup-language publishing document textbooks essays disseminate

disseminate's People

Contributors

jlorieau avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

disseminate's Issues

load_required for multiple nested directories

The document's load_required method will reload if the parent_context's mtime is update. In the case of the NMR book, the root document is removed by two levels from the chapters. The chapter is always reloaded because the parent_mtime is newer because it's updated mtime is not set correctly.

src
├── fundamental_solnNMR
│   ├── fundamental_soln_nmr.dm
│   └── inept
│       └── inept.dm
├── index.dm

Add @list and @outline environments

The list and outline environments should be able to process nested lists.

ex:

@outline{
- My first point
  - My second point
  - My third point
- My fourth point
}

media manager

Make a media manager that keeps track of included files and copies them to a media directory in the target folder.

latex includegraphics filename bug

Filenames that include special characters, like periods, trip up the \includegraphics latex function. This is fixed by wrapping the filename with curly braces.

Implement flexible dependency pathnames in the src directory

Dependency files that are not in the media/ directory of the project src are not copied correctly to the target paths.

current behavior

book/src/Chapter1/figures/fig1.png -> book/tex/fig1.png

expected behavior

book/src/Chapter1/figures/fig1.png -> book/tex/Chapter1/figures/fig1.png

Implement new builder system

Implement build system inspired by Scons.

  • Deciders based on modification times and md5 hashes
  • A build environment that manages the builds for a project
  • The build environment owns the root document, and the context stores a weakref to the build environment
  • The environment manages builders for creating dependency files and target files
  • The TargetBuilders render documents to their target format.
  • CompositeBuilders can implement either ParallelBuilders for concurrent builds and SequentialBuilders for builds in sequence.

Implement @next and @prev tags

For html targets, it would be useful to have @next and @prev tags, which could be loaded in the header, to provide links to the previous and next documents using the document label.

Implement citations

Implement a @cite tag that creates citation labels and has the option to lookup and format citation.

Add ``is_valid`` to tags

Add a validation function, is_valid, to tags to check that the contents are correct. This is a useful opportunity to raise a useful error message.

Revise context processing order for root context entries

Some context entries from the default (root) context, like @toc, are converted to tags for their respective documents. When sub-documents copy the parent context's entries, these tags should not be copied but rather reproduced from their original string entries. This will ensure that the converted tag will pertain and belong to each document's context, rather than the parent context.

index/glossary

add functionality to create a glossary/index at the end of the document

Add option for output directory to CLI

The option for an output directory was removed from the CLI because it needs to handle multiple projects at once. For example, the CLI may be run for a root "books" directory with "book1" and "book2". Setting the output directory currently write the output of "book1" and "book2" to the same directory. An output option would need to write these separately.

Update documentation

  • Cleanup documentation examples to follow Table/Data
  • Add a pygment parser for disseminate code

Signals

Implement signals to register and reset the label_manager and dependency_manager to decouple these from the document.

Add test for bug in os.link on linux

When compiling a textbook on linux, the converion from tex to pdf raises the following error on linux:

File "/usr/local/lib/python3.6/dist-packages/disseminate/convert/tex.py", line 60, in convert
    os.link(temp_filepath_pdf, self.target_filepath())
OSError: [Errno 18] Invalid cross-device link: '/tmp/tmp0k6awsdv/index.pdf' -> '/builds/psnee/free-energy/public/pdf/Chapter1_GasEquationsState/index.pdf'

Implement an external dependency manager

The current dependency manager operates with locking of each file, meaning that it can't robustly run the conversion of files concurrently.

Solutions:

  • Implement concurrently in the conversions
  • Use an external tool
    • scons seems like a natural choice, but it doesn't integrate into python easily. It's intended to run SCons files.

Customize copy behavior for context

Context entries are sometimes copied, not copied, appended or replaced. Some of these options are currently available, like do not inherit, but it's not clear whether inherited attributes are replaced (immutables) or appended (mutables). Options in the context, like do_not_inherit, should make this more clear.

An option to fix this would be something like a replace attribute that lists entries that are replaced when present in the child context, rather than appended.

lxml namespaces

Implement lxml namespaces so that attributes like epub:type can be included.

This could be implemented as attributes with dicts as values.

@toc tag update

The @toc tag in a root document is not updated when a new subdocument is added.

Implement navigation tags as context processors

The navigation tags (@prev, @next) can be sped up if these are calculated as a processor for the context when creating documents. The document list for each target would only need to be loaded once to populate these tags.

However, this would likely need to be done after all documents are loaded as a "post-load" signal, whereas the other processors are run as "on-load" signals.

Macros vs Substitution tags

It is convenient to have values stored in the header, like the document's title or author names, and substitute these into the main document. The text of these can be substituted like a macro, or a Substitution tag can be used to refer back to the header/context entry. Each of these approaches have specific strengths:

Substitution

Advantages

  • For a substitution tag, an entry may be a tag itself. Having the entry as a tag is useful when using templates, as these can be used and formatted in the template, separately from the body of the document.
(( authors.html ))
(( body.html ))

Disadvantages

  • Substitutions may not work for header/context entries with the same name as tags. For example, 'title' can be used as a Branch tag, but it cannot be used as a substitution later in the document, as the 'title' tag will be used instead of a substitution tag.
  • It's fairly easy to create circular relationships. Mechanisms that block circular relationships may not properly substitute the contents of the Substitution tag

Macros

Advantages

  • Much simpler to work with
  • A macro could be processed into an ast after the macro substitution.
(( authors.html ))
(( body.html ))

## Disadvantages
+ Line numbering relating to the source document is difficult to track

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.