Permalink
Browse files

Expand double-newlines, then collapse double 'p' tags

This commit replaces #xmlText{} entries containing only two newlines
(after stripping away spaces) with a 'p' tag. Afterwards, the
markdown/3 function traverses the tree and removes 'p' tags
followed by another 'p' tag.

After this, it seems ok to remove the trailing space previously
added by edown_xmerl:brstrip().
  • Loading branch information...
1 parent db46c7f commit e32e40af648f0f90ee1e92613c0d7c772ac3bc64 @uwiger uwiger committed May 12, 2012
Showing with 96 additions and 97 deletions.
  1. +16 −16 README.md
  2. +16 −16 doc/README.md
  3. +5 −7 doc/edown_doclet.md
  4. +2 −14 doc/edown_layout.md
  5. +0 −8 doc/edown_lib.md
  6. +23 −17 doc/edown_make.md
  7. +0 −12 doc/edown_xmerl.md
  8. +33 −6 src/edown_layout.erl
  9. +1 −1 src/edown_xmerl.erl
View
@@ -15,32 +15,32 @@ More-or-less readable Markdown can be generated.
A doclet needs to be written that also creates
a markdown-based index and overview. Currently, the
edoc_doclet creates an index.html and overview.html,
-which do not point to the .md files.
+which do not point to the .md files.
-To generate markdown edoc, run: <pre>
+To generate markdown edoc, run:<pre>
edoc:application(App, [{doclet, edown_doclet} | OtherOpts]).
-</pre>
+</pre>
The `edown_xmerl` module is used as an xmerl export module.
It converts xmerl's "simple xml" to Markdown syntax. Note that
GH-flavored Markdown allows HTML markup (at least common tags),
-but doesn't expand markdown markup inside HTML markup, so the `edown_xmerl` module has to know the context in which it operates.
+but doesn't expand markdown markup inside HTML markup, so the`edown_xmerl` module has to know the context in which it operates.
-** Special edown option: **
+** Special edown option: **
Using the option `{top_level_readme, {File, BaseHref}}`, a github-friendly
`README.md` in the top directory can be generated from the `overview.edoc`.
This file is the same as the `doc/README.md` file already generated,
but with relative links corrected (using `BaseHref`) so that they actually
work. This step is needed since Github doesn't support relative paths in
-Markdown links.
+Markdown links.
-Example:
+Example:
-`{top_level_readme, {"./README.md", "http://github.com/esl/edown"}}`
+`{top_level_readme, {"./README.md", "http://github.com/esl/edown"}}`
The conversion function will fetch the current branch name from git,
-and fail if it cannot do so.
+and fail if it cannot do so.
NOTE
====
@@ -54,24 +54,24 @@ different sections. It would have been better to have a framework
where some plugin functions identify the different files to be
written, and the outline of each, other plugins convert to suitable
content representation (e.g. HTML or Markdown), and EDoc then
-writes the files necessary.
+writes the files necessary.
For now, EDown focuses on producing reasonable Markdown, rather
than complying fully with the plugin framework. That is, the
edown_doclet module will not go out of its way to function together
-with any other layout module than edown_layout, and vice versa.
+with any other layout module than edown_layout, and vice versa.
markedoc
-========
+========
The sed script bin/markedoc works in the opposite direction and converts
-your `README.md` to an `EDoc` file.
+your `README.md` to an `EDoc` file.
-See [bin/MARKEDOC-README.md](http://github.com/esl/edown/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>`
+**FreeBSD, Mac OS X**`$ sed -E -f markedoc.sed <markdown file> > <edoc file>`
-**Linux** `$ sed -r -f markedoc.sed <markdown file> > <edoc file>`
+**Linux**`$ sed -r -f markedoc.sed <markdown file> > <edoc file>`
##Modules##
View
@@ -15,32 +15,32 @@ More-or-less readable Markdown can be generated.
A doclet needs to be written that also creates
a markdown-based index and overview. Currently, the
edoc_doclet creates an index.html and overview.html,
-which do not point to the .md files.
+which do not point to the .md files.
-To generate markdown edoc, run: <pre>
+To generate markdown edoc, run:<pre>
edoc:application(App, [{doclet, edown_doclet} | OtherOpts]).
-</pre>
+</pre>
The `edown_xmerl` module is used as an xmerl export module.
It converts xmerl's "simple xml" to Markdown syntax. Note that
GH-flavored Markdown allows HTML markup (at least common tags),
-but doesn't expand markdown markup inside HTML markup, so the `edown_xmerl` module has to know the context in which it operates.
+but doesn't expand markdown markup inside HTML markup, so the`edown_xmerl` module has to know the context in which it operates.
-** Special edown option: **
+** Special edown option: **
Using the option `{top_level_readme, {File, BaseHref}}`, a github-friendly
`README.md` in the top directory can be generated from the `overview.edoc`.
This file is the same as the `doc/README.md` file already generated,
but with relative links corrected (using `BaseHref`) so that they actually
work. This step is needed since Github doesn't support relative paths in
-Markdown links.
+Markdown links.
-Example:
+Example:
-`{top_level_readme, {"./README.md", "http://github.com/esl/edown"}}`
+`{top_level_readme, {"./README.md", "http://github.com/esl/edown"}}`
The conversion function will fetch the current branch name from git,
-and fail if it cannot do so.
+and fail if it cannot do so.
NOTE
====
@@ -54,24 +54,24 @@ different sections. It would have been better to have a framework
where some plugin functions identify the different files to be
written, and the outline of each, other plugins convert to suitable
content representation (e.g. HTML or Markdown), and EDoc then
-writes the files necessary.
+writes the files necessary.
For now, EDown focuses on producing reasonable Markdown, rather
than complying fully with the plugin framework. That is, the
edown_doclet module will not go out of its way to function together
-with any other layout module than edown_layout, and vice versa.
+with any other layout module than edown_layout, and vice versa.
markedoc
-========
+========
The sed script bin/markedoc works in the opposite direction and converts
-your `README.md` to an `EDoc` file.
+your `README.md` to an `EDoc` file.
-See [bin/MARKEDOC-README.md](bin/MARKEDOC-README.md).
+See [bin/MARKEDOC-README.md](bin/MARKEDOC-README.md).
-**FreeBSD, Mac OS X** `$ sed -E -f markedoc.sed <markdown file> > <edoc file>`
+**FreeBSD, Mac OS X**`$ sed -E -f markedoc.sed <markdown file> > <edoc file>`
-**Linux** `$ sed -r -f markedoc.sed <markdown file> > <edoc file>`
+**Linux**`$ sed -r -f markedoc.sed <markdown file> > <edoc file>`
##Modules##
View
@@ -8,8 +8,6 @@
EDoc Doclet module for producing Markdown.
-
-
Copyright (c) 2010 Erlang Solutions Ltd
__Authors:__ Ulf Wiger ([`ulf@wiger.net`](mailto:ulf@wiger.net)).<a name="index"></a>
@@ -29,21 +27,21 @@ __Authors:__ Ulf Wiger ([`ulf@wiger.net`](mailto:ulf@wiger.net)).<a name="index"
###run/2##
-
-
<pre>run(Command::<a href="#type-doclet_gen">doclet_gen()</a> | <a href="#type-doclet_toc">doclet_toc()</a>, Ctxt::<a href="#type-edoc_context">edoc_context()</a>) -> ok</pre>
<br></br>
+Main doclet entry point.
-Main doclet entry point.
Also see [`//edoc/edoc:layout/2`](http://www.erlang.org/doc/man/edoc.html#layout-2) for layout-related options, and
-[`//edoc/edoc:get_doc/2`](http://www.erlang.org/doc/man/edoc.html#get_doc-2) for options related to reading source
-files. Options:
+[`//edoc/edoc:get_doc/2`](http://www.erlang.org/doc/man/edoc.html#get_doc-2) for options related to reading source
+files.
+
+Options:
View
@@ -8,8 +8,6 @@
Markdown layout module for EDoc.
-
-
Copyright (c) 2010 Erlang Solutions Ltd
__Authors:__ Ulf Wiger ([`ulf@wiger.net`](mailto:ulf@wiger.net)).<a name="description"></a>
@@ -33,24 +31,20 @@ The module is intended to be used together with edoc.<a name="index"></a>
###markdown/3##
-
-
`markdown(Title, CSS, Body) -> any()`
<a name="module-2"></a>
###module/2##
-
-
`module(Element, Options) -> any()`
+The layout function.
-
-The layout function. Options to the standard layout:
+Options to the standard layout:
@@ -129,25 +123,19 @@ __See also:__ [//edoc/edoc:layout/2](http://www.erlang.org/doc/man/edoc.html#lay
###overview/2##
-
-
`overview(E, Options) -> any()`
<a name="package-2"></a>
###package/2##
-
-
`package(E, Options) -> any()`
<a name="type-1"></a>
###type/1##
-
-
`type(E) -> any()`
View
@@ -8,8 +8,6 @@
Markdown for EDoc - common support functions.
-
-
Copyright (c) 2010 Erlang Solutions Ltd
__Authors:__ Ulf Wiger ([`ulf.wiger@erlang-solutions.com`](mailto:ulf.wiger@erlang-solutions.com)).<a name="index"></a>
@@ -29,25 +27,19 @@ __Authors:__ Ulf Wiger ([`ulf.wiger@erlang-solutions.com`](mailto:ulf.wiger@erla
###export/1##
-
-
`export(Data) -> any()`
<a name="get_attrval-2"></a>
###get_attrval/2##
-
-
`get_attrval(Name, XmlElement) -> any()`
<a name="redirect_uri-1"></a>
###redirect_uri/1##
-
-
`redirect_uri(XmlElement) -> any()`
View
@@ -5,8 +5,6 @@
* [Function Details](#functions)
-
-
<a name="index"></a>
##Function Index##
@@ -24,49 +22,57 @@
###from_script/1##
-
-
<pre>from_script(Config::ConfigFile) -&gt; ok | {error, Reason}</pre>
<br></br>
+Reads ConfigFile and calls [`edoc:application/3`](edoc.md#application-3)
-Reads ConfigFile and calls [`edoc:application/3`](edoc.md#application-3)
The ConfigFile will be read using [`file:script/1`](file.md#script-1), and should return
-`{App, Dir, Options}`, as required by [`edoc:application/3`](edoc.md#application-3). This function does not manage dependencies. It is simply a wrapper around
+`{App, Dir, Options}`, as required by [`edoc:application/3`](edoc.md#application-3).
+
+This function does not manage dependencies. It is simply a wrapper around
[`edoc:application/3`](edoc.md#application-3).<a name="main-1"></a>
###main/1##
-
-
<pre>main(Args::[Config]) -&gt; no_return()</pre>
<br></br>
+Escript entry point for building edown (or edoc) documentation
+
-Escript entry point for building edown (or edoc) documentation
+Usage: edown_make -config ConfigFile [-pa P] [-pz P]
+
+
+
+Calls [from_script(ConfigFile)](#from_script-1) and then terminates,
+with a normal or non-normal exit code, depending on the outcome.
-Usage: edown_make -config ConfigFile [-pa P] [-pz P]
-Calls [from_script(ConfigFile)](#from_script-1) and then terminates,
-with a normal or non-normal exit code, depending on the outcome.
Make sure `$EDOWN/edown_make` is runnable, and in the command path, and
that the edown BEAM files are in the Erlang path (e.g. using $ERL_LIBS).
-The `edown_make` escript also accepts `-pa P` and/or `-pz P` flags as a
-means of locating the edown byte code.
+The `edown_make` escript also accepts `-pa P` and/or `-pz P` flags as a
+means of locating the edown byte code.
+
+
+
+Note, however, that the function `edoc_make:main/1` only expects the
+config file as an input argument, corresponding to
+
+
-Note, however, that the function `edoc_make:main/1` only expects the
-config file as an input argument, corresponding to
+`escript edoc_make.beam ConfigFile`
-`escript edoc_make.beam ConfigFile` (The reason for this is that if the beam file can be passed directly to
+(The reason for this is that if the beam file can be passed directly to
the escript command, setting the path should also be doable that way).
Oops, something went wrong.

0 comments on commit e32e40a

Please sign in to comment.