Coder Social home page Coder Social logo

ifosslawbook's Introduction

Ifoss law book

This repository contains the sources in various formats of the second edition of the IFOSS Law Book.

Any pull request will be authorized only by the copyright holders of the individual contributions.

NOTE: if you see this note you are working on the master branch please always work on the bugfix branch and make a pull request from there, so that the original version is untouched until we merge all the changes. On your local filesystem, you can do

   git -b bugfix
   git branch --set-upstream-to=origin/bugfix bugfix

and work from there

Some useful commands to generata Markdown:

Requires ASCIIDOC

To generate an intermediary docbook document for all .txt (asciidoc) documents in the directory.

asciidoc -b docbook *.txt

Requires Pandoc (any version).

Assuming you have all the docbook documents in the same place (directory)

find *.xml -exec pandoc -Ss -f docbook -t markdown_strict+footnotes {} -o {}.xml \;

That creates a number of Markdown documents for all docbook documents in the directory

To generate a single HTML file from the Markdown documents, you need to change the internal footnotes references (as you cannot have two identical footnote reference in the same file) I use this simple substitution script, to be add to a subdirectory, which adds a random number to the footnote references across all files and writes them in the subdirectory:

#/bin/bash!

for f in ../*.xml.md

do

 sed "s/\(\[\^\)\([0-9]\|[0-9][0-9]\|[0-9][0-9][0-9]\)\(\]\)/\1_$RANDOM\_\2\3/g" $f > $(basename $f)

 echo "done with $(basename $f)"

done

NOTE: check that the script went well and copy the resulting documents to the main directory.

Some documents have internal references. There is only a handful of them. You can count how many with:

grep -c "<<sec" *.txt

So instead of scripting it, you will be content with changing them by hand. You only need to seek for something like

[section\_title](#sec_finland_moral_rights)

and to do two things:

a) Chnage the referenced text (the text between square brackets) so to have it look like:
[Moral Rights](#sec_finland_moral_rights) and b) Ad the exact part between round brackets next to the relevant section title (where the reference points to) so it looks like:
#### Moral Rights {#sec_finland_moral_rights}

Now you are ready to produce a full HTML or PDF with

pandoc -Ss -f markdown_strict+footnotes+auto_identifiers+implicit_header_references+header_attributes -o file.html file.pdf *.xml.md

Thank you

Carlo Piana

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.