Skip to content

Commit

Permalink
docx files go in their own notebook folder
Browse files Browse the repository at this point in the history
easier to separate and store them - either for faster re-conversion with different parameters, or separate use
  • Loading branch information
nixsee authored Jul 23, 2020
1 parent 387e3a2 commit 5af6ae7
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions ConvertOneNote2MarkDown-v2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ Function ProcessSections ($group, $FilePath) {
$fullfilepathwithoutextension = ""
$fullfilepathwithoutextension = "$($fullexportdirpath)\$($pagename)"
$fullexportpath = ""
$fullexportpath = "$($fullfilepathwithoutextension).docx"
#$fullexportpath = "$($fullfilepathwithoutextension).docx"


# process for subpage prefixes
if ($pagelevel -eq 1) {
Expand Down Expand Up @@ -117,6 +118,8 @@ Function ProcessSections ($group, $FilePath) {
$pagename = "$($pagename)-$recurrence"
$recurrence++
}

$fullexportpath = "$($NotebookFilePath)\docx\$($pagename).docx"

# use existing or create new docx files
if ($usedocx -eq 2) {
Expand Down Expand Up @@ -279,6 +282,21 @@ Function ProcessSections ($group, $FilePath) {
$notesdestpath = Read-Host -Prompt "Entry"
""
"-----------------------------------------------"

#prompt to use existing word docs (90% faster)
""
"-----------------------------------------------"
"1: Create new .docx files - Default"
"2: Use existing .docx files (90% faster)"
[int] $usedocx = Read-Host -Prompt "Entry"

#prompt to discard intermediate word docs
""
"-----------------------------------------------"
"1: Discard intermediate .docx files - Default"
"2: Keep .docx files"
[int] $keepdocx = Read-Host -Prompt "Entry"

# prompt for prefix vs subfolders
"1: Create folders for subpages (e.g. Page\Subpage.md)- Default"
"2: Add prefixes for subpages (e.g. Page_Subpage.md)"
Expand Down Expand Up @@ -317,20 +335,6 @@ elseif ($conversion -eq 5){ $converter = "markdown_phpextra"}
elseif ($conversion -eq 6){ $converter = "markdown_strict"}
else { $converter = "markdown"}

#prompt to use existing word docs (90% faster)
""
"-----------------------------------------------"
"1: Create new .docx files - Default"
"2: Use existing .docx files (90% faster)"
[int] $usedocx = Read-Host -Prompt "Entry"

#prompt to discard intermediate word docs
""
"-----------------------------------------------"
"1: Discard intermediate .docx files - Default"
"2: Keep .docx files"
[int] $keepdocx = Read-Host -Prompt "Entry"

#prompt to clear double spaces between bullets
"-----------------------------------------------"
"1: Clear double spaces in bullets - Default"
Expand Down Expand Up @@ -359,6 +363,8 @@ if (Test-Path -Path $notesdestpath) {
$NotebookFilePath = "$($notesdestpath)\$($notebookFileName)"
$levelsfromroot = 0

New-Item -Path "$($NotebookFilePath)" -Name "docx" -ItemType "directory" -ErrorAction SilentlyContinue

"=============="
#process any sections that are not in a section group
ProcessSections $notebook $NotebookFilePath
Expand Down

0 comments on commit 5af6ae7

Please sign in to comment.