mirror of
https://github.com/boostorg/boostlook.git
synced 2026-01-20 16:32:17 +00:00
Compare commits
112 Commits
boost-1.87
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f056e064ea | ||
|
|
d264e70b57 | ||
|
|
858f832cf5 | ||
|
|
6adfbca7ab | ||
|
|
db04621383 | ||
|
|
dec44ce10a | ||
|
|
ab2d0fda0a | ||
|
|
8c9f0364d1 | ||
|
|
e32c8bda45 | ||
|
|
76d10265f5 | ||
|
|
2afbebc0c5 | ||
|
|
d0cc6d5e1e | ||
|
|
20ddde5333 | ||
|
|
66401ab4d7 | ||
|
|
cdfdff1a43 | ||
|
|
c8ea8e2061 | ||
|
|
5454b1c038 | ||
|
|
34fb6a94b3 | ||
|
|
b4306e4b94 | ||
|
|
36d2ef80b0 | ||
|
|
6ab075ff7f | ||
|
|
38452398bb | ||
|
|
95ac38a2af | ||
|
|
a588568d28 | ||
|
|
db0140e77c | ||
|
|
4071795de1 | ||
|
|
14c9e079a0 | ||
|
|
99cd5620b7 | ||
|
|
9c55ac6ddf | ||
|
|
47f31fb1bf | ||
|
|
70f75fb9ba | ||
|
|
5d8e2f099e | ||
|
|
c1e9536804 | ||
|
|
af6de4ca0b | ||
|
|
b4d7057719 | ||
|
|
a720b59a65 | ||
|
|
eaf1bfdd36 | ||
|
|
a605eee2d3 | ||
|
|
66d701fed4 | ||
|
|
a8c5b634e1 | ||
|
|
757e3c16c9 | ||
|
|
e1412c671e | ||
|
|
2ea58f2693 | ||
|
|
f8a393d7ed | ||
|
|
1b0f191b58 | ||
|
|
9bb732f91b | ||
|
|
d9059ad133 | ||
|
|
4aac76ddd2 | ||
|
|
ba1af1d32d | ||
|
|
527bfdfc95 | ||
|
|
8d8e85d6ca | ||
|
|
c597e7372e | ||
|
|
3bedf84a63 | ||
|
|
d1b966dbd1 | ||
|
|
f5513867a8 | ||
|
|
61820c5ee7 | ||
|
|
bcb3cb530f | ||
|
|
8eb5871cb2 | ||
|
|
e0ecfc91c5 | ||
|
|
e130dc047b | ||
|
|
fe8033808f | ||
|
|
ec37dd0b36 | ||
|
|
e79effb823 | ||
|
|
b0a65d53d8 | ||
|
|
f173718329 | ||
|
|
2ee6dc59fa | ||
|
|
3aaa0db5d6 | ||
|
|
a5041ced2d | ||
|
|
f7148a3dc6 | ||
|
|
0f18ac59c2 | ||
|
|
473cd45074 | ||
|
|
538540cdc9 | ||
|
|
2f6553ba31 | ||
|
|
adec6006ce | ||
|
|
db19639793 | ||
|
|
ee40a557f9 | ||
|
|
fab289a8fb | ||
|
|
ae8eff4cfa | ||
|
|
6ac3315c1e | ||
|
|
aaf7928ae1 | ||
|
|
1996d2e5cd | ||
|
|
60ea4e15ea | ||
|
|
1d8f100e27 | ||
|
|
f2912dae60 | ||
|
|
edae038a12 | ||
|
|
635523765b | ||
|
|
4691e12a97 | ||
|
|
e4bbe2c988 | ||
|
|
2d1ce0543b | ||
|
|
8e0507c040 | ||
|
|
0d189f8dba | ||
|
|
8c8b17b371 | ||
|
|
ac9339031c | ||
|
|
898d3194db | ||
|
|
f8c7e6c87c | ||
|
|
608c10de80 | ||
|
|
35446e1a34 | ||
|
|
78a00e206d | ||
|
|
62a0a7e179 | ||
|
|
3541dca9b5 | ||
|
|
4771a0aa9d | ||
|
|
b3355ac246 | ||
|
|
eada473564 | ||
|
|
57721be356 | ||
|
|
82821acb50 | ||
|
|
0260bc0e6e | ||
|
|
8a925d39ad | ||
|
|
084de82b16 | ||
|
|
ec5e02c410 | ||
|
|
de37aec7ab | ||
|
|
36c49442a9 | ||
|
|
d05b628e9e |
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1,4 +1,3 @@
|
||||
* text=auto
|
||||
|
||||
*.css text eol=lf
|
||||
|
||||
|
||||
8
.github/workflows/sync-boostlook-css.yml
vendored
8
.github/workflows/sync-boostlook-css.yml
vendored
@@ -16,10 +16,10 @@ jobs:
|
||||
if: github.repository == 'boostorg/boostlook'
|
||||
steps:
|
||||
- name: Checkout current repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Checkout website-v2 repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: boostorg/website-v2
|
||||
ref: develop
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.11"
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Copy boostlook.css to website-v2
|
||||
run: |
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
git config user.email "${{ github.actor }}@users.noreply.github.com"
|
||||
git add static/css/boostlook.css
|
||||
if ! git diff-index --quiet HEAD; then
|
||||
git commit -m "chore: Update boostlook.css from boostlook repository [skip ci]"
|
||||
git commit -m "chore: Update boostlook.css from boostlook repository"
|
||||
git push origin develop
|
||||
else
|
||||
echo "No changes to commit. Skipping commit to develop."
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
doc/html
|
||||
.DS_Store
|
||||
|
||||
BIN
MonaspaceNeon-Regular.woff2
Normal file
BIN
MonaspaceNeon-Regular.woff2
Normal file
Binary file not shown.
BIN
MonaspaceNeon-Var.woff2
Normal file
BIN
MonaspaceNeon-Var.woff2
Normal file
Binary file not shown.
BIN
MonaspaceRadon-Italic.woff2
Normal file
BIN
MonaspaceRadon-Italic.woff2
Normal file
Binary file not shown.
BIN
MonaspaceXenon-Italic.woff2
Normal file
BIN
MonaspaceXenon-Italic.woff2
Normal file
Binary file not shown.
BIN
MonaspaceXenon-Var.woff2
Normal file
BIN
MonaspaceXenon-Var.woff2
Normal file
Binary file not shown.
BIN
NotoSansMono-Regular.ttf
Normal file
BIN
NotoSansMono-Regular.ttf
Normal file
Binary file not shown.
94
README.md
94
README.md
@@ -15,3 +15,97 @@ html mp11.html : mp11.adoc
|
||||
Noto font files are covered under the Open Font License:
|
||||
|
||||
https://fonts.google.com/noto/use
|
||||
|
||||
## Live Preview for AsciiDoc Documentation
|
||||
|
||||
BoostLook includes a **live preview** feature to streamline local development and review of AsciiDoc documentation. This allows for automatic rendering and real-time browser preview of changes made to [`specimen.adoc`](/doc/specimen.adoc) and [`boostlook.css`](/boostlook.css) files.
|
||||
|
||||
### Overview
|
||||
|
||||
The preview functionality is handled by a Ruby script ([`boostlook_preview.rb`](./boostlook_preview.rb)). This script monitors AsciiDoc, HTML, and CSS files for changes, automatically rebuilding and opening the rendered HTML in your default web browser.
|
||||
|
||||
---
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Ensure the following dependencies are installed:
|
||||
|
||||
- **Ruby** (>= 2.7 recommended)
|
||||
- **Asciidoctor** – Install via `gem install asciidoctor`
|
||||
- **Listen Gem** – Install via `gem install listen`
|
||||
- **Boost.Build (b2)** – Required for builds invoked by the script. Ensure it is installed and available in your system's PATH.
|
||||
|
||||
---
|
||||
|
||||
### Usage and Detailed Steps
|
||||
|
||||
1. **Install Ruby and Required Gems**:
|
||||
- Ensure Ruby is installed on your system. You can check by running:
|
||||
```bash
|
||||
ruby -v
|
||||
```
|
||||
If Ruby is not installed, follow the instructions on [ruby-lang.org](https://www.ruby-lang.org/en/documentation/installation/) to install it.
|
||||
- Install Asciidoctor:
|
||||
```bash
|
||||
gem install asciidoctor
|
||||
```
|
||||
- Install the Listen gem:
|
||||
```bash
|
||||
gem install listen
|
||||
```
|
||||
|
||||
2. **Install Boost.Build (b2)**:
|
||||
- Follow the instructions on the [Boost.Build website](https://boostorg.github.io/build/) to install `b2`.
|
||||
- Ensure `b2` is available in your system's PATH by running:
|
||||
```bash
|
||||
which b2
|
||||
```
|
||||
|
||||
3. **Locate Specimen AsciiDoc File**:
|
||||
- Place your AsciiDoc files in the `doc` directory. The default file is `doc/specimen.adoc`.
|
||||
- The default file structure should include:
|
||||
|
||||
```
|
||||
/boostlook
|
||||
├── doc
|
||||
│ └── specimen.adoc <--
|
||||
│ └── ...
|
||||
├── boostlook.css
|
||||
└── boostlook_preview.rb
|
||||
└── boostlook.rb
|
||||
└── ...
|
||||
```
|
||||
|
||||
4. **Navigate to the project directory**:
|
||||
```bash
|
||||
cd /path/to/boostlook
|
||||
```
|
||||
|
||||
5. **Run the preview script**:
|
||||
- Ensure you're in the root folder
|
||||
```bash
|
||||
ruby boostlook_preview.rb
|
||||
```
|
||||
|
||||
6. **Edit and Preview**:
|
||||
- Edit your AsciiDoc (specimen.adoc) or CSS (boostlook.css) files.
|
||||
- The script will automatically detect changes and rebuild the documentation.
|
||||
- Refresh the browser to see changes.
|
||||
|
||||
7. **Refresh Your Browser** to view changes.
|
||||
|
||||
---
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
- **Script Not Running**:
|
||||
- Ensure all prerequisites are installed correctly.
|
||||
- Check for any error messages in the terminal and resolve them accordingly.
|
||||
|
||||
- **Changes Not Reflecting**:
|
||||
- Ensure the files being edited are within the monitored directories (`doc` and root directory).
|
||||
- Verify that the browser is refreshing automatically or manually refresh the browser.
|
||||
|
||||
- **Boost.Build (b2) Not Found**:
|
||||
- Ensure `b2` is installed and available in your system's PATH.
|
||||
- Run `which b2` to verify its availability.
|
||||
|
||||
4812
boostlook.css
4812
boostlook.css
File diff suppressed because it is too large
Load Diff
13
boostlook.rb
13
boostlook.rb
@@ -3,13 +3,21 @@ Asciidoctor::Extensions.register do
|
||||
process do |doc, output|
|
||||
output = output.sub(/(<body[^>]*>)/, '\1<div class="boostlook">')
|
||||
output = output.sub('</body>', '</div></body>')
|
||||
output = output.sub(/(<body.*?<div[^>]*id="toc"[^>]*>)/m, '\1<button id="toggle-toc" title="Show Table of Contents" aria-expanded="false" aria-controls="toc">☰</button>')
|
||||
# Comment out toggle button - TOC should always be visible
|
||||
# output = output.sub(/(<body.*?<div[^>]*id="toc"[^>]*>)/m, '\1<button id="toggle-toc" title="Show Table of Contents" aria-expanded="false" aria-controls="toc">☰</button>')
|
||||
output = output.sub(/(<body.*?<div[^>]*id="footer"[^>]*>)/m, '</div>\1')
|
||||
|
||||
script_tag = <<~SCRIPT
|
||||
<script>
|
||||
(function() {
|
||||
const html = document.documentElement;
|
||||
// Always show TOC - no toggle functionality needed
|
||||
html.classList.add('toc-visible');
|
||||
html.classList.add('toc-pinned');
|
||||
html.classList.remove('toc-hidden');
|
||||
|
||||
// Comment out toggle functionality since TOC should always be visible
|
||||
/*
|
||||
const isPinned = localStorage.getItem('tocPinned') === 'true';
|
||||
|
||||
html.classList.add('toc-hidden');
|
||||
@@ -39,7 +47,7 @@ Asciidoctor::Extensions.register do
|
||||
isPinned = !isPinned;
|
||||
localStorage.setItem('tocPinned', isPinned);
|
||||
html.classList.toggle('toc-pinned', isPinned);
|
||||
updateTocVisibility(isPinned); state
|
||||
updateTocVisibility(isPinned);
|
||||
});
|
||||
|
||||
tocButton.addEventListener("mouseenter", () => {
|
||||
@@ -56,6 +64,7 @@ Asciidoctor::Extensions.register do
|
||||
|
||||
updateTocVisibility(isPinned);
|
||||
});
|
||||
*/
|
||||
})();
|
||||
</script>
|
||||
SCRIPT
|
||||
|
||||
163
boostlook_preview.rb
Executable file
163
boostlook_preview.rb
Executable file
@@ -0,0 +1,163 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'asciidoctor'
|
||||
require 'listen'
|
||||
require 'pathname'
|
||||
require 'logger'
|
||||
|
||||
# AsciidocRenderer handles building AsciiDoc files, monitoring changes, and rendering the output in a browser.
|
||||
class AsciidocRenderer
|
||||
# Define our relevant constant paths
|
||||
PATHS = {
|
||||
jamfile: 'doc/Jamfile',
|
||||
specimen_docinfo_footer: 'doc/specimen-docinfo-footer.html',
|
||||
specimen_adoc: 'doc/specimen.adoc',
|
||||
css: 'boostlook.css',
|
||||
boostlook_rb: 'boostlook.rb',
|
||||
output_dir: 'doc/html'
|
||||
}.freeze
|
||||
|
||||
# OS-specific commands to open the default web browser
|
||||
OS_BROWSER_COMMANDS = {
|
||||
/darwin/ => 'open', # macOS
|
||||
/linux/ => 'xdg-open', # Linux
|
||||
/mingw|mswin/ => 'start' # Windows
|
||||
}.freeze
|
||||
|
||||
def initialize
|
||||
# Initialize the logger
|
||||
@logger = Logger.new($stdout)
|
||||
@logger.level = Logger::INFO
|
||||
@logger.formatter = ->(_, _, _, msg) { "#{msg}\n" }
|
||||
|
||||
@file_opened = false # Flag to prevent multiple browser openings
|
||||
@shutdown_requested = false # Flag to handle graceful shutdown
|
||||
validate_b2 # Ensure Boost.Build is installed
|
||||
end
|
||||
|
||||
# Entry point to run the renderer
|
||||
def run
|
||||
validate_files # Check for the presence of required files
|
||||
initial_build # Perform the initial build and render
|
||||
setup_signal_traps # Setup signal handlers for graceful shutdown
|
||||
watch_files # Start watching for file changes
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Validates that all required files are present
|
||||
def validate_files
|
||||
required_files = [PATHS[:jamfile], PATHS[:specimen_docinfo_footer], PATHS[:specimen_adoc], PATHS[:css], PATHS[:boostlook_rb]]
|
||||
missing_files = required_files.reject { |file| File.exist?(file) }
|
||||
unless missing_files.empty?
|
||||
missing_files.each { |file| @logger.error("Required file #{file} not found") }
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
|
||||
# Checks if the 'b2' command (Boost.Build) is available
|
||||
def validate_b2
|
||||
unless system('which b2 > /dev/null 2>&1')
|
||||
@logger.error("'b2' command not found. Please install Boost.Build and ensure it's in your PATH.")
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
|
||||
# Builds the AsciiDoc project using Boost.Build
|
||||
def build_asciidoc
|
||||
Dir.chdir('doc') do
|
||||
if system('b2')
|
||||
@logger.info("Build successful")
|
||||
true
|
||||
else
|
||||
@logger.error("Build failed")
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Opens the generated HTML file in the default web browser
|
||||
def open_in_browser
|
||||
return if @file_opened
|
||||
|
||||
cmd = OS_BROWSER_COMMANDS.find { |platform, _| RUBY_PLATFORM =~ platform }&.last
|
||||
if cmd
|
||||
system("#{cmd} #{PATHS[:output_dir]}/specimen.html")
|
||||
@file_opened = true
|
||||
else
|
||||
@logger.warn("Unsupported OS. Please open #{PATHS[:output_dir]}/specimen.html manually")
|
||||
end
|
||||
end
|
||||
|
||||
# Performs the initial build and opens the result in the browser
|
||||
def initial_build
|
||||
if build_asciidoc && File.exist?("#{PATHS[:output_dir]}/specimen.html")
|
||||
open_in_browser
|
||||
@logger.info("Rendered #{PATHS[:specimen_adoc]} to #{PATHS[:output_dir]}/specimen.html")
|
||||
else
|
||||
@logger.error("Failed to generate #{PATHS[:output_dir]}/specimen.html")
|
||||
end
|
||||
end
|
||||
|
||||
# Sets up file listeners to watch for changes and trigger rebuilds
|
||||
def watch_files
|
||||
@listener = Listen.to('doc', '.') do |modified, added, removed|
|
||||
handle_file_changes(modified, added, removed)
|
||||
end
|
||||
|
||||
@listener.ignore(/doc\/html/) # Ignore changes in the output directory
|
||||
@listener.start
|
||||
@logger.info("Watching for changes in 'doc' and root directories (excluding 'doc/html')...")
|
||||
|
||||
# Keep the script running until a shutdown is requested
|
||||
until @shutdown_requested
|
||||
sleep 1
|
||||
end
|
||||
|
||||
shutdown # Perform shutdown procedures
|
||||
end
|
||||
|
||||
# Handles detected file changes by determining if a rebuild is necessary
|
||||
def handle_file_changes(modified, added, removed)
|
||||
@logger.debug("Modified files: #{modified.join(', ')}")
|
||||
@logger.debug("Added files: #{added.join(', ')}") if added.any?
|
||||
@logger.debug("Removed files: #{removed.join(', ')}") if removed.any?
|
||||
|
||||
relevant_files = [
|
||||
File.expand_path(PATHS[:jamfile]),
|
||||
File.expand_path(PATHS[:specimen_docinfo_footer]),
|
||||
File.expand_path(PATHS[:specimen_adoc]),
|
||||
File.expand_path(PATHS[:css]),
|
||||
File.expand_path(PATHS[:boostlook_rb])
|
||||
]
|
||||
|
||||
# Check if any of the changed files are relevant for rebuilding
|
||||
changes_relevant = (modified + added + removed).any? do |file|
|
||||
relevant_files.include?(File.expand_path(file))
|
||||
end
|
||||
|
||||
if changes_relevant
|
||||
@logger.info("Relevant changes detected, rebuilding...")
|
||||
if build_asciidoc && File.exist?("#{PATHS[:output_dir]}/specimen.html")
|
||||
open_in_browser
|
||||
@logger.info("Re-rendered successfully")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Sets up signal traps to handle graceful shutdown on interrupt or terminate signals
|
||||
def setup_signal_traps
|
||||
Signal.trap("INT") { @shutdown_requested = true }
|
||||
Signal.trap("TERM") { @shutdown_requested = true }
|
||||
end
|
||||
|
||||
# Performs shutdown procedures, such as stopping the file listener
|
||||
def shutdown
|
||||
@logger.info("Shutting down...")
|
||||
@listener.stop if @listener
|
||||
exit
|
||||
end
|
||||
end
|
||||
|
||||
# Instantiate and run the AsciidocRenderer
|
||||
AsciidocRenderer.new.run
|
||||
5718
doc/bin/asciidoctor-backend-html5/specimen.html
Normal file
5718
doc/bin/asciidoctor-backend-html5/specimen.html
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
<style>
|
||||
|
||||
*:not(pre)>code { background: none; color: #600000; }
|
||||
:not(pre):not([class^=L])>code { background: none; color: #600000; }
|
||||
*:not(pre)>code { background: none; }
|
||||
:not(pre):not([class^=L])>code { background: none; }
|
||||
|
||||
</style>
|
||||
|
||||
@@ -438,7 +438,7 @@ See <<chars_format overview>> for description.
|
||||
[#integral_usage_notes_]
|
||||
* All built-in integral types are allowed except bool which is deleted
|
||||
* from_chars for integral type is constexpr (BOOST_CHARCONV_CONSTEXPR is defined) when:
|
||||
** compiled using `-std=c++14` or newer
|
||||
** compiled using `-std=c++14` or newer
|
||||
** using a compiler with `\__builtin_ is_constant_evaluated`
|
||||
* These functions have been tested to support `\__int128` and `unsigned __int128`
|
||||
|
||||
@@ -993,4 +993,3 @@ This documentation is copyright 2022-2023 Peter Dimov and Matt Borland and is di
|
||||
the http://www.boost.org/LICENSE_1_0.txt[Boost Software License, Version 1.0].
|
||||
|
||||
:leveloffset: -1
|
||||
|
||||
|
||||
BIN
notosans.woff2
Normal file
BIN
notosans.woff2
Normal file
Binary file not shown.
BIN
notosans_ext.woff2
Normal file
BIN
notosans_ext.woff2
Normal file
Binary file not shown.
BIN
notosans_mono.woff
Normal file
BIN
notosans_mono.woff
Normal file
Binary file not shown.
BIN
notosans_mono_ext.woff
Normal file
BIN
notosans_mono_ext.woff
Normal file
Binary file not shown.
Reference in New Issue
Block a user