Skip to content

Commit

Permalink
Experimental: Add option to name branch for top_level_README
Browse files Browse the repository at this point in the history
See esl#8

If {top_level_readme, {Path, URL, Branch}} is specified, edown will
use Branch instead of deriving the current branch when linking to
the top-level README file.
  • Loading branch information
uwiger committed Mar 25, 2013
1 parent 7b59ee1 commit 30a9f78
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
16 changes: 8 additions & 8 deletions README.md
Expand Up @@ -48,9 +48,9 @@ and fail if it cannot do so.
Rebar customizations
====================
A set of escripts can be found under
[edown/priv/scripts/](http://github.com/esl/gproc/blob/master/priv/scripts/), which
[edown/priv/scripts/](http://github.com/esl/edown/blob/master/priv/scripts/), which
can be used to customize the `rebar` built process. The
[rebar.config.script](http://github.com/esl/gproc/blob/master/priv/scripts/rebar.config.script)
[rebar.config.script](http://github.com/esl/edown/blob/master/priv/scripts/rebar.config.script)
file should be copied into your application, next to `rebar.config`.
It will sense if `doc` is a current target, and will then include
`edown` in the `deps`; otherwise, it removes it. This way, you will
Expand Down Expand Up @@ -114,7 +114,7 @@ markedoc
The sed script bin/markedoc works in the opposite direction and converts
your `README.md` to an `EDoc` file.

See [bin/MARKEDOC-README.md](http://github.com/esl/gproc/blob/master/bin/MARKEDOC-README.md).
See [bin/MARKEDOC-README.md](http://github.com/esl/edown/blob/master/bin/MARKEDOC-README.md).

**FreeBSD, Mac OS X**`$ sed -E -f markedoc.sed <markdown file> > <edoc file>`

Expand All @@ -125,9 +125,9 @@ See [bin/MARKEDOC-README.md](http://github.com/esl/gproc/blob/master/bin/MARKEDO


<table width="100%" border="0" summary="list of modules">
<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/edown_doclet.md" class="module">edown_doclet</a></td></tr>
<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/edown_layout.md" class="module">edown_layout</a></td></tr>
<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/edown_lib.md" class="module">edown_lib</a></td></tr>
<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/edown_make.md" class="module">edown_make</a></td></tr>
<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/edown_xmerl.md" class="module">edown_xmerl</a></td></tr></table>
<tr><td><a href="http://github.com/esl/edown/blob/master/doc/edown_doclet.md" class="module">edown_doclet</a></td></tr>
<tr><td><a href="http://github.com/esl/edown/blob/master/doc/edown_layout.md" class="module">edown_layout</a></td></tr>
<tr><td><a href="http://github.com/esl/edown/blob/master/doc/edown_lib.md" class="module">edown_lib</a></td></tr>
<tr><td><a href="http://github.com/esl/edown/blob/master/doc/edown_make.md" class="module">edown_make</a></td></tr>
<tr><td><a href="http://github.com/esl/edown/blob/master/doc/edown_xmerl.md" class="module">edown_xmerl</a></td></tr></table>

9 changes: 8 additions & 1 deletion src/edown_doclet.erl
Expand Up @@ -170,11 +170,18 @@ make_top_level_README(Data, Options) ->
{Path, BaseHRef} ->
Dir = filename:dirname(Path),
Filename = filename:basename(Path),
make_top_level_README(Data, Dir, Filename, BaseHRef)
make_top_level_README(Data, Dir, Filename, BaseHRef);
{Path, BaseHRef, Branch} ->
Dir = filename:dirname(Path),
Filename = filename:basename(Path),
make_top_level_README(Data, Dir, Filename, BaseHRef, Branch)
end.

make_top_level_README(Data, Dir, F, BaseHRef) ->
Branch = get_git_branch(),
make_top_level_README(Data, Dir, F, BaseHRef, Branch).

make_top_level_README(Data, Dir, F, BaseHRef, Branch) ->
Exp = [xmerl_lib:expand_element(D) || D <- Data],
New = [xmerl_lib:mapxml(
fun(#xmlElement{name = a,
Expand Down

0 comments on commit 30a9f78

Please sign in to comment.