Commit 5d24072a authored by Marco Cavalli's avatar Marco Cavalli
Browse files

doc: pyenv steps in readme

fix: add try except in to_docx routines
parent c30f4ef5
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -81,3 +81,7 @@ package.json
package-lock.json
package-lock.json
md_to_docx_converter/public/API*.css
md_to_docx_converter/public/API*.css
md_to_docx_converter/public/primer*.css
md_to_docx_converter/public/primer*.css

# Files
.envrc
.python-version
 No newline at end of file
+16 −6
Original line number Original line Diff line number Diff line
@@ -4,7 +4,7 @@


### 1.1.1 Required Software
### 1.1.1 Required Software


#### [Miniconda](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html) (or any other python environment manager)
#### [Miniconda](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html) or [Pyenv](https://github.com/pyenv/pyenv) or any other python environment manager


Latest
Latest


@@ -20,17 +20,27 @@ Latest


Latest
Latest


### 1.1.1 Create a virtual environment with Conda
### 1.1.1 Create a virtual environment


Assuming you have Miniconda installed, follow these steps. If you are not using Miniconda, you can use any other python environment manger, just go to point 3 of the list and install the requirements using pip.
If you prefer to use Minconda or Pyenv, setup a virtual environment according to the following steps. If you are not using Miniconda or Pyenv, you can use any other python environment manger, just go to point 3 of the list and install the requirements using pip.


1. Follow the [instructions](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html) to setup Miniconda.
1. Setup
    1. Follow the [instructions](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html) to setup Miniconda, OR...
    2. Follow steps [A](https://github.com/pyenv/pyenv?tab=readme-ov-file#a-getting-pyenv), [B](https://github.com/pyenv/pyenv?tab=readme-ov-file#b-set-up-your-shell-environment-for-pyenv), [C](https://github.com/pyenv/pyenv?tab=readme-ov-file#c-restart-your-shell), and [D](https://github.com/pyenv/pyenv?tab=readme-ov-file#d-install-python-build-dependencies) of the [instructions](https://github.com/pyenv/pyenv?tab=readme-ov-file#installation) to setup Pyenv.


2. Create a virtual environment with Python version **3.10.16** to use with the script.
2. Create a virtual environment with Python version **3.10.16** to use with the script.


   1. `conda create -p path/to/environment_name python=3.10.16`
   1. For Miniconda...
       1. `conda create --name environment_name python=3.10.16`
       2. `conda activate environment_name`
       2. `conda activate environment_name`


    2. For Pyenv...
        1. `cd path/to/ETSI_GS_CIM_009`
        2. `pyenv install 3.10.16`
        3. `pyenv local 3.10.16` - Use Python 3.10.16 with this folder
        4. `pyenv virtualenv environment_name`
        5. `pyenv activate environment_name`

3. Install the requirements contained in _requirements.txt_.
3. Install the requirements contained in _requirements.txt_.
   1. `cd path/to/ETSI-GS-CIM-009`
   1. `cd path/to/ETSI-GS-CIM-009`
   2. `pip install -r requirements.txt`
   2. `pip install -r requirements.txt`
+9 −5
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ from src.constants import (
from src.utils import (
from src.utils import (
    combine_biu_classes,
    combine_biu_classes,
    handle_html_consolidation,
    handle_html_consolidation,
    p_warning
)
)




@@ -602,11 +603,14 @@ def prepare_table_cell_classes(soup: BeautifulSoup):


        # Ensure plaintext is wrapped in a paragraph so paragraph styles can be applied to it
        # Ensure plaintext is wrapped in a paragraph so paragraph styles can be applied to it
        for child in div.children:
        for child in div.children:
            try:
                if not isinstance(child, NavigableString):
                if not isinstance(child, NavigableString):
                    continue
                    continue


                para = soup.new_tag("p").append(child.get_text())
                para = soup.new_tag("p").append(child.get_text())
                child.replace_with(para)
                child.replace_with(para)
            except ValueError:
                p_warning(f'Could not add child: {repr(child)} to paragraph in table cell')


        div.unwrap()
        div.unwrap()