summaryrefslogtreecommitdiff
path: root/lib/erl_docgen
diff options
context:
space:
mode:
authorLukas Larsson <lukas@erlang.org>2022-01-31 11:40:41 +0100
committerLukas Larsson <lukas@erlang.org>2022-01-31 11:43:39 +0100
commit2fea265c8461b0345d40bb36def3002bb393aadc (patch)
treed8dd731a1c57c71e97987a029f1fba2b9e4cbec3 /lib/erl_docgen
parentd2c8ef455a17e7d6542ceb5beba26dddfac28d17 (diff)
downloaderlang-2fea265c8461b0345d40bb36def3002bb393aadc.tar.gz
erl_docgen: Fix codeinclude
The regexp for finding <codeinclude> did not take into consideration that elements in xml do not need to have a closing tag. We shouldn't really try parsing xml with regexp, but we try to make the best of the situation. This commit also removed codeinclude from the dtd so that at least in the future if any other codeinclude falls through the regexp matching the xmllint will catch it. Closes #5662
Diffstat (limited to 'lib/erl_docgen')
-rw-r--r--lib/erl_docgen/doc/src/Makefile6
-rw-r--r--lib/erl_docgen/doc/src/block_tags.xmlsrc (renamed from lib/erl_docgen/doc/src/block_tags.xml)2
-rwxr-xr-xlib/erl_docgen/priv/bin/codeline_preprocessing.escript2
-rw-r--r--lib/erl_docgen/priv/dtd/common.dtd2
4 files changed, 8 insertions, 4 deletions
diff --git a/lib/erl_docgen/doc/src/Makefile b/lib/erl_docgen/doc/src/Makefile
index bf6fd9d2a5..143a421cd2 100644
--- a/lib/erl_docgen/doc/src/Makefile
+++ b/lib/erl_docgen/doc/src/Makefile
@@ -47,14 +47,18 @@ XML_CHAPTER_FILES = \
inline_tags.xml \
header_tags.xml \
character_entities.xml \
- block_tags.xml \
doc_storage.xml
+XML_CHAPTER_GEN_FILES = \
+ block_tags.xml
+
BOOK_FILES = book.xml
XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF6_FILES) \
$(XML_PART_FILES) $(XML_CHAPTER_FILES)
+XML_GEN_FILES = $(XML_CHAPTER_GEN_FILES:%=$(XMLDIR)/%)
+
TECHNICAL_DESCR_FILES =
EXAMPLE_FILES = \
diff --git a/lib/erl_docgen/doc/src/block_tags.xml b/lib/erl_docgen/doc/src/block_tags.xmlsrc
index a2c1310cd0..a3e59c1b6f 100644
--- a/lib/erl_docgen/doc/src/block_tags.xml
+++ b/lib/erl_docgen/doc/src/block_tags.xmlsrc
@@ -27,7 +27,7 @@
<docno/>
<date/>
<rev/>
- <file>block_tags.xml</file>
+ <file>block_tags.xmlsrc</file>
</header>
<p>Block tags typically define a separate block of information, such
diff --git a/lib/erl_docgen/priv/bin/codeline_preprocessing.escript b/lib/erl_docgen/priv/bin/codeline_preprocessing.escript
index 1a87f2307c..8195dfa743 100755
--- a/lib/erl_docgen/priv/bin/codeline_preprocessing.escript
+++ b/lib/erl_docgen/priv/bin/codeline_preprocessing.escript
@@ -77,7 +77,7 @@ parse(InDev, OutDev, CPath) ->
parse_line(CPath, Line) ->
- case re:run(Line, "<codeinclude([^>]*)>.*</codeinclude>", [{capture, [1], list}]) of
+ case re:run(Line, "<codeinclude(.*)(>.*</codeinclude>|/>)", [{capture, [1], list}]) of
{match,[Attributes]} ->
File =
case re:run(Attributes,"file=\"([^\"]+)\"",[{capture, [1], list}]) of
diff --git a/lib/erl_docgen/priv/dtd/common.dtd b/lib/erl_docgen/priv/dtd/common.dtd
index cc186fe5d6..9f5bdc50b8 100644
--- a/lib/erl_docgen/priv/dtd/common.dtd
+++ b/lib/erl_docgen/priv/dtd/common.dtd
@@ -24,7 +24,7 @@
<!ENTITY % refs "seemfa|seeerl|seetype|seeapp|seecom|seecref|seefile|seeguide|url" >
-<!ENTITY % block "p|pre|code|list|taglist|codeinclude" >
+<!ENTITY % block "p|pre|code|list|taglist" >
<!ENTITY % inline "#PCDATA|c|i|em|strong|term|br|%refs;|
marker|anno|image" >
<!-- XXX -->