From 2464ea59bb9eb912cc8704229e9f16a09fd5848b Mon Sep 17 00:00:00 2001 From: "E. S." Date: Thu, 15 May 2025 16:48:57 +0300 Subject: [PATCH] ic: upd figure design --- data/tzo/41.md | 8 ++------ public/ic/scss/lib/ic.scss | 25 +++++++++++++++++++++---- src/lib/ic/TZO.php | 32 ++++++++++++++++++++++---------- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/data/tzo/41.md b/data/tzo/41.md index 89bddd6..e75e2c6 100644 --- a/data/tzo/41.md +++ b/data/tzo/41.md @@ -22,9 +22,7 @@ The idea of rotation is embedded in the foundations of mechanics and geometry fr The equation describing the motion of a point in such a system, as it turned out, is equally suitable for describing the oscillations of a weight on a spring or a pendulum on a suspension, for the sinusoidal propagation of waves, and for describing the modes of string vibrations. Due to obvious connections with music, the system is called a harmonic oscillator. -
![](https://kniganews.org/wp-content/uploads/2012/12/simple_harmonic_motion_orbit.gif)
- -
Simple examples of harmonic motion (Wikipedia animation)
+
![](https://kniganews.org/wp-content/uploads/2012/12/simple_harmonic_motion_orbit.gif "Simple examples of harmonic motion (Wikipedia animation)")
When classical physics was replaced by quantum physics, it quickly became apparent that the harmonic oscillator plays no lesser role there. More precisely, a much greater one. Not only because the strictly discrete natural frequencies of a musical string's sound are a direct mechanical analogy for the allowed orbitals of an electron in an atom. But also because the wave equations of quantum objects are fundamentally built on the idea of oscillations and the mathematics of complex numbers. And this mathematical apparatus is essentially ideally suited for solving problems about the motion of a point in a circle (in the phase space of states). @@ -44,9 +42,7 @@ From this picture, it is logical to move on to constantly oscillating quantum pa Another important aspect of the quantum world is that particles of matter interact – quantum entangle – not directly but necessarily through a photon or a mediator particle. For the geometric description of this picture, it is essential that a moving photon can be represented by its plane of polarization. Typically, if a photon is reflected by a particle, the plane of the wave propagates without rotation (linear polarization). But if the photon is emitted by a particle, then the plane of polarization rotates around the axis of propagation (circular polarization). -
![](https://kniganews.org/wp-content/uploads/2012/12/photon.jpg)
- -
A twisted ribbon — one way to depict a single photon with circular polarization
+
![](https://kniganews.org/wp-content/uploads/2012/12/photon.jpg "A twisted ribbon — one way to depict a single photon with circular polarization")
Looking at the picture from this perspective, it is easier to imagine the mechanism of forming quantum entanglement. When a photon departs from one particle, they are already entangled, and the photon's plane of polarization already carries information about the quantum state (spin direction) of the particle. When the photon reaches another particle, the plane of polarization makes a "slice" of its current state. If the particle’s diameter is maximum, then the interaction takes place at its maximum. And if the cross-section diameter is zero at that moment, then there is no interaction and, consequently, no entanglement at all. diff --git a/public/ic/scss/lib/ic.scss b/public/ic/scss/lib/ic.scss index f3b4d72..f21361c 100644 --- a/public/ic/scss/lib/ic.scss +++ b/public/ic/scss/lib/ic.scss @@ -21,10 +21,27 @@ font-size: $fs + 2px; } - img { - display: block; - max-width: 100%; - height: auto; + figure { + margin-left: 0; + margin-right: 0; + .img-wrapper { + box-sizing: border-box; + border: thin $border-color solid; + padding: 5px; + max-width: 100%; + margin: 0 auto; + display: inline-block; + } + img { + display: block; + height: auto; + max-width: 100%; + } + figcaption { + font-style: italic; + color: $dark-grey; + padding-top: 4px; + } } .tzo-nav { diff --git a/src/lib/ic/TZO.php b/src/lib/ic/TZO.php index 71a76e9..8c81f87 100644 --- a/src/lib/ic/TZO.php +++ b/src/lib/ic/TZO.php @@ -36,16 +36,28 @@ class TZO $html = MarkupUtil::markdownToHtml($md, use_image_previews: false); - // images - $html = preg_replace_callback('/!\[]\((https:\/\/kniganews\.org\/wp-content\/uploads\/(\d{4})\/(\d{2})\/([^\/)]+))\)/', function($matches) { - $year = $matches[2]; - $month = $matches[3]; - $filename = $matches[4]; - $new_filename = $year.$month.'_'.$filename; - // TODO cache image size - list($w, $h) = $this->getImageSize(APP_ROOT.'/public/ic/images/tzo/'.$new_filename); - return ''; - }, $html); + $html = preg_replace_callback( + '#!\[]\(' + .'(https://kniganews\.org/wp-content/uploads/(\d{4})/(\d{2})/([^/\s]+))' // 1=url, 2=year,3=month,4=filename + .'(?:\s+"([^"]*)")?' // 5=caption (optional) + .'\)#', + function($m) { + $year = $m[2]; + $month = $m[3]; + $filename = $m[4]; + $caption = $m[5] ?? ''; + $new_file = $year.$month.'_'. $filename; + $path = APP_ROOT.'/public/ic/images/tzo/'.$new_file; + list($w, $h) = $this->getImageSize($path); // TODO cache image size + return ( + '
' + .'
'.substr($filename, strrpos($filename, '.')+1).'
' + .($caption != '' ? '
'.htmlescape($caption).'
' : '') + .'
' + ); + }, + $html + ); // links $html = preg_replace_callback(