Compare commits
8 Commits
v2.3.2-bet
...
feature/au
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5ca14ebb5 | ||
|
|
6d358443ec | ||
|
|
5771f63edd | ||
|
|
444e191c2b | ||
|
|
82abc70460 | ||
|
|
58278596df | ||
|
|
b7af2efe4c | ||
|
|
e35f4dbf62 |
4
.github/workflows/assign.yml
vendored
@@ -14,9 +14,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Assign the user or unassign stale assignments
|
||||
# Note: v3.0.0 is broken (dist/index.mjs vs action.yml expects index.js)
|
||||
# See: https://github.com/takanome-dev/assign-issue-action/issues/426
|
||||
uses: takanome-dev/assign-issue-action@v2.2
|
||||
uses: takanome-dev/assign-issue-action@v2.3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
maintainers: 'noisyfox,softfever'
|
||||
|
||||
242
.github/workflows/build_all.yml
vendored
@@ -5,6 +5,7 @@ on:
|
||||
branches:
|
||||
- main
|
||||
- release/*
|
||||
- feature/auto-update # TODO: Remove after auto-update testing is complete
|
||||
paths:
|
||||
- 'deps/**'
|
||||
- 'src/**'
|
||||
@@ -48,25 +49,26 @@ concurrency:
|
||||
|
||||
|
||||
jobs:
|
||||
build_linux:
|
||||
name: Build Linux
|
||||
strategy:
|
||||
fail-fast: false
|
||||
# Don't run scheduled builds on forks:
|
||||
if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
|
||||
uses: ./.github/workflows/build_check_cache.yml
|
||||
with:
|
||||
os: ubuntu-24.04
|
||||
build-deps-only: ${{ inputs.build-deps-only || false }}
|
||||
secrets: inherit
|
||||
# build_linux:
|
||||
# name: Build Linux
|
||||
# strategy:
|
||||
# fail-fast: false
|
||||
# # Don't run scheduled builds on forks:
|
||||
# if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
|
||||
# uses: ./.github/workflows/build_check_cache.yml
|
||||
# with:
|
||||
# os: ubuntu-24.04
|
||||
# build-deps-only: ${{ inputs.build-deps-only || false }}
|
||||
# secrets: inherit
|
||||
build_all:
|
||||
name: Build Non-Linux
|
||||
name: Build macOS (testing auto-update)
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-latest
|
||||
- os: orca-macos-arm64
|
||||
# TODO: Re-enable Windows after auto-update testing is complete
|
||||
# - os: windows-latest
|
||||
- os: macos-14
|
||||
arch: arm64
|
||||
# Don't run scheduled builds on forks:
|
||||
if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
|
||||
@@ -77,109 +79,109 @@ jobs:
|
||||
build-deps-only: ${{ inputs.build-deps-only || false }}
|
||||
force-build: ${{ github.event_name == 'schedule' }}
|
||||
secrets: inherit
|
||||
unit_tests:
|
||||
name: Unit Tests
|
||||
runs-on: ubuntu-24.04
|
||||
needs: build_linux
|
||||
if: ${{ !cancelled() && success() }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
sparse-checkout: |
|
||||
.github
|
||||
scripts
|
||||
tests
|
||||
- name: Apt-Install Dependencies
|
||||
uses: ./.github/actions/apt-install-deps
|
||||
- name: Restore Test Artifact
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: ${{ github.sha }}-tests
|
||||
- uses: lukka/get-cmake@latest
|
||||
with:
|
||||
cmakeVersion: "~3.28.0" # use most recent 3.28.x version
|
||||
- name: Unpackage and Run Unit Tests
|
||||
timeout-minutes: 20
|
||||
run: |
|
||||
tar -xvf build_tests.tar
|
||||
scripts/run_unit_tests.sh
|
||||
- name: Upload Test Logs
|
||||
uses: actions/upload-artifact@v6
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: unit-test-logs
|
||||
path: build/tests/**/*.log
|
||||
- name: Publish Test Results
|
||||
if: always()
|
||||
uses: EnricoMi/publish-unit-test-result-action@v2
|
||||
with:
|
||||
files: "ctest_results.xml"
|
||||
flatpak:
|
||||
name: "Flatpak"
|
||||
container:
|
||||
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
|
||||
options: --privileged
|
||||
volumes:
|
||||
- /usr/local/lib/android:/usr/local/lib/android
|
||||
- /usr/share/dotnet:/usr/share/dotnet
|
||||
- /opt/ghc:/opt/ghc1
|
||||
- /usr/local/share/boost:/usr/local/share/boost1
|
||||
- /opt/hostedtoolcache:/opt/hostedtoolcache1
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
variant:
|
||||
- arch: x86_64
|
||||
runner: ubuntu-24.04
|
||||
- arch: aarch64
|
||||
runner: ubuntu-24.04-arm
|
||||
# Don't run scheduled builds on forks:
|
||||
if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
|
||||
runs-on: ${{ matrix.variant.runner }}
|
||||
env:
|
||||
date:
|
||||
ver:
|
||||
ver_pure:
|
||||
steps:
|
||||
- name: "Remove unneeded stuff to free disk space"
|
||||
run:
|
||||
rm -rf /usr/local/lib/android/* /usr/share/dotnet/* /opt/ghc1/* "/usr/local/share/boost1/*" /opt/hostedtoolcache1/*
|
||||
- uses: actions/checkout@v6
|
||||
- name: Get the version and date
|
||||
run: |
|
||||
ver_pure=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
ver="PR-${{ github.event.number }}"
|
||||
git_commit_hash="${{ github.event.pull_request.head.sha }}"
|
||||
else
|
||||
ver=V$ver_pure
|
||||
git_commit_hash=""
|
||||
fi
|
||||
echo "ver=$ver" >> $GITHUB_ENV
|
||||
echo "ver_pure=$ver_pure" >> $GITHUB_ENV
|
||||
echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
||||
echo "git_commit_hash=$git_commit_hash" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
- uses: flatpak/flatpak-github-actions/flatpak-builder@master
|
||||
with:
|
||||
bundle: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
|
||||
manifest-path: scripts/flatpak/io.github.softfever.OrcaSlicer.yml
|
||||
cache: true
|
||||
arch: ${{ matrix.variant.arch }}
|
||||
upload-artifact: false
|
||||
- name: Upload artifacts Flatpak
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
|
||||
path: '/__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak'
|
||||
- name: Deploy Flatpak to nightly release
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main'
|
||||
uses: WebFreak001/deploy-nightly@v3.2.0
|
||||
with:
|
||||
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
|
||||
release_id: 137995723
|
||||
asset_path: /__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
|
||||
asset_name: OrcaSlicer-Linux-flatpak_nightly_${{ matrix.variant.arch }}.flatpak
|
||||
asset_content_type: application/octet-stream
|
||||
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
|
||||
# unit_tests:
|
||||
# name: Unit Tests
|
||||
# runs-on: ubuntu-24.04
|
||||
# needs: build_linux
|
||||
# if: ${{ !cancelled() && success() }}
|
||||
# steps:
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@v6
|
||||
# with:
|
||||
# sparse-checkout: |
|
||||
# .github
|
||||
# scripts
|
||||
# tests
|
||||
# - name: Apt-Install Dependencies
|
||||
# uses: ./.github/actions/apt-install-deps
|
||||
# - name: Restore Test Artifact
|
||||
# uses: actions/download-artifact@v7
|
||||
# with:
|
||||
# name: ${{ github.sha }}-tests
|
||||
# - uses: lukka/get-cmake@latest
|
||||
# with:
|
||||
# cmakeVersion: "~3.28.0" # use most recent 3.28.x version
|
||||
# - name: Unpackage and Run Unit Tests
|
||||
# timeout-minutes: 20
|
||||
# run: |
|
||||
# tar -xvf build_tests.tar
|
||||
# scripts/run_unit_tests.sh
|
||||
# - name: Upload Test Logs
|
||||
# uses: actions/upload-artifact@v6
|
||||
# if: ${{ failure() }}
|
||||
# with:
|
||||
# name: unit-test-logs
|
||||
# path: build/tests/**/*.log
|
||||
# - name: Publish Test Results
|
||||
# if: always()
|
||||
# uses: EnricoMi/publish-unit-test-result-action@v2
|
||||
# with:
|
||||
# files: "ctest_results.xml"
|
||||
# flatpak:
|
||||
# name: "Flatpak"
|
||||
# container:
|
||||
# image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
|
||||
# options: --privileged
|
||||
# volumes:
|
||||
# - /usr/local/lib/android:/usr/local/lib/android
|
||||
# - /usr/share/dotnet:/usr/share/dotnet
|
||||
# - /opt/ghc:/opt/ghc1
|
||||
# - /usr/local/share/boost:/usr/local/share/boost1
|
||||
# - /opt/hostedtoolcache:/opt/hostedtoolcache1
|
||||
# strategy:
|
||||
# fail-fast: false
|
||||
# matrix:
|
||||
# variant:
|
||||
# - arch: x86_64
|
||||
# runner: ubuntu-24.04
|
||||
# - arch: aarch64
|
||||
# runner: ubuntu-24.04-arm
|
||||
# # Don't run scheduled builds on forks:
|
||||
# if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
|
||||
# runs-on: ${{ matrix.variant.runner }}
|
||||
# env:
|
||||
# date:
|
||||
# ver:
|
||||
# ver_pure:
|
||||
# steps:
|
||||
# - name: "Remove unneeded stuff to free disk space"
|
||||
# run:
|
||||
# rm -rf /usr/local/lib/android/* /usr/share/dotnet/* /opt/ghc1/* "/usr/local/share/boost1/*" /opt/hostedtoolcache1/*
|
||||
# - uses: actions/checkout@v6
|
||||
# - name: Get the version and date
|
||||
# run: |
|
||||
# ver_pure=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
|
||||
# if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
# ver="PR-${{ github.event.number }}"
|
||||
# git_commit_hash="${{ github.event.pull_request.head.sha }}"
|
||||
# else
|
||||
# ver=V$ver_pure
|
||||
# git_commit_hash=""
|
||||
# fi
|
||||
# echo "ver=$ver" >> $GITHUB_ENV
|
||||
# echo "ver_pure=$ver_pure" >> $GITHUB_ENV
|
||||
# echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
||||
# echo "git_commit_hash=$git_commit_hash" >> $GITHUB_ENV
|
||||
# shell: bash
|
||||
# - uses: flatpak/flatpak-github-actions/flatpak-builder@master
|
||||
# with:
|
||||
# bundle: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
|
||||
# manifest-path: scripts/flatpak/io.github.softfever.OrcaSlicer.yml
|
||||
# cache: true
|
||||
# arch: ${{ matrix.variant.arch }}
|
||||
# upload-artifact: false
|
||||
# - name: Upload artifacts Flatpak
|
||||
# uses: actions/upload-artifact@v6
|
||||
# with:
|
||||
# name: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
|
||||
# path: '/__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak'
|
||||
# - name: Deploy Flatpak to nightly release
|
||||
# if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main'
|
||||
# uses: WebFreak001/deploy-nightly@v3.2.0
|
||||
# with:
|
||||
# upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
|
||||
# release_id: 137995723
|
||||
# asset_path: /__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
|
||||
# asset_name: OrcaSlicer-Linux-flatpak_nightly_${{ matrix.variant.arch }}.flatpak
|
||||
# asset_content_type: application/octet-stream
|
||||
# max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
|
||||
|
||||
2
.github/workflows/build_check_cache.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
||||
- name: set outputs
|
||||
id: set_outputs
|
||||
env:
|
||||
dep-folder-name: ${{ inputs.os != 'orca-macos-arm64' && '/OrcaSlicer_dep' || '' }}
|
||||
dep-folder-name: ${{ inputs.os != 'macos-14' && '/OrcaSlicer_dep' || '' }}
|
||||
output-cmd: ${{ inputs.os == 'windows-latest' && '$env:GITHUB_OUTPUT' || '"$GITHUB_OUTPUT"'}}
|
||||
run: |
|
||||
echo cache-key=${{ inputs.os }}-cache-orcaslicer_deps-build-${{ hashFiles('deps/**') }} >> ${{ env.output-cmd }}
|
||||
|
||||
14
.github/workflows/build_deps.yml
vendored
@@ -74,18 +74,18 @@ jobs:
|
||||
cd ${{ github.workspace }}/deps/build
|
||||
|
||||
- name: Build on Mac ${{ inputs.arch }}
|
||||
if: inputs.os == 'orca-macos-arm64'
|
||||
if: inputs.os == 'macos-14'
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
# brew install automake texinfo libtool
|
||||
# brew list
|
||||
# brew uninstall --ignore-dependencies zstd
|
||||
./build_release_macos.sh -dx -a universal -t 10.15
|
||||
brew install automake texinfo libtool
|
||||
brew list
|
||||
brew uninstall --ignore-dependencies zstd
|
||||
./build_release_macos.sh -dx -a universal -t 10.15 -1
|
||||
for arch in arm64 x86_64; do
|
||||
(cd "${{ github.workspace }}/deps/build/${arch}" && \
|
||||
find . -mindepth 1 -maxdepth 1 ! -name 'OrcaSlicer_dep' -exec rm -rf {} +)
|
||||
done
|
||||
# brew install zstd
|
||||
brew install zstd
|
||||
|
||||
|
||||
- name: Apt-Install Dependencies
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
|
||||
# Upload Artifacts
|
||||
# - name: Upload Mac ${{ inputs.arch }} artifacts
|
||||
# if: inputs.os == 'orca-macos-arm64'
|
||||
# if: inputs.os == 'macos-14'
|
||||
# uses: actions/upload-artifact@v6
|
||||
# with:
|
||||
# name: OrcaSlicer_dep_mac_${{ env.date }}
|
||||
|
||||
154
.github/workflows/build_orca.yml
vendored
@@ -86,29 +86,31 @@ jobs:
|
||||
|
||||
# Mac
|
||||
- name: Install tools mac
|
||||
if: inputs.os == 'orca-macos-arm64'
|
||||
if: inputs.os == 'macos-14'
|
||||
run: |
|
||||
# brew install libtool
|
||||
# brew list
|
||||
brew install libtool
|
||||
brew list
|
||||
mkdir -p ${{ github.workspace }}/deps/build
|
||||
|
||||
# - name: Free disk space
|
||||
# if: inputs.os == 'orca-macos-arm64'
|
||||
# run: |
|
||||
# df -hI /dev/disk3s1s1
|
||||
# sudo find /Applications -maxdepth 1 -type d -name "Xcode_*.app" ! -name "Xcode_15.4.app" -exec rm -rf {} +
|
||||
# sudo rm -rf ~/Library/Developer/CoreSimulator/Caches/*
|
||||
# df -hI /dev/disk3s1s1
|
||||
- name: Free disk space
|
||||
if: inputs.os == 'macos-14'
|
||||
run: |
|
||||
df -hI /dev/disk3s1s1
|
||||
sudo find /Applications -maxdepth 1 -type d -name "Xcode_*.app" ! -name "Xcode_15.4.app" -exec rm -rf {} +
|
||||
sudo rm -rf ~/Library/Developer/CoreSimulator/Caches/*
|
||||
df -hI /dev/disk3s1s1
|
||||
|
||||
- name: Build slicer mac
|
||||
if: inputs.os == 'orca-macos-arm64'
|
||||
if: inputs.os == 'macos-14'
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
./build_release_macos.sh -s -n -x -a universal -t 10.15
|
||||
# TODO: Change back to -a universal after auto-update testing is complete
|
||||
./build_release_macos.sh -s -n -x -a arm64 -t 10.15 -1
|
||||
|
||||
# Thanks to RaySajuuk, it's working now
|
||||
- name: Sign app and notary
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && inputs.os == 'orca-macos-arm64'
|
||||
# TODO: Remove feature/auto-update after testing is complete
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || github.ref == 'refs/heads/feature/auto-update') && inputs.os == 'macos-14'
|
||||
working-directory: ${{ github.workspace }}
|
||||
env:
|
||||
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
|
||||
@@ -122,73 +124,123 @@ jobs:
|
||||
security create-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_PATH
|
||||
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
|
||||
security unlock-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_PATH
|
||||
# Set the temporary keychain as the default to prevent codesign from accessing the locked login keychain
|
||||
security default-keychain -s "$KEYCHAIN_PATH"
|
||||
security import $CERTIFICATE_PATH -P $P12_PASSWORD -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
|
||||
security list-keychain -d user -s $KEYCHAIN_PATH
|
||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $P12_PASSWORD $KEYCHAIN_PATH
|
||||
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app
|
||||
# TODO: Change build/arm64 back to build/universal after auto-update testing is complete
|
||||
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer.app
|
||||
# Sign OrcaSlicer_profile_validator.app if it exists
|
||||
if [ -f "${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
|
||||
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app
|
||||
if [ -f "${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
|
||||
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app
|
||||
fi
|
||||
|
||||
|
||||
# Create main OrcaSlicer DMG without the profile validator helper
|
||||
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_dmg
|
||||
rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/*
|
||||
cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/
|
||||
ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/Applications
|
||||
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
|
||||
mkdir -p ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg
|
||||
rm -rf ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/*
|
||||
cp -R ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/
|
||||
ln -sfn /Applications ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/Applications
|
||||
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
|
||||
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
|
||||
|
||||
|
||||
# Create separate OrcaSlicer_profile_validator DMG if the app exists
|
||||
if [ -f "${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
|
||||
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg
|
||||
rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/*
|
||||
cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/
|
||||
ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/Applications
|
||||
hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
|
||||
if [ -f "${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
|
||||
mkdir -p ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg
|
||||
rm -rf ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/*
|
||||
cp -R ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/
|
||||
ln -sfn /Applications ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/Applications
|
||||
hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
|
||||
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
|
||||
fi
|
||||
|
||||
# Notarize main DMG
|
||||
xcrun notarytool submit "OrcaSlicer_Mac_universal_${{ env.ver }}.dmg" --apple-id "${{ secrets.APPLE_DEV_ACCOUNT }}" --team-id "${{ secrets.TEAM_ID }}" --password "${{ secrets.APP_PWD }}" --wait
|
||||
xcrun notarytool store-credentials "notarytool-profile" --apple-id "${{ secrets.APPLE_DEV_ACCOUNT }}" --team-id "${{ secrets.TEAM_ID }}" --password "${{ secrets.APP_PWD }}"
|
||||
xcrun notarytool submit "OrcaSlicer_Mac_universal_${{ env.ver }}.dmg" --keychain-profile "notarytool-profile" --wait
|
||||
xcrun stapler staple OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
|
||||
|
||||
|
||||
# Notarize profile validator DMG if it exists
|
||||
if [ -f "OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg" ]; then
|
||||
xcrun notarytool submit "OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg" --apple-id "${{ secrets.APPLE_DEV_ACCOUNT }}" --team-id "${{ secrets.TEAM_ID }}" --password "${{ secrets.APP_PWD }}" --wait
|
||||
xcrun notarytool submit "OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg" --keychain-profile "notarytool-profile" --wait
|
||||
xcrun stapler staple OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
|
||||
fi
|
||||
|
||||
- name: Sign DMG for Sparkle auto-update
|
||||
# TODO: Remove feature/auto-update after testing is complete
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || github.ref == 'refs/heads/feature/auto-update') && inputs.os == 'macos-14'
|
||||
working-directory: ${{ github.workspace }}
|
||||
env:
|
||||
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
|
||||
run: |
|
||||
# Get the Sparkle sign_update tool from deps (installed to OrcaSlicer_dep/bin)
|
||||
SIGN_UPDATE="${{ github.workspace }}/deps/build/arm64/OrcaSlicer_dep/bin/sign_update"
|
||||
|
||||
# Fallback to x86_64 if arm64 not found
|
||||
if [ ! -f "$SIGN_UPDATE" ]; then
|
||||
SIGN_UPDATE="${{ github.workspace }}/deps/build/x86_64/OrcaSlicer_dep/bin/sign_update"
|
||||
fi
|
||||
|
||||
if [ -f "$SIGN_UPDATE" ] && [ -n "$SPARKLE_PRIVATE_KEY" ]; then
|
||||
# Write the private key to a temp file
|
||||
echo "$SPARKLE_PRIVATE_KEY" > /tmp/sparkle_private_key
|
||||
chmod 600 /tmp/sparkle_private_key
|
||||
|
||||
# Sign the DMG and capture the signature
|
||||
SIGNATURE=$("$SIGN_UPDATE" "OrcaSlicer_Mac_universal_${{ env.ver }}.dmg" -f /tmp/sparkle_private_key)
|
||||
|
||||
# Clean up the key file
|
||||
rm -f /tmp/sparkle_private_key
|
||||
|
||||
# Save signature to a file for later use in appcast generation
|
||||
echo "$SIGNATURE" > OrcaSlicer_Mac_universal_${{ env.ver }}.dmg.sig
|
||||
echo "Sparkle signature generated: $SIGNATURE"
|
||||
|
||||
# Also output as GitHub Actions output
|
||||
echo "sparkle_signature=$SIGNATURE" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Warning: Sparkle sign_update tool not found at $SIGN_UPDATE or private key not set, skipping signature generation"
|
||||
if [ ! -f "$SIGN_UPDATE" ]; then
|
||||
echo "sign_update not found. Available files:"
|
||||
ls -la "${{ github.workspace }}/deps/build/arm64/OrcaSlicer_dep/" || true
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Create DMG without notary
|
||||
if: github.ref != 'refs/heads/main' && inputs.os == 'orca-macos-arm64'
|
||||
# TODO: Remove feature/auto-update exclusion after testing is complete
|
||||
if: github.ref != 'refs/heads/main' && github.ref != 'refs/heads/feature/auto-update' && !startsWith(github.ref, 'refs/heads/release/') && inputs.os == 'macos-14'
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_dmg
|
||||
rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/*
|
||||
cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/
|
||||
ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/Applications
|
||||
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
|
||||
|
||||
# TODO: Change build/arm64 back to build/universal after auto-update testing is complete
|
||||
mkdir -p ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg
|
||||
rm -rf ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/*
|
||||
cp -R ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/
|
||||
ln -sfn /Applications ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/Applications
|
||||
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
|
||||
|
||||
# Create separate OrcaSlicer_profile_validator DMG if the app exists
|
||||
if [ -f "${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
|
||||
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg
|
||||
rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/*
|
||||
cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/
|
||||
ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/Applications
|
||||
hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
|
||||
if [ -f "${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
|
||||
mkdir -p ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg
|
||||
rm -rf ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/*
|
||||
cp -R ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/
|
||||
ln -sfn /Applications ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/Applications
|
||||
hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
|
||||
fi
|
||||
|
||||
- name: Upload artifacts mac
|
||||
if: inputs.os == 'orca-macos-arm64'
|
||||
if: inputs.os == 'macos-14'
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: OrcaSlicer_Mac_universal_${{ env.ver }}
|
||||
path: ${{ github.workspace }}/OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
|
||||
|
||||
- name: Upload Sparkle signature mac
|
||||
if: inputs.os == 'macos-14'
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: OrcaSlicer_Mac_universal_${{ env.ver }}_sig
|
||||
path: ${{ github.workspace }}/OrcaSlicer_Mac_universal_${{ env.ver }}.dmg.sig
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Upload OrcaSlicer_profile_validator DMG mac
|
||||
if: inputs.os == 'orca-macos-arm64'
|
||||
if: inputs.os == 'macos-14'
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: OrcaSlicer_profile_validator_Mac_universal_DMG_${{ env.ver }}
|
||||
@@ -196,7 +248,7 @@ jobs:
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Deploy Mac release
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && inputs.os == 'orca-macos-arm64'
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && inputs.os == 'macos-14'
|
||||
uses: WebFreak001/deploy-nightly@v3.2.0
|
||||
with:
|
||||
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
|
||||
@@ -207,7 +259,7 @@ jobs:
|
||||
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
|
||||
|
||||
- name: Deploy Mac OrcaSlicer_profile_validator DMG release
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && inputs.os == 'orca-macos-arm64'
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && inputs.os == 'macos-14'
|
||||
uses: WebFreak001/deploy-nightly@v3.2.0
|
||||
with:
|
||||
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
|
||||
|
||||
84
.github/workflows/check_profiles.yml
vendored
@@ -1,8 +1,8 @@
|
||||
name: Check profiles
|
||||
on:
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'resources/profiles/**'
|
||||
- ".github/workflows/check_profiles.yml"
|
||||
@@ -10,33 +10,25 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
logLevel:
|
||||
description: 'Log level'
|
||||
description: 'Log level'
|
||||
required: true
|
||||
default: 'warning'
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
contents: read
|
||||
|
||||
|
||||
jobs:
|
||||
check_translation:
|
||||
name: Check profiles
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Run extra JSON check
|
||||
id: extra_json_check
|
||||
continue-on-error: true
|
||||
run: |
|
||||
set +e
|
||||
python3 ./scripts/orca_extra_profile_check.py 2>&1 | tee ${{ runner.temp }}/extra_json_check.log
|
||||
exit ${PIPESTATUS[0]}
|
||||
python3 ./scripts/orca_extra_profile_check.py
|
||||
|
||||
# download
|
||||
- name: Download
|
||||
- name: Download
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
curl -LJO https://github.com/SoftFever/Orca_tools/releases/download/1/OrcaSlicer_profile_validator
|
||||
@@ -44,71 +36,15 @@ jobs:
|
||||
|
||||
# validate profiles
|
||||
- name: validate system profiles
|
||||
id: validate_system
|
||||
continue-on-error: true
|
||||
run: |
|
||||
set +e
|
||||
./OrcaSlicer_profile_validator -p ${{ github.workspace }}/resources/profiles -l 2 2>&1 | tee ${{ runner.temp }}/validate_system.log
|
||||
exit ${PIPESTATUS[0]}
|
||||
./OrcaSlicer_profile_validator -p ${{ github.workspace }}/resources/profiles -l 2
|
||||
|
||||
- name: validate custom presets
|
||||
id: validate_custom
|
||||
continue-on-error: true
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
set +e
|
||||
curl -LJO https://github.com/OrcaSlicer/OrcaSlicer/releases/download/nightly-builds/orca_custom_preset_tests.zip
|
||||
unzip -q ./orca_custom_preset_tests.zip -d ${{ github.workspace }}/resources/profiles
|
||||
./OrcaSlicer_profile_validator -p ${{ github.workspace }}/resources/profiles -l 2 2>&1 | tee ${{ runner.temp }}/validate_custom.log
|
||||
exit ${PIPESTATUS[0]}
|
||||
|
||||
- name: Post error comment on PR
|
||||
if: ${{ always() && github.event_name == 'pull_request' && (steps.extra_json_check.outcome == 'failure' || steps.validate_system.outcome == 'failure' || steps.validate_custom.outcome == 'failure') }}
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
{
|
||||
echo "## :x: Profile Validation Errors"
|
||||
echo ""
|
||||
|
||||
if [ "${{ steps.extra_json_check.outcome }}" = "failure" ]; then
|
||||
echo "### Extra JSON Check Failed"
|
||||
echo ""
|
||||
echo '```'
|
||||
head -c 30000 ${{ runner.temp }}/extra_json_check.log || echo "No output captured"
|
||||
echo '```'
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ "${{ steps.validate_system.outcome }}" = "failure" ]; then
|
||||
echo "### System Profile Validation Failed"
|
||||
echo ""
|
||||
echo '```'
|
||||
head -c 30000 ${{ runner.temp }}/validate_system.log || echo "No output captured"
|
||||
echo '```'
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ "${{ steps.validate_custom.outcome }}" = "failure" ]; then
|
||||
echo "### Custom Preset Validation Failed"
|
||||
echo ""
|
||||
echo '```'
|
||||
head -c 30000 ${{ runner.temp }}/validate_custom.log || echo "No output captured"
|
||||
echo '```'
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo "---"
|
||||
echo "*Please fix the above errors and push a new commit.*"
|
||||
} > ${{ runner.temp }}/pr_comment.md
|
||||
|
||||
gh pr comment ${{ github.event.pull_request.number }} --body-file ${{ runner.temp }}/pr_comment.md
|
||||
|
||||
- name: Fail if any check failed
|
||||
if: ${{ always() && (steps.extra_json_check.outcome == 'failure' || steps.validate_system.outcome == 'failure' || steps.validate_custom.outcome == 'failure') }}
|
||||
run: |
|
||||
echo "One or more profile checks failed. See above for details."
|
||||
exit 1
|
||||
unzip ./orca_custom_preset_tests.zip -d ${{ github.workspace }}/resources/profiles
|
||||
./OrcaSlicer_profile_validator -p ${{ github.workspace }}/resources/profiles -l 2
|
||||
|
||||
|
||||
|
||||
|
||||
138
.github/workflows/generate_appcast.yml
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
name: Generate Appcast
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version to generate appcast for (e.g., 2.3.2)'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
generate_appcast:
|
||||
name: Generate and Deploy Appcast
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Get version from release or input
|
||||
id: version
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "release" ]; then
|
||||
VERSION="${{ github.event.release.tag_name }}"
|
||||
VERSION="${VERSION#v}" # Remove 'v' prefix if present
|
||||
else
|
||||
VERSION="${{ github.event.inputs.version }}"
|
||||
fi
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "Version: $VERSION"
|
||||
|
||||
- name: Download release assets info
|
||||
id: assets
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
TAG="v$VERSION"
|
||||
|
||||
# Get release info
|
||||
RELEASE_URL="https://github.com/${{ github.repository }}/releases/tag/$TAG"
|
||||
echo "release_url=$RELEASE_URL" >> $GITHUB_OUTPUT
|
||||
|
||||
# Get macOS DMG URL and size
|
||||
# Use browser_download_url for public access (not .url which is the API endpoint)
|
||||
MAC_ASSET=$(gh release view "$TAG" --json assets -q '.assets[] | select(.name | contains("Mac_universal")) | select(.name | endswith(".dmg"))')
|
||||
if [ -n "$MAC_ASSET" ]; then
|
||||
MAC_URL=$(echo "$MAC_ASSET" | jq -r '.browser_download_url // .url')
|
||||
MAC_SIZE=$(echo "$MAC_ASSET" | jq -r '.size')
|
||||
echo "mac_url=$MAC_URL" >> $GITHUB_OUTPUT
|
||||
echo "mac_size=$MAC_SIZE" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
# Get Windows installer URL and size
|
||||
# Use browser_download_url for public access (not .url which is the API endpoint)
|
||||
WIN_ASSET=$(gh release view "$TAG" --json assets -q '.assets[] | select(.name | contains("Windows_Installer")) | select(.name | endswith(".exe"))')
|
||||
if [ -n "$WIN_ASSET" ]; then
|
||||
WIN_URL=$(echo "$WIN_ASSET" | jq -r '.browser_download_url // .url')
|
||||
WIN_SIZE=$(echo "$WIN_ASSET" | jq -r '.size')
|
||||
echo "win_url=$WIN_URL" >> $GITHUB_OUTPUT
|
||||
echo "win_size=$WIN_SIZE" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Download signatures
|
||||
id: signatures
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
TAG="v$VERSION"
|
||||
|
||||
# Try to download macOS signature artifact
|
||||
MAC_SIG_ARTIFACT="OrcaSlicer_Mac_universal_V${VERSION}_sig"
|
||||
if gh run download --name "$MAC_SIG_ARTIFACT" -D /tmp/mac_sig 2>/dev/null; then
|
||||
MAC_SIG=$(cat /tmp/mac_sig/*.sig)
|
||||
echo "mac_signature=$MAC_SIG" >> $GITHUB_OUTPUT
|
||||
echo "Found macOS signature: $MAC_SIG"
|
||||
else
|
||||
echo "No macOS signature artifact found"
|
||||
fi
|
||||
|
||||
# For Windows, signature would come from WinSparkle signing (if implemented)
|
||||
# echo "win_signature=$WIN_SIG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate appcast.xml
|
||||
run: |
|
||||
python scripts/generate_appcast.py \
|
||||
--version "${{ steps.version.outputs.version }}" \
|
||||
--release-notes-url "${{ steps.assets.outputs.release_url }}" \
|
||||
--mac-url "${{ steps.assets.outputs.mac_url }}" \
|
||||
--mac-signature "${{ steps.signatures.outputs.mac_signature }}" \
|
||||
--mac-length "${{ steps.assets.outputs.mac_size }}" \
|
||||
--output appcast.xml
|
||||
|
||||
echo "Generated appcast.xml:"
|
||||
cat appcast.xml
|
||||
|
||||
- name: Upload appcast artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: appcast
|
||||
path: appcast.xml
|
||||
|
||||
# Deploy to Cloudflare KV (for check-version.orcaslicer.com Worker)
|
||||
- name: Deploy appcast to Cloudflare KV
|
||||
if: github.event_name == 'release'
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
KV_NAMESPACE_ID: ${{ secrets.CLOUDFLARE_KV_APPCAST_ID }}
|
||||
run: |
|
||||
if [ -n "$CLOUDFLARE_API_TOKEN" ] && [ -n "$CLOUDFLARE_ACCOUNT_ID" ] && [ -n "$KV_NAMESPACE_ID" ]; then
|
||||
# Deploy appcast.xml
|
||||
curl -X PUT \
|
||||
"https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/storage/kv/namespaces/$KV_NAMESPACE_ID/values/appcast.xml" \
|
||||
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
|
||||
-H "Content-Type: text/plain" \
|
||||
--data-binary @appcast.xml
|
||||
echo "Appcast deployed to Cloudflare KV"
|
||||
|
||||
# Deploy macOS signature file (for verification/auditing)
|
||||
if [ -n "${{ steps.signatures.outputs.mac_signature }}" ]; then
|
||||
echo "${{ steps.signatures.outputs.mac_signature }}" > mac_signature.txt
|
||||
curl -X PUT \
|
||||
"https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/storage/kv/namespaces/$KV_NAMESPACE_ID/values/signatures/${{ steps.version.outputs.version }}/mac.sig" \
|
||||
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
|
||||
-H "Content-Type: text/plain" \
|
||||
--data-binary @mac_signature.txt
|
||||
echo "macOS signature deployed to Cloudflare KV"
|
||||
fi
|
||||
else
|
||||
echo "Cloudflare credentials not configured, skipping deployment"
|
||||
fi
|
||||
2
.gitignore
vendored
@@ -43,3 +43,5 @@ test.js
|
||||
/.cache/
|
||||
.clangd
|
||||
internal_docs/
|
||||
# Sparkle auto-update test artifacts
|
||||
/.sparkle-test/
|
||||
|
||||
77
CLAUDE.md
@@ -9,43 +9,68 @@ OrcaSlicer is an open-source 3D slicer application forked from Bambu Studio, bui
|
||||
## Build Commands
|
||||
|
||||
### Building on Windows
|
||||
**Always use this command to build the project when testing build issues on Windows.**
|
||||
```bash
|
||||
cmake --build . --config %build_type% --target ALL_BUILD -- -m
|
||||
# Build everything
|
||||
build_release_vs2022.bat
|
||||
|
||||
# Build with debug symbols
|
||||
build_release_vs2022.bat debug
|
||||
|
||||
# Build only dependencies
|
||||
build_release_vs2022.bat deps
|
||||
|
||||
# Build only slicer (after deps are built)
|
||||
build_release_vs2022.bat slicer
|
||||
|
||||
|
||||
```
|
||||
|
||||
### Building on macOS
|
||||
**Always use this command to build the project when testing build issues on macOS.**
|
||||
```bash
|
||||
cmake --build build/arm64 --config RelWithDebInfo --target all --
|
||||
# Build everything (dependencies and slicer)
|
||||
./build_release_macos.sh
|
||||
|
||||
# Build only dependencies
|
||||
./build_release_macos.sh -d
|
||||
|
||||
# Build only slicer (after deps are built)
|
||||
./build_release_macos.sh -s
|
||||
|
||||
# Use Ninja generator for faster builds
|
||||
./build_release_macos.sh -x
|
||||
|
||||
# Build for specific architecture
|
||||
./build_release_macos.sh -a arm64 # or x86_64 or universal
|
||||
|
||||
# Build for specific macOS version target
|
||||
./build_release_macos.sh -t 11.3
|
||||
```
|
||||
|
||||
### Building on Linux
|
||||
**Always use this command to build the project when testing build issues on Linux.**
|
||||
```bash
|
||||
cmake --build build/arm64 --config RelWithDebInfo --target all --
|
||||
# First time setup - install system dependencies
|
||||
./build_linux.sh -u
|
||||
|
||||
# Build dependencies and slicer
|
||||
./build_linux.sh -dsi
|
||||
|
||||
# Build everything (alternative)
|
||||
./build_linux.sh -dsi
|
||||
|
||||
# Individual options:
|
||||
./build_linux.sh -d # dependencies only
|
||||
./build_linux.sh -s # slicer only
|
||||
./build_linux.sh -i # build AppImage
|
||||
|
||||
# Performance and debug options:
|
||||
./build_linux.sh -j N # limit to N cores
|
||||
./build_linux.sh -1 # single core build
|
||||
./build_linux.sh -b # Debug build
|
||||
./build_linux.sh -e # RelWithDebInfo build
|
||||
./build_linux.sh -c # clean build
|
||||
./build_linux.sh -r # skip RAM/disk checks
|
||||
./build_linux.sh -l # use Clang instead of GCC
|
||||
```
|
||||
### Build test:
|
||||
|
||||
**Always use this command to build the project when testing build issues on Windows.**
|
||||
```bash
|
||||
cmake --build . --config %build_type% --target ALL_BUILD -- -m
|
||||
```
|
||||
|
||||
### Building on macOS
|
||||
**Always use this command to build the project when testing build issues on macOS.**
|
||||
```bash
|
||||
cmake --build build/arm64 --config RelWithDebInfo --target all --
|
||||
```
|
||||
|
||||
### Building on Linux
|
||||
**Always use this command to build the project when testing build issues on Linux.**
|
||||
```bash
|
||||
cmake --build build/arm64 --config RelWithDebInfo --target all --
|
||||
|
||||
```
|
||||
|
||||
|
||||
### Build System
|
||||
- Uses CMake with minimum version 3.13 (maximum 3.31.x on Windows)
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "4.0")
|
||||
set(CMAKE_POLICY_VERSION_MINIMUM 3.5 CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
# Verify that your CMake version is exactly 3.5 series or higher on windows
|
||||
@@ -129,7 +125,7 @@ option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
|
||||
option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1)
|
||||
option(SLIC3R_ASAN "Enable ASan on Clang and GCC" 0)
|
||||
# If SLIC3R_FHS is 1 -> SLIC3R_DESKTOP_INTEGRATION is always 0, othrewise variable.
|
||||
CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_INTEGRATION "Allow performing desktop integration during runtime" 1 "NOT SLIC3R_FHS" 0)
|
||||
CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_INTEGRATION "Allow perfoming desktop integration during runtime" 1 "NOT SLIC3R_FHS" 0)
|
||||
|
||||
set(OPENVDB_FIND_MODULE_PATH "" CACHE PATH "Path to OpenVDB installation's find modules.")
|
||||
|
||||
@@ -575,7 +571,6 @@ endif()
|
||||
if(POLICY CMP0167)
|
||||
cmake_policy(SET CMP0167 NEW)
|
||||
endif()
|
||||
set(Boost_NO_SYSTEM_PATHS TRUE)
|
||||
find_package(Boost 1.83.0 REQUIRED COMPONENTS system filesystem thread log log_setup locale regex chrono atomic date_time iostreams program_options nowide)
|
||||
|
||||
add_library(boost_libs INTERFACE)
|
||||
@@ -693,10 +688,6 @@ find_package(PNG REQUIRED)
|
||||
set(OpenGL_GL_PREFERENCE "LEGACY")
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
if(APPLE AND CMAKE_VERSION VERSION_GREATER_EQUAL "4.0")
|
||||
set(OPENGL_LIBRARIES "-framework OpenGL" CACHE STRING "OpenGL framework" FORCE)
|
||||
endif()
|
||||
|
||||
set(GLEW_ROOT "${CMAKE_PREFIX_PATH}")
|
||||
message("GLEW_ROOT: ${GLEW_ROOT}")
|
||||
# Find glew or use bundled version
|
||||
@@ -731,7 +722,7 @@ add_custom_target(gettext_make_pot
|
||||
)
|
||||
add_custom_target(gettext_merge_po_with_pot
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Merge localization po with new generated pot file"
|
||||
COMMENT "Merge localization po with new generted pot file"
|
||||
)
|
||||
file(GLOB BBL_L10N_PO_FILES "${BBL_L18N_DIR}/*/OrcaSlicer*.po")
|
||||
foreach(po_file ${BBL_L10N_PO_FILES})
|
||||
@@ -820,6 +811,11 @@ function(orcaslicer_copy_dlls target config postfix output_dlls)
|
||||
${TOP_LEVEL_PROJECT_DIR}/deps/WebView2/lib/win-${_arch}/WebView2Loader.dll
|
||||
DESTINATION ${_out_dir})
|
||||
|
||||
# WinSparkle for auto-updates
|
||||
if(EXISTS "${CMAKE_PREFIX_PATH}/bin/WinSparkle.dll")
|
||||
file(COPY ${CMAKE_PREFIX_PATH}/bin/WinSparkle.dll DESTINATION ${_out_dir})
|
||||
endif()
|
||||
|
||||
file(COPY ${CMAKE_PREFIX_PATH}/bin/occt/TKBO.dll
|
||||
${CMAKE_PREFIX_PATH}/bin/occt/TKBRep.dll
|
||||
${CMAKE_PREFIX_PATH}/bin/occt/TKCAF.dll
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
while getopts ":dpa:snt:xbc:1Th" opt; do
|
||||
while getopts ":dpa:snt:xbc:1h" opt; do
|
||||
case "${opt}" in
|
||||
d )
|
||||
export BUILD_TARGET="deps"
|
||||
@@ -37,9 +37,6 @@ while getopts ":dpa:snt:xbc:1Th" opt; do
|
||||
1 )
|
||||
export CMAKE_BUILD_PARALLEL_LEVEL=1
|
||||
;;
|
||||
T )
|
||||
export BUILD_TESTS="1"
|
||||
;;
|
||||
h ) echo "Usage: ./build_release_macos.sh [-d]"
|
||||
echo " -d: Build deps only"
|
||||
echo " -a: Set ARCHITECTURE (arm64 or x86_64 or universal)"
|
||||
@@ -50,7 +47,6 @@ while getopts ":dpa:snt:xbc:1Th" opt; do
|
||||
echo " -b: Build without reconfiguring CMake"
|
||||
echo " -c: Set CMake build configuration, default is Release"
|
||||
echo " -1: Use single job for building"
|
||||
echo " -T: Build and run tests"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
@@ -89,15 +85,6 @@ if [ -z "$OSX_DEPLOYMENT_TARGET" ]; then
|
||||
export OSX_DEPLOYMENT_TARGET="11.3"
|
||||
fi
|
||||
|
||||
CMAKE_VERSION=$(cmake --version | head -1 | sed 's/[^0-9]*\([0-9]*\).*/\1/')
|
||||
if [ "$CMAKE_VERSION" -ge 4 ] 2>/dev/null; then
|
||||
export CMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
export CMAKE_POLICY_COMPAT="-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
|
||||
echo "Detected CMake 4.x, adding compatibility flag (env + cmake arg)"
|
||||
else
|
||||
export CMAKE_POLICY_COMPAT=""
|
||||
fi
|
||||
|
||||
echo "Build params:"
|
||||
echo " - ARCH: $ARCH"
|
||||
echo " - BUILD_CONFIG: $BUILD_CONFIG"
|
||||
@@ -146,8 +133,7 @@ function build_deps() {
|
||||
-G "${DEPS_CMAKE_GENERATOR}" \
|
||||
-DCMAKE_BUILD_TYPE="$BUILD_CONFIG" \
|
||||
-DCMAKE_OSX_ARCHITECTURES:STRING="${_ARCH}" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" \
|
||||
${CMAKE_POLICY_COMPAT}
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}"
|
||||
fi
|
||||
cmake --build . --config "$BUILD_CONFIG" --target deps
|
||||
)
|
||||
@@ -184,24 +170,13 @@ function build_slicer() {
|
||||
-G "${SLICER_CMAKE_GENERATOR}" \
|
||||
-DORCA_TOOLS=ON \
|
||||
${ORCA_UPDATER_SIG_KEY:+-DORCA_UPDATER_SIG_KEY="$ORCA_UPDATER_SIG_KEY"} \
|
||||
${BUILD_TESTS:+-DBUILD_TESTS=ON} \
|
||||
-DCMAKE_BUILD_TYPE="$BUILD_CONFIG" \
|
||||
-DCMAKE_OSX_ARCHITECTURES="${_ARCH}" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" \
|
||||
${CMAKE_POLICY_COMPAT}
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}"
|
||||
fi
|
||||
cmake --build . --config "$BUILD_CONFIG" --target "$SLICER_BUILD_TARGET"
|
||||
)
|
||||
|
||||
if [ "1." == "$BUILD_TESTS". ]; then
|
||||
echo "Running tests for $_ARCH..."
|
||||
(
|
||||
set -x
|
||||
cd "$PROJECT_BUILD_DIR"
|
||||
ctest --build-config "$BUILD_CONFIG" --output-on-failure
|
||||
)
|
||||
fi
|
||||
|
||||
echo "Verify localization with gettext..."
|
||||
(
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
@@ -2,19 +2,6 @@
|
||||
@echo off
|
||||
set WP=%CD%
|
||||
|
||||
@REM Check for Ninja Multi-Config option (-x)
|
||||
set USE_NINJA=0
|
||||
for %%a in (%*) do (
|
||||
if "%%a"=="-x" set USE_NINJA=1
|
||||
)
|
||||
|
||||
if "%USE_NINJA%"=="1" (
|
||||
echo Using Ninja Multi-Config generator
|
||||
set CMAKE_GENERATOR="Ninja Multi-Config"
|
||||
set VS_VERSION=Ninja
|
||||
goto :generator_ready
|
||||
)
|
||||
|
||||
@REM Detect Visual Studio version using msbuild
|
||||
echo Detecting Visual Studio version using msbuild...
|
||||
|
||||
@@ -63,8 +50,6 @@ if "%VS_MAJOR%"=="16" (
|
||||
echo Detected Visual Studio %VS_VERSION% (version %VS_MAJOR%)
|
||||
echo Using CMake generator: %CMAKE_GENERATOR%
|
||||
|
||||
:generator_ready
|
||||
|
||||
@REM Pack deps
|
||||
if "%1"=="pack" (
|
||||
setlocal ENABLEDELAYEDEXPANSION
|
||||
@@ -111,13 +96,8 @@ echo "building deps.."
|
||||
echo on
|
||||
REM Set minimum CMake policy to avoid <3.5 errors
|
||||
set CMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
if "%USE_NINJA%"=="1" (
|
||||
cmake ../ -G %CMAKE_GENERATOR% -DCMAKE_BUILD_TYPE=%build_type%
|
||||
cmake --build . --config %build_type% --target deps
|
||||
) else (
|
||||
cmake ../ -G %CMAKE_GENERATOR% -A x64 -DCMAKE_BUILD_TYPE=%build_type%
|
||||
cmake --build . --config %build_type% --target deps -- -m
|
||||
)
|
||||
cmake ../ -G %CMAKE_GENERATOR% -A x64 -DCMAKE_BUILD_TYPE=%build_type%
|
||||
cmake --build . --config %build_type% --target deps -- -m
|
||||
@echo off
|
||||
|
||||
if "%1"=="deps" exit /b 0
|
||||
@@ -130,13 +110,8 @@ cd %build_dir%
|
||||
|
||||
echo on
|
||||
set CMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
if "%USE_NINJA%"=="1" (
|
||||
cmake .. -G %CMAKE_GENERATOR% -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
|
||||
cmake --build . --config %build_type% --target ALL_BUILD
|
||||
) else (
|
||||
cmake .. -G %CMAKE_GENERATOR% -A x64 -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
|
||||
cmake --build . --config %build_type% --target ALL_BUILD -- -m
|
||||
)
|
||||
cmake .. -G %CMAKE_GENERATOR% -A x64 -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
|
||||
cmake --build . --config %build_type% --target ALL_BUILD -- -m
|
||||
@echo off
|
||||
cd ..
|
||||
call scripts/run_gettext.bat
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
set(_q "")
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
||||
set(_q QUIET)
|
||||
set(_quietly TRUE)
|
||||
endif()
|
||||
find_package(${CMAKE_FIND_PACKAGE_NAME} ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG ${_q})
|
||||
|
||||
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
include(CheckIncludeFileCXX)
|
||||
add_library(draco INTERFACE)
|
||||
target_include_directories(draco INTERFACE include)
|
||||
|
||||
if (_quietly)
|
||||
set(CMAKE_REQUIRED_QUIET ON)
|
||||
endif()
|
||||
CHECK_INCLUDE_FILE_CXX("draco/draco_features.h" HAVE_DRACO_H)
|
||||
|
||||
if (NOT HAVE_DRACO_H)
|
||||
if (${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Draco library not found. Please install the dependency.")
|
||||
elseif(NOT _quietly)
|
||||
message(WARNING "Draco library not found.")
|
||||
endif()
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
# PrusaSlicer specifics:
|
||||
# This file is backported from CMake 3.15 distribution to behave uniformly
|
||||
# across all versions of CMake. It explicitly adds GLEW_STATIC compile
|
||||
# across all versions of CMake. It explicitly adds GLEW_STATIC complile
|
||||
# definition to static targets which is needed to prevent link errors.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
@@ -223,13 +223,8 @@ if(NOT TARGET GLEW::glew AND NOT GLEW_USE_STATIC_LIBS)
|
||||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
|
||||
|
||||
if(APPLE)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0")
|
||||
set_target_properties(GLEW::glew
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES "-framework OpenGL")
|
||||
else()
|
||||
set_target_properties(GLEW::glew
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||
endif()
|
||||
set_target_properties(GLEW::glew
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||
endif()
|
||||
|
||||
if(GLEW_SHARED_LIBRARY_RELEASE)
|
||||
@@ -263,13 +258,8 @@ elseif(NOT TARGET GLEW::glew_s AND GLEW_USE_STATIC_LIBS)
|
||||
set_target_properties(GLEW::glew_s PROPERTIES INTERFACE_COMPILE_DEFINITIONS GLEW_STATIC)
|
||||
|
||||
if(APPLE)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0")
|
||||
set_target_properties(GLEW::glew_s
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES "-framework OpenGL")
|
||||
else()
|
||||
set_target_properties(GLEW::glew_s
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||
endif()
|
||||
set_target_properties(GLEW::glew_s
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||
endif()
|
||||
|
||||
if(GLEW_STATIC_LIBRARY_RELEASE)
|
||||
@@ -302,13 +292,8 @@ if(NOT TARGET GLEW::GLEW)
|
||||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
|
||||
|
||||
if(APPLE)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0")
|
||||
set_target_properties(GLEW::GLEW
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES "-framework OpenGL")
|
||||
else()
|
||||
set_target_properties(GLEW::GLEW
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||
endif()
|
||||
set_target_properties(GLEW::GLEW
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||
endif()
|
||||
|
||||
if(TARGET GLEW::glew)
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
#
|
||||
# * TBB_FOUND - Set to false, or undefined, if we haven’t found, or
|
||||
# don’t want to use TBB.
|
||||
# * TBB_<component>_FOUND - If False, optional <component> part of TBB system is
|
||||
# * TBB_<component>_FOUND - If False, optional <component> part of TBB sytem is
|
||||
# not available.
|
||||
# * TBB_VERSION - The full version string
|
||||
# * TBB_VERSION_MAJOR - The major version
|
||||
@@ -77,7 +77,7 @@
|
||||
# tbbmalloc, tbbmalloc_debug, tbb_preview, or
|
||||
# tbb_preview_debug.
|
||||
#
|
||||
# The following variables should be used to build and link with TBB:
|
||||
# The following varibles should be used to build and link with TBB:
|
||||
#
|
||||
# * TBB_INCLUDE_DIRS - The include directory for TBB.
|
||||
# * TBB_LIBRARIES - The libraries to link against to use TBB.
|
||||
|
||||
@@ -131,13 +131,22 @@
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<!-- Disable App Transport Security. Resolves https://github.com/OrcaSlicer/OrcaSlicer/issues/791 -->
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
<true/>
|
||||
<key>NSAllowsArbitraryLoadsInWebContent</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<!-- Sparkle 2 Auto-Update Configuration -->
|
||||
<key>SUFeedURL</key>
|
||||
<string>https://check-version.orcaslicer.com/appcast.xml</string>
|
||||
<key>SUPublicEDKey</key>
|
||||
<string>eLFARgt9i0VZQR4FtXiTL6jdwjkGr2RMPjfYCCfBWeM=</string>
|
||||
<key>SUEnableAutomaticChecks</key>
|
||||
<true/>
|
||||
<key>SUAllowsAutomaticUpdates</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
30
deps/CMakeLists.txt
vendored
@@ -1,7 +1,3 @@
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "4.0")
|
||||
set(CMAKE_POLICY_VERSION_MINIMUM 3.5 CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
#
|
||||
# This CMake project downloads, configures and builds OrcaSlicer dependencies on Unix and Windows.
|
||||
#
|
||||
@@ -20,8 +16,8 @@ endif()
|
||||
# On Windows, architecture (64 vs 32 bits) is judged based on the compiler variant.
|
||||
# To build dependencies for either 64 or 32 bit OS, use the respective compiler command line.
|
||||
#
|
||||
# WARNING: On UNIX platforms wxWidgets hardcode the destdir path into its `wx-config` utility,
|
||||
# therefore, unfortunately, the installation cannot be copied/moved elsewhere without re-installing wxWidgets.
|
||||
# WARNING: On UNIX platforms wxWidgets hardcode the destdir path into its `wx-conffig` utility,
|
||||
# therefore, unfortunatelly, the installation cannot be copied/moved elsewhere without re-installing wxWidgets.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
@@ -181,7 +177,6 @@ if (NOT IS_CROSS_COMPILE OR NOT APPLE)
|
||||
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname}
|
||||
${_gen}
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}
|
||||
-DCMAKE_MODULE_PATH:STRING=${PROJECT_SOURCE_DIR}/../cmake/modules
|
||||
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR}
|
||||
@@ -226,7 +221,6 @@ else()
|
||||
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname}
|
||||
${_gen}
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}
|
||||
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR}
|
||||
-DBUILD_SHARED_LIBS:BOOL=OFF
|
||||
@@ -336,8 +330,6 @@ include(CGAL/CGAL.cmake)
|
||||
include(NLopt/NLopt.cmake)
|
||||
include(libnoise/libnoise.cmake)
|
||||
|
||||
include(Draco/Draco.cmake)
|
||||
|
||||
|
||||
# I *think* 1.1 is used for *just* md5 hashing?
|
||||
# 3.1 has everything in the right place, but the md5 funcs used are deprecated
|
||||
@@ -394,6 +386,16 @@ endif ()
|
||||
include(OCCT/OCCT.cmake)
|
||||
include(OpenCV/OpenCV.cmake)
|
||||
|
||||
# WinSparkle for Windows auto-updates
|
||||
if(WIN32)
|
||||
include(WinSparkle/WinSparkle.cmake)
|
||||
endif()
|
||||
|
||||
# Sparkle 2 for macOS auto-updates
|
||||
if(APPLE)
|
||||
include(Sparkle/Sparkle.cmake)
|
||||
endif()
|
||||
|
||||
set(_dep_list
|
||||
dep_Boost
|
||||
dep_TBB
|
||||
@@ -401,7 +403,6 @@ set(_dep_list
|
||||
${CURL_PKG}
|
||||
${WXWIDGETS_PKG}
|
||||
dep_Cereal
|
||||
dep_Draco
|
||||
dep_NLopt
|
||||
dep_OpenVDB
|
||||
dep_OpenCSG
|
||||
@@ -419,12 +420,19 @@ set(_dep_list
|
||||
if (MSVC)
|
||||
# Experimental
|
||||
#list(APPEND _dep_list "dep_qhull")
|
||||
# WinSparkle for auto-updates
|
||||
list(APPEND _dep_list "dep_WinSparkle")
|
||||
else()
|
||||
list(APPEND _dep_list "dep_Qhull")
|
||||
# Not working, static build has different Eigen
|
||||
#list(APPEND _dep_list "dep_libigl")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
# Sparkle 2 for auto-updates
|
||||
list(APPEND _dep_list "dep_Sparkle")
|
||||
endif()
|
||||
|
||||
add_custom_target(deps ALL DEPENDS ${_dep_list})
|
||||
|
||||
# Note: I'm not using any of the LOG_xxx options in ExternalProject_Add() commands
|
||||
|
||||
4
deps/Draco/Draco.cmake
vendored
@@ -1,4 +0,0 @@
|
||||
orcaslicer_add_cmake_project(Draco
|
||||
URL https://github.com/google/draco/archive/refs/tags/1.5.7.zip
|
||||
URL_HASH SHA256=27b72ba2d5ff3d0a9814ad40d4cb88f8dc89a35491c0866d952473f8f9416b77
|
||||
)
|
||||
27
deps/Sparkle/Sparkle.cmake
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
# Sparkle 2 - Auto-update framework for macOS
|
||||
# https://sparkle-project.org/
|
||||
# https://github.com/sparkle-project/Sparkle
|
||||
#
|
||||
# Sparkle is distributed as a pre-built framework, so we just download and extract.
|
||||
|
||||
if(APPLE)
|
||||
set(SPARKLE_VERSION "2.8.1")
|
||||
|
||||
ExternalProject_Add(
|
||||
dep_Sparkle
|
||||
EXCLUDE_FROM_ALL ON
|
||||
URL "https://github.com/sparkle-project/Sparkle/releases/download/${SPARKLE_VERSION}/Sparkle-${SPARKLE_VERSION}.tar.xz"
|
||||
URL_HASH SHA256=5cddb7695674ef7704268f38eccaee80e3accbf19e61c1689efff5b6116d85be
|
||||
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/Sparkle
|
||||
# No build step needed - just install pre-built framework and tools
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/Frameworks
|
||||
# Use ditto to preserve symlinks in framework bundle (cmake -E copy_directory breaks symlinks)
|
||||
COMMAND ditto <SOURCE_DIR>/Sparkle.framework ${DESTDIR}/Frameworks/Sparkle.framework
|
||||
# Also install the Sparkle CLI tools (sign_update, generate_appcast) for CI/CD signing
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/bin
|
||||
COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/bin/sign_update ${DESTDIR}/bin/sign_update
|
||||
COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/bin/generate_appcast ${DESTDIR}/bin/generate_appcast
|
||||
)
|
||||
endif()
|
||||
33
deps/WinSparkle/WinSparkle.cmake
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
# WinSparkle - Auto-update framework for Windows
|
||||
# https://winsparkle.org/
|
||||
# https://github.com/vslavik/winsparkle
|
||||
#
|
||||
# WinSparkle is distributed as pre-built binaries, so we just download and extract.
|
||||
|
||||
if(WIN32)
|
||||
set(WINSPARKLE_VERSION "0.8.3")
|
||||
|
||||
# Determine architecture
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(WINSPARKLE_ARCH "x64")
|
||||
else()
|
||||
set(WINSPARKLE_ARCH "x86")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(
|
||||
dep_WinSparkle
|
||||
EXCLUDE_FROM_ALL ON
|
||||
URL "https://github.com/vslavik/winsparkle/releases/download/v${WINSPARKLE_VERSION}/WinSparkle-${WINSPARKLE_VERSION}.zip"
|
||||
URL_HASH SHA256=5ff4a4604c78d57e01d83e22f79f5ffea0c4969defd48b45c69ccbd6b1a71e94
|
||||
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/WinSparkle
|
||||
# No build step needed - just install pre-built binaries
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
<SOURCE_DIR>/include ${DESTDIR}/include
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
<SOURCE_DIR>/${WINSPARKLE_ARCH}/Release/WinSparkle.dll ${DESTDIR}/bin/WinSparkle.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
<SOURCE_DIR>/${WINSPARKLE_ARCH}/Release/WinSparkle.lib ${DESTDIR}/lib/WinSparkle.lib
|
||||
)
|
||||
endif()
|
||||
9
deps/wxWidgets/wxWidgets.cmake
vendored
@@ -24,14 +24,6 @@ else ()
|
||||
set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=OFF")
|
||||
endif ()
|
||||
|
||||
set(_wx_opengl_override "")
|
||||
if(APPLE AND CMAKE_VERSION VERSION_GREATER_EQUAL "4.0")
|
||||
set(_wx_opengl_override
|
||||
-DOPENGL_gl_LIBRARY="-framework OpenGL"
|
||||
-DOPENGL_glu_LIBRARY="-framework OpenGL"
|
||||
)
|
||||
endif()
|
||||
|
||||
orcaslicer_add_cmake_project(
|
||||
wxWidgets
|
||||
GIT_REPOSITORY "https://github.com/SoftFever/Orca-deps-wxWidgets"
|
||||
@@ -39,7 +31,6 @@ orcaslicer_add_cmake_project(
|
||||
DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} ${JPEG_PKG}
|
||||
${_wx_flatpak_patch}
|
||||
CMAKE_ARGS
|
||||
${_wx_opengl_override}
|
||||
-DwxBUILD_PRECOMP=ON
|
||||
${_wx_toolkit}
|
||||
"-DCMAKE_DEBUG_POSTFIX:STRING=${_wx_debug_postfix}"
|
||||
|
||||
@@ -26,7 +26,6 @@ add_subdirectory(imguizmo)
|
||||
add_subdirectory(libigl)
|
||||
add_subdirectory(libnest2d)
|
||||
add_subdirectory(mcut)
|
||||
add_subdirectory(md4c)
|
||||
add_subdirectory(miniz)
|
||||
add_subdirectory(minilzo)
|
||||
add_subdirectory(qhull)
|
||||
|
||||
@@ -153,8 +153,6 @@ namespace ImGui
|
||||
// const wchar_t CustomSupportsMarker = 0x1D;
|
||||
// const wchar_t CustomSeamMarker = 0x1E;
|
||||
// const wchar_t MmuSegmentationMarker = 0x1F;
|
||||
//const wchar_t HorizontalHide = 0xB1; // ORCA use FoldButtonIcon / UnfoldButtonIcon
|
||||
//const wchar_t HorizontalShow = 0xB2;
|
||||
|
||||
// Do not forget use following letters only in wstring
|
||||
//BBS use 08xx to avoid unicode character which may be used
|
||||
|
||||
@@ -18,7 +18,7 @@ template <
|
||||
typename DerivedF,
|
||||
typename SType,
|
||||
typename DerivedNF>
|
||||
IGL_INLINE bool igl::loop(
|
||||
IGL_INLINE void igl::loop(
|
||||
const int n_verts,
|
||||
const Eigen::PlainObjectBase<DerivedF> & F,
|
||||
Eigen::SparseMatrix<SType>& S,
|
||||
@@ -26,15 +26,15 @@ IGL_INLINE bool igl::loop(
|
||||
{
|
||||
typedef Eigen::SparseMatrix<SType> SparseMat;
|
||||
typedef Eigen::Triplet<SType> Triplet_t;
|
||||
|
||||
|
||||
//Ref. https://graphics.stanford.edu/~mdfisher/subdivision.html
|
||||
//Heavily borrowing from igl::upsample
|
||||
|
||||
|
||||
DerivedF FF, FFi;
|
||||
triangle_triangle_adjacency(F, FF, FFi);
|
||||
std::vector<std::vector<typename DerivedF::Scalar>> adjacencyList;
|
||||
adjacency_list(F, adjacencyList, true);
|
||||
|
||||
|
||||
//Compute the number and positions of the vertices to insert (on edges)
|
||||
Eigen::MatrixXi NI = Eigen::MatrixXi::Constant(FF.rows(), FF.cols(), -1);
|
||||
Eigen::MatrixXi NIdoubles = Eigen::MatrixXi::Zero(FF.rows(), FF.cols());
|
||||
@@ -48,18 +48,12 @@ IGL_INLINE bool igl::loop(
|
||||
{
|
||||
NI(i,j) = counter;
|
||||
NIdoubles(i,j) = 0;
|
||||
if (FF(i,j) != -1)
|
||||
if (FF(i,j) != -1)
|
||||
{
|
||||
//If it is not a boundary
|
||||
int adj_triangle = FF(i, j);
|
||||
int adj_edge = FFi(i, j);
|
||||
if (adj_triangle >= 0 && adj_triangle < NI.rows() && adj_edge >= 0 && adj_edge < NI.cols()) {
|
||||
NI(adj_triangle, adj_edge) = counter;
|
||||
NIdoubles(i, j) = 1;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
NI(FF(i,j), FFi(i,j)) = counter;
|
||||
NIdoubles(i,j) = 1;
|
||||
} else
|
||||
{
|
||||
//Mark boundary vertices for later
|
||||
vertIsOnBdry(F(i,j)) = 1;
|
||||
@@ -69,24 +63,24 @@ IGL_INLINE bool igl::loop(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const int& n_odd = n_verts;
|
||||
const int& n_even = counter;
|
||||
const int n_newverts = n_odd + n_even;
|
||||
|
||||
|
||||
//Construct vertex positions
|
||||
std::vector<Triplet_t> tripletList;
|
||||
for(int i=0; i<n_odd; ++i)
|
||||
for(int i=0; i<n_odd; ++i)
|
||||
{
|
||||
//Old vertices
|
||||
const std::vector<int>& localAdjList = adjacencyList[i];
|
||||
if(vertIsOnBdry(i)==1)
|
||||
if(vertIsOnBdry(i)==1)
|
||||
{
|
||||
//Boundary vertex
|
||||
tripletList.emplace_back(i, localAdjList.front(), 1./8.);
|
||||
tripletList.emplace_back(i, localAdjList.back(), 1./8.);
|
||||
tripletList.emplace_back(i, i, 3./4.);
|
||||
} else
|
||||
} else
|
||||
{
|
||||
const int n = localAdjList.size();
|
||||
const SType dn = n;
|
||||
@@ -105,19 +99,19 @@ IGL_INLINE bool igl::loop(
|
||||
tripletList.emplace_back(i, i, 1.-dn*beta);
|
||||
}
|
||||
}
|
||||
for(int i=0; i<FF.rows(); ++i)
|
||||
for(int i=0; i<FF.rows(); ++i)
|
||||
{
|
||||
//New vertices
|
||||
for(int j=0; j<3; ++j)
|
||||
for(int j=0; j<3; ++j)
|
||||
{
|
||||
if(NIdoubles(i,j)==0)
|
||||
if(NIdoubles(i,j)==0)
|
||||
{
|
||||
if(FF(i,j)==-1)
|
||||
if(FF(i,j)==-1)
|
||||
{
|
||||
//Boundary vertex
|
||||
tripletList.emplace_back(NI(i,j) + n_odd, F(i,j), 1./2.);
|
||||
tripletList.emplace_back(NI(i,j) + n_odd, F(i, (j+1)%3), 1./2.);
|
||||
} else
|
||||
} else
|
||||
{
|
||||
tripletList.emplace_back(NI(i,j) + n_odd, F(i,j), 3./8.);
|
||||
tripletList.emplace_back(NI(i,j) + n_odd, F(i, (j+1)%3), 3./8.);
|
||||
@@ -129,34 +123,33 @@ IGL_INLINE bool igl::loop(
|
||||
}
|
||||
S.resize(n_newverts, n_verts);
|
||||
S.setFromTriplets(tripletList.begin(), tripletList.end());
|
||||
|
||||
|
||||
// Build the new topology (Every face is replaced by four)
|
||||
NF.resize(F.rows()*4, 3);
|
||||
for(int i=0; i<F.rows();++i)
|
||||
{
|
||||
Eigen::VectorXi VI(6);
|
||||
VI << F(i,0), F(i,1), F(i,2), NI(i,0) + n_odd, NI(i,1) + n_odd, NI(i,2) + n_odd;
|
||||
|
||||
|
||||
Eigen::VectorXi f0(3), f1(3), f2(3), f3(3);
|
||||
f0 << VI(0), VI(3), VI(5);
|
||||
f1 << VI(1), VI(4), VI(3);
|
||||
f2 << VI(3), VI(4), VI(5);
|
||||
f3 << VI(4), VI(2), VI(5);
|
||||
|
||||
|
||||
NF.row((i*4)+0) = f0;
|
||||
NF.row((i*4)+1) = f1;
|
||||
NF.row((i*4)+2) = f2;
|
||||
NF.row((i*4)+3) = f3;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <
|
||||
typename DerivedV,
|
||||
typename DerivedV,
|
||||
typename DerivedF,
|
||||
typename DerivedNV,
|
||||
typename DerivedNF>
|
||||
IGL_INLINE bool igl::loop(
|
||||
IGL_INLINE void igl::loop(
|
||||
const Eigen::PlainObjectBase<DerivedV>& V,
|
||||
const Eigen::PlainObjectBase<DerivedF>& F,
|
||||
Eigen::PlainObjectBase<DerivedNV>& NV,
|
||||
@@ -165,19 +158,16 @@ IGL_INLINE bool igl::loop(
|
||||
{
|
||||
NV = V;
|
||||
NF = F;
|
||||
for(int i=0; i<number_of_subdivs; ++i)
|
||||
for(int i=0; i<number_of_subdivs; ++i)
|
||||
{
|
||||
DerivedNF tempF = NF;
|
||||
Eigen::SparseMatrix<typename DerivedV::Scalar> S;
|
||||
if (!loop(NV.rows(), tempF, S, NF)) {
|
||||
return false;
|
||||
}
|
||||
loop(NV.rows(), tempF, S, NF);
|
||||
// This .eval is super important
|
||||
NV = (S*NV).eval();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
template void igl::loop<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, int);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace igl
|
||||
typename DerivedF,
|
||||
typename SType,
|
||||
typename DerivedNF>
|
||||
IGL_INLINE bool loop(
|
||||
IGL_INLINE void loop(
|
||||
const int n_verts,
|
||||
const Eigen::PlainObjectBase<DerivedF> & F,
|
||||
Eigen::SparseMatrix<SType>& S,
|
||||
@@ -44,11 +44,11 @@ namespace igl
|
||||
// NV a matrix containing the new vertices
|
||||
// NF a matrix containing the new faces
|
||||
template <
|
||||
typename DerivedV,
|
||||
typename DerivedV,
|
||||
typename DerivedF,
|
||||
typename DerivedNV,
|
||||
typename DerivedNF>
|
||||
IGL_INLINE bool loop(
|
||||
IGL_INLINE void loop(
|
||||
const Eigen::PlainObjectBase<DerivedV>& V,
|
||||
const Eigen::PlainObjectBase<DerivedF>& F,
|
||||
Eigen::PlainObjectBase<DerivedNV>& NV,
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(MD4C C)
|
||||
|
||||
set(MD_VERSION_MAJOR 0)
|
||||
set(MD_VERSION_MINOR 5)
|
||||
set(MD_VERSION_RELEASE 2)
|
||||
set(MD_VERSION "${MD_VERSION_MAJOR}.${MD_VERSION_MINOR}.${MD_VERSION_RELEASE}")
|
||||
|
||||
set(PROJECT_VERSION "${MD_VERSION}")
|
||||
set(PROJECT_URL "https://github.com/mity/md4c")
|
||||
|
||||
|
||||
#option(BUILD_MD2HTML_EXECUTABLE "Whether to compile the md2html executable" ON)
|
||||
|
||||
|
||||
#if(WIN32)
|
||||
# # On Windows, given there is no standard lib install dir etc., we rather
|
||||
# # by default build static lib.
|
||||
# option(BUILD_SHARED_LIBS "help string describing option" OFF)
|
||||
#else()
|
||||
# # On Linux, MD4C is slowly being adding into some distros which prefer
|
||||
# # shared lib.
|
||||
# option(BUILD_SHARED_LIBS "help string describing option" ON)
|
||||
#endif()
|
||||
|
||||
add_definitions(
|
||||
-DMD_VERSION_MAJOR=${MD_VERSION_MAJOR}
|
||||
-DMD_VERSION_MINOR=${MD_VERSION_MINOR}
|
||||
-DMD_VERSION_RELEASE=${MD_VERSION_RELEASE}
|
||||
)
|
||||
|
||||
#set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo MinSizeRel)
|
||||
#if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
# set(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE})
|
||||
#
|
||||
# if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
# set(CMAKE_BUILD_TYPE "Release")
|
||||
# endif()
|
||||
#endif()
|
||||
|
||||
|
||||
if(${CMAKE_C_COMPILER_ID} MATCHES GNU|Clang)
|
||||
add_compile_options(-Wall -Wextra -Wshadow)
|
||||
|
||||
# We enforce -Wdeclaration-after-statement because Qt project needs to
|
||||
# build MD4C with Integrity compiler which chokes whenever a declaration
|
||||
# is not at the beginning of a block.
|
||||
add_compile_options(-Wdeclaration-after-statement)
|
||||
elseif(MSVC)
|
||||
# Disable warnings about the so-called unsecured functions:
|
||||
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
|
||||
add_compile_options(/W3)
|
||||
|
||||
# Specify proper C runtime library:
|
||||
string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||
string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_RELWITHDEBINFO "{$CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /MT")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE} /MT")
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
add_subdirectory(src)
|
||||
#if (BUILD_MD2HTML_EXECUTABLE)
|
||||
# add_subdirectory(md2html)
|
||||
#endif ()
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
# The MIT License (MIT)
|
||||
|
||||
Copyright © 2016-2024 Martin Mitáš
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the “Software”),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
@@ -1,297 +0,0 @@
|
||||
|
||||
# MD4C Readme
|
||||
|
||||
* Home: http://github.com/mity/md4c
|
||||
* Wiki: http://github.com/mity/md4c/wiki
|
||||
* Issue tracker: http://github.com/mity/md4c/issues
|
||||
|
||||
MD4C stands for "Markdown for C" and that's exactly what this project is about.
|
||||
|
||||
|
||||
## What is Markdown
|
||||
|
||||
In short, Markdown is the markup language this `README.md` file is written in.
|
||||
|
||||
The following resources can explain more if you are unfamiliar with it:
|
||||
* [Wikipedia article](http://en.wikipedia.org/wiki/Markdown)
|
||||
* [CommonMark site](http://commonmark.org)
|
||||
|
||||
|
||||
## What is MD4C
|
||||
|
||||
MD4C is Markdown parser implementation in C, with the following features:
|
||||
|
||||
* **Compliance:** Generally, MD4C aims to be compliant to the latest version of
|
||||
[CommonMark specification](http://spec.commonmark.org/). Currently, we are
|
||||
fully compliant to CommonMark 0.31.
|
||||
|
||||
* **Extensions:** MD4C supports some commonly requested and accepted extensions.
|
||||
See below.
|
||||
|
||||
* **Performance:** MD4C is [very fast](https://talk.commonmark.org/t/2520).
|
||||
|
||||
* **Compactness:** MD4C parser is implemented in one source file and one header
|
||||
file. There are no dependencies other than standard C library.
|
||||
|
||||
* **Embedding:** MD4C parser is easy to reuse in other projects, its API is
|
||||
very straightforward: There is actually just one function, `md_parse()`.
|
||||
|
||||
* **Push model:** MD4C parses the complete document and calls few callback
|
||||
functions provided by the application to inform it about a start/end of
|
||||
every block, a start/end of every span, and with any textual contents.
|
||||
|
||||
* **Portability:** MD4C builds and works on Windows and POSIX-compliant OSes.
|
||||
(It should be simple to make it run also on most other platforms, at least as
|
||||
long as the platform provides C standard library, including a heap memory
|
||||
management.)
|
||||
|
||||
* **Encoding:** MD4C by default expects UTF-8 encoding of the input document.
|
||||
But it can be compiled to recognize ASCII-only control characters (i.e. to
|
||||
disable all Unicode-specific code), or (on Windows) to expect UTF-16 (i.e.
|
||||
what is on Windows commonly called just "Unicode"). See more details below.
|
||||
|
||||
* **Permissive license:** MD4C is available under the [MIT license](LICENSE.md).
|
||||
|
||||
|
||||
## Using MD4C
|
||||
|
||||
### Parsing Markdown
|
||||
|
||||
If you need just to parse a Markdown document, you need to include `md4c.h`
|
||||
and link against MD4C library (`-lmd4c`); or alternatively add `md4c.[hc]`
|
||||
directly to your code base as the parser is only implemented in the single C
|
||||
source file.
|
||||
|
||||
The main provided function is `md_parse()`. It takes a text in the Markdown
|
||||
syntax and a pointer to a structure which provides pointers to several callback
|
||||
functions.
|
||||
|
||||
As `md_parse()` processes the input, it calls the callbacks (when entering or
|
||||
leaving any Markdown block or span; and when outputting any textual content of
|
||||
the document), allowing application to convert it into another format or render
|
||||
it onto the screen.
|
||||
|
||||
|
||||
### Converting to HTML
|
||||
|
||||
If you need to convert Markdown to HTML, include `md4c-html.h` and link against
|
||||
MD4C-HTML library (`-lmd4c-html`); or alternatively add the sources `md4c.[hc]`,
|
||||
`md4c-html.[hc]` and `entity.[hc]` into your code base.
|
||||
|
||||
To convert a Markdown input, call `md_html()` function. It takes the Markdown
|
||||
input and calls the provided callback function. The callback is fed with
|
||||
chunks of the HTML output. Typical callback implementation just appends the
|
||||
chunks into a buffer or writes them to a file.
|
||||
|
||||
|
||||
## Markdown Extensions
|
||||
|
||||
The default behavior is to recognize only Markdown syntax defined by the
|
||||
[CommonMark specification](http://spec.commonmark.org/).
|
||||
|
||||
However, with appropriate flags, the behavior can be tuned to enable some
|
||||
extensions:
|
||||
|
||||
* With the flag `MD_FLAG_COLLAPSEWHITESPACE`, a non-trivial whitespace is
|
||||
collapsed into a single space.
|
||||
|
||||
* With the flag `MD_FLAG_TABLES`, GitHub-style tables are supported.
|
||||
|
||||
* With the flag `MD_FLAG_TASKLISTS`, GitHub-style task lists are supported.
|
||||
|
||||
* With the flag `MD_FLAG_STRIKETHROUGH`, strike-through spans are enabled
|
||||
(text enclosed in tilde marks, e.g. `~foo bar~`).
|
||||
|
||||
* With the flag `MD_FLAG_PERMISSIVEURLAUTOLINKS` permissive URL autolinks
|
||||
(not enclosed in `<` and `>`) are supported.
|
||||
|
||||
* With the flag `MD_FLAG_PERMISSIVEEMAILAUTOLINKS`, permissive e-mail
|
||||
autolinks (not enclosed in `<` and `>`) are supported.
|
||||
|
||||
* With the flag `MD_FLAG_PERMISSIVEWWWAUTOLINKS` permissive WWW autolinks
|
||||
without any scheme specified (e.g. `www.example.com`) are supported. MD4C
|
||||
then assumes `http:` scheme.
|
||||
|
||||
* With the flag `MD_FLAG_LATEXMATHSPANS` LaTeX math spans (`$...$`) and
|
||||
LaTeX display math spans (`$$...$$`) are supported. (Note though that the
|
||||
HTML renderer outputs them verbatim in a custom tag `<x-equation>`.)
|
||||
|
||||
* With the flag `MD_FLAG_WIKILINKS`, wiki-style links (`[[link label]]` and
|
||||
`[[target article|link label]]`) are supported. (Note that the HTML renderer
|
||||
outputs them in a custom tag `<x-wikilink>`.)
|
||||
|
||||
* With the flag `MD_FLAG_UNDERLINE`, underscore (`_`) denotes an underline
|
||||
instead of an ordinary emphasis or strong emphasis.
|
||||
|
||||
Few features of CommonMark (those some people see as mis-features) may be
|
||||
disabled with the following flags:
|
||||
|
||||
* With the flag `MD_FLAG_NOHTMLSPANS` or `MD_FLAG_NOHTMLBLOCKS`, raw inline
|
||||
HTML or raw HTML blocks respectively are disabled.
|
||||
|
||||
* With the flag `MD_FLAG_NOINDENTEDCODEBLOCKS`, indented code blocks are
|
||||
disabled.
|
||||
|
||||
|
||||
## Input/Output Encoding
|
||||
|
||||
The CommonMark specification declares that any sequence of Unicode code points
|
||||
is a valid CommonMark document.
|
||||
|
||||
But, under a closer inspection, Unicode plays any role in few very specific
|
||||
situations when parsing Markdown documents:
|
||||
|
||||
1. For detection of word boundaries when processing emphasis and strong
|
||||
emphasis, some classification of Unicode characters (whether it is
|
||||
a whitespace or a punctuation) is needed.
|
||||
|
||||
2. For (case-insensitive) matching of a link reference label with the
|
||||
corresponding link reference definition, Unicode case folding is used.
|
||||
|
||||
3. For translating HTML entities (e.g. `&`) and numeric character
|
||||
references (e.g. `#` or `ಫ`) into their Unicode equivalents.
|
||||
|
||||
However note MD4C leaves this translation on the renderer/application; as
|
||||
the renderer is supposed to really know output encoding and whether it
|
||||
really needs to perform this kind of translation. (For example, when the
|
||||
renderer outputs HTML, it may leave the entities untranslated and defer the
|
||||
work to a web browser.)
|
||||
|
||||
MD4C relies on this property of the CommonMark and the implementation is, to
|
||||
a large degree, encoding-agnostic. Most of MD4C code only assumes that the
|
||||
encoding of your choice is compatible with ASCII. I.e. that the codepoints
|
||||
below 128 have the same numeric values as ASCII.
|
||||
|
||||
Any input MD4C does not understand is simply seen as part of the document text
|
||||
and sent to the renderer's callback functions unchanged.
|
||||
|
||||
The two situations (word boundary detection and link reference matching) where
|
||||
MD4C has to understand Unicode are handled as specified by the following
|
||||
preprocessor macros (as specified at the time MD4C is being built):
|
||||
|
||||
* If preprocessor macro `MD4C_USE_UTF8` is defined, MD4C assumes UTF-8 for the
|
||||
word boundary detection and for the case-insensitive matching of link labels.
|
||||
|
||||
When none of these macros is explicitly used, this is the default behavior.
|
||||
|
||||
* On Windows, if preprocessor macro `MD4C_USE_UTF16` is defined, MD4C uses
|
||||
`WCHAR` instead of `char` and assumes UTF-16 encoding in those situations.
|
||||
(UTF-16 is what Windows developers usually call just "Unicode" and what
|
||||
Win32API generally works with.)
|
||||
|
||||
Note that because this macro affects also the types in `md4c.h`, you have
|
||||
to define the macro both when building MD4C as well as when including
|
||||
`md4c.h`.
|
||||
|
||||
Also note this is only supported in the parser (`md4c.[hc]`). The HTML
|
||||
renderer does not support this and you will have to write your own custom
|
||||
renderer to use this feature.
|
||||
|
||||
* If preprocessor macro `MD4C_USE_ASCII` is defined, MD4C assumes nothing but
|
||||
an ASCII input.
|
||||
|
||||
That effectively means that non-ASCII whitespace or punctuation characters
|
||||
won't be recognized as such and that link reference matching will work in
|
||||
a case-insensitive way only for ASCII letters (`[a-zA-Z]`).
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
The API of the parser is quite well documented in the comments in the `md4c.h`.
|
||||
Similarly, the markdown-to-html API is described in its header `md4c-html.h`.
|
||||
|
||||
There is also [project wiki](http://github.com/mity/md4c/wiki) which provides
|
||||
some more comprehensive documentation. However note it is incomplete and some
|
||||
details may be somewhat outdated.
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
**Q: How does MD4C compare to other Markdown parsers?**
|
||||
|
||||
**A:** Some other implementations combine Markdown parser and HTML generator
|
||||
into a single entangled code hidden behind an interface which just allows the
|
||||
conversion from Markdown to HTML. They are often unusable if you want to
|
||||
process the input in any other way.
|
||||
|
||||
Second, most parsers (if not all of them; at least within the scope of C/C++
|
||||
language) are full DOM-like parsers: They construct abstract syntax tree (AST)
|
||||
representation of the whole Markdown document. That takes time and it leads to
|
||||
bigger memory footprint.
|
||||
|
||||
Building AST is completely fine as long as you need it. If you don't, there is
|
||||
a very high chance that using MD4C will be substantially faster and less hungry
|
||||
in terms of memory consumption.
|
||||
|
||||
Last but not least, some Markdown parsers are implemented in a naive way. When
|
||||
fed with a [smartly crafted input pattern](test/pathological_tests.py), they
|
||||
may exhibit quadratic (or even worse) parsing times. What MD4C can still parse
|
||||
in a fraction of second may turn into long minutes or possibly hours with them.
|
||||
Hence, when such a naive parser is used to process an input from an untrusted
|
||||
source, the possibility of denial-of-service attacks becomes a real danger.
|
||||
|
||||
A lot of our effort went into providing linear parsing times no matter what
|
||||
kind of crazy input MD4C parser is fed with. (If you encounter an input pattern
|
||||
which leads to a sub-linear parsing times, please do not hesitate and report it
|
||||
as a bug.)
|
||||
|
||||
**Q: Does MD4C perform any input validation?**
|
||||
|
||||
**A:** No. And we are proud of it. :-)
|
||||
|
||||
CommonMark specification states that any sequence of Unicode characters is
|
||||
a valid Markdown document. (In practice, this more or less always means UTF-8
|
||||
encoding.)
|
||||
|
||||
In other words, according to the specification, it does not matter whether some
|
||||
Markdown syntax construction is in some way broken or not. If it's broken, it
|
||||
won't be recognized and the parser should see it just as a verbatim text.
|
||||
|
||||
MD4C takes this a step further: It sees any sequence of bytes as a valid input,
|
||||
following completely the GIGO philosophy (garbage in, garbage out). I.e. any
|
||||
ill-formed UTF-8 byte sequence will propagate to the respective callback as
|
||||
a part of the text.
|
||||
|
||||
If you need to validate that the input is, say, a well-formed UTF-8 document,
|
||||
you have to do it on your own. The easiest way how to do this is to simply
|
||||
validate the whole document before passing it to the MD4C parser.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MD4C is covered with MIT license, see the file `LICENSE.md`.
|
||||
|
||||
|
||||
## Links to Related Projects
|
||||
|
||||
Ports and bindings to other languages:
|
||||
|
||||
* [commonmark-d](https://github.com/AuburnSounds/commonmark-d):
|
||||
Port of MD4C to D language.
|
||||
|
||||
* [markdown-wasm](https://github.com/rsms/markdown-wasm):
|
||||
Port of MD4C to WebAssembly.
|
||||
|
||||
* [PyMD4C](https://github.com/dominickpastore/pymd4c):
|
||||
Python bindings for MD4C
|
||||
|
||||
Software using MD4C:
|
||||
|
||||
* [imgui_md](https://github.com/mekhontsev/imgui_md):
|
||||
Markdown renderer for [Dear ImGui](https://github.com/ocornut/imgui)
|
||||
|
||||
* [MarkDown Monolith Assembler](https://github.com/1Hyena/mdma):
|
||||
A command line tool for building browser-based books.
|
||||
|
||||
* [QOwnNotes](https://www.qownnotes.org/):
|
||||
A plain-text file notepad and todo-list manager with markdown support and
|
||||
ownCloud / Nextcloud integration.
|
||||
|
||||
* [Qt](https://www.qt.io/):
|
||||
Cross-platform C++ GUI framework.
|
||||
|
||||
* [Textosaurus](https://github.com/martinrotter/textosaurus):
|
||||
Cross-platform text editor based on Qt and Scintilla.
|
||||
|
||||
* [8th](https://8th-dev.com/):
|
||||
Cross-platform concatenative programming language.
|
||||
@@ -1,53 +0,0 @@
|
||||
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 1)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
|
||||
|
||||
|
||||
# Build rules for MD4C parser library
|
||||
|
||||
configure_file(md4c.pc.in md4c.pc @ONLY)
|
||||
add_library(md4c md4c.c md4c.h)
|
||||
set_target_properties(md4c PROPERTIES
|
||||
COMPILE_FLAGS "-DMD4C_USE_UTF8"
|
||||
VERSION ${MD_VERSION}
|
||||
SOVERSION ${MD_VERSION_MAJOR}
|
||||
PUBLIC_HEADER md4c.h
|
||||
)
|
||||
|
||||
# Build rules for HTML renderer library
|
||||
|
||||
configure_file(md4c-html.pc.in md4c-html.pc @ONLY)
|
||||
add_library(md4c-html md4c-html.c md4c-html.h entity.c entity.h)
|
||||
set_target_properties(md4c-html PROPERTIES
|
||||
VERSION ${MD_VERSION}
|
||||
SOVERSION ${MD_VERSION_MAJOR}
|
||||
PUBLIC_HEADER md4c-html.h
|
||||
)
|
||||
target_link_libraries(md4c-html md4c)
|
||||
|
||||
|
||||
# Install rules
|
||||
|
||||
#install(
|
||||
# TARGETS md4c
|
||||
# EXPORT md4cConfig
|
||||
# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
# INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
#)
|
||||
#install(FILES ${CMAKE_BINARY_DIR}/src/md4c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
#
|
||||
#install(
|
||||
# TARGETS md4c-html
|
||||
# EXPORT md4cConfig
|
||||
# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
#)
|
||||
#install(FILES ${CMAKE_BINARY_DIR}/src/md4c-html.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
#
|
||||
#install(EXPORT md4cConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/md4c/ NAMESPACE md4c::)
|
||||
#
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* MD4C: Markdown parser for C
|
||||
* (http://github.com/mity/md4c)
|
||||
*
|
||||
* Copyright (c) 2016-2024 Martin Mitáš
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MD4C_ENTITY_H
|
||||
#define MD4C_ENTITY_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/* Most entities are formed by single Unicode codepoint, few by two codepoints.
|
||||
* Single-codepoint entities have codepoints[1] set to zero. */
|
||||
typedef struct ENTITY_tag ENTITY;
|
||||
struct ENTITY_tag {
|
||||
const char* name;
|
||||
unsigned codepoints[2];
|
||||
};
|
||||
|
||||
const ENTITY* entity_lookup(const char* name, size_t name_size);
|
||||
|
||||
|
||||
#endif /* MD4C_ENTITY_H */
|
||||
@@ -1,567 +0,0 @@
|
||||
/*
|
||||
* MD4C: Markdown parser for C
|
||||
* (http://github.com/mity/md4c)
|
||||
*
|
||||
* Copyright (c) 2016-2024 Martin Mitáš
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "md4c-html.h"
|
||||
#include "entity.h"
|
||||
|
||||
|
||||
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199409L
|
||||
/* C89/90 or old compilers in general may not understand "inline". */
|
||||
#if defined __GNUC__
|
||||
#define inline __inline__
|
||||
#elif defined _MSC_VER
|
||||
#define inline __inline
|
||||
#else
|
||||
#define inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef struct MD_HTML_tag MD_HTML;
|
||||
struct MD_HTML_tag {
|
||||
void (*process_output)(const MD_CHAR*, MD_SIZE, void*);
|
||||
void* userdata;
|
||||
unsigned flags;
|
||||
int image_nesting_level;
|
||||
char escape_map[256];
|
||||
};
|
||||
|
||||
#define NEED_HTML_ESC_FLAG 0x1
|
||||
#define NEED_URL_ESC_FLAG 0x2
|
||||
|
||||
|
||||
/*****************************************
|
||||
*** HTML rendering helper functions ***
|
||||
*****************************************/
|
||||
|
||||
#define ISDIGIT(ch) ('0' <= (ch) && (ch) <= '9')
|
||||
#define ISLOWER(ch) ('a' <= (ch) && (ch) <= 'z')
|
||||
#define ISUPPER(ch) ('A' <= (ch) && (ch) <= 'Z')
|
||||
#define ISALNUM(ch) (ISLOWER(ch) || ISUPPER(ch) || ISDIGIT(ch))
|
||||
|
||||
|
||||
static inline void
|
||||
render_verbatim(MD_HTML* r, const MD_CHAR* text, MD_SIZE size)
|
||||
{
|
||||
r->process_output(text, size, r->userdata);
|
||||
}
|
||||
|
||||
/* Keep this as a macro. Most compiler should then be smart enough to replace
|
||||
* the strlen() call with a compile-time constant if the string is a C literal. */
|
||||
#define RENDER_VERBATIM(r, verbatim) \
|
||||
render_verbatim((r), (verbatim), (MD_SIZE) (strlen(verbatim)))
|
||||
|
||||
|
||||
static void
|
||||
render_html_escaped(MD_HTML* r, const MD_CHAR* data, MD_SIZE size)
|
||||
{
|
||||
MD_OFFSET beg = 0;
|
||||
MD_OFFSET off = 0;
|
||||
|
||||
/* Some characters need to be escaped in normal HTML text. */
|
||||
#define NEED_HTML_ESC(ch) (r->escape_map[(unsigned char)(ch)] & NEED_HTML_ESC_FLAG)
|
||||
|
||||
while(1) {
|
||||
/* Optimization: Use some loop unrolling. */
|
||||
while(off + 3 < size && !NEED_HTML_ESC(data[off+0]) && !NEED_HTML_ESC(data[off+1])
|
||||
&& !NEED_HTML_ESC(data[off+2]) && !NEED_HTML_ESC(data[off+3]))
|
||||
off += 4;
|
||||
while(off < size && !NEED_HTML_ESC(data[off]))
|
||||
off++;
|
||||
|
||||
if(off > beg)
|
||||
render_verbatim(r, data + beg, off - beg);
|
||||
|
||||
if(off < size) {
|
||||
switch(data[off]) {
|
||||
case '&': RENDER_VERBATIM(r, "&"); break;
|
||||
case '<': RENDER_VERBATIM(r, "<"); break;
|
||||
case '>': RENDER_VERBATIM(r, ">"); break;
|
||||
case '"': RENDER_VERBATIM(r, """); break;
|
||||
}
|
||||
off++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
beg = off;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
render_url_escaped(MD_HTML* r, const MD_CHAR* data, MD_SIZE size)
|
||||
{
|
||||
static const MD_CHAR hex_chars[] = "0123456789ABCDEF";
|
||||
MD_OFFSET beg = 0;
|
||||
MD_OFFSET off = 0;
|
||||
|
||||
/* Some characters need to be escaped in URL attributes. */
|
||||
#define NEED_URL_ESC(ch) (r->escape_map[(unsigned char)(ch)] & NEED_URL_ESC_FLAG)
|
||||
|
||||
while(1) {
|
||||
while(off < size && !NEED_URL_ESC(data[off]))
|
||||
off++;
|
||||
if(off > beg)
|
||||
render_verbatim(r, data + beg, off - beg);
|
||||
|
||||
if(off < size) {
|
||||
char hex[3];
|
||||
|
||||
switch(data[off]) {
|
||||
case '&': RENDER_VERBATIM(r, "&"); break;
|
||||
default:
|
||||
hex[0] = '%';
|
||||
hex[1] = hex_chars[((unsigned)data[off] >> 4) & 0xf];
|
||||
hex[2] = hex_chars[((unsigned)data[off] >> 0) & 0xf];
|
||||
render_verbatim(r, hex, 3);
|
||||
break;
|
||||
}
|
||||
off++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
beg = off;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned
|
||||
hex_val(char ch)
|
||||
{
|
||||
if('0' <= ch && ch <= '9')
|
||||
return ch - '0';
|
||||
if('A' <= ch && ch <= 'Z')
|
||||
return ch - 'A' + 10;
|
||||
else
|
||||
return ch - 'a' + 10;
|
||||
}
|
||||
|
||||
static void
|
||||
render_utf8_codepoint(MD_HTML* r, unsigned codepoint,
|
||||
void (*fn_append)(MD_HTML*, const MD_CHAR*, MD_SIZE))
|
||||
{
|
||||
static const MD_CHAR utf8_replacement_char[] = { (char)0xef, (char)0xbf, (char)0xbd };
|
||||
|
||||
unsigned char utf8[4];
|
||||
size_t n;
|
||||
|
||||
if(codepoint <= 0x7f) {
|
||||
n = 1;
|
||||
utf8[0] = codepoint;
|
||||
} else if(codepoint <= 0x7ff) {
|
||||
n = 2;
|
||||
utf8[0] = 0xc0 | ((codepoint >> 6) & 0x1f);
|
||||
utf8[1] = 0x80 + ((codepoint >> 0) & 0x3f);
|
||||
} else if(codepoint <= 0xffff) {
|
||||
n = 3;
|
||||
utf8[0] = 0xe0 | ((codepoint >> 12) & 0xf);
|
||||
utf8[1] = 0x80 + ((codepoint >> 6) & 0x3f);
|
||||
utf8[2] = 0x80 + ((codepoint >> 0) & 0x3f);
|
||||
} else {
|
||||
n = 4;
|
||||
utf8[0] = 0xf0 | ((codepoint >> 18) & 0x7);
|
||||
utf8[1] = 0x80 + ((codepoint >> 12) & 0x3f);
|
||||
utf8[2] = 0x80 + ((codepoint >> 6) & 0x3f);
|
||||
utf8[3] = 0x80 + ((codepoint >> 0) & 0x3f);
|
||||
}
|
||||
|
||||
if(0 < codepoint && codepoint <= 0x10ffff)
|
||||
fn_append(r, (char*)utf8, (MD_SIZE)n);
|
||||
else
|
||||
fn_append(r, utf8_replacement_char, 3);
|
||||
}
|
||||
|
||||
/* Translate entity to its UTF-8 equivalent, or output the verbatim one
|
||||
* if such entity is unknown (or if the translation is disabled). */
|
||||
static void
|
||||
render_entity(MD_HTML* r, const MD_CHAR* text, MD_SIZE size,
|
||||
void (*fn_append)(MD_HTML*, const MD_CHAR*, MD_SIZE))
|
||||
{
|
||||
if(r->flags & MD_HTML_FLAG_VERBATIM_ENTITIES) {
|
||||
render_verbatim(r, text, size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* We assume UTF-8 output is what is desired. */
|
||||
if(size > 3 && text[1] == '#') {
|
||||
unsigned codepoint = 0;
|
||||
|
||||
if(text[2] == 'x' || text[2] == 'X') {
|
||||
/* Hexadecimal entity (e.g. "�")). */
|
||||
MD_SIZE i;
|
||||
for(i = 3; i < size-1; i++)
|
||||
codepoint = 16 * codepoint + hex_val(text[i]);
|
||||
} else {
|
||||
/* Decimal entity (e.g. "&1234;") */
|
||||
MD_SIZE i;
|
||||
for(i = 2; i < size-1; i++)
|
||||
codepoint = 10 * codepoint + (text[i] - '0');
|
||||
}
|
||||
|
||||
render_utf8_codepoint(r, codepoint, fn_append);
|
||||
return;
|
||||
} else {
|
||||
/* Named entity (e.g. " "). */
|
||||
const ENTITY* ent;
|
||||
|
||||
ent = entity_lookup(text, size);
|
||||
if(ent != NULL) {
|
||||
render_utf8_codepoint(r, ent->codepoints[0], fn_append);
|
||||
if(ent->codepoints[1])
|
||||
render_utf8_codepoint(r, ent->codepoints[1], fn_append);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fn_append(r, text, size);
|
||||
}
|
||||
|
||||
static void
|
||||
render_attribute(MD_HTML* r, const MD_ATTRIBUTE* attr,
|
||||
void (*fn_append)(MD_HTML*, const MD_CHAR*, MD_SIZE))
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; attr->substr_offsets[i] < attr->size; i++) {
|
||||
MD_TEXTTYPE type = attr->substr_types[i];
|
||||
MD_OFFSET off = attr->substr_offsets[i];
|
||||
MD_SIZE size = attr->substr_offsets[i+1] - off;
|
||||
const MD_CHAR* text = attr->text + off;
|
||||
|
||||
switch(type) {
|
||||
case MD_TEXT_NULLCHAR: render_utf8_codepoint(r, 0x0000, render_verbatim); break;
|
||||
case MD_TEXT_ENTITY: render_entity(r, text, size, fn_append); break;
|
||||
default: fn_append(r, text, size); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
render_open_ol_block(MD_HTML* r, const MD_BLOCK_OL_DETAIL* det)
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
if(det->start == 1) {
|
||||
RENDER_VERBATIM(r, "<ol>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "<ol start=\"%u\">\n", det->start);
|
||||
RENDER_VERBATIM(r, buf);
|
||||
}
|
||||
|
||||
static void
|
||||
render_open_li_block(MD_HTML* r, const MD_BLOCK_LI_DETAIL* det)
|
||||
{
|
||||
if(det->is_task) {
|
||||
RENDER_VERBATIM(r, "<li class=\"task-list-item\">"
|
||||
"<input type=\"checkbox\" class=\"task-list-item-checkbox\" disabled");
|
||||
if(det->task_mark == 'x' || det->task_mark == 'X')
|
||||
RENDER_VERBATIM(r, " checked");
|
||||
RENDER_VERBATIM(r, ">");
|
||||
} else {
|
||||
RENDER_VERBATIM(r, "<li>");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
render_open_code_block(MD_HTML* r, const MD_BLOCK_CODE_DETAIL* det)
|
||||
{
|
||||
RENDER_VERBATIM(r, "<pre><code");
|
||||
|
||||
/* If known, output the HTML 5 attribute class="language-LANGNAME". */
|
||||
if(det->lang.text != NULL) {
|
||||
RENDER_VERBATIM(r, " class=\"language-");
|
||||
render_attribute(r, &det->lang, render_html_escaped);
|
||||
RENDER_VERBATIM(r, "\"");
|
||||
}
|
||||
|
||||
RENDER_VERBATIM(r, ">");
|
||||
}
|
||||
|
||||
static void
|
||||
render_open_td_block(MD_HTML* r, const MD_CHAR* cell_type, const MD_BLOCK_TD_DETAIL* det)
|
||||
{
|
||||
RENDER_VERBATIM(r, "<");
|
||||
RENDER_VERBATIM(r, cell_type);
|
||||
|
||||
switch(det->align) {
|
||||
case MD_ALIGN_LEFT: RENDER_VERBATIM(r, " align=\"left\">"); break;
|
||||
case MD_ALIGN_CENTER: RENDER_VERBATIM(r, " align=\"center\">"); break;
|
||||
case MD_ALIGN_RIGHT: RENDER_VERBATIM(r, " align=\"right\">"); break;
|
||||
default: RENDER_VERBATIM(r, ">"); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
render_open_a_span(MD_HTML* r, const MD_SPAN_A_DETAIL* det)
|
||||
{
|
||||
RENDER_VERBATIM(r, "<a href=\"");
|
||||
render_attribute(r, &det->href, render_url_escaped);
|
||||
|
||||
if(det->title.text != NULL) {
|
||||
RENDER_VERBATIM(r, "\" title=\"");
|
||||
render_attribute(r, &det->title, render_html_escaped);
|
||||
}
|
||||
|
||||
RENDER_VERBATIM(r, "\">");
|
||||
}
|
||||
|
||||
static void
|
||||
render_open_img_span(MD_HTML* r, const MD_SPAN_IMG_DETAIL* det)
|
||||
{
|
||||
RENDER_VERBATIM(r, "<img src=\"");
|
||||
render_attribute(r, &det->src, render_url_escaped);
|
||||
|
||||
RENDER_VERBATIM(r, "\" alt=\"");
|
||||
}
|
||||
|
||||
static void
|
||||
render_close_img_span(MD_HTML* r, const MD_SPAN_IMG_DETAIL* det)
|
||||
{
|
||||
if(det->title.text != NULL) {
|
||||
RENDER_VERBATIM(r, "\" title=\"");
|
||||
render_attribute(r, &det->title, render_html_escaped);
|
||||
}
|
||||
|
||||
RENDER_VERBATIM(r, (r->flags & MD_HTML_FLAG_XHTML) ? "\" />" : "\">");
|
||||
}
|
||||
|
||||
static void
|
||||
render_open_wikilink_span(MD_HTML* r, const MD_SPAN_WIKILINK_DETAIL* det)
|
||||
{
|
||||
RENDER_VERBATIM(r, "<x-wikilink data-target=\"");
|
||||
render_attribute(r, &det->target, render_html_escaped);
|
||||
|
||||
RENDER_VERBATIM(r, "\">");
|
||||
}
|
||||
|
||||
|
||||
/**************************************
|
||||
*** HTML renderer implementation ***
|
||||
**************************************/
|
||||
|
||||
static int
|
||||
enter_block_callback(MD_BLOCKTYPE type, void* detail, void* userdata)
|
||||
{
|
||||
static const MD_CHAR* head[6] = { "<h1>", "<h2>", "<h3>", "<h4>", "<h5>", "<h6>" };
|
||||
MD_HTML* r = (MD_HTML*) userdata;
|
||||
|
||||
switch(type) {
|
||||
case MD_BLOCK_DOC: /* noop */ break;
|
||||
case MD_BLOCK_QUOTE: RENDER_VERBATIM(r, "<blockquote>\n"); break;
|
||||
case MD_BLOCK_UL: RENDER_VERBATIM(r, "<ul>\n"); break;
|
||||
case MD_BLOCK_OL: render_open_ol_block(r, (const MD_BLOCK_OL_DETAIL*)detail); break;
|
||||
case MD_BLOCK_LI: render_open_li_block(r, (const MD_BLOCK_LI_DETAIL*)detail); break;
|
||||
case MD_BLOCK_HR: RENDER_VERBATIM(r, (r->flags & MD_HTML_FLAG_XHTML) ? "<hr />\n" : "<hr>\n"); break;
|
||||
case MD_BLOCK_H: RENDER_VERBATIM(r, head[((MD_BLOCK_H_DETAIL*)detail)->level - 1]); break;
|
||||
case MD_BLOCK_CODE: render_open_code_block(r, (const MD_BLOCK_CODE_DETAIL*) detail); break;
|
||||
case MD_BLOCK_HTML: /* noop */ break;
|
||||
case MD_BLOCK_P: RENDER_VERBATIM(r, "<p>"); break;
|
||||
case MD_BLOCK_TABLE: RENDER_VERBATIM(r, "<table>\n"); break;
|
||||
case MD_BLOCK_THEAD: RENDER_VERBATIM(r, "<thead>\n"); break;
|
||||
case MD_BLOCK_TBODY: RENDER_VERBATIM(r, "<tbody>\n"); break;
|
||||
case MD_BLOCK_TR: RENDER_VERBATIM(r, "<tr>\n"); break;
|
||||
case MD_BLOCK_TH: render_open_td_block(r, "th", (MD_BLOCK_TD_DETAIL*)detail); break;
|
||||
case MD_BLOCK_TD: render_open_td_block(r, "td", (MD_BLOCK_TD_DETAIL*)detail); break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
leave_block_callback(MD_BLOCKTYPE type, void* detail, void* userdata)
|
||||
{
|
||||
static const MD_CHAR* head[6] = { "</h1>\n", "</h2>\n", "</h3>\n", "</h4>\n", "</h5>\n", "</h6>\n" };
|
||||
MD_HTML* r = (MD_HTML*) userdata;
|
||||
|
||||
switch(type) {
|
||||
case MD_BLOCK_DOC: /*noop*/ break;
|
||||
case MD_BLOCK_QUOTE: RENDER_VERBATIM(r, "</blockquote>\n"); break;
|
||||
case MD_BLOCK_UL: RENDER_VERBATIM(r, "</ul>\n"); break;
|
||||
case MD_BLOCK_OL: RENDER_VERBATIM(r, "</ol>\n"); break;
|
||||
case MD_BLOCK_LI: RENDER_VERBATIM(r, "</li>\n"); break;
|
||||
case MD_BLOCK_HR: /*noop*/ break;
|
||||
case MD_BLOCK_H: RENDER_VERBATIM(r, head[((MD_BLOCK_H_DETAIL*)detail)->level - 1]); break;
|
||||
case MD_BLOCK_CODE: RENDER_VERBATIM(r, "</code></pre>\n"); break;
|
||||
case MD_BLOCK_HTML: /* noop */ break;
|
||||
case MD_BLOCK_P: RENDER_VERBATIM(r, "</p>\n"); break;
|
||||
case MD_BLOCK_TABLE: RENDER_VERBATIM(r, "</table>\n"); break;
|
||||
case MD_BLOCK_THEAD: RENDER_VERBATIM(r, "</thead>\n"); break;
|
||||
case MD_BLOCK_TBODY: RENDER_VERBATIM(r, "</tbody>\n"); break;
|
||||
case MD_BLOCK_TR: RENDER_VERBATIM(r, "</tr>\n"); break;
|
||||
case MD_BLOCK_TH: RENDER_VERBATIM(r, "</th>\n"); break;
|
||||
case MD_BLOCK_TD: RENDER_VERBATIM(r, "</td>\n"); break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
enter_span_callback(MD_SPANTYPE type, void* detail, void* userdata)
|
||||
{
|
||||
MD_HTML* r = (MD_HTML*) userdata;
|
||||
int inside_img = (r->image_nesting_level > 0);
|
||||
|
||||
/* We are inside a Markdown image label. Markdown allows to use any emphasis
|
||||
* and other rich contents in that context similarly as in any link label.
|
||||
*
|
||||
* However, unlike in the case of links (where that contents becomescontents
|
||||
* of the <a>...</a> tag), in the case of images the contents is supposed to
|
||||
* fall into the attribute alt: <img alt="...">.
|
||||
*
|
||||
* In that context we naturally cannot output nested HTML tags. So lets
|
||||
* suppress them and only output the plain text (i.e. what falls into text()
|
||||
* callback).
|
||||
*
|
||||
* CommonMark specification declares this a recommended practice for HTML
|
||||
* output.
|
||||
*/
|
||||
if(type == MD_SPAN_IMG)
|
||||
r->image_nesting_level++;
|
||||
if(inside_img)
|
||||
return 0;
|
||||
|
||||
switch(type) {
|
||||
case MD_SPAN_EM: RENDER_VERBATIM(r, "<em>"); break;
|
||||
case MD_SPAN_STRONG: RENDER_VERBATIM(r, "<strong>"); break;
|
||||
case MD_SPAN_U: RENDER_VERBATIM(r, "<u>"); break;
|
||||
case MD_SPAN_A: render_open_a_span(r, (MD_SPAN_A_DETAIL*) detail); break;
|
||||
case MD_SPAN_IMG: render_open_img_span(r, (MD_SPAN_IMG_DETAIL*) detail); break;
|
||||
case MD_SPAN_CODE: RENDER_VERBATIM(r, "<code>"); break;
|
||||
case MD_SPAN_DEL: RENDER_VERBATIM(r, "<del>"); break;
|
||||
case MD_SPAN_LATEXMATH: RENDER_VERBATIM(r, "<x-equation>"); break;
|
||||
case MD_SPAN_LATEXMATH_DISPLAY: RENDER_VERBATIM(r, "<x-equation type=\"display\">"); break;
|
||||
case MD_SPAN_WIKILINK: render_open_wikilink_span(r, (MD_SPAN_WIKILINK_DETAIL*) detail); break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
leave_span_callback(MD_SPANTYPE type, void* detail, void* userdata)
|
||||
{
|
||||
MD_HTML* r = (MD_HTML*) userdata;
|
||||
|
||||
if(type == MD_SPAN_IMG)
|
||||
r->image_nesting_level--;
|
||||
if(r->image_nesting_level > 0)
|
||||
return 0;
|
||||
|
||||
switch(type) {
|
||||
case MD_SPAN_EM: RENDER_VERBATIM(r, "</em>"); break;
|
||||
case MD_SPAN_STRONG: RENDER_VERBATIM(r, "</strong>"); break;
|
||||
case MD_SPAN_U: RENDER_VERBATIM(r, "</u>"); break;
|
||||
case MD_SPAN_A: RENDER_VERBATIM(r, "</a>"); break;
|
||||
case MD_SPAN_IMG: render_close_img_span(r, (MD_SPAN_IMG_DETAIL*) detail); break;
|
||||
case MD_SPAN_CODE: RENDER_VERBATIM(r, "</code>"); break;
|
||||
case MD_SPAN_DEL: RENDER_VERBATIM(r, "</del>"); break;
|
||||
case MD_SPAN_LATEXMATH: /*fall through*/
|
||||
case MD_SPAN_LATEXMATH_DISPLAY: RENDER_VERBATIM(r, "</x-equation>"); break;
|
||||
case MD_SPAN_WIKILINK: RENDER_VERBATIM(r, "</x-wikilink>"); break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
text_callback(MD_TEXTTYPE type, const MD_CHAR* text, MD_SIZE size, void* userdata)
|
||||
{
|
||||
MD_HTML* r = (MD_HTML*) userdata;
|
||||
|
||||
switch(type) {
|
||||
case MD_TEXT_NULLCHAR: render_utf8_codepoint(r, 0x0000, render_verbatim); break;
|
||||
case MD_TEXT_BR: RENDER_VERBATIM(r, (r->image_nesting_level == 0
|
||||
? ((r->flags & MD_HTML_FLAG_XHTML) ? "<br />\n" : "<br>\n")
|
||||
: " "));
|
||||
break;
|
||||
case MD_TEXT_SOFTBR: RENDER_VERBATIM(r, (r->image_nesting_level == 0 ? "\n" : " ")); break;
|
||||
case MD_TEXT_HTML: render_verbatim(r, text, size); break;
|
||||
case MD_TEXT_ENTITY: render_entity(r, text, size, render_html_escaped); break;
|
||||
default: render_html_escaped(r, text, size); break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
debug_log_callback(const char* msg, void* userdata)
|
||||
{
|
||||
MD_HTML* r = (MD_HTML*) userdata;
|
||||
if(r->flags & MD_HTML_FLAG_DEBUG)
|
||||
fprintf(stderr, "MD4C: %s\n", msg);
|
||||
}
|
||||
|
||||
int
|
||||
md_html(const MD_CHAR* input, MD_SIZE input_size,
|
||||
void (*process_output)(const MD_CHAR*, MD_SIZE, void*),
|
||||
void* userdata, unsigned parser_flags, unsigned renderer_flags)
|
||||
{
|
||||
MD_HTML render = { process_output, userdata, renderer_flags, 0, { 0 } };
|
||||
int i;
|
||||
|
||||
MD_PARSER parser = {
|
||||
0,
|
||||
parser_flags,
|
||||
enter_block_callback,
|
||||
leave_block_callback,
|
||||
enter_span_callback,
|
||||
leave_span_callback,
|
||||
text_callback,
|
||||
debug_log_callback,
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Build map of characters which need escaping. */
|
||||
for(i = 0; i < 256; i++) {
|
||||
unsigned char ch = (unsigned char) i;
|
||||
|
||||
if(strchr("\"&<>", ch) != NULL)
|
||||
render.escape_map[i] |= NEED_HTML_ESC_FLAG;
|
||||
|
||||
if(!ISALNUM(ch) && strchr("~-_.+!*(),%#@?=;:/,+$", ch) == NULL)
|
||||
render.escape_map[i] |= NEED_URL_ESC_FLAG;
|
||||
}
|
||||
|
||||
/* Consider skipping UTF-8 byte order mark (BOM). */
|
||||
if(renderer_flags & MD_HTML_FLAG_SKIP_UTF8_BOM && sizeof(MD_CHAR) == 1) {
|
||||
static const MD_CHAR bom[3] = { (char)0xef, (char)0xbb, (char)0xbf };
|
||||
if(input_size >= sizeof(bom) && memcmp(input, bom, sizeof(bom)) == 0) {
|
||||
input += sizeof(bom);
|
||||
input_size -= sizeof(bom);
|
||||
}
|
||||
}
|
||||
|
||||
return md_parse(input, input_size, &parser, (void*) &render);
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* MD4C: Markdown parser for C
|
||||
* (http://github.com/mity/md4c)
|
||||
*
|
||||
* Copyright (c) 2016-2024 Martin Mitáš
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MD4C_HTML_H
|
||||
#define MD4C_HTML_H
|
||||
|
||||
#include "md4c.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* If set, debug output from md_parse() is sent to stderr. */
|
||||
#define MD_HTML_FLAG_DEBUG 0x0001
|
||||
#define MD_HTML_FLAG_VERBATIM_ENTITIES 0x0002
|
||||
#define MD_HTML_FLAG_SKIP_UTF8_BOM 0x0004
|
||||
#define MD_HTML_FLAG_XHTML 0x0008
|
||||
|
||||
|
||||
/* Render Markdown into HTML.
|
||||
*
|
||||
* Note only contents of <body> tag is generated. Caller must generate
|
||||
* HTML header/footer manually before/after calling md_html().
|
||||
*
|
||||
* Params input and input_size specify the Markdown input.
|
||||
* Callback process_output() gets called with chunks of HTML output.
|
||||
* (Typical implementation may just output the bytes to a file or append to
|
||||
* some buffer).
|
||||
* Param userdata is just propagated back to process_output() callback.
|
||||
* Param parser_flags are flags from md4c.h propagated to md_parse().
|
||||
* Param render_flags is bitmask of MD_HTML_FLAG_xxxx.
|
||||
*
|
||||
* Returns -1 on error (if md_parse() fails.)
|
||||
* Returns 0 on success.
|
||||
*/
|
||||
int md_html(const MD_CHAR* input, MD_SIZE input_size,
|
||||
void (*process_output)(const MD_CHAR*, MD_SIZE, void*),
|
||||
void* userdata, unsigned parser_flags, unsigned renderer_flags);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" { */
|
||||
#endif
|
||||
|
||||
#endif /* MD4C_HTML_H */
|
||||
@@ -1,13 +0,0 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
||||
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
|
||||
Name: @PROJECT_NAME@ HTML renderer
|
||||
Description: Markdown to HTML converter library.
|
||||
Version: @PROJECT_VERSION@
|
||||
URL: @PROJECT_URL@
|
||||
|
||||
Requires: md4c = @PROJECT_VERSION@
|
||||
Libs: -L${libdir} -lmd4c-html
|
||||
Cflags: -I${includedir}
|
||||
@@ -1,407 +0,0 @@
|
||||
/*
|
||||
* MD4C: Markdown parser for C
|
||||
* (http://github.com/mity/md4c)
|
||||
*
|
||||
* Copyright (c) 2016-2024 Martin Mitáš
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MD4C_H
|
||||
#define MD4C_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined MD4C_USE_UTF16
|
||||
/* Magic to support UTF-16. Note that in order to use it, you have to define
|
||||
* the macro MD4C_USE_UTF16 both when building MD4C as well as when
|
||||
* including this header in your code. */
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
typedef WCHAR MD_CHAR;
|
||||
#else
|
||||
#error MD4C_USE_UTF16 is only supported on Windows.
|
||||
#endif
|
||||
#else
|
||||
typedef char MD_CHAR;
|
||||
#endif
|
||||
|
||||
typedef unsigned MD_SIZE;
|
||||
typedef unsigned MD_OFFSET;
|
||||
|
||||
|
||||
/* Block represents a part of document hierarchy structure like a paragraph
|
||||
* or list item.
|
||||
*/
|
||||
typedef enum MD_BLOCKTYPE {
|
||||
/* <body>...</body> */
|
||||
MD_BLOCK_DOC = 0,
|
||||
|
||||
/* <blockquote>...</blockquote> */
|
||||
MD_BLOCK_QUOTE,
|
||||
|
||||
/* <ul>...</ul>
|
||||
* Detail: Structure MD_BLOCK_UL_DETAIL. */
|
||||
MD_BLOCK_UL,
|
||||
|
||||
/* <ol>...</ol>
|
||||
* Detail: Structure MD_BLOCK_OL_DETAIL. */
|
||||
MD_BLOCK_OL,
|
||||
|
||||
/* <li>...</li>
|
||||
* Detail: Structure MD_BLOCK_LI_DETAIL. */
|
||||
MD_BLOCK_LI,
|
||||
|
||||
/* <hr> */
|
||||
MD_BLOCK_HR,
|
||||
|
||||
/* <h1>...</h1> (for levels up to 6)
|
||||
* Detail: Structure MD_BLOCK_H_DETAIL. */
|
||||
MD_BLOCK_H,
|
||||
|
||||
/* <pre><code>...</code></pre>
|
||||
* Note the text lines within code blocks are terminated with '\n'
|
||||
* instead of explicit MD_TEXT_BR. */
|
||||
MD_BLOCK_CODE,
|
||||
|
||||
/* Raw HTML block. This itself does not correspond to any particular HTML
|
||||
* tag. The contents of it _is_ raw HTML source intended to be put
|
||||
* in verbatim form to the HTML output. */
|
||||
MD_BLOCK_HTML,
|
||||
|
||||
/* <p>...</p> */
|
||||
MD_BLOCK_P,
|
||||
|
||||
/* <table>...</table> and its contents.
|
||||
* Detail: Structure MD_BLOCK_TABLE_DETAIL (for MD_BLOCK_TABLE),
|
||||
* structure MD_BLOCK_TD_DETAIL (for MD_BLOCK_TH and MD_BLOCK_TD)
|
||||
* Note all of these are used only if extension MD_FLAG_TABLES is enabled. */
|
||||
MD_BLOCK_TABLE,
|
||||
MD_BLOCK_THEAD,
|
||||
MD_BLOCK_TBODY,
|
||||
MD_BLOCK_TR,
|
||||
MD_BLOCK_TH,
|
||||
MD_BLOCK_TD
|
||||
} MD_BLOCKTYPE;
|
||||
|
||||
/* Span represents an in-line piece of a document which should be rendered with
|
||||
* the same font, color and other attributes. A sequence of spans forms a block
|
||||
* like paragraph or list item. */
|
||||
typedef enum MD_SPANTYPE {
|
||||
/* <em>...</em> */
|
||||
MD_SPAN_EM,
|
||||
|
||||
/* <strong>...</strong> */
|
||||
MD_SPAN_STRONG,
|
||||
|
||||
/* <a href="xxx">...</a>
|
||||
* Detail: Structure MD_SPAN_A_DETAIL. */
|
||||
MD_SPAN_A,
|
||||
|
||||
/* <img src="xxx">...</a>
|
||||
* Detail: Structure MD_SPAN_IMG_DETAIL.
|
||||
* Note: Image text can contain nested spans and even nested images.
|
||||
* If rendered into ALT attribute of HTML <IMG> tag, it's responsibility
|
||||
* of the parser to deal with it.
|
||||
*/
|
||||
MD_SPAN_IMG,
|
||||
|
||||
/* <code>...</code> */
|
||||
MD_SPAN_CODE,
|
||||
|
||||
/* <del>...</del>
|
||||
* Note: Recognized only when MD_FLAG_STRIKETHROUGH is enabled.
|
||||
*/
|
||||
MD_SPAN_DEL,
|
||||
|
||||
/* For recognizing inline ($) and display ($$) equations
|
||||
* Note: Recognized only when MD_FLAG_LATEXMATHSPANS is enabled.
|
||||
*/
|
||||
MD_SPAN_LATEXMATH,
|
||||
MD_SPAN_LATEXMATH_DISPLAY,
|
||||
|
||||
/* Wiki links
|
||||
* Note: Recognized only when MD_FLAG_WIKILINKS is enabled.
|
||||
*/
|
||||
MD_SPAN_WIKILINK,
|
||||
|
||||
/* <u>...</u>
|
||||
* Note: Recognized only when MD_FLAG_UNDERLINE is enabled. */
|
||||
MD_SPAN_U
|
||||
} MD_SPANTYPE;
|
||||
|
||||
/* Text is the actual textual contents of span. */
|
||||
typedef enum MD_TEXTTYPE {
|
||||
/* Normal text. */
|
||||
MD_TEXT_NORMAL = 0,
|
||||
|
||||
/* NULL character. CommonMark requires replacing NULL character with
|
||||
* the replacement char U+FFFD, so this allows caller to do that easily. */
|
||||
MD_TEXT_NULLCHAR,
|
||||
|
||||
/* Line breaks.
|
||||
* Note these are not sent from blocks with verbatim output (MD_BLOCK_CODE
|
||||
* or MD_BLOCK_HTML). In such cases, '\n' is part of the text itself. */
|
||||
MD_TEXT_BR, /* <br> (hard break) */
|
||||
MD_TEXT_SOFTBR, /* '\n' in source text where it is not semantically meaningful (soft break) */
|
||||
|
||||
/* Entity.
|
||||
* (a) Named entity, e.g.
|
||||
* (Note MD4C does not have a list of known entities.
|
||||
* Anything matching the regexp /&[A-Za-z][A-Za-z0-9]{1,47};/ is
|
||||
* treated as a named entity.)
|
||||
* (b) Numerical entity, e.g. Ӓ
|
||||
* (c) Hexadecimal entity, e.g. ካ
|
||||
*
|
||||
* As MD4C is mostly encoding agnostic, application gets the verbatim
|
||||
* entity text into the MD_PARSER::text_callback(). */
|
||||
MD_TEXT_ENTITY,
|
||||
|
||||
/* Text in a code block (inside MD_BLOCK_CODE) or inlined code (`code`).
|
||||
* If it is inside MD_BLOCK_CODE, it includes spaces for indentation and
|
||||
* '\n' for new lines. MD_TEXT_BR and MD_TEXT_SOFTBR are not sent for this
|
||||
* kind of text. */
|
||||
MD_TEXT_CODE,
|
||||
|
||||
/* Text is a raw HTML. If it is contents of a raw HTML block (i.e. not
|
||||
* an inline raw HTML), then MD_TEXT_BR and MD_TEXT_SOFTBR are not used.
|
||||
* The text contains verbatim '\n' for the new lines. */
|
||||
MD_TEXT_HTML,
|
||||
|
||||
/* Text is inside an equation. This is processed the same way as inlined code
|
||||
* spans (`code`). */
|
||||
MD_TEXT_LATEXMATH
|
||||
} MD_TEXTTYPE;
|
||||
|
||||
|
||||
/* Alignment enumeration. */
|
||||
typedef enum MD_ALIGN {
|
||||
MD_ALIGN_DEFAULT = 0, /* When unspecified. */
|
||||
MD_ALIGN_LEFT,
|
||||
MD_ALIGN_CENTER,
|
||||
MD_ALIGN_RIGHT
|
||||
} MD_ALIGN;
|
||||
|
||||
|
||||
/* String attribute.
|
||||
*
|
||||
* This wraps strings which are outside of a normal text flow and which are
|
||||
* propagated within various detailed structures, but which still may contain
|
||||
* string portions of different types like e.g. entities.
|
||||
*
|
||||
* So, for example, lets consider this image:
|
||||
*
|
||||
* 
|
||||
*
|
||||
* The image alt text is propagated as a normal text via the MD_PARSER::text()
|
||||
* callback. However, the image title ('foo " bar') is propagated as
|
||||
* MD_ATTRIBUTE in MD_SPAN_IMG_DETAIL::title.
|
||||
*
|
||||
* Then the attribute MD_SPAN_IMG_DETAIL::title shall provide the following:
|
||||
* -- [0]: "foo " (substr_types[0] == MD_TEXT_NORMAL; substr_offsets[0] == 0)
|
||||
* -- [1]: """ (substr_types[1] == MD_TEXT_ENTITY; substr_offsets[1] == 4)
|
||||
* -- [2]: " bar" (substr_types[2] == MD_TEXT_NORMAL; substr_offsets[2] == 10)
|
||||
* -- [3]: (n/a) (n/a ; substr_offsets[3] == 14)
|
||||
*
|
||||
* Note that these invariants are always guaranteed:
|
||||
* -- substr_offsets[0] == 0
|
||||
* -- substr_offsets[LAST+1] == size
|
||||
* -- Currently, only MD_TEXT_NORMAL, MD_TEXT_ENTITY, MD_TEXT_NULLCHAR
|
||||
* substrings can appear. This could change only of the specification
|
||||
* changes.
|
||||
*/
|
||||
typedef struct MD_ATTRIBUTE {
|
||||
const MD_CHAR* text;
|
||||
MD_SIZE size;
|
||||
const MD_TEXTTYPE* substr_types;
|
||||
const MD_OFFSET* substr_offsets;
|
||||
} MD_ATTRIBUTE;
|
||||
|
||||
|
||||
/* Detailed info for MD_BLOCK_UL. */
|
||||
typedef struct MD_BLOCK_UL_DETAIL {
|
||||
int is_tight; /* Non-zero if tight list, zero if loose. */
|
||||
MD_CHAR mark; /* Item bullet character in MarkDown source of the list, e.g. '-', '+', '*'. */
|
||||
} MD_BLOCK_UL_DETAIL;
|
||||
|
||||
/* Detailed info for MD_BLOCK_OL. */
|
||||
typedef struct MD_BLOCK_OL_DETAIL {
|
||||
unsigned start; /* Start index of the ordered list. */
|
||||
int is_tight; /* Non-zero if tight list, zero if loose. */
|
||||
MD_CHAR mark_delimiter; /* Character delimiting the item marks in MarkDown source, e.g. '.' or ')' */
|
||||
} MD_BLOCK_OL_DETAIL;
|
||||
|
||||
/* Detailed info for MD_BLOCK_LI. */
|
||||
typedef struct MD_BLOCK_LI_DETAIL {
|
||||
int is_task; /* Can be non-zero only with MD_FLAG_TASKLISTS */
|
||||
MD_CHAR task_mark; /* If is_task, then one of 'x', 'X' or ' '. Undefined otherwise. */
|
||||
MD_OFFSET task_mark_offset; /* If is_task, then offset in the input of the char between '[' and ']'. */
|
||||
} MD_BLOCK_LI_DETAIL;
|
||||
|
||||
/* Detailed info for MD_BLOCK_H. */
|
||||
typedef struct MD_BLOCK_H_DETAIL {
|
||||
unsigned level; /* Header level (1 - 6) */
|
||||
} MD_BLOCK_H_DETAIL;
|
||||
|
||||
/* Detailed info for MD_BLOCK_CODE. */
|
||||
typedef struct MD_BLOCK_CODE_DETAIL {
|
||||
MD_ATTRIBUTE info;
|
||||
MD_ATTRIBUTE lang;
|
||||
MD_CHAR fence_char; /* The character used for fenced code block; or zero for indented code block. */
|
||||
} MD_BLOCK_CODE_DETAIL;
|
||||
|
||||
/* Detailed info for MD_BLOCK_TABLE. */
|
||||
typedef struct MD_BLOCK_TABLE_DETAIL {
|
||||
unsigned col_count; /* Count of columns in the table. */
|
||||
unsigned head_row_count; /* Count of rows in the table header (currently always 1) */
|
||||
unsigned body_row_count; /* Count of rows in the table body */
|
||||
} MD_BLOCK_TABLE_DETAIL;
|
||||
|
||||
/* Detailed info for MD_BLOCK_TH and MD_BLOCK_TD. */
|
||||
typedef struct MD_BLOCK_TD_DETAIL {
|
||||
MD_ALIGN align;
|
||||
} MD_BLOCK_TD_DETAIL;
|
||||
|
||||
/* Detailed info for MD_SPAN_A. */
|
||||
typedef struct MD_SPAN_A_DETAIL {
|
||||
MD_ATTRIBUTE href;
|
||||
MD_ATTRIBUTE title;
|
||||
int is_autolink; /* nonzero if this is an autolink */
|
||||
} MD_SPAN_A_DETAIL;
|
||||
|
||||
/* Detailed info for MD_SPAN_IMG. */
|
||||
typedef struct MD_SPAN_IMG_DETAIL {
|
||||
MD_ATTRIBUTE src;
|
||||
MD_ATTRIBUTE title;
|
||||
} MD_SPAN_IMG_DETAIL;
|
||||
|
||||
/* Detailed info for MD_SPAN_WIKILINK. */
|
||||
typedef struct MD_SPAN_WIKILINK {
|
||||
MD_ATTRIBUTE target;
|
||||
} MD_SPAN_WIKILINK_DETAIL;
|
||||
|
||||
/* Flags specifying extensions/deviations from CommonMark specification.
|
||||
*
|
||||
* By default (when MD_PARSER::flags == 0), we follow CommonMark specification.
|
||||
* The following flags may allow some extensions or deviations from it.
|
||||
*/
|
||||
#define MD_FLAG_COLLAPSEWHITESPACE 0x0001 /* In MD_TEXT_NORMAL, collapse non-trivial whitespace into single ' ' */
|
||||
#define MD_FLAG_PERMISSIVEATXHEADERS 0x0002 /* Do not require space in ATX headers ( ###header ) */
|
||||
#define MD_FLAG_PERMISSIVEURLAUTOLINKS 0x0004 /* Recognize URLs as autolinks even without '<', '>' */
|
||||
#define MD_FLAG_PERMISSIVEEMAILAUTOLINKS 0x0008 /* Recognize e-mails as autolinks even without '<', '>' and 'mailto:' */
|
||||
#define MD_FLAG_NOINDENTEDCODEBLOCKS 0x0010 /* Disable indented code blocks. (Only fenced code works.) */
|
||||
#define MD_FLAG_NOHTMLBLOCKS 0x0020 /* Disable raw HTML blocks. */
|
||||
#define MD_FLAG_NOHTMLSPANS 0x0040 /* Disable raw HTML (inline). */
|
||||
#define MD_FLAG_TABLES 0x0100 /* Enable tables extension. */
|
||||
#define MD_FLAG_STRIKETHROUGH 0x0200 /* Enable strikethrough extension. */
|
||||
#define MD_FLAG_PERMISSIVEWWWAUTOLINKS 0x0400 /* Enable WWW autolinks (even without any scheme prefix, if they begin with 'www.') */
|
||||
#define MD_FLAG_TASKLISTS 0x0800 /* Enable task list extension. */
|
||||
#define MD_FLAG_LATEXMATHSPANS 0x1000 /* Enable $ and $$ containing LaTeX equations. */
|
||||
#define MD_FLAG_WIKILINKS 0x2000 /* Enable wiki links extension. */
|
||||
#define MD_FLAG_UNDERLINE 0x4000 /* Enable underline extension (and disables '_' for normal emphasis). */
|
||||
#define MD_FLAG_HARD_SOFT_BREAKS 0x8000 /* Force all soft breaks to act as hard breaks. */
|
||||
|
||||
#define MD_FLAG_PERMISSIVEAUTOLINKS (MD_FLAG_PERMISSIVEEMAILAUTOLINKS | MD_FLAG_PERMISSIVEURLAUTOLINKS | MD_FLAG_PERMISSIVEWWWAUTOLINKS)
|
||||
#define MD_FLAG_NOHTML (MD_FLAG_NOHTMLBLOCKS | MD_FLAG_NOHTMLSPANS)
|
||||
|
||||
/* Convenient sets of flags corresponding to well-known Markdown dialects.
|
||||
*
|
||||
* Note we may only support subset of features of the referred dialect.
|
||||
* The constant just enables those extensions which bring us as close as
|
||||
* possible given what features we implement.
|
||||
*
|
||||
* ABI compatibility note: Meaning of these can change in time as new
|
||||
* extensions, bringing the dialect closer to the original, are implemented.
|
||||
*/
|
||||
#define MD_DIALECT_COMMONMARK 0
|
||||
#define MD_DIALECT_GITHUB (MD_FLAG_PERMISSIVEAUTOLINKS | MD_FLAG_TABLES | MD_FLAG_STRIKETHROUGH | MD_FLAG_TASKLISTS)
|
||||
|
||||
/* Parser structure.
|
||||
*/
|
||||
typedef struct MD_PARSER {
|
||||
/* Reserved. Set to zero.
|
||||
*/
|
||||
unsigned abi_version;
|
||||
|
||||
/* Dialect options. Bitmask of MD_FLAG_xxxx values.
|
||||
*/
|
||||
unsigned flags;
|
||||
|
||||
/* Caller-provided rendering callbacks.
|
||||
*
|
||||
* For some block/span types, more detailed information is provided in a
|
||||
* type-specific structure pointed by the argument 'detail'.
|
||||
*
|
||||
* The last argument of all callbacks, 'userdata', is just propagated from
|
||||
* md_parse() and is available for any use by the application.
|
||||
*
|
||||
* Note any strings provided to the callbacks as their arguments or as
|
||||
* members of any detail structure are generally not zero-terminated.
|
||||
* Application has to take the respective size information into account.
|
||||
*
|
||||
* Any rendering callback may abort further parsing of the document by
|
||||
* returning non-zero.
|
||||
*/
|
||||
int (*enter_block)(MD_BLOCKTYPE /*type*/, void* /*detail*/, void* /*userdata*/);
|
||||
int (*leave_block)(MD_BLOCKTYPE /*type*/, void* /*detail*/, void* /*userdata*/);
|
||||
|
||||
int (*enter_span)(MD_SPANTYPE /*type*/, void* /*detail*/, void* /*userdata*/);
|
||||
int (*leave_span)(MD_SPANTYPE /*type*/, void* /*detail*/, void* /*userdata*/);
|
||||
|
||||
int (*text)(MD_TEXTTYPE /*type*/, const MD_CHAR* /*text*/, MD_SIZE /*size*/, void* /*userdata*/);
|
||||
|
||||
/* Debug callback. Optional (may be NULL).
|
||||
*
|
||||
* If provided and something goes wrong, this function gets called.
|
||||
* This is intended for debugging and problem diagnosis for developers;
|
||||
* it is not intended to provide any errors suitable for displaying to an
|
||||
* end user.
|
||||
*/
|
||||
void (*debug_log)(const char* /*msg*/, void* /*userdata*/);
|
||||
|
||||
/* Reserved. Set to NULL.
|
||||
*/
|
||||
void (*syntax)(void);
|
||||
} MD_PARSER;
|
||||
|
||||
|
||||
/* For backward compatibility. Do not use in new code.
|
||||
*/
|
||||
typedef MD_PARSER MD_RENDERER;
|
||||
|
||||
|
||||
/* Parse the Markdown document stored in the string 'text' of size 'size'.
|
||||
* The parser provides callbacks to be called during the parsing so the
|
||||
* caller can render the document on the screen or convert the Markdown
|
||||
* to another format.
|
||||
*
|
||||
* Zero is returned on success. If a runtime error occurs (e.g. a memory
|
||||
* fails), -1 is returned. If the processing is aborted due any callback
|
||||
* returning non-zero, the return value of the callback is returned.
|
||||
*/
|
||||
int md_parse(const MD_CHAR* text, MD_SIZE size, const MD_PARSER* parser, void* userdata);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" { */
|
||||
#endif
|
||||
|
||||
#endif /* MD4C_H */
|
||||
@@ -1,13 +0,0 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
||||
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
|
||||
Name: @PROJECT_NAME@
|
||||
Description: Markdown parser library with a SAX-like callback-based interface.
|
||||
Version: @PROJECT_VERSION@
|
||||
URL: @PROJECT_URL@
|
||||
|
||||
Requires:
|
||||
Libs: -L${libdir} -lmd4c
|
||||
Cflags: -I${includedir}
|
||||
BIN
resources/calib/cornering/SCV-V2.stl
Normal file
BIN
resources/calib/input_shaping/fast_tower_test.stl
Normal file
BIN
resources/calib/input_shaping/ringing_tower.stl
Normal file
BIN
resources/calib/pressure_advance/pressure_advance_test.stl
Normal file
BIN
resources/calib/pressure_advance/tower_with_seam.stl
Normal file
BIN
resources/calib/retraction/retraction_tower.stl
Normal file
BIN
resources/calib/temperature_tower/temperature_tower.stl
Normal file
BIN
resources/calib/vfa/VFA.stl
Normal file
35396
resources/calib/volumetric_speed/SpeedTestStructure.step
Normal file
31616
resources/calib/volumetric_speed/SpeedTestStructure.stp
Normal file
@@ -64,26 +64,26 @@
|
||||
|
||||
[hint:Precise wall]
|
||||
text = Precise wall\nDid you know that turning on precise wall can improve precision and layer consistency?
|
||||
documentation_link = https://www.orcaslicer.com/wiki/quality_settings_precision#precise-wall
|
||||
documentation_link = https://github.com/OrcaSlicer/OrcaSlicer/wiki/quality_settings_precision
|
||||
|
||||
[hint:Sandwich mode]
|
||||
text = Sandwich mode\nDid you know that you can use sandwich mode (inner-outer-inner) to improve precision and layer consistency if your model doesn't have very steep overhangs?
|
||||
|
||||
[hint:Chamber temperature]
|
||||
text = Chamber temperature\nDid you know that OrcaSlicer supports chamber temperature?
|
||||
documentation_link = https://www.orcaslicer.com/wiki/material_temperatures#print-chamber-temperature
|
||||
documentation_link = https://github.com/OrcaSlicer/OrcaSlicer/wiki/Chamber-temperature
|
||||
|
||||
[hint:Calibration]
|
||||
text = Calibration\nDid you know that calibrating your printer can do wonders? Check out our beloved calibration solution in OrcaSlicer.
|
||||
documentation_link = https://www.orcaslicer.com/wiki/calibration
|
||||
documentation_link = https://github.com/OrcaSlicer/OrcaSlicer/wiki/Calibration
|
||||
|
||||
[hint:Auxiliary fan]
|
||||
text = Auxiliary fan\nDid you know that OrcaSlicer supports Auxiliary part cooling fan?
|
||||
documentation_link = https://www.orcaslicer.com/wiki/material_cooling#auxiliary-part-cooling-fan
|
||||
documentation_link = https://github.com/OrcaSlicer/OrcaSlicer/wiki/Auxiliary-fan
|
||||
|
||||
[hint:Air filtration]
|
||||
text = Air filtration/Exhaust Fan\nDid you know that OrcaSlicer can support Air filtration/Exhaust Fan?
|
||||
documentation_link = https://www.orcaslicer.com/wiki/material_cooling#activate-air-filtration
|
||||
documentation_link = https://github.com/OrcaSlicer/OrcaSlicer/wiki/air-filtration
|
||||
|
||||
[hint:G-code window]
|
||||
text = G-code window\nYou can turn on/off the G-code window by pressing the <b>C</b> key.
|
||||
|
||||
BIN
resources/handy_models/3DBenchy.3mf
Normal file
BIN
resources/handy_models/OrcaToleranceTest.stl
Normal file
BIN
resources/handy_models/Orca_stringhell.3mf
Normal file
BIN
resources/handy_models/Stanford_Bunny.3mf
Normal file
BIN
resources/handy_models/Voron_Design_Cube_v7.3mf
Normal file
BIN
resources/handy_models/calicat.stl
Normal file
BIN
resources/handy_models/ksr_fdmtest_v4.3mf
Normal file
@@ -1 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="35" height="25" viewBox="0 0 35 25"><path d="M12,21c4.97,0,9-4.03,9-9S16.97,3,12,3,3,7.03,3,12s4.03,9,9,9Z" style="fill:#ed1c24;"/><path d="M13,14h-2v-7h2v7ZM13,15h-2v2h2v-2Z" style="fill:#e6e6e6;"/><path d="M25.5,10.5l4,3,4-3" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/></svg>
|
||||
<svg width="35" height="25" viewBox="0 0 35 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M26.7876 10.739L29.899 13.8505C30.0943 14.0458 30.4109 14.0458 30.6061 13.8505L33.7177 10.739" stroke="#ACACAC" stroke-linecap="round"/>
|
||||
<path d="M12 4.34668C14.1549 4.34668 16.2215 5.2027 17.7452 6.72644C19.269 8.25017 20.125 10.3168 20.125 12.4717C20.125 14.6266 19.269 16.6932 17.7452 18.2169C16.2215 19.7407 14.1549 20.5967 12 20.5967C9.84512 20.5967 7.77849 19.7407 6.25476 18.2169C4.73102 16.6932 3.875 14.6266 3.875 12.4717C3.875 10.3168 4.73102 8.25017 6.25476 6.72644C7.77849 5.2027 9.84512 4.34668 12 4.34668ZM12 22.4717C14.6522 22.4717 17.1957 21.4181 19.0711 19.5427C20.9464 17.6674 22 15.1238 22 12.4717C22 9.81951 20.9464 7.27598 19.0711 5.40061C17.1957 3.52525 14.6522 2.47168 12 2.47168C9.34784 2.47168 6.8043 3.52525 4.92893 5.40061C3.05357 7.27598 2 9.81951 2 12.4717C2 15.1238 3.05357 17.6674 4.92893 19.5427C6.8043 21.4181 9.34784 22.4717 12 22.4717ZM12 7.47168C11.4805 7.47168 11.0625 7.88965 11.0625 8.40918V12.7842C11.0625 13.3037 11.4805 13.7217 12 13.7217C12.5195 13.7217 12.9375 13.3037 12.9375 12.7842V8.40918C12.9375 7.88965 12.5195 7.47168 12 7.47168ZM13.25 16.2217C13.25 15.8902 13.1183 15.5722 12.8839 15.3378C12.6495 15.1034 12.3315 14.9717 12 14.9717C11.6685 14.9717 11.3505 15.1034 11.1161 15.3378C10.8817 15.5722 10.75 15.8902 10.75 16.2217C10.75 16.5532 10.8817 16.8711 11.1161 17.1056C11.3505 17.34 11.6685 17.4717 12 17.4717C12.3315 17.4717 12.6495 17.34 12.8839 17.1056C13.1183 16.8711 13.25 16.5532 13.25 16.2217Z" fill="#D01B1B"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 1.5 KiB |
@@ -1 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18"><rect x="0" y="0" width="17" height="17" rx="8.5" ry="8.5" style="fill:#009688;"/><rect x="8" y="13" width="1" height="1" style="fill:#e6e6e6;"/><path d="M5.5,6.5c0-1.66,1.34-3,3-3s3,1.34,3,3c0,3-3,2-3,4v1" style="fill:none; stroke:#e6e6e6; stroke-linecap:round; stroke-linejoin:round;"/></svg>
|
||||
<svg width="19" height="18" viewBox="0 0 19 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M17.2722 9C17.2722 7.0606 16.5018 5.20064 15.1304 3.82928C13.7591 2.45792 11.8991 1.6875 9.95972 1.6875C8.02032 1.6875 6.16036 2.45792 4.789 3.82928C3.41764 5.20064 2.64722 7.0606 2.64722 9C2.64722 10.9394 3.41764 12.7994 4.789 14.1707C6.16036 15.5421 8.02032 16.3125 9.95972 16.3125C11.8991 16.3125 13.7591 15.5421 15.1304 14.1707C16.5018 12.7994 17.2722 10.9394 17.2722 9ZM0.959717 9C0.959717 6.61305 1.90793 4.32387 3.59576 2.63604C5.28358 0.948212 7.57277 0 9.95972 0C12.3467 0 14.6359 0.948212 16.3237 2.63604C18.0115 4.32387 18.9597 6.61305 18.9597 9C18.9597 11.3869 18.0115 13.6761 16.3237 15.364C14.6359 17.0518 12.3467 18 9.95972 18C7.57277 18 5.28358 17.0518 3.59576 15.364C1.90793 13.6761 0.959717 11.3869 0.959717 9ZM6.92925 5.81133C7.20698 5.02734 7.95229 4.5 8.7855 4.5H10.8351C12.0621 4.5 13.0535 5.49492 13.0535 6.71836C13.0535 7.51289 12.6281 8.24766 11.939 8.64492L10.8035 9.29531C10.7964 9.75234 10.4203 10.125 9.95972 10.125C9.49214 10.125 9.11597 9.74883 9.11597 9.28125V8.80664C9.11597 8.5043 9.27769 8.22656 9.54136 8.07539L11.0988 7.18242C11.264 7.0875 11.366 6.91172 11.366 6.72187C11.366 6.42656 11.1269 6.19102 10.8351 6.19102H8.7855C8.66597 6.19102 8.5605 6.26484 8.52183 6.37734L8.50776 6.41953C8.35308 6.85898 7.86792 7.0875 7.43198 6.93281C6.99604 6.77812 6.76401 6.29297 6.9187 5.85703L6.93276 5.81484L6.92925 5.81133ZM8.83472 12.375C8.83472 12.0766 8.95324 11.7905 9.16422 11.5795C9.3752 11.3685 9.66135 11.25 9.95972 11.25C10.2581 11.25 10.5442 11.3685 10.7552 11.5795C10.9662 11.7905 11.0847 12.0766 11.0847 12.375C11.0847 12.6734 10.9662 12.9595 10.7552 13.1705C10.5442 13.3815 10.2581 13.5 9.95972 13.5C9.66135 13.5 9.3752 13.3815 9.16422 13.1705C8.95324 12.9595 8.83472 12.6734 8.83472 12.375Z" fill="#909090"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 422 B After Width: | Height: | Size: 1.8 KiB |
@@ -1 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><path d="M143,77.38v17.67h-17.67M140.32,93.38c-5.9-13.06-18.02-23.01-33.22-25.5-20.15-3.3-39.35,7.57-47.43,25.29" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round; stroke-width:5px;"/><path d="M123,47.23c.88,0,1.71-.17,2.48-.48.15.56.24,1.15.24,1.76,0,3.71-3.01,6.72-6.72,6.72s-6.72-3.01-6.72-6.72c0-2.83,1.76-5.25,4.24-6.24.77,2.86,3.38,4.97,6.48,4.97Z" style="fill:#949494;"/><path d="M77,47.23c-.88,0-1.71-.17-2.48-.48-.15.56-.24,1.15-.24,1.76,0,3.71,3.01,6.72,6.72,6.72,3.71,0,6.72-3.01,6.72-6.72,0-2.83-1.76-5.25-4.24-6.24-.77,2.86-3.38,4.97-6.48,4.97Z" style="fill:#949494;"/><path d="M46,152h108M71,123h0c0-6.63-5.37-12-12-12h0c-6.63,0-12,5.37-12,12h0c0,6.63,5.37,12,12,12h0c6.63,0,12-5.37,12-12ZM153,123h0c0-6.63-5.37-12-12-12h0c-6.63,0-12,5.37-12,12h0c0,6.63,5.37,12,12,12h0c6.63,0,12-5.37,12-12ZM89.5,112.5l21,21M110.5,112.5l-21,21" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round; stroke-width:5px;"/></svg>
|
||||
<svg width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_1314_965)">
|
||||
<path d="M151.1 99.8C151.1 114 145.3 126.8 136 136C126.9 145.1 114.3 150.6 100.4 150.6C86.6002 150.6 74.0002 145 64.8002 136C55.5002 126.8 49.7002 114 49.7002 99.8C49.7002 71.7 72.4002 49 100.4 49C128.4 49 151.1 71.8 151.1 99.8Z" fill="#F7F7F7"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M100.4 50C72.9538 50 50.7002 72.251 50.7002 99.8C50.7002 113.721 56.3845 126.267 65.5017 135.287C74.5247 144.113 86.8764 149.6 100.4 149.6C114.032 149.6 126.378 144.208 135.293 135.293L135.297 135.289C144.415 126.269 150.1 113.722 150.1 99.8C150.1 72.3497 127.845 50 100.4 50ZM48.7002 99.8C48.7002 71.149 71.8466 48 100.4 48C128.955 48 152.1 71.2503 152.1 99.8C152.1 114.278 146.186 127.33 136.705 136.71C127.42 145.993 114.568 151.6 100.4 151.6C86.3251 151.6 73.4777 145.888 64.1009 136.715L64.0969 136.711C54.6151 127.331 48.7002 114.278 48.7002 99.8Z" fill="#DBDBDB"/>
|
||||
<path d="M93.3692 54.2109L89.6083 67.4761L98.6108 73.7153L97.9777 88.9569L109.341 68.1032L104.063 63.8865L110.099 54.2109H116.875L137.375 76.5109L138.175 140.911C138.175 143.111 136.375 144.811 134.175 144.811H71.3751C69.175 144.811 67.375 143.011 67.375 140.911V58.111C67.375 55.9109 69.175 54.2109 71.3751 54.2109H93.3692Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M71.3751 55.2109C69.6939 55.2109 68.375 56.496 68.375 58.111V140.911C68.375 142.442 69.7108 143.811 71.3751 143.811H134.175C135.854 143.811 137.172 142.529 137.175 140.917C137.175 140.915 137.175 140.913 137.175 140.911L136.38 76.906L116.436 55.2109H110.654L105.382 63.6607L109.965 67.3219C110.344 67.6247 110.451 68.1558 110.219 68.5817L98.8558 89.4354C98.6334 89.8436 98.1589 90.0447 97.7108 89.9206C97.2627 89.7965 96.9593 89.38 96.9786 88.9154L97.5888 74.2237L89.0387 68.298C88.6874 68.0545 88.5297 67.6146 88.6463 67.2033L92.0463 55.2109H71.3751ZM66.375 58.111C66.375 55.3259 68.6561 53.2109 71.3751 53.2109H93.3692C93.6826 53.2109 93.9779 53.3579 94.1669 53.6079C94.3559 53.858 94.4168 54.1822 94.3313 54.4837L90.7654 67.0613L99.1804 72.8934C99.4621 73.0886 99.6241 73.4144 99.6099 73.7568L99.1551 84.706L108.061 68.3611L103.438 64.6677C103.042 64.351 102.946 63.7877 103.214 63.3572L109.25 53.6816C109.433 53.3889 109.754 53.2109 110.099 53.2109H116.875C117.155 53.2109 117.422 53.3282 117.611 53.5342L138.111 75.8342C138.278 76.0156 138.372 76.2521 138.375 76.4985L139.175 140.911C139.175 143.696 136.894 145.811 134.175 145.811H71.3751C68.6392 145.811 66.375 143.58 66.375 140.911V58.111Z" fill="#DBDBDB"/>
|
||||
<path d="M146.7 66.4998C148.964 66.4998 150.8 64.6642 150.8 62.3998C150.8 60.1354 148.964 58.2998 146.7 58.2998C144.435 58.2998 142.6 60.1354 142.6 62.3998C142.6 64.6642 144.435 66.4998 146.7 66.4998Z" fill="#EBEBEB"/>
|
||||
<path d="M152.7 50.4999C154.247 50.4999 155.5 49.2463 155.5 47.6999C155.5 46.1535 154.247 44.8999 152.7 44.8999C151.154 44.8999 149.9 46.1535 149.9 47.6999C149.9 49.2463 151.154 50.4999 152.7 50.4999Z" fill="#EBEBEB"/>
|
||||
<path d="M51.3 66.3998C52.8464 66.3998 54.1 65.1462 54.1 63.5998C54.1 62.0534 52.8464 60.7998 51.3 60.7998C49.7536 60.7998 48.5 62.0534 48.5 63.5998C48.5 65.1462 49.7536 66.3998 51.3 66.3998Z" fill="#EBEBEB"/>
|
||||
<path d="M34.2 120.4C37.0719 120.4 39.4 118.072 39.4 115.2C39.4 112.328 37.0719 110 34.2 110C31.3281 110 29 112.328 29 115.2C29 118.072 31.3281 120.4 34.2 120.4Z" fill="#EBEBEB"/>
|
||||
<path d="M89.2291 67.7108H77.1291C76.4291 67.7108 75.8291 67.1108 75.8291 66.4108C75.8291 65.7108 76.4291 65.1108 77.1291 65.1108H89.2291C89.9291 65.1108 90.5291 65.7108 90.5291 66.4108C90.5291 67.1108 89.9291 67.7108 89.2291 67.7108Z" fill="#DBDBDB"/>
|
||||
<path d="M88.7291 74.911H77.1291C76.4291 74.911 75.8291 74.311 75.8291 73.611C75.8291 72.911 76.4291 72.311 77.1291 72.311H88.6291C89.3291 72.311 89.9291 72.911 89.9291 73.611C89.9291 74.311 89.3291 74.911 88.7291 74.911Z" fill="#DBDBDB"/>
|
||||
<path d="M116.029 54.2109V72.0109C116.029 74.5109 118.229 76.5109 120.729 76.5109H136.529" fill="#DBDBDB"/>
|
||||
<path d="M89.9799 48.2657L86.1982 42.5732" stroke="#C2C2C2" stroke-width="2"/>
|
||||
<path d="M100.065 45.4195L100.51 31" stroke="#C2C2C2" stroke-width="2"/>
|
||||
<path d="M109.107 48.4L115.144 35.2974" stroke="#C2C2C2" stroke-width="2"/>
|
||||
<path d="M88.5713 120.379C88.1513 120.379 87.8152 120.211 87.4792 119.959C86.8911 119.371 86.8911 118.363 87.4792 117.775C91.3437 113.994 96.4685 111.894 101.929 111.894C107.39 111.894 112.515 113.994 116.38 117.775C116.968 118.363 116.968 119.371 116.38 119.959C115.791 120.547 114.783 120.547 114.195 119.959C110.919 116.682 106.55 114.918 101.929 114.918C97.3086 114.918 92.94 116.682 89.6635 119.959C89.3274 120.211 88.9914 120.379 88.5713 120.379Z" fill="#C2C2C2"/>
|
||||
<path d="M93.8641 97.8636L95.8804 95.8473C96.4685 95.2592 96.4685 94.2511 95.8804 93.663C95.2923 93.0749 94.2842 93.0749 93.6961 93.663L91.6798 95.6793L89.6635 93.663C89.0754 93.0749 88.0672 93.0749 87.4792 93.663C86.8911 94.2511 86.8911 95.2592 87.4792 95.8473L89.4955 97.8636L87.4792 99.8799C86.8911 100.468 86.8911 101.476 87.4792 102.064C87.8152 102.4 88.1513 102.484 88.5713 102.484C88.9914 102.484 89.3274 102.316 89.6635 102.064L91.6798 100.048L93.6961 102.064C94.0322 102.4 94.3682 102.484 94.7883 102.484C95.2083 102.484 95.5444 102.316 95.8804 102.064C96.4685 101.476 96.4685 100.468 95.8804 99.8799L93.8641 97.8636Z" fill="#C2C2C2"/>
|
||||
<path d="M114.279 97.8636L116.295 95.8473C116.884 95.2592 116.884 94.2511 116.295 93.663C115.707 93.0749 114.699 93.0749 114.111 93.663L112.095 95.6793L110.079 93.663C109.49 93.0749 108.482 93.0749 107.894 93.663C107.306 94.2511 107.306 95.2592 107.894 95.8473L109.91 97.8636L107.894 99.8799C107.306 100.468 107.306 101.476 107.894 102.064C108.23 102.4 108.566 102.484 108.986 102.484C109.406 102.484 109.742 102.316 110.079 102.064L112.095 100.048L114.111 102.064C114.447 102.4 114.783 102.484 115.203 102.484C115.623 102.484 115.959 102.316 116.295 102.064C116.884 101.476 116.884 100.468 116.295 99.8799L114.279 97.8636Z" fill="#C2C2C2"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_1314_965">
|
||||
<rect width="200" height="160" fill="white" transform="translate(0 20)"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 6.0 KiB |
@@ -1 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M14.5,2.96v2.54h-2.54" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/><rect x=".5" y="8.5" width="3" height="3" rx="1.5" ry="1.5" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/><rect x="12.5" y="8.5" width="3" height="3" rx="1.5" ry="1.5" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/><path d="M6.5,8.5l3,3M9.5,8.5l-3,3" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/><line x1=".5" y1="14.5" x2="15.5" y2="14.5" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/><path d="M14.14,5.5c-.9-2-2.76-3.53-5.09-3.91-3.09-.51-6.03,1.16-7.27,3.88" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/></svg>
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.25 16H4.75V18.5H7.25V16ZM4.75 15C4.48478 15 4.23043 15.1054 4.04289 15.2929C3.85536 15.4804 3.75 15.7348 3.75 16V18.5C3.75 18.7652 3.85536 19.0196 4.04289 19.2071C4.23043 19.3946 4.48478 19.5 4.75 19.5H7.25C7.51522 19.5 7.76957 19.3946 7.95711 19.2071C8.14464 19.0196 8.25 18.7652 8.25 18.5V16C8.25 15.7348 8.14464 15.4804 7.95711 15.2929C7.76957 15.1054 7.51522 15 7.25 15H4.75ZM13.25 16H10.75V18.5H13.25V16ZM10.75 15C10.4848 15 10.2304 15.1054 10.0429 15.2929C9.85536 15.4804 9.75 15.7348 9.75 16V18.5C9.75 18.7652 9.85536 19.0196 10.0429 19.2071C10.2304 19.3946 10.4848 19.5 10.75 19.5H13.25C13.5152 19.5 13.7696 19.3946 13.9571 19.2071C14.1446 19.0196 14.25 18.7652 14.25 18.5V16C14.25 15.7348 14.1446 15.4804 13.9571 15.2929C13.7696 15.1054 13.5152 15 13.25 15H10.75ZM19.25 16H16.75V18.5H19.25V16ZM16.75 15C16.4848 15 16.2304 15.1054 16.0429 15.2929C15.8554 15.4804 15.75 15.7348 15.75 16V18.5C15.75 18.7652 15.8554 19.0196 16.0429 19.2071C16.2304 19.3946 16.4848 19.5 16.75 19.5H19.25C19.5152 19.5 19.7696 19.3946 19.9571 19.2071C20.1446 19.0196 20.25 18.7652 20.25 18.5V16C20.25 15.7348 20.1446 15.4804 19.9571 15.2929C19.7696 15.1054 19.5152 15 19.25 15H16.75ZM6.367 8.244C5.181 9.537 4.559 11.069 4.499 12.047C4.48654 12.2458 4.39562 12.4315 4.24624 12.5632C4.09687 12.695 3.90128 12.762 3.7025 12.7495C3.50372 12.737 3.31803 12.6461 3.18629 12.4967C3.05455 12.3474 2.98754 12.1518 3 11.953C3.087 10.563 3.894 8.719 5.26 7.23C6.646 5.72 8.673 4.5 11.25 4.5C13.823 4.5 15.886 5.717 17.29 7.226C18.671 8.71 19.5 10.572 19.5 12H18C18 11.06 17.4 9.546 16.192 8.248C15.007 6.974 13.32 6 11.25 6C9.184 6 7.535 6.97 6.367 8.244Z" fill="#262E30"/>
|
||||
<path d="M20.25 12H14.25L20.25 6V12Z" fill="#262E30"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 1.8 KiB |
@@ -1 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M14.5,2.96v2.54h-2.54M3.5,10h0c0-.83-.67-1.5-1.5-1.5h0c-.83,0-1.5.67-1.5,1.5h0c0,.83.67,1.5,1.5,1.5h0c.83,0,1.5-.67,1.5-1.5ZM15.5,10h0c0-.83-.67-1.5-1.5-1.5h0c-.83,0-1.5.67-1.5,1.5h0c0,.83.67,1.5,1.5,1.5h0c.83,0,1.5-.67,1.5-1.5ZM6.5,8.5l3,3M9.5,8.5l-3,3M.5,14.5h15M14.14,5.5c-.9-2-2.76-3.53-5.09-3.91-3.09-.51-6.03,1.16-7.27,3.88" style="fill:none; opacity:.5; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/></svg>
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.25001 16H4.75001V18.5H7.25001V16ZM4.75001 15C4.48479 15 4.23044 15.1054 4.0429 15.2929C3.85537 15.4804 3.75001 15.7348 3.75001 16V18.5C3.75001 18.7652 3.85537 19.0196 4.0429 19.2071C4.23044 19.3946 4.48479 19.5 4.75001 19.5H7.25001C7.51522 19.5 7.76958 19.3946 7.95712 19.2071C8.14465 19.0196 8.25001 18.7652 8.25001 18.5V16C8.25001 15.7348 8.14465 15.4804 7.95712 15.2929C7.76958 15.1054 7.51522 15 7.25001 15H4.75001ZM13.25 16H10.75V18.5H13.25V16ZM10.75 15C10.4848 15 10.2304 15.1054 10.0429 15.2929C9.85537 15.4804 9.75001 15.7348 9.75001 16V18.5C9.75001 18.7652 9.85537 19.0196 10.0429 19.2071C10.2304 19.3946 10.4848 19.5 10.75 19.5H13.25C13.5152 19.5 13.7696 19.3946 13.9571 19.2071C14.1447 19.0196 14.25 18.7652 14.25 18.5V16C14.25 15.7348 14.1447 15.4804 13.9571 15.2929C13.7696 15.1054 13.5152 15 13.25 15H10.75ZM19.25 16H16.75V18.5H19.25V16ZM16.75 15C16.4848 15 16.2304 15.1054 16.0429 15.2929C15.8554 15.4804 15.75 15.7348 15.75 16V18.5C15.75 18.7652 15.8554 19.0196 16.0429 19.2071C16.2304 19.3946 16.4848 19.5 16.75 19.5H19.25C19.5152 19.5 19.7696 19.3946 19.9571 19.2071C20.1447 19.0196 20.25 18.7652 20.25 18.5V16C20.25 15.7348 20.1447 15.4804 19.9571 15.2929C19.7696 15.1054 19.5152 15 19.25 15H16.75ZM6.36701 8.244C5.18101 9.537 4.55901 11.069 4.49901 12.047C4.48654 12.2458 4.39562 12.4315 4.24625 12.5632C4.09688 12.695 3.90129 12.762 3.70251 12.7495C3.50373 12.737 3.31804 12.6461 3.1863 12.4967C3.05455 12.3474 2.98754 12.1518 3.00001 11.953C3.08701 10.563 3.89401 8.719 5.26001 7.23C6.64601 5.72 8.67301 4.5 11.25 4.5C13.823 4.5 15.886 5.717 17.29 7.226C18.671 8.71 19.5 10.572 19.5 12H18C18 11.06 17.4 9.546 16.192 8.248C15.007 6.974 13.32 6 11.25 6C9.18401 6 7.53501 6.97 6.36701 8.244Z" fill="#ACACAC"/>
|
||||
<path d="M20.25 12H14.25L20.25 6V12Z" fill="#ACACAC"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 567 B After Width: | Height: | Size: 1.9 KiB |
@@ -1 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M14.5,2.96v2.54h-2.54" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/><rect x=".5" y="8.5" width="3" height="3" rx="1.5" ry="1.5" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/><rect x="12.5" y="8.5" width="3" height="3" rx="1.5" ry="1.5" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/><path d="M6.5,8.5l3,3M9.5,8.5l-3,3" style="fill:none; stroke:#ed1c24; stroke-linecap:round; stroke-linejoin:round;"/><line x1=".5" y1="14.5" x2="15.5" y2="14.5" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/><path d="M14.14,5.5c-.9-2-2.76-3.53-5.09-3.91-3.09-.51-6.03,1.16-7.27,3.88" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/></svg>
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.47995 16.1333H4.89662V18.7167H7.47995V16.1333ZM4.89662 15.1C4.62256 15.1 4.35973 15.2089 4.16594 15.4027C3.97215 15.5964 3.86328 15.8593 3.86328 16.1333V18.7167C3.86328 18.9907 3.97215 19.2536 4.16594 19.4473C4.35973 19.6411 4.62256 19.75 4.89662 19.75H7.47995C7.75401 19.75 8.01684 19.6411 8.21063 19.4473C8.40441 19.2536 8.51328 18.9907 8.51328 18.7167V16.1333C8.51328 15.8593 8.40441 15.5964 8.21063 15.4027C8.01684 15.2089 7.75401 15.1 7.47995 15.1H4.89662ZM13.68 16.1333H11.0966V18.7167H13.68V16.1333ZM11.0966 15.1C10.8226 15.1 10.5597 15.2089 10.3659 15.4027C10.1722 15.5964 10.0633 15.8593 10.0633 16.1333V18.7167C10.0633 18.9907 10.1722 19.2536 10.3659 19.4473C10.5597 19.6411 10.8226 19.75 11.0966 19.75H13.68C13.954 19.75 14.2168 19.6411 14.4106 19.4473C14.6044 19.2536 14.7133 18.9907 14.7133 18.7167V16.1333C14.7133 15.8593 14.6044 15.5964 14.4106 15.4027C14.2168 15.2089 13.954 15.1 13.68 15.1H11.0966ZM19.88 16.1333H17.2966V18.7167H19.88V16.1333ZM17.2966 15.1C17.0226 15.1 16.7597 15.2089 16.5659 15.4027C16.3722 15.5964 16.2633 15.8593 16.2633 16.1333V18.7167C16.2633 18.9907 16.3722 19.2536 16.5659 19.4473C16.7597 19.6411 17.0226 19.75 17.2966 19.75H19.88C20.154 19.75 20.4168 19.6411 20.6106 19.4473C20.8044 19.2536 20.9133 18.9907 20.9133 18.7167V16.1333C20.9133 15.8593 20.8044 15.5964 20.6106 15.4027C20.4168 15.2089 20.154 15.1 19.88 15.1H17.2966ZM6.56752 8.1188C5.34198 9.4549 4.69925 11.038 4.63725 12.0486C4.62437 12.254 4.53042 12.4458 4.37607 12.582C4.22172 12.7181 4.01961 12.7874 3.8142 12.7745C3.6088 12.7616 3.41692 12.6677 3.28078 12.5133C3.14465 12.3589 3.0754 12.1568 3.08828 11.9514C3.17818 10.5151 4.01208 8.60963 5.42362 7.071C6.85582 5.51067 8.95038 4.25 11.6133 4.25C14.2721 4.25 16.4038 5.50757 17.8546 7.06687C19.2817 8.60033 20.1383 10.5244 20.1383 12H18.5883C18.5883 11.0287 17.9683 9.4642 16.72 8.12293C15.4955 6.80647 13.7523 5.8 11.6133 5.8C9.47842 5.8 7.77445 6.80233 6.56752 8.1188Z" fill="#262E30"/>
|
||||
<path d="M20.9133 12H14.7133L20.9133 5.79999V12Z" fill="#262E30"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 2.1 KiB |
@@ -1 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><rect x="1" y="1" width="5" height="14" rx="2" ry="2" style="fill:#949494;"/><rect x="10" y="1" width="5" height="14" rx="2" ry="2" style="fill:#949494;"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14"><rect x="2" y="1" width="3" height="12" rx="1" style="fill:#949494"/><rect x="9" y="1" width="3" height="12" rx="1" style="fill:#949494"/></svg>
|
||||
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 227 B |