Commit 4346d511 authored by Carsten Eie Frigaard's avatar Carsten Eie Frigaard
Browse files

update

parent e24c07cd
......@@ -2,10 +2,11 @@ COURSE
DEFS
[HOMEHTML] https://itundervisning.ase.au.dk/ITMAL_E21/Html
[HOME] https://itundervisning.ase.au.dk/ITMAL_E21
[HOML] <span style='font-family: courier new, courier;'>[HOML]</span>
[GITMAL] <span style='font-family: courier new, courier;'>[GITMAL]</span>
[GITHOML] <span style='font-family: courier new, courier;'>[GITHOML]</span>
[JPYNB] <span style='font-family: courier new, courier;'>[JPYNB]</span>
[FIGS] https://itundervisning.ase.au.dk/ITMAL_E21/Html/Figs
[HOML] <span style='font-family: courier new, courier;'>[HOML]</span>
[GITMAL] <span style='font-family: courier new, courier;'>[GITMAL]</span>
[GITHOML] <span style='font-family: courier new, courier;'>[GITHOML]</span>
[JPYNB] <span style='font-family: courier new, courier;'>[JPYNB]</span>
[OPTIONAL] (OPTIONEL)
[KURSUSINFORMATION] <a href='https://brightspace.au.dk/d2l/le/lessons/27524/units/244588'>kursusinformation</a>
......@@ -13,16 +14,336 @@ DEFS
[KURSUSINFOGPU] <a href='https://brightspace.au.dk/d2l/le/lessons/27524/topics/244596' rel='noopener' target='_blank'>kursusinformation | GPU Cluster</a>
[BR] <br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CONTENT Litteratur
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\header{Litteratur}
\sub{Hands-on Machine Learning [HOML]}
\displaystyle{
\img{[FIGS]/book_homl.jpg, Hands-on Machine Learning with Scikit-Learn (front image)}
[BR] \i{Hands-on Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems}
[BR]
[BR] Aurélien Géron
[BR] O'Reilly / Wiley, 2019, 2.ed.
[BR] ISBN: 9781492032649
[BR] \link{online link, https://www.oreilly.com/library/view/hands-on-machine-learning/9781492032632/}
}
\p{\i{NOTE 1:} dette er anden udgave (Second Edition/2.ed) af Géron's " Hands-on",
undgå at bruge førsteudgaven, idet den benytter TensorFlow direkte istedet for
Keras, og desuden har flere mangler.}
\p{\i{NOTE 2:} i PDF udgaven (Early Release, June 2019, 2019-04-22: Fifth Release)
svare sidetal og nogle kaptitler ikke til den officielle bog udgave ovenfor!}
\sub{Deep Learning [DL]}
\displaystyle{
\img{[FIGS]/book_dl.jpg, Deep Learning (front image)}
[BR] \i{Deep Learning}
[BR]
[BR] Ian Goodfellow, Yoshua Bengio, Aaron Courville
[BR] The MIT Press
[BR] November 18, 2016
[BR] Hardcover: 775 pages
[BR] ISBN-10: 0262035618
[BR] ISBN-13: 978-0262035613
[BR] \link{online link, http://www.deeplearningbook.org/}
}
\p{\i{NOTE:} ikke obligatorisk, kun få afsnit og figure bruges herfra. (Bog god til
videregående Neural Netværks-teori og meget brugt i ML sammenhænge.)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CONTENT Kursusforkortelser
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\header{Kursusforkortelser}
[DL]: \displaystyle{
Enten bare Deep Learning eller Deep Learning bogen af Ian Goodfellow, et. al.
}
[G]: \displaystyle{
Group, ITMAL øvelsesgruppe.
}
[GITHOML]: \displaystyle{
GitHub repository til [HOML],
\quote{\linkex{github.com/ageron/handson-ml2, https:///github.com/ageron/handson-ml2/}}
Clone via HTTPS:
\quote{\code{git clone https://github.com/ageron/handson-ml2.git}}
eller via SSH
\quote{\code{git clone git@github.com:ageron/handson-ml2.git}}
}
[GITMAL]: \displaystyle{
Git repository for ITMAL,
\quote{\linkex{gitlab.au.dk/au204573/GITMAL, https://gitlab.au.dk/au204573/GITMAL/}}
Clone via HTTPS:
\quote{\code{git clone https://gitlab.au.dk/au204573/GITMAL.git}}
eller via SSH
\quote{\code{git clone git@gitlab.au.dk:au204573/GITMAL.git}}
}
[HOML]: \displaystyle{
Hands-on Machine Learning af Aurélien Géron, hovedlitteratur til dette kursus.
[BR][BR] For klarhedens skyld undtales 'HOML' som Holm i Brian Holm.
[BR][BR]\img{[FIGS]/brian_holm.jpg, Brian Holm (foto fra cdn-ctstaging.pressidium.com)}
\cite{https://cdn-ctstaging.pressidium.com/wp-content/uploads/2020/12/CORVOS_00000365-066.jpg}
}
[ITMAL]: \displaystyle{
IT Machine Learning, kursusnavnet.
}
% [J1, J2, .. JN]: En journal opgave/aflevering, f.eks. "Journal 1" (J1). 'Journaler' erstattes af 'opgave afleveringer', O1, O2, osv.
[JPYNB]: \displaystyle{
Jypyter Python NoteBook, dvs. Notebook applikationen eller en notebook kildetekst fil (med endelsen .ipynb).
}
[ML]: \displaystyle{
Machine Learning, det generelle koncept.
}
[NN:] \displaystyle{
Neural Network.
}
[O1, O2, O3, O4]: \displaystyle{
En opgaveaflevering, f.eks. O1 for opgaveaflevering 1.
%(opgave afleveringer hed tidligere journaler).
}
[SG]: \displaystyle{
Super-group, bestående af tre eller fire Grupper [G]'s.
}
[Q]: \displaystyle{
Et specifikt spørgsmål (Question) i en journal opgave, ala Qc for opgave 'c' i et journal spørgsmål.
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CONTENT Dokumentation og links
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sub{Web sites}
Primære
\ul{
\li{\linkex{[GITHOML] github.com/ageron/handson-ml2, https://github.com/ageron/handson-ml2/}}
\li{\linkex{Scikit-learn:scikit-learn.org/stable, https://scikit-learn.org/stable/}}
\li{\linkex{Keras: keras.io, https://keras.io/}}
}
Sekundære
\ul{
\li{\linkex{Jupyter: jupyter-notebook.readthedocs.io/en/stable, https://jupyter-notebook.readthedocs.io/en/stable/}}
\li{\linkex{Anaconda Cloud: anaconda.org, https://anaconda.org/}}
\li{\linkex{Tensorflow: www.tensorflow.org, https://www.tensorflow.org/}}
}
Datakilder
\ul{
\li{\link{Kaggle datasets: www.kaggle.com, https://www.kaggle.com/}}
\li{\i{Sign in with your email} => genbrug gerne min konto, og undgå tidsplid:
\ul{
\li{user: cef@ase.au.dk}
\li{password: test123}
}
}
}
Dokumentation
\ul{
\li{Brug den inbyggede hjælp i [JPYNP]}
\img{[FIGS]/Screenshot_jupyter_help.png,}
}
Guides etc.
\ul{
\li{\linkex{A Quick Python intro (short), https://www.w3schools.com/python/python_intro.asp}}
\li{\linkex{A Python tutorial (not so short!), https://docs.python.org/3/tutorial/}}
\li{Jupyter shortcuts quick guide XXX}
\li{Scikit-learn reference XXX}
\li{Scikit-learn cheat sheet XXX}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CONTENT GPU Cluster
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Der er adgang til en GPU baseret server ifbm kurset. Serveren består af en 'master' som kan tilgås via
http://gpucluster.st.lab.au.dk/
og fire 'slave' noder med GPU'er via
http://gpucluster.st.lab.au.dk/jhub1 (NEDE: brændt varm!)
http://gpucluster.st.lab.au.dk/jhub2
http://gpucluster.st.lab.au.dk/jhub3
http://gpucluster.st.lab.au.dk/jhub4 (unavailable/resv. til forksning)
http://gpucluster.st.lab.au.dk/jhub5 (GPU 3090 og ny 4GHz CPU, 3090 har problemer med Tensorflow)
som frit kan benyttes.
Adgang kræver at i er på EDUROAM eller VPN/au access,.
Der er pt. ingen load-balancing på de fire noder så se på gpucluster hjemmesiden, hvilke noder der er mindst belastede (via TOP dataen).
Brug
Alle grupper har fået deres egen konto, og f.eks. så logger Grp 09 ind som:
Login: f21mal09
Password: f21mal09_123
Dvs. brugernavn/login f21malXX hvor XX er jeres ITMAL gruppe og password sammen som brugernavn med med _123 tilføjet.
Quick Guide
GIT via Jupyter
I kan clone git repositoret via en '!'-shell commando i Jupyter notepad'en
! git clone https://cfrigaard@bitbucket.org/cfrigaard/itmal
og så herefter pull'e via
! cd itmal && git pull
PYTHONPATH
NOTE: PYTHONPATH er IKKE sat (som vi gjorde i L03/modules_and _classes.ipynb), men kan simuleres via
import sys,os sys.path.append(os.path.expanduser('~/itmal'))
Hvis du kloner GITMAL til itmal som overnfor er der nu automatisk sat en path op til libitaml, prøv det!
GPU Hukommelse
Ved brug af Keras+GPU allokeres automatisk al GPU hukommelse. Når vi er flere brugere skal i derfor indsætte følgende i starten af jeres Keras/Tensorflow Jupyternotebook kode:
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.05
config.gpu_options.allow_growth=True
set_session(tf.Session(config=config))
eller blot
from libitmal import kernelfuns as itmalkernelfuns
itmalkernelfuns.EnableGPU()
så allokeres kun en brøkdel af GPU hukommelsen! Det ser ud til at growth=True ikke virker, så sæt per_process_gpu_memory_fraction op hvis i har behov.
Der kører nu et automatisk startup-script når i logger ind/åbner en nodebook. Se
/home/shared/(??)/startup/00_init.py
der kører StartupSequence_SetPath() og StartupSequence_EnableGPU(), den sidste unktion med følgende default paramete
def StartupSequence_EnableGPU(gpu_mem_fraction=0.05, gpus=None, cpus=None)
Bemærk at jeres jupyter server, beholder all hukommelse, også når i logger af...kun "stop my server"/"start server" frigiver!
Jeg vil slå alle proceser ned, der har allokeret over ca. 4Gb GPU hukommelse eller har kørt i en uge...det er en automatisk process, der kører med ca 5. interval!
Noter
Terminal på cluster
Brug Jupyter notebooks terminalen:
Herefter har du en fin terminal på cluster noden:
SSH til cluster
Eller gør det på den klassiske metode via SSH til clusterens 'masternode' via
> ssh -p 443 gpucluster.st.lab.au.dk
og herfra videre til 'noder' via ssh node 1 til node 4, f.eks.
> ssh node3
Brug ikke 'masternode'en til udregninger, kun node 1 til 4!
Sæt gerne jeres SSH certifickater på, så i slipper for login/password..
Password
Kan kun ændres via SSH og > passwd
Se Hvad der kører på CPU
! top -n1
Se Hvad der kører på GPU
! nvidia-smi
Kill din egne processer
! kill -9 <pid>
eller
! pkill <navn>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LESSON L00
CONTENT L00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\header{Forberedelse inden kursusstart}
%\header{Forberedelse inden kursusstart}
\sub{Formål}
......@@ -111,12 +432,12 @@ at undersøg/bruge det).}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LESSON L01
CONTENT L01
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\header{Introduktion}
%\header{Introduktion}
\sub{Formål}
......
......@@ -2,22 +2,25 @@ COUSEPLAN
HEAD
Uge{40} |Dato{110} |Lektion{20}|Emne{200} |Opgave{90} |Kommentar{150}
CONTENT
05 |02/02-2021 |L01 |Intro | |
06 |09/02-2021 |L02 |Klassifikation | |
07 |16/02-2021 |L03 |End-to-end ML | |
08 |23/02-2021 |L04 |Regression |O1 (28/02) |
09 |02/03-2021 |L05 |Data analyse | |
10 |09/03-2021 |L06 |Neurale netværk (NN) | |
11 |16/03-2021 |L07 |Træning og generalisering |O2 (17/03) |
12 |23/03-2021 |L08 |Regularisering og søgning | |
13 |30/03-2021 | | | |Påske (ingen undervisning)
14 |06/04-2021 |L09 |Deep learning (CNN) | |
15 |13/04-2021 |L10 |Probabilistiske modeller |O3 (14/04) |
16 |20/04-2021 |L11 |Unsupervised learning I (PCA) | |
17 |27/04-2021 |L12 |Unsupervised learnindg II (Kmeans,GMM) | |Kursus-evaluering
18 |04/05-2021 |L13 |Projektarbejde (Discord) | |
19 |11/05-2021 |L14 |O4 projekt | |
20 |18/05-2021 |L15 |O4 projekt |O4 (19/05) |
35 |03/09-2021 |L01 |Intro | |
36 |10/09-2021 |L02 |Klassifikation | |
37 |17/09-2021 |L03 |End-to-end ML | |
38 |24/09-2021 |L04 |Regression og SGD |O1 (24/09) |
39 |01/10-2021 |L05 |Data analyse | |
40 |08/10-2021 |L06 |Træning og generalisering | |
41 |15/10-2021 |L07 |Regularisering og søgning |O2 (15/10) |
42 |22/10-2021 | | | |Efterårsferie (ingen undervisning)
43 |29/10-2021 |L08 |Neurale netværk (NN) | |
44 |05/11-2021 |L09 |Deep learning (CNN) | |
45 |12/11-2021 |L10 |Hardware til ML |O3 (12/11) |
46 |19/11-2021 |L11 |Unsupervised learning I (PCA) | |
47 |26/11-2021 |L12 |Unsupervised learnindg II (Kmeans,GMM) | |Kursus-evaluering
48 |03/12-2021 |L13 |O4 projekt | |
49 |10/12-2021 |L14 |O4 projekt | |
50 |17/12-2021 |L15 |O4 projekt |O4 (19/05) |
NOTES
Tidpunkt: Fredage 08:15 til 12:00
Lokale: 5106-110
REFS
[1] sdf
[2] sfd zdf
......
......@@ -8,6 +8,10 @@ PWD = $(shell pwd)
COURSEFILES = ITMAL_E21
MKDIFF=colordiff -dw Refs/$1 $1 && echo "DIFF OK" && rm $1
sync: build
ssh si "cd ITMAL_E21 && rm -f Html/*.html && git pull"
cd ../../Html && scp -C -r *.html Figs/ si:ITMAL_E21/Html
build:
@ $(PYCOURSE) -c $(COURSEFILES)/course.tex -v -o ../../Html/
@ $(PYPLAN) -p $(COURSEFILES)/plan.txt -v -o ../../Html/plan.html
......@@ -23,13 +27,8 @@ test:
@ cd Test && $(PWD)/$(PYFILETREE) $(TESTARGS) -o $(PWD)/tree.html
@ $(call MKDIFF,tree.html)
sync: build
cd .. && scp -r Html/*.html si:ITMAL_E21/Html
ssh si "cd ITMAL_E21 && git pull"
edit:
joe $(PYCOURSE)
clean:
@ rm -f index.html out.html test.html ../Html/L??.html
......
......@@ -35,11 +35,17 @@ def Check(expr, msg):
if not expr:
Err("EXPRESSION NOT FULLFILLED: " + msg)
def Trim(s):
s = isStr(s, False).replace("\t"," ")
def Trim(s, checknonempty=True):
s = isStr(s, isBool(checknonempty)).replace("\t"," ")
s = s.strip()
return s
def SuffixFrom(s, splitstr):
n = isStr(s).rfind(isStr(splitstr))
if n<0:
ERR(f"string '{s}' does not contain split string '{splitstr}' at all")
return s[n+len(splitstr):]
def Dbg(verbose, msg, level=1):
isInt(verbose)
isStr(msg)
......@@ -47,19 +53,10 @@ def Dbg(verbose, msg, level=1):
if level <= verbose:
print(msg, file=stderr)
def Print(msg, outputfile):
assert isStr(msg)
#assert outputfile is None or isinstance(outputfile, _io.TextIOWrapper)
#print(msg, file=(stdout if outputfile is None else outputfile))
print(msg, file=outputfile)
def Outputfile(outputfile):
isStr(outputfile)
f = stdout
if not (outputfile is None or len(outputfile)==0 or outputfile=="None"):
f = open(outputfile, 'w')
else:
f = stdout
assert outputfile is not None
outputfile = isStr(outputfile).replace(" ", "_")
f = stdout if (outputfile is None or len(outputfile)==0 or outputfile=="None") else open(outputfile, 'w')
return f
def LoadText(filename, timeout=4000, split=True):
......@@ -69,6 +66,13 @@ def LoadText(filename, timeout=4000, split=True):
c = c.split("\n")
return c
def MkHtmlPage(htmlcontent):
assert isStr(htmlcontent).find("DOCTYPE")<0 and htmlcontent.find("<html>")<=0 and htmlcontent.find("<body>")<=0
#bodystyle = "style='font-family: Verdana;font-size: 12pt;color: #494c4e;'"
bodystyle = "style='font-family: times new roman, times, serif;font-size: 12pt;color: #424222;'"
meta = "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>"
return f"<!DOCTYPE html>\n<html>\n{meta}\n<body {bodystyle}>\n" + htmlcontent + "\n</body>\n</html>"
def HandleException(ex):
try:
assert isinstance(ex, Exception)
......
......@@ -56,6 +56,19 @@ if __name__ == '__main__':
return True
@staticmethod
def __MkParseArg(a, checknonempty0=True, checknonempty1=True):
args = isStr(a).split(",")
assert len(args)==2
arg0 = Trim(args[0], checknonempty0)
arg1 = Trim(args[1], checknonempty1)
if arg0.find('"')>=0 or arg0.find("'")>=0:
ERR(f"do not use pligs (') or quotes (\") in style command, style='{arg0}'")
return arg0, arg1
@staticmethod
def __MkLink(a, exlink, left, right):
......@@ -63,7 +76,7 @@ if __name__ == '__main__':
assert len(args)==2
arg0 = isStr(args[0], False)
arg1 = isStr(args[1]).strip()
arg1 = Trim(args[1])
if len(arg1)==0:
ERR("need second link argument, currently empty")
......@@ -82,21 +95,19 @@ if __name__ == '__main__':
@staticmethod
def __MkStyle(a, left, right):
args = isStr(a).split(",")
assert len(args)==2
arg0 = isStr(args[0]).strip()
arg1 = isStr(args[1]).strip()
if arg0.find('"')>=0 or arg0.find("'")>=0:
ERR(f"do not use pligs (') or quotes (\") in style command, style='{arg0}'")
arg0, arg1 = Cmd.__MkParseArg(a)
return f"{isStr(left)}span style='{arg0}'{isStr(right)}{arg1}{left}/span{right}"
@staticmethod
def __MkImg(a, left, right):
arg0, arg1 = Cmd.__MkParseArg(a, True, False)
if arg1=="":
arg1="the-missing-link: " + arg0
return f"{isStr(left)}img src='{arg0}' alt='{arg1}'{isStr(right)}"
@staticmethod
def __isHtmlCmd(c):
return isStr(c) in ["b", "i", "p", "ul", "ol", "li", "header", "sub", "em", "indent", "code", "ipynb", "displaystyle"]
return isStr(c) in ["b", "i", "p", "ul", "ol", "li", "header", "sub", "em", "indent", "code", "ipynb", "quote", "displaystyle", "cite"]
def __MkCmd(self):
......@@ -110,6 +121,7 @@ if __name__ == '__main__':
left = '<'
right= '>'
leftmarg = " style='margin-left: 30px;'"
t = f"cmd={c}({a})"
Dbg(verbose, f"FOUND COMMAND={t}..", 2)
......@@ -118,30 +130,51 @@ if __name__ == '__main__':
# fun(arg)..
if Cmd.__isHtmlCmd(c):
style = ""
if c=="header":
c = "h3"
head =""
tail =""
style = ""
if c=="b" or c=="i" or c=="p" or c=="li" or c=="ul" or c=="ol":
pass
elif c=="header":
c = "h2"
elif c=="sub":
c = "h4"
c = "h3"
elif c=="em":
c = "i"
elif c=="displaystyle":
c = "p"
style = " style='margin-left: 30px'"
style = leftmarg
elif c=="indent":
c = "span"
style = " style='margin-left: 30px'"
style = " style='margin-left: 30px;'"
elif c=="code" or c=="ipynb":
c = "span"
style=" style='font-family: courier new, courier;'"
elif c=="cite" :
c = "span"
a = "[kilde: " + a + "]"
style=" style='font-size: xx-small;'"
head = "<br>\n"
tail = "<br>\n"
elif c=="quote":
c = "span"
style = leftmarg
head = "<br>\n<br>\n"
tail = "<br>\n<br>\n"
else:
ERR(f"that odd, an unhandled command '{c}' that seem to be present in isHtmlCmd list")
v = f"{left}{c}{style}{right}{a}{left}/{c}{right}"
v = f"{head}{left}{c}{style}{right}{a}{left}/{c}{right}{tail}"
# fun(arg0, arg1)..
elif c=="link" or c=="linkex":
v = Cmd.__MkLink(a, c=="linkex", left, right)
elif c=="style":
v = Cmd.__MkStyle(a, left, right)
elif c=="img":
v = Cmd.__MkImg(a, left, right)
else:
ERR(f"unknown command '{c}' with argument(s) '{a}'")
......@@ -175,8 +208,8 @@ if __name__ == '__main__':
self.__cmd = isStr(self.__st, True)
self.__st = ""
else:
if c=='(':
WARN("found left parathesis '(' while in command parsing mode, did you mean '{'?")
if c=='('