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

2.x: Correct marble diagram dimensions #5087

Merged
merged 1 commit into from
Feb 9, 2017
Merged

2.x: Correct marble diagram dimensions #5087

merged 1 commit into from
Feb 9, 2017

Conversation

Stephan202
Copy link
Contributor

This fixes part of #4535, as requested in #5067.

These changes were generated using the following script:

#!/usr/bin/env bash

find . -name '*.java' -print0 \
  | xargs -0 grep '^\s*\*' \
  | grep -oP 'https.*?\.png' \
  | sort -u \
  | while read -r I; do
      echo "Updating ${I}..."
      # Gather image details.
      DATA="$(identify <(curl -f -L -s "${I}"))"

      # Extract the image's true width and height.
      WIDTH="$(echo "${DATA}" | grep -oP '(?<=PNG )\d+')"
      HEIGHT="$(echo "${DATA}" | grep -oP 'PNG \d+x\d+' | grep -oP '(?<=x)\d+')"

      # Determine the image's scaled height, assuming a width of 640 pixels.
      NEW_HEIGHT="$(echo 'scale=100; s='"${WIDTH}"' / 640; scale=0; '"${HEIGHT}"' / s' | bc)"

      # Update all `<img/>` tags referencing the image.
      find . -name '*.java' -print0 \
        | xargs -0 perl -i -p -e 's,<img( (width|height)="[^"]*")* src="\Q'"${I}"'\E",<img width="640" height="'"${NEW_HEIGHT}"'" src="'"${I}"'",g'
    done

This fixes part of #4535.

These changes were generated using the following script:

```sh
#!/usr/bin/env bash

find . -name '*.java' -print0 \
  | xargs -0 grep '^\s*\*' \
  | grep -oP 'https.*?\.png' \
  | sort -u \
  | while read -r I; do
      echo "Updating ${I}..."
      # Gather image details.
      DATA="$(identify <(curl -f -L -s "${I}"))"

      # Extract the image's true width and height.
      WIDTH="$(echo "${DATA}" | grep -oP '(?<=PNG )\d+')"
      HEIGHT="$(echo "${DATA}" | grep -oP 'PNG \d+x\d+' | grep -oP '(?<=x)\d+')"

      # Determine the image's scaled height, assuming a width of 640 pixels.
      NEW_HEIGHT="$(echo 'scale=100; s='"${WIDTH}"' / 640; scale=0; '"${HEIGHT}"' / s' | bc)"

      # Update all `<img/>` tags referencing the image.
      find . -name '*.java' -print0 \
        | xargs -0 perl -i -p -e 's,<img( (width|height)="[^"]*")* src="\Q'"${I}"'\E",<img width="640" height="'"${NEW_HEIGHT}"'" src="'"${I}"'",g'
    done
```
@Stephan202
Copy link
Contributor Author

(Note that I assumed that it's okay to just fix the width of all images at 640px; that seemed to be the prevailing style.)

@akarnokd akarnokd added this to the 2.0 backlog milestone Feb 9, 2017
@akarnokd
Copy link
Member

akarnokd commented Feb 9, 2017

Great scripting job!

@Stephan202
Copy link
Contributor Author

Thanks! :). Since the change only touches JavaDoc, I assume the Travis CI job failure is spurious/unrelated? Otherwise I'll need a pointer on how to correct the situation.

@akarnokd
Copy link
Member

akarnokd commented Feb 9, 2017

The failure is due to time sensitive tests failing on an overloaded CI. I'll try to resolve it separately, don't worry about it.

@codecov
Copy link

codecov bot commented Feb 9, 2017

Codecov Report

Merging #5087 into 2.x will increase coverage by 0.07%.

@@             Coverage Diff              @@
##                2.x    #5087      +/-   ##
============================================
+ Coverage     95.51%   95.59%   +0.07%     
- Complexity     5547     5550       +3     
============================================
  Files           614      614              
  Lines         39580    39580              
  Branches       5559     5559              
============================================
+ Hits          37805    37836      +31     
+ Misses          778      758      -20     
+ Partials        997      986      -11
Impacted Files Coverage Δ Complexity Δ
.../java/io/reactivex/processors/ReplayProcessor.java 98.75% <ø> (+0.2%) 49 <ø> (ø)
...ain/java/io/reactivex/subjects/PublishSubject.java 97.87% <ø> (ø) 40 <ø> (ø)
...ernal/operators/flowable/BlockingFlowableNext.java 95.16% <ø> (ø) 2 <ø> (ø)
src/main/java/io/reactivex/Flowable.java 100% <ø> (ø) 520 <ø> (ø)
...main/java/io/reactivex/subjects/ReplaySubject.java 97.11% <ø> (ø) 51 <ø> (ø)
...ators/observable/BlockingObservableMostRecent.java 100% <ø> (ø) 2 <ø> (ø)
...in/java/io/reactivex/subjects/BehaviorSubject.java 89.63% <ø> (+4.66%) 55 <ø> (-1)
...l/operators/observable/BlockingObservableNext.java 98.36% <ø> (ø) 2 <ø> (ø)
...n/java/io/reactivex/parallel/ParallelFlowable.java 100% <ø> (ø) 41 <ø> (ø)
src/main/java/io/reactivex/Completable.java 100% <ø> (ø) 112 <ø> (ø)
... and 43 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8819cc9...066f8e3. Read the comment docs.

@akarnokd akarnokd changed the title Correct marble diagram dimensions 2.x: Correct marble diagram dimensions Feb 9, 2017
@akarnokd akarnokd merged commit 0bf1ec0 into ReactiveX:2.x Feb 9, 2017
@Stephan202 Stephan202 deleted the bugfix/correct-marble-diagram-dimensions branch February 9, 2017 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants