Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

C++ Reference Docs: Switch to use new Fathead Template Elements #407

Closed
moollaza opened this issue Oct 5, 2016 · 19 comments
Closed

C++ Reference Docs: Switch to use new Fathead Template Elements #407

moollaza opened this issue Oct 5, 2016 · 19 comments

Comments

@moollaza
Copy link
Member

moollaza commented Oct 5, 2016

We now have Fathead Template Elements designed specifically for Programming Fatheads. These are HTML elements that should be added to the output.txt by each Programming Fathead's parsing script(s).

This Fathead should be updated to use the templates:

  • The entire abstract should be wrapped in a <div> with class prog__container
  • Any text before/after the code blocks must be wrapped in <p> tags
  • Any subheadings should be wrapped in a <div> with class prog__sub

Here is an example:

<section class="prog__container">
    <p>Creates a JavaScript Date instance that represents a single moment in time.</p>
    <pre>
        <code>
            new Date;
            new Date(value);
            new Date(dateString);
            new Date(year, month[, day[, hour[, minutes[, seconds[, milliseconds]]]]]);
        </code>
    </pre>
    <span class="prog__sub">Return Value</span>
    <p>The removed element.</p>
</section>

This issue is part of the Programming Mission: help us improve the results for C++ related searches!


IA Page: http://duck.co/ia/view/cppreference_doc
Maintainer: @manrajgrover

@sahildua2305
Copy link
Collaborator

sahildua2305 commented Oct 15, 2016

I'll pick this up.

@sergey-krushch
Copy link

The way it is organized currently is: the data generation script for DDG is actually hosted on cppreference.com. I assume that this is a known and a preferred way of organizing this. If not, then... it needs to be changed :)
Anyway, I have a fix. But because it requires several steps (make a commit to the cppreference.com repo and then wait for it to appear in the cppreference.com archives) I'd like someone to verify the format.
Example (ignore indentation, it is for readability only):

<section class="prog__container">
  <p>Computes the sum of the given value <code>init</code> and the elements in the range <code>[first, last)</code>.</p>
  <pre>
    <code>
      template&lt; class InputIt, class T &gt;\nT accumulate( InputIt first, InputIt last, T init );
    </code>
  </pre>
  <pre>
    <code>
      template&lt; class InputIt, class T, class BinaryOperation &gt;T accumulate( InputIt first, InputIt last, T init,\n              BinaryOperation op );
    </code>
  </pre>
</section>

@sahildua2305
Copy link
Collaborator

@sergey-krusch there is this as well.

@moollaza can you please confirm which one is actually live? The IA page link you mentioned in the description refers to a fathead that @sergey-krusch is talking about.

@sergey-krushch
Copy link

@sahildua2305 Yeah, I've seen it. But the issue seems to be referring to the cppreference_doc specifically. Though this is something that needs clarification as well.

@sahildua2305
Copy link
Collaborator

@moollaza can you please confirm?

@moollaza
Copy link
Member Author

moollaza commented Nov 2, 2016

@sahildua2305 @sergey-krusch I happened to discuss this on the Forum yesterday :)

The cppreference_doc Fathead is extremely old and needs to be rebuilt. @sergey-krusch I was not aware that cppreference.com had an open-source repo though -- does it house the code that is being passed along to us in the tarball?

If that code is open, then I suppose we could update it accordingly, bit really I think we should rebuild this IA to function as all the others do, which means housing the parsing code in our Fathead repo, so we can update it as necessary, without depending on a third part to manage and release the changes. We can still download the XML to be parsed from cppreference.com if they prefer that over scraping their site.

@moollaza
Copy link
Member Author

moollaza commented Nov 2, 2016

@sahildua2305 @sergey-krusch the other code in the c++_ref should be removed from the repo, or adapted for this IA. Either way, the code used for the IA with ID cppreference_doc needs to live in the cppreference_doc directory 👍

@p12tic
Copy link
Contributor

p12tic commented Nov 10, 2016

Hi,

I'm the original author of the cppreference_doc fathead plugin code. This issue was only recently brought to light to me. If it's still possible (since @sahildua2305 already volunteered), I would like to volunteer implementing needed fixes for it. However, I would strongly recommend against spliting the output.txt generation code from the cppreference repository. I wrote a much longer comment with justification in #539 (comment).

@rasikapohankar
Copy link
Contributor

@sahildua2305 we can update the parsing script in the cppreference-doc repository by sending a PR there. What would you like to do?

@sahildua2305
Copy link
Collaborator

Can you do it, @rasikapohankar ?

@p12tic
Copy link
Contributor

p12tic commented Nov 15, 2016

@sahildua2305 Are you still interested in improving this Fathead? If not, I can take over.

@sahildua2305
Copy link
Collaborator

@p12tic please go ahead 😄

@p12tic
Copy link
Contributor

p12tic commented Nov 18, 2016

It looks like simple fix by @sergey-krusch (p12tic/cppreference-doc@7352ebd) has been actually enough to solve this specific issue. I've merged that to cppreference-doc repo and additionally did some extra stuff :-)

  • refactored the code generating output.txt
  • merged code snippets into single code block so that it's less confusing
  • added command-line config options so that it's possible to somewhat configure the output.txt generation from parse.sh in this repository

I have output.txt that I would like to test: https://gist.github.com/p12tic/87488c7d68715b267100b3b69de46005. Could someone configure it on the beta website?

@sergey-krushch
Copy link

@p12tic Thank you :) I was actually waiting for someone to confirm on the output format before doing the PR. But eventually discussion took a bit different route :)

@rasikapohankar
Copy link
Contributor

@p12tic Can you please open a pull request with the new output.txt? It will be deployed to beta automatically for testing 🙂

@rasikapohankar
Copy link
Contributor

I didn't mean to unassign @p12tic, not sure why it happened 😕 🤔

@tagawa Can you please reassign @p12tic? I can't seem to find them in the list..

@tagawa
Copy link
Collaborator

tagawa commented Jan 2, 2017

@rasikapohankar Thanks for noticing. I think @p12tic has now removed himself from the contributor list so we can't assign it to him.

@p12tic
Copy link
Contributor

p12tic commented Jan 2, 2017

Hmm, I did so because I was getting emails about all Fathead bugs. Perhaps I should look into muting threads instead next time.

@pjhampton
Copy link
Contributor

Closing due to #781 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants