Updated. /JL

This commit is contained in:
Jan Lerking
2023-08-29 13:54:54 +02:00
parent 3b28d1ade2
commit b3ce9dc350
5 changed files with 242 additions and 17 deletions

View File

@@ -1,30 +1,31 @@
# Python repo template
[![GitHub forks](https://img.shields.io/github/forks/Lerking/python-repo-template.svg?style=social&label=Fork&maxAge=2592000)](https://GitHub.com/Lerking/python-repo-template/forks/)
[![GitHub stars](https://img.shields.io/github/stars/Lerking/python-repo-template.svg?style=social&label=Star&maxAge=2592000)](https://GitHub.com/Lerking/python-repo-template/stargazers/)
[![GitHub watchers](https://img.shields.io/github/watchers/Lerking/python-repo-template.svg?style=social&label=Watch&maxAge=2592000)](https://GitHub.com/Lerking/python-repo-template/watchers/)
# md2doc
A small utility to convert md files into doc files.
[![GitHub forks](https://img.shields.io/github/forks/Lerking/md2doc.svg?style=social&label=Fork&maxAge=2592000)](https://GitHub.com/Lerking/md2doc/forks/)
[![GitHub stars](https://img.shields.io/github/stars/Lerking/md2doc.svg?style=social&label=Star&maxAge=2592000)](https://GitHub.com/Lerking/md2doc/stargazers/)
[![GitHub watchers](https://img.shields.io/github/watchers/Lerking/md2doc.svg?style=social&label=Watch&maxAge=2592000)](https://GitHub.com/Lerking/md2doc/watchers/)
[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)
[![GitHub version](https://badge.fury.io/gh/Lerking-python-repo-template.svg)](https://github.com/Lerking/python-repo-template)
[![GitHub version](https://badge.fury.io/gh/Lerking-md2doc.svg)](https://github.com/Lerking/md2doc)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Lerking/python-repo-template.github.io/graphs/commit-activity)
[![GitHub contributors](https://img.shields.io/github/contributors/Lerking/python-repo-template.svg)](https://GitHub.com/Lerking/python-repo-template/graphs/contributors/)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Lerking/md2doc.github.io/graphs/commit-activity)
[![GitHub contributors](https://img.shields.io/github/contributors/Lerking/md2doc.svg)](https://GitHub.com/Lerking/md2doc/graphs/contributors/)
[![Github file count](https://img.shields.io/github/directory-file-count/Lerking/python-repo-template)]()
[![Github file count](https://img.shields.io/github/directory-file-count/Lerking/md2doc)]()
[![GitHub issues](https://img.shields.io/github/issues/Lerking/python-repo-template.svg)](https://GitHub.com/Lerking/python-repo-template/issues/)
[![GitHub issues-closed](https://img.shields.io/github/issues-closed/Lerking/python-repo-template.svg)](https://GitHub.com/Lerking/python-repo-template/issues?q=is%3Aissue+is%3Aclosed)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/Lerking/python-repo-template.svg)](http://isitmaintained.com/project/Lerking/python-repo-template "Percentage of issues still open")
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/Lerking/python-repo-template.svg)](http://isitmaintained.com/project/Lerking/python-repo-template "Average time to resolve an issue")
[![GitHub issues](https://img.shields.io/github/issues/Lerking/md2doc.svg)](https://GitHub.com/Lerking/md2doc/issues/)
[![GitHub issues-closed](https://img.shields.io/github/issues-closed/Lerking/md2doc.svg)](https://GitHub.com/Lerking/md2doc/issues?q=is%3Aissue+is%3Aclosed)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/Lerking/md2doc.svg)](http://isitmaintained.com/project/Lerking/md2doc "Percentage of issues still open")
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/Lerking/md2doc.svg)](http://isitmaintained.com/project/Lerking/md2doc "Average time to resolve an issue")
[![GitHub pull-requests](https://img.shields.io/github/issues-pr/Lerking/python-repo-template.svg)](https://GitHub.com/Lerking/python-repo-template/pull)
[![GitHub total-pull-requests](https://badgen.net/github/prs/Lerking/python-repo-template)](https://GitHub.com/Lerking/python-repo-template/pull)
[![GitHub pull-requests](https://img.shields.io/github/issues-pr/Lerking/md2doc.svg)](https://GitHub.com/Lerking/md2doc/pull)
[![GitHub total-pull-requests](https://badgen.net/github/prs/Lerking/md2doc)](https://GitHub.com/Lerking/md2doc/pull)
Coding time for this reposotory.</br>
[![wakatime](https://wakatime.com/badge/user/d43f2852-fd6f-45b4-b713-558ad18204d4/project/dcf411f9-6d3e-4b14-9290-5ed419cf4012.svg)](https://wakatime.com/badge/user/d43f2852-fd6f-45b4-b713-558ad18204d4/project/dcf411f9-6d3e-4b14-9290-5ed419cf4012)
[![wakatime](https://wakatime.com/badge/user/d43f2852-fd6f-45b4-b713-558ad18204d4/project/7d720253-677f-4922-bf52-9a9575ee14e6.svg)](https://wakatime.com/badge/user/d43f2852-fd6f-45b4-b713-558ad18204d4/project/7d720253-677f-4922-bf52-9a9575ee14e6)
See the wiki for usage and examples.
[python-repo-template wiki page](https://github.com/Lerking/python-repo-template/wiki)
[md2doc wiki page](https://github.com/Lerking/md2doc/wiki)
Visitors since repo creation.</br>
![Visitor Badge](https://visitor-badge.laobi.icu/badge?page_id=Lerking.python-repo-template)
![Visitor Badge](https://visitor-badge.laobi.icu/badge?page_id=Lerking.md2doc)

18
main.py
View File

@@ -0,0 +1,18 @@
import markdown
from docx import Document
from htmldocx import HtmlToDocx
def read_md():
with open('./test-data/markdown_sample.md', 'r') as f:
text = f.read()
return markdown.markdown(text)
def write_doc(text):
doc = Document()
parser = HtmlToDocx()
parser.add_html_to_document(text, doc)
doc.save("./test-data/markdown_sample.docx")
if __name__=="__main__":
write_doc(read_md())

Binary file not shown.

View File

@@ -0,0 +1,154 @@
An h1 header
============
Paragraphs are separated by a blank line.
2nd paragraph. *Italic*, **bold**, and `monospace`. Itemized lists
look like:
* this one
* that one
* the other one
Note that --- not considering the asterisk --- the actual text
content starts at 4-columns in.
> Block quotes are
> written like so.
>
> They can span multiple paragraphs,
> if you like.
Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it's all
in chapters 12--14"). Three dots ... will be converted to an ellipsis.
Unicode is supported. ☺
An h2 header
------------
Here's a numbered list:
1. first item
2. second item
3. third item
Note again how the actual text starts at 4 columns in (4 characters
from the left side). Here's a code sample:
# Let me re-iterate ...
for i in 1 .. 10 { do-something(i) }
As you probably guessed, indented 4 spaces. By the way, instead of
indenting the block, you can use delimited blocks, if you like:
```
define foobar() {
print "Welcome to flavor country!";
}
```
(which makes copying & pasting easier). You can optionally mark the
delimited block for Pandoc to syntax highlight it:
```python
import time
# Quick, count to ten!
for i in range(10):
# (but not *too* quick)
time.sleep(0.5)
print i
```
### An h3 header ###
Now a nested list:
1. First, get these ingredients:
* carrots
* celery
* lentils
2. Boil some water.
3. Dump everything in the pot and follow
this algorithm:
find wooden spoon
uncover pot
stir
cover pot
balance wooden spoon precariously on pot handle
wait 10 minutes
goto first step (or shut off burner when done)
Do not bump wooden spoon or it will fall.
Notice again how text always lines up on 4-space indents (including
that last line which continues item 3 above).
Here's a link to [a website](http://foo.bar), to a [local
doc](local-doc.html), and to a [section heading in the current
doc](#an-h2-header). Here's a footnote [^1].
[^1]: Footnote text goes here.
Tables can look like this:
size | material | color
--- | --- | ---
9 | leather | brown
10 | hemp canvas | natural
11 | glass | transparent
Table: Shoes, their sizes, and what they're made of
(The above is the caption for the table.) Pandoc also supports
multi-line tables:
---
keyword | text
--- | ---
red | Sunsets, apples, and</br>other red or reddish</br>things.
green | Leaves, grass, frogs</br>and other things it's</br>not easy being.
A horizontal rule follows.
***
Here's a definition list:
apples
: Good for making applesauce.
oranges
: Citrus!
tomatoes
: There's no "e" in tomatoe.
Again, text is indented 4 spaces. (Put a blank line between each
term/definition pair to spread things out more.)
Here's a "line block":
| Line one
| Line too
| Line tree
and images can be specified like so:
![example image](example-image.jpg "An exemplary image")
Inline math equations go in like so: $\omega = d\phi / dt$. Display
math should get its own line and be put in in double-dollarsigns:
$$I = \int \rho R^{2} dV$$
And note that you can backslash-escape any punctuation characters
which you wish to be displayed literally, ex.: \`foo\`, \*bar\*, etc.

52
test-data/revise_mv.md Normal file
View File

@@ -0,0 +1,52 @@
# Revising module variants.
1. [Open reference document](#open-reference-document)
2. [Update econfig repository](#update-econfig-repository)
3. [Revise module variant](#revise-module-variant)
4. [Check in changes in econfig repository](#check-in-changes-in-econfig-repository)
5. [Import and verify updates in TeamCenter](#import-and-verify-updates-in-teamcenter)
6. [Update models.decanter repository](#update-models-decanter-repository)
7. [Sign off ECN for review](#sign-off-ecn-for-review)
8. [Complete ECN](#complete-ecn)
### Open reference document
Open the reference excel document from TeamCenter.
Check that the MVs to be revised matches the MVs in the Impacted folder.
If there are inconsistencies, contact design engineer to have the reference excel document and/or the Impacted folder updated.
### Update econfig repository
Switch to the ALiCE.econfig.Decanter repository and make sure the __master__ branch is checked out.
Update local files.
### Revise module variant
Either update the MVs directly in TCStudio or using the Excel plugin.
If new domain values are needed, also make sure to add them in eDecanter_domains.tcx
### Check in changes to econfig repository
Once the MVs have been updated, check in the changes in Visual Studio.
Copy the SHA ID for your check in.
### Import and verify updates in Teamcenter
Run the "Import Product Class" workflow.
Once finished, check that new MV revisions have been created in the 'Results' folder and the MVs have all been updated according to the reference excel sheet.
### Update models decanter repository
Check out the Next_release_Dev branch.
Update local files.
Copy updated module file from ALiCE.econfig.Decanter/master branch into ALiCE.models.Decanter/Next_release_Dev branch.
If needed update eDecanter_domains.tcx as well.
Deploy module to ALiCE module files.
### Sign off ECN for review
'Perform' ECN and enter module engineers name for review.
The ECN will now be sent to the module engineers work folder.
### Complete ECN
When review has been done, 'Perform' the ECN and select 'Complete'