PeterFeicht / cppreference-doc

C++ standard library reference
en.cppreference.com
GNU General Public License v3.0
577 stars 47 forks source link

missing devhelp pages #31

Closed mikucionisaau closed 1 week ago

mikucionisaau commented 2 years ago

I am primarily interested in devhelp documentation on Debian/Linux.

Here is what I tried:

wget https://github.com/PeterFeicht/cppreference-doc/releases/download/v20220730/cppreference-doc-20220730.tar.xz
tar xf cppreference-doc-20220730.tar.xz
cd cppreference-doc-20220730/
sudo apt install python3-pip
pip install premailer
sed -i "s/allow_loading_external_files=False/allow_loading_external_files=True/g" ~/.local/lib/python3.10/site-packages/premailer/premailer.py
make -j$(nproc) doc_devhelp

Which quickly gave me the following messages at the end:

...
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:650:6:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : li
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:650:11:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : ul
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:651:6:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : dd
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:651:11:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : dl
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:656:6:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : li
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:656:11:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : ul
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:657:6:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : dd
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:657:11:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : dl

./build_link_map.py
./index2devhelp.py /usr/share/cppreference/doc/html index-chapters-c.xml  \
    "C Standard Library reference" "cppreference-doc-en-c" "c" \
    index-functions-c.xml "output/devhelp-index-c.xml"
./index2devhelp.py /usr/share/cppreference/doc/html index-chapters-cpp.xml  \
    "C++ Standard Library reference" "cppreference-doc-en-cpp" "cpp" \
    index-functions-cpp.xml "output/devhelp-index-cpp.xml"
./fix_devhelp-links.py "output/devhelp-index-c.xml"  \
    "output/cppreference-doc-en-c.devhelp2"
./fix_devhelp-links.py "output/devhelp-index-cpp.xml" \
    "output/cppreference-doc-en-cpp.devhelp2"
Could not find cpp/header/contract in mapping
Could not find cpp/numeric/special_math in mapping
Could not find cpp/iterator/readable_traits in mapping
Could not find cpp/memory/new/nothrow_t in mapping
Could not find cpp/memory/allocator_arg_t in mapping
Could not find cpp/utility/initializer_list/rbegin2 in mapping
Could not find cpp/utility/initializer_list/rend2 in mapping
Could not find cpp/chrono/operator""h in mapping
Could not find cpp/chrono/operator""min in mapping
Could not find cpp/chrono/operator""s in mapping
Could not find cpp/chrono/operator""ms in mapping
Could not find cpp/chrono/operator""us in mapping
Could not find cpp/chrono/operator""ns in mapping
Could not find cpp/chrono/operator""d in mapping
Could not find cpp/chrono/operator""y in mapping
Could not find cpp/utility/piecewise_construct_t in mapping
Could not find cpp/string/basic_string/operator""s in mapping
Could not find cpp/string/basic_string_view/begin_end_nonmem in mapping
Could not find cpp/string/basic_string_view/begin_end_nonmem in mapping
Could not find cpp/string/basic_string_view/begin_end_nonmem in mapping
Could not find cpp/string/basic_string_view/begin_end_nonmem in mapping
Could not find cpp/string/basic_string_view/begin_end_nonmem in mapping
Could not find cpp/string/basic_string_view/begin_end_nonmem in mapping
Could not find cpp/string/basic_string_view/begin_end_nonmem in mapping
Could not find cpp/string/basic_string_view/begin_end_nonmem in mapping
Could not find cpp/string/basic_string_view/begin_end_nonmem in mapping
Could not find cpp/string/basic_string_view/begin_end_nonmem in mapping
Could not find cpp/string/basic_string_view/begin_end_nonmem in mapping
Could not find cpp/string/basic_string_view/begin_end_nonmem in mapping
Could not find cpp/string/basic_string_view/operator""sv in mapping
Could not find cpp/numeric/complex/operator""i in mapping
Could not find cpp/numeric/complex/operator""i in mapping
Could not find cpp/numeric/complex/operator""i in mapping
Could not find cpp/experimental/fs/filesystem_error/operator= in mapping

The returned status is 0 so it looks like "success", but I am not sure what to make of those messages.

Then make -j$(nproc) all took quite some time and sudo make install, but both succeeded without warning or error messages, so that looks like a success.

However, if I look for any of the items reported above then devhelp seems to find them in the index, but not their content: image image image image image

So something is missing.

The online version operator""sv has ben modified on 21 September 2021, at 08:42 so this is not exactly new. I would appreciate any pointers where to look for a fix.

Here is how special_math link is represented in output/link_map.xml:

<file from="cpp/experimental/special_functions" to="en/cpp/experimental/special_math.html"/>

Online there are two versions of special math functions:

So this is not important.

Another page: cpp/header/contract has been deleted (probably in favor of concepts), so this is also not important.

Then operator""sv and similar operators are very handy, but there seems to be an issue with escaping quotes resulting in the following line in output/link_map.xml:

<file from="cpp/string/basic_string_view/operator\" to="en/cpp/string/basic_string_view/operator_q__q_sv.html"/>

which is produced by build_link_map.py, where the regular expression on line 51 fails to capture escaped quotes:

m = re.search('"wgPageName":"([^"]*)"', text)

therefore should be replaced with:

m = re.search(r'"wgPageName":"((\\.|[^"\\])*)"', text)

Then the escaped quotes need to be replaced with plain quotes after line 55:

title = m.group(1)
title = title.replace(r'\"', r'"')

Then the produced output/link_map.xml contains &quote; instead of quote character which is correct xml. Then recompile, install and then it works! image

mikucionisaau commented 2 years ago

The Could not find cpp/string/basic_string_view/begin_end_nonmem message is due to missing std::begin(std::basic_string_view) non-member function on std::basic_string_view page (I have added those on cppreference.com, so hopefully they will appear in the index next time)

PeterFeicht commented 2 years ago

Thanks for the report and PR. I'll have a look at the PR when I do the next release, could take a couple of days though.

PeterFeicht commented 2 years ago
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:650:6:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : li
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:650:11:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : ul
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:651:6:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : dd
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:651:11:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : dl
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:656:6:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : li
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:656:11:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : ul
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:657:6:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : dd
HTML WARN: output/reference/en/c/language/operator_arithmetic.html:657:11:ERROR:HTML:ERR_TAG_NAME_MISMATCH: Unexpected end tag : dl

Those are harmless, BTW. They're caused by MediaWiki generating invalid HTML sometimes. I briefly looked at how to fix it, but I don't know enough about MediaWiki unfortunately.

mikucionisaau commented 2 years ago

I was wondering if there is a shorthand to install only the devhelp pages: make doc_devhelp seem to produce them but make install seem to trigger make all which consumes a lot of CPU-time.

Basically, is make all a necessary step if I am interested only in devhelp pages?

PeterFeicht commented 2 years ago

Hm, I don't use the Makefile for installation, but I guess it installs everything? If so, then it needs to build everything of course.

I guess an install target for the different kinds of output could make sense.