Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
HansOlsson committed Feb 9, 2022
1 parent e78573b commit 115c849
Show file tree
Hide file tree
Showing 94 changed files with 9,366 additions and 22,027 deletions.
61 changes: 15 additions & 46 deletions .CI/Jenkinsfile
Expand Up @@ -18,7 +18,7 @@ pipeline {
stage('build') {
agent {
docker {
image 'modelicaspec/latexml:20210330'
image 'modelicaspec/latexml:20200415'
label 'linux'
alwaysPull true
}
Expand All @@ -29,10 +29,8 @@ pipeline {
steps {
sh 'mkdir -p /tmp/jenkins'
sh 'latexmk -pdf MLS.tex'
sh 'latexml MLS.tex --includestyles --path=media --dest MLS.xml'
sh 'latexmlpost MLS.xml -format html -pmml --splitat=chapter --splitnaming=labelrelative --javascript=LaTeXML-maybeMathjax.js --navigationtoc=context --css=css/MLS.css --css=css/MLS-navbar-left.css --dest MLS.html'
sh '.scripts/patch-viewport.sh'
sh '.scripts/patch-body-ios-hover.sh'
sh 'latexml --path=media MLS.tex --dest MLS.xml'
sh 'latexmlpost MLS.xml -format html -pmml --splitat=chapter --splitnaming=labelrelative --javascript=css/LaTeXML-maybeMathJax.js --navigationtoc=context --css=css/LaTeXML-navbar-left.css --dest MLS.html'
sh 'ln -s preface.html Chx1.html'
sh 'ln -s lexical-structure.html Ch2.html'
sh 'ln -s operators-and-expressions.html Ch3.html'
Expand All @@ -53,17 +51,17 @@ pipeline {
sh 'ln -s annotations.html Ch18.html'
sh 'ln -s unit-expressions.html Ch19.html'
sh 'ln -s the-modelica-standard-library.html Ch20.html'
sh 'ln -s glossary.html A1.html'
sh 'ln -s modelica-concrete-syntax.html A2.html'
sh 'ln -s modelica-dae-representation.html A3.html'
sh 'ln -s derivation-of-stream-equations.html A4.html'
sh 'ln -s modelica-revision-history.html A5.html'
sh 'ln -s bib.html A6.html'
sh 'ln -s bib.html literature.html'
sh 'ln -s literature.html A6.html'
sh script: '! (find . -type l -xtype l | egrep \'.*\')', label: 'Verify symbolic links work'
sh 'tar czf MLS.tar.gz *.html *.css *.js media/ css/'
sh 'tar czf MLS.tar.gz *.html *.css media css/'
archiveArtifacts artifacts: 'MLS.tar.gz', fingerprint: true
archiveArtifacts artifacts: 'MLS.pdf', fingerprint: true
stash name: 'MLS', includes: '*.html,*.css,*.js,MLS.pdf,media/**,css/**,MLS.tar.gz'
stash name: 'MLS', includes: '*.html,*.css,MLS.pdf,media/**,css/**,MLS.tar.gz'
}
}
stage('upload') {
Expand All @@ -75,9 +73,7 @@ pipeline {
anyOf {
buildingTag()
anyOf {
branch 'jenkins'
branch 'master'
branch 'maint/**'
}
}
}
Expand All @@ -89,26 +85,16 @@ pipeline {
steps {
unstash name: 'MLS'
sh "test ! -z ${env.GIT_BRANCH}"
sshagent (credentials: ['Hudson-SSH-Key']) {
sh 'ssh-keyscan github.com >> ~/.ssh/known_hosts'
sh "test -d specification.modelica.org || git clone git@github.com:modelica/specification.modelica.org"
sh "cd specification.modelica.org/ && git fetch && git reset --hard origin/master"
sh "rm -rf 'specification.modelica.org/${env.GIT_BRANCH}' && mkdir -p 'specification.modelica.org/${env.GIT_BRANCH}'"
sh "cp -a *.html *.css *.js MLS.pdf media css 'specification.modelica.org/${env.GIT_BRANCH}'"
sh """
cd specification.modelica.org
git add '${env.GIT_BRANCH}'
if ! git diff-index --quiet origin/master --; then
git commit --amend -m "Initial commit"
git push -f
fi
"""
}
sshPublisher(publishers: [sshPublisherDesc(configName: 'ModelicaSpecification', transfers: [sshTransfer(remoteDirectory: "${env.GIT_BRANCH}", sourceFiles: '*.html,*.css,MLS.pdf,media/**,css/**')])])
}
}
stage('index') {
agent {
label 'linux'
docker {
image 'modelicaspec/markdown:20190307'
label 'linux'
alwaysPull true
}
}
when {
allOf {
Expand All @@ -120,25 +106,8 @@ pipeline {
beforeAgent true
}
steps {
script {
docker.image('modelicaspec/markdown:20190307').inside {
sh 'python3 .CI/index.py'
}
}
sshagent (credentials: ['Hudson-SSH-Key']) {
sh 'ssh-keyscan github.com >> ~/.ssh/known_hosts'
sh "test -d specification.modelica.org || git clone git@github.com:modelica/specification.modelica.org"
sh "cd specification.modelica.org/ && git fetch && git reset --hard origin/master"
sh "cp -a index.html specification.modelica.org/"
sh """
cd specification.modelica.org
git add index.html
if ! git diff-index --quiet origin/master --; then
git commit --amend -m "Initial commit"
git push -f
fi
"""
}
sh 'python3 .CI/index.py'
sshPublisher(publishers: [sshPublisherDesc(configName: 'ModelicaSpecification', transfers: [sshTransfer(sourceFiles: 'index.html')])])
}
}
}
Expand Down
143 changes: 4 additions & 139 deletions .CI/index.py
Expand Up @@ -2,145 +2,10 @@
import xml.etree.ElementTree as ET
xml = "<xml>" + markdown.markdown(open('README.md', encoding="utf-8").read(), extensions=['markdown.extensions.tables']) + "</xml>"
root = ET.fromstring(xml)
head = """<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Modelica Specification</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />
<link rel="stylesheet" href="https://doc.modelica.org/Modelica%203.2.3/Resources/helpOM/style.css" />
</head>
<body class="md-body">
<nav class="navbar navbar-light bg-light">
<div class="container justify-content-between flex-nowrap">
<span class="navbar-brand mb-0">
<a href="https://modelica.org/"><img src="https://raw.githubusercontent.com/modelica/MA-Logos/master/HighRes/Modelica_Language.svg" alt="Modelica Language logo" class="md-logo"></a>
</span>
<div id="head-selects"></div>
</div>
</nav>
<div class="container pt-4">
<h1 class="pt-2 h2">Modelica Specification</h1>
"""
tail = """ </div>
<div class="container">
<template id="md-tool-select">
<div class="md-item p-0">
<form class="form-inline align-items-end">
<input type="text" placeholder="Type your search..." class="form-control form-control-sm md-search-input mb-2 mr-sm-2">
<div class="input-group mb-2 mr-sm-2">
<select class="form-control form-control-sm md-item__version-select"></select>
</div>
<div class="input-group mb-2 mr-sm-2">
<a href="#" target="_blank" rel="noopener" class="btn btn-outline-secondary btn-sm btn-block md-item__link">Browse</a>
</div>
</form>
</div>
</template>
<template id="md-tool-template">
<div class="md-item p-0">
<div class="md-item__description">Description</div>
</div>
</template>
<div id="container" class="pb-4"></div>
</div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<script>
var data = {
"versions": ["3.6-dev", "3.5", "3.4"]
};
var buildSelect = function(select, data){
while(select.firstChild) select.removeChild(select.firstChild);
data.forEach(function (item) {
var option = document.createElement('option');
option.textContent = item;
option.value = item;
select.appendChild(option);
});
select[1].selected = 1;
};
var initSelects = function(versions){
var container = document.createElement('div');
var template = document.getElementById('md-tool-select');
var clone = document.importNode(template.content, true);
buildSelect(clone.querySelector('.md-item__version-select'), versions);
clone.querySelector('.md-item__link').setAttribute('href', buildLink(versions[1]));
container.appendChild(clone);
document.getElementById('head-selects').appendChild(container);
}
var buildLink = function(version){
var link = '';
if(version == '3.6-dev'){
link = 'https://specification.modelica.org/master/MLS.html';
}else{
link = 'https://specification.modelica.org/maint/' + version + '/MLS.html';
}
return link;
}
var updateSearch = function(version){
if(version == '3.6-dev'){
search.algoliaOptions.facetFilters = [
"version:master",
"tags:specification",
]
}else{
search.algoliaOptions.facetFilters = [
"version:" + version,
"tags:specification",
]
}
}
$(document).ready(function() {
initSelects(data.versions);
$('body').on('change', '.md-item__version-select', function(){
var version = $(this).val();
var link = buildLink(version);
$('.md-item').find('.md-item__link').attr('href', link);
updateSearch(version);
});
search = docsearch({
apiKey: '97b18f2173101844a41539b817e99337',
indexName: 'modelica',
inputSelector: '.md-search-input',
debug: false, // Set debug to true if you want to inspect the dropdown
algoliaOptions: {
advancedSyntax: true,
typoTolerance: false,
hitsPerPage: 16,
facetFilters: ["version:3.5", "tags:specification"]
}
});
});
</script>
</html>
"""
for elem in root.findall('.//table'):
with open("index.html", "w") as f:
f.write(head)
f.write(ET.tostring(elem).decode('utf-8'))
f.write(tail)
f = open("index.html", "w")
f.write("<html>")
f.write(ET.tostring(elem).decode('utf-8'))
f.write("</html>")
sys.exit(0)
sys.exit(1)
2 changes: 1 addition & 1 deletion .CI/latexml/Dockerfile
Expand Up @@ -23,7 +23,7 @@ RUN sed -i s,http://archive.ubuntu.com/ubuntu/,mirror://mirrors.ubuntu.com/mirro
&& $INSTALL/install-tl --profile texlive.profile \
&& rm texlive.profile \
&& tlmgr update --self --all --reinstall-forcibly-removed \
&& tlmgr install latexmk listings caption cleveref xcolor float multirow tocloft parskip etoolbox index biblatex biber newtxtt \
&& tlmgr install latexmk listings xcolor float multirow tocloft parskip etoolbox \
&& cpanm JSON \
&& cpanm LaTeXML \
&& apt-get autoremove -qy make gcc curl wget git cpanminus libxml2-dev libxslt-dev \
Expand Down
5 changes: 0 additions & 5 deletions .CI/latexml/Dockerfile.2.incremental

This file was deleted.

10 changes: 0 additions & 10 deletions .CI/latexml/Dockerfile.incremental

This file was deleted.

24 changes: 0 additions & 24 deletions .CI/latexml/README.md

This file was deleted.

19 changes: 1 addition & 18 deletions .gitignore
Expand Up @@ -148,23 +148,6 @@ sympy-plots-for-*.tex/
MLS\.pdf

LaTeXML.css
ltx-article.css
MLS.tar.gz
ltx-listings.css
ltx-report.css
LaTeXML-maybeMathjax.js

MLS.tar.gz

# Directories belonging to the LaTeXML build
/annotations/
/connectors-and-connections/
/interface-or-type-relationships/
/modelica-dae-representation/
/overloaded-operators/
/packages/
/preface/
/state-machines/
/stream-connectors/
/synchronous-language-elements/
/the-modelica-standard-library/
/unit-expressions/
4 changes: 0 additions & 4 deletions .scripts/patch-body-ios-hover.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .scripts/patch-viewport.sh

This file was deleted.

6 changes: 0 additions & 6 deletions LICENSE.md

This file was deleted.

0 comments on commit 115c849

Please sign in to comment.