Skip to content

Project PLATEAU by MLIT: Japanese Ministry of Land, Infrastructure, Transport and Tourism (国土交通省)

Notifications You must be signed in to change notification settings

metanorma/mn-samples-plateau

Repository files navigation

Project PLATEAU sample documents

These documents belong to Project PLATEAU by MLIT.

Structure

sources/

source of the documents

sources/001-v4/

PLATEAU Handbook #01 source, v4.

sources/001-v4/iur/

i-UR data. Downloaded from here: https://www.chisou.go.jp/tiiki/toshisaisei/itoshisaisei/iur/index.html (see #128)

sources/002-v4/

PLATEAU Handbook #02 source, v4.

reference-docs/

Reference documents.

_site/

(automatically generated, in the gh-pages branch) published document.

collection.yml

The PLATEAU Handbook collection of 001 and 002. After compilation the output will be at index.html.

Usage (general)

Quick start

The easy way if you install locally:

git clone https://github.com/metanorma/mn-samples-plateau/
bundle
bundle exec metanorma sources/001-v4/document.adoc
# => sources/001-v4/document.{html,xml,pdf}

Installing Metanorma

Fetching the document

git clone https://github.com/metanorma/mn-samples-plateau/

Building a single document

bundle exec metanorma sources/001-v4/document.adoc # or whichever document

This command outputs the built document at:

  • sources/001-v4/document.{html,pdf,xml}

Building the full site

bundle exec metanorma site generate

This command creates _site/. The HTML entry point is at _site/index.html.

Building the collection

Note
This functionality is experimental, it builds a site with split sections in HTML.
bundle exec metanorma collection collection.yml

This command creates _site/ with the HTML entry point at _site/index.html.

(DEPRECATED) Converting documents from HTML

Warning
There is NO NEED to convert the original HTML documents to Metanorma. This is only historic information, and the commands have already been changed.

Steps:

  1. Install coradoc (run bundle install)

  2. Obtain the index.html from https://www.mlit.go.jp/plateaudocument02/

  3. Load the page entirely, and then copy/paste the HTML DOM content into a new index.html file.

  4. Run the reverse_adoc command:

$ bundle exec reverse_adoc -rcoradoc/reverse_adoc/plugins/plateau --split-sections 2 --external-images -o sources/001-v4/document.adoc reference-docs/plateau-document-01-v4.html
$ bundle exec reverse_adoc -rcoradoc/reverse_adoc/plugins/plateau --split-sections 2 --external-images -o sources/002-v4/document.adoc reference-docs/plateau-document-02-v4.html

Where:

reference-docs/plateau-document-01.html

is the input document

-o plateau-document-01/index.adoc

is the output document path

--split-sections

means to split files at Clause level 2

--external-images

means to extract out all images to separate files

-rcoradoc/reverse_adoc/plugins/plateau

applies Plateau-specific conversions

Editor usage

Convert images from webp to PNG

Some PLATEAU documents utilize webp images.

Due to #7 , the PDF renderer we use, Apache FOP, does not support webp images.

Hence at import we have to convert all webp images into PNG.

Converting with parallel processing: (if you have GNU Parallel)

$ parallel dwebp {} -o {}.png ::: *.webp

Converting sequentially:

$ find . -name "*.webp" -exec dwebp \{} -o \{}.png

Updating the files to refer to the new .png files:

sed -i '' 's/\.webp/.webp.png/g' sources/001-v3/sections/*.adoc

Running via Docker or locally

If you have installed the build tools locally, and wish to run the locally-installed compilation tools, there is nothing further to set.

If you don’t want to deal with local dependencies, use the docker:

docker run -v "$(pwd)":/metanorma -w /metanorma -it metanorma/metanorma metanorma site generate

About

Project PLATEAU by MLIT: Japanese Ministry of Land, Infrastructure, Transport and Tourism (国土交通省)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages