Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPP Fix - prevent source code parent replacement if parent is a list item #2088

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

thewheat
Copy link
Contributor

Fixes #2060

image

Error in parsing

$ thor docs:page cpp /io/basic_istream/get  --verbose --debug
Request: en.cppreference.com/w/cpp/io/basic_istream/get                                                                                                               [200] [2623ms]
Filter: ApplyBaseUrl                                                                                                                                                           [0ms]
Filter: Container                                                                                                                                                              [2ms]
Filter: Cppref::FixCode                                                                                                                                                        [3ms]
~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call': undefined method `name=' for nil:NilClass (NoMethodError)

          node.parent.name = 'pre'
                     ^^^^^^^

Explanation of PR

  • On looking at some of the pages it seems that the common parent is a list item (classes t-li1,t-li2,t-li3) and the usage is inline code so
    • by pass current fix_code.rb processing if we can detect this
    • and for clean_html.rb formatting use code instead of a pre block

Other pages affected

$ grep -i fix_code.rb:7 generate_cpp_source_no_changes.txt  -B3              
  https://en.cppreference.com/w/cpp/io/ios_base
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/utility/functional/not_fn
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/language/integer_literal
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/language/explicit_cast
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/io/basic_ostream/operator_ltlt
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/utility/to_chars
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/utility/variant/visit
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/memory/new/operator_delete
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/language/dynamic_cast
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/container/array/operator_cmp
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/language/storage_duration
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/language/function
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/language/static_cast
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/language/reinterpret_cast
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/language/operator_member_access
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/language/overload_resolution
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/utility/tuple/get
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/ranges/drop_view
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/algorithm/sort_heap
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/numeric/math/fma
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/container/deque/operator_cmp
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/container/forward_list/operator_cmp
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/container/set/operator_cmp
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/container/list/operator_cmp
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/container/vector/operator_cmp
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/container/multimap/operator_cmp
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/container/multiset/operator_cmp
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/container/map/operator_cmp
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/utility/tuple/operator_cmp
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/io/basic_ostream/operator_ltlt2
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/io/basic_istream/get
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'
--
  https://en.cppreference.com/w/cpp/ranges/cartesian_product_view/iterator/operator_cmp
  NoMethodError: undefined method `name=' for nil:NilClass

  ~/devdocs/lib/docs/filters/cppref/fix_code.rb:7:in `block in call'

@thewheat thewheat requested a review from a team as a code owner October 22, 2023 14:23
@simon04 simon04 merged commit 9aac42c into freeCodeCamp:main Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C++ std::basic_istream get
2 participants