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

Markdown on demand #829

Merged
merged 6 commits into from
Apr 5, 2016
Merged

Markdown on demand #829

merged 6 commits into from
Apr 5, 2016

Conversation

lukego
Copy link
Member

@lukego lukego commented Mar 17, 2016

This branch creates all documentation build products on-demand instead of expecting them to be checked into the repository. This simplifies the source code maintenance.

  1. Image files created by ditaa are now created by Makefile and not stored in the repository.
  2. The .src.md concept is gone. Now all markdown files are in "source" format, with ascii art, and the Makefile preprocesses them all while building the manual.

The manuals also now build in obj/doc/ instead of directly in doc/.

The benefit that I see here is simplicity for maintaining the sources. Now developers updating documentation don't have to remember to make markdown and decide which parts of its output are relevant to check in. I also like the fact that relatively exotic build dependencies like ditaa would only be needed for building the manual and not for routine development.

The main downside is that the docs will not show pretty pictures when you browse them on the Github web interface. Bummer. I don't feel we can afford this level of complexity for nice-to-have features of secondary documentation formats though.

lukego added 4 commits March 17, 2016 04:47
The markdown files in the repository are now all "source" e.g.
containing ascii art rather than references to Ditaa-generated images.

Specifically this change overwrites the ".md" files with their
".src.md" versions and removes the ".png" image files.

This stuff can all be built on demand instead of stored in the repo.
The documentation build infrastructure now expects to preprocess every
markdown file and write the result into obj/. This replaces the
previous behavior of expecting the files in the repository to already
be preprocessed.
Build the manual in the obj/doc/ directory (for build objects) rather
than the doc/ directory (for sources).

Fix the Makefile dependencies to work. They are still ugly though...
@eugeneia eugeneia self-assigned this Mar 17, 2016
eugeneia added a commit to eugeneia/snabb that referenced this pull request Mar 17, 2016
eugeneia added a commit to eugeneia/snabb that referenced this pull request Mar 17, 2016
@@ -184,20 +183,20 @@ obj/jit_vmprof.o: extra/vmprof.c | $(OBJDIR)

book: doc/snabbswitch.pdf doc/snabbswitch.html doc/snabbswitch.epub

doc/snabbswitch.md: markdown Makefile doc/genbook.sh
obj/doc/snabbswitch.markdown: snabb markdown Makefile doc/genbook.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukego Why does snabbswitch.markdown require snabb though?

lukego added a commit to lukego/snabb that referenced this pull request Mar 18, 2016
Resolved a bunch of conflicts because I edited the markdown files
pdf-manual and then replaced .md with .src.md files on
markdown-on-demand.
Previously process-markdown took only an input file argument and
printed the result to standard output. Now it takes both an input file
and output file argument.

The important change is that the '.images' directory containing ditaa
images is now created in the same directory as the output file, and
that directory is created if necessary.

Previously the '.images' was created in the source directory and in
practice this was only the right thing if the output file happened to
also be in that directory. This was true the past when we were
converting foo.src.md -> foo.md but is not true anymore now that we
convert foo.md -> obj/foo.md.

src/Makefile is updated to reflect this. This also made it possible to
drop the Makefile dependency from the manual on the 'snabb'
executable, which was an ugly hack intended to ensure that the
required directory tree in obj/ had been created somehow. Now the
process-markdown script automatically creates any required output
directory.
@lukego
Copy link
Member Author

lukego commented Mar 18, 2016

@eugeneia Thanks for catching the snabb dependency. That was me being lazy about making sure the directories in obj existed when they were needed for writing markdown output. Pushed commit 64ee8af with a better solution.

eugeneia added a commit to eugeneia/snabb that referenced this pull request Mar 18, 2016
@@ -153,7 +153,7 @@ $(JITOBJS): obj/jit_%.o: ../lib/luajit/src/jit/%.lua $(OBJDIR)

$(RMOBJS): obj/%: %
$(E) "MARKDOWN $@"
$(Q) scripts/process-markdown $< > $@
$(Q) scripts/process-markdown $< $@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukego This might have broken things? It worked before but now I get:

MARKDOWN  obj/program/lwaftr/doc/README.ndp.md
make: *** [obj/program/lwaftr/doc/README.ndp.md] Error 1

Had used 'readlink -f' to canonicalize input and output paths.
However, this fails when the output directory does not exist yet.

Now uses 'readlink -m' instead to avoid this problem.
lukego added a commit to lukego/snabb that referenced this pull request Mar 21, 2016
This file now contains a diagram so it needs to have separate .src.md
and .md versions. This can be cleaned up when these changes eventually
merge with the on-demand markdown (snabbco#829).
eugeneia added a commit to eugeneia/snabb that referenced this pull request Mar 21, 2016
eugeneia added a commit to eugeneia/snabb that referenced this pull request Mar 21, 2016
@eugeneia eugeneia merged commit 19ffe84 into snabbco:master Apr 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants