Skip to content

Commit

Permalink
Prepare v0.1.2
Browse files Browse the repository at this point in the history
- Fix novx import/export and yw7 export.
- Provide a download link on the landing page.
  • Loading branch information
peter88213 committed Oct 3, 2024
1 parent 79e5c87 commit 993e3eb
Show file tree
Hide file tree
Showing 15 changed files with 216 additions and 31 deletions.
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This is a variant of the [novelibre](https://github.com/peter88213/novelibre) no

## Note

This program is intended only as a proof of concept. It is still in pre-Alpha status.
This program is intended only as a proof of concept. It is still in Alpha status.

See the development details in the [mdnovel features project](https://github.com/users/peter88213/projects/17/views/2).

Expand Down Expand Up @@ -61,6 +61,49 @@ See the development details in the [mdnovel features project](https://github.com
- Users may want to install [pandoc](https://pandoc.org/) for processing the exported documents.


## Download and install

### Default: Executable Python zip archive

Download the latest release [mdnovel_v0.1.2.pyzw](https://github.com/peter88213/mdnovel/raw/main/dist/mdnovel_v0.1.2.pyzw)

- Launch *mdnovel_v0.1.2.pyzw* by double-clicking (Windows/Linux desktop),
- or execute `python mdnovel_v0.1.2.pyzw` (Windows), resp. `python3 mdnovel_v0.1.2.pyzw` (Linux) on the command line.

#### Important

Many web browsers recognize the download as an executable file and offer to open it immediately.
This starts the installation.

However, depending on your security settings, your browser may
initially refuse to download the executable file.
In this case, your confirmation or an additional action is required.
If this is not possible, you have the option of downloading
the zip file.


### Alternative: Zip file

The package is also available in zip format: [mdnovel_v0.1.2.zip](https://github.com/peter88213/mdnovel/raw/main/dist/mdnovel_v0.1.2.zip)

- Extract the *mdnovel_v0.1.2* folder from the downloaded zipfile "mdnovel_v0.1.2.zip".
- Move into this new folder and launch *setup.pyw* by double-clicking (Windows/Linux desktop),
- or execute `python setup.pyw` (Windows), resp. `python3 setup.pyw` (Linux) on the command line.

---

[Changelog](docs/changelog.md)

## Usage

See the [help pages](https://peter88213.github.io/mdnovel/help/)

---

## Credits

- The logo is made using the free *Pusab* font by Ryoichi Tsunekawa, [Flat-it](http://flat-it.com/).

## License

This is Open Source software, and *mdnovel* is licensed under GPLv3. See the
Expand Down
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[LATEST]
version = 0.1.1
download_link = https://github.com/peter88213/mdnovel/raw/main/dist/mdnovel_v0.1.1.pyzw
version = 0.1.2
download_link = https://github.com/peter88213/mdnovel/raw/main/dist/mdnovel_v0.1.2.pyzw
Binary file removed dist/mdnovel_v0.1.1.pyzw
Binary file not shown.
Binary file removed dist/mdnovel_v0.1.1.zip
Binary file not shown.
Binary file added dist/mdnovel_v0.1.2.pyzw
Binary file not shown.
Binary file added dist/mdnovel_v0.1.2.zip
Binary file not shown.
9 changes: 8 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ See the [GitHub "Features" project](https://github.com/users/peter88213/projects
- Exporting a Markdown full synopsis with section descriptions.
- Exporting a csv Plot Grid.


### Version 0.1.1

- Bugfix / refactor.
- Bugfix / refactor.


### Version 0.1.2

- Fix novx import/export and yw7 export.
- Provide a download link on the landing page.
112 changes: 112 additions & 0 deletions docs/template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# ![N](docs/img/nLogo32.png) mdnovel

A novel writing application using markdown.

![Screenshot](docs/Screenshots/screen01.png)

This is a variant of the [novelibre](https://github.com/peter88213/novelibre) novel writing application.

## Note

This program is intended only as a proof of concept. It is still in Alpha status.

See the development details in the [mdnovel features project](https://github.com/users/peter88213/projects/17/views/2).


## Features (to come)

- With *mdnovel*, extensive novels can be broken down into **parts, chapters, and sections**.
- You can store data on **characters, locations, and items** that are important for the story.
This includes the optional definition of a **viewpoint character** for each section.
- All of this appears as a clear and editable **tree** structure with listed information.
- Summaries can be entered at all these levels, from which **synopses** and lists can be generated.
- If you choose a **narrative structure**, *mdnovel* can display stages (e.g. acts or steps) in the tree.
When plotting, descriptions of these stages can be entered, from which *mdnovel* can generate
its own documentation. Prefabricated structural models can also be imported from templates.
- *mdnovel* also allows you to create and document an underlying structure of **plot lines**
(e.g. subplots or character arcs) apart from the chapters and sections. This can then be linked
to the sections of the novel text.
- *mdnovel* provides a **plot grid** with plot line notes for each section. This allows you to
see the big picture and keep track of multiple subplots.
- To keep track of progress, the **word count** and the **completion status** of the sections are displayed.
- Individual chapters and sections can be flagged as "unused" to exclude them from document export.
- You can add information about the **narrative time** and duration to each section. If you enter a date,
the day of the week is displayed. You can also call up the age of characters that are assigned to
a section. The date and time information can be synchronised with dedicated timeline software.
- For **printing**, *mdnovel* exports a neatly designed novel manuscript that can be converted with *pandoc*
into several document and ebook formats.
- *mdnovel* saves its data in a single, easy-to-understand Markdown/YAML-formatted text file.
- *mdnovel* is written in Python and should run on several **operating systems**, like Windows and Linux.
- The application is ready for internationalization with GNU gettext. German translations are provided.


## The differences to *novelibre*

- All section content in *mdnovel* is Markdown-formatted.
- *mdnovel* comes with a Markdown section editor. The user is not supposed to export the text for editing.
- *mdnovel* saves the project in a YAML/Markdown based file format instead of the XML based *.novx* format.
- There is no connection with OpenOffice/LibreOffice.
- Document export is in Markdown or csv format.
- New project can be created from Markdown-formatted Work-in-progress or outline.


## Requirements

- Windows or Linux. Mac OS support is experimental.
- [Python](https://www.python.org/) version 3.6+.
- For current Windows versions, use version 3.9.10 or above.
- For Vista and Windows 7, use version 3.7.2.
- Linux users: Make sure you have the *python3-tk* package installed.
To see the tooltips, make sure that you have the *idle3* package installed.
- Users may want to install [pandoc](https://pandoc.org/) for processing the exported documents.


## Download and install

### Default: Executable Python zip archive

Download the latest release [mdnovel_v0.99.0.pyzw](https://github.com/peter88213/mdnovel/raw/main/dist/mdnovel_v0.99.0.pyzw)

- Launch *mdnovel_v0.99.0.pyzw* by double-clicking (Windows/Linux desktop),
- or execute `python mdnovel_v0.99.0.pyzw` (Windows), resp. `python3 mdnovel_v0.99.0.pyzw` (Linux) on the command line.

#### Important

Many web browsers recognize the download as an executable file and offer to open it immediately.
This starts the installation.

However, depending on your security settings, your browser may
initially refuse to download the executable file.
In this case, your confirmation or an additional action is required.
If this is not possible, you have the option of downloading
the zip file.


### Alternative: Zip file

The package is also available in zip format: [mdnovel_v0.99.0.zip](https://github.com/peter88213/mdnovel/raw/main/dist/mdnovel_v0.99.0.zip)

- Extract the *mdnovel_v0.99.0* folder from the downloaded zipfile "mdnovel_v0.99.0.zip".
- Move into this new folder and launch *setup.pyw* by double-clicking (Windows/Linux desktop),
- or execute `python setup.pyw` (Windows), resp. `python3 setup.pyw` (Linux) on the command line.

---

[Changelog](docs/changelog.md)

## Usage

See the [help pages](https://peter88213.github.io/mdnovel/help/)

---

## Credits

- The logo is made using the free *Pusab* font by Ryoichi Tsunekawa, [Flat-it](http://flat-it.com/).

## License

This is Open Source software, and *mdnovel* is licensed under GPLv3. See the
[GNU General Public License website](https://www.gnu.org/licenses/gpl-3.0.en.html) for more
details, or consult the [LICENSE](https://github.com/peter88213/novelibre/blob/main/LICENSE) file.

6 changes: 3 additions & 3 deletions i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#
msgid ""
msgstr ""
"Project-Id-Version: 0.1.1\n"
"POT-Creation-Date: 2024-10-01 23:31:14\n"
"PO-Revision-Date: 2024-10-01 23:31:14\n"
"Project-Id-Version: 0.1.2\n"
"POT-Creation-Date: 2024-10-03 16:52:17\n"
"PO-Revision-Date: 2024-10-03 16:52:17\n"
"Last-Translator: Peter Triesberger\n"
"Language: de\n"
"MIME-Version: 1.0\n"
Expand Down
Binary file modified i18n/locale/de/LC_MESSAGES/mdnovel.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions i18n/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#
msgid ""
msgstr ""
"Project-Id-Version: 0.1.1\n"
"POT-Creation-Date: 2024-10-01 23:31:14\n"
"Project-Id-Version: 0.1.2\n"
"POT-Creation-Date: 2024-10-03 16:52:17\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: LANGUAGE\n"
Expand Down
44 changes: 29 additions & 15 deletions src/mdnvlib/novx/novx_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,15 @@ def _build_section_branch(self, xmlSection, prjScn):
sectionContent = prjScn.sectionContent
if sectionContent:
while '\n\n' in sectionContent:
sectionContent = sectionContent.replace('\n\n', '\n').strip()
sectionContent = sectionContent.replace('\n\n', '@%&').strip()
while '***' in sectionContent:
sectionContent = sectionContent.replace('***', '§%§')
sectionContent = re.sub(r'\*\*(.+?)\*\*', '<strong>\\1</strong>', sectionContent)
sectionContent = re.sub(r'\*(.+?)\*', '<em>\\1</em>', sectionContent)
while '§%§' in sectionContent:
sectionContent = sectionContent.replace('§%§', '***')
newlines = []
for line in sectionContent.split('\n'):
line = re.sub(r'(^|[^\*])\*\*(.+?)\*\*([^\*]|$)', '\\1<strong>\\2</strong>\\3', line)
line = re.sub(r'(^|[^\*])\*(.+?)\*([^\*]|$)', '\\1<em>\\2</em>\\3', line)
for line in sectionContent.split('@%&'):
line = f'<p>{line}</p>'
newlines.append(line)
sectionContent = '\n'.join(newlines)
Expand All @@ -518,15 +522,25 @@ def _get_element_text(self, xmlElement, tag, default=None):
else:
return default

def _get_link_dict(self, parent):
def _get_link_dict(self, xmlElement):
"""Return a dictionary of links.
If the element doesn't exist, return an empty dictionary.
"""
links = {}
for xmlLink in parent.iterfind('Link'):
path = xmlLink.attrib.get('path', None)
fullPath = xmlLink.attrib.get('fullPath', None)
for xmlLink in xmlElement.iterfind('Link'):
xmlPath = xmlLink.find('Path')
if xmlPath is not None:
path = xmlPath.text
xmlFullPath = xmlLink.find('FullPath')
if xmlFullPath is not None:
fullPath = xmlFullPath.text
else:
fullPath = None
else:
# Read deprecated attributes from DTD 1.3.
path = xmlLink.attrib.get('path', None)
fullPath = xmlLink.attrib.get('fullPath', None)
if path:
links[path] = fullPath
return links
Expand Down Expand Up @@ -928,28 +942,28 @@ def _read_section(self, xmlSection, scId):
('</Content>', ''),
('<em> ', ' <em>'),
('<strong> ', ' <strong>'),
('</em><em>', ''),
('</strong><strong>', ''),
('<p>', ''),
('<p style="quotations">', ''),
('</p>', '\n'),
('<em>', '*'),
('</em>', '*'),
('<strong>', '**'),
('</strong>', '**'),
('<comment>', '<!-- Comment start-->'),
('</comment>', '<!-- Comment end-->'),
(' ', ' '),
]
for novx, md in MD_REPLACEMENTS:
text = text.replace(novx, md)

text = text.replace('\n', '@%&')
text = re.sub(r'<comment>.*?</comment>', '', text)
text = re.sub(r'<note .*?>].*?<\/note>', '', text)
newlines = []
lines = text.split('\n')
lines = text.split('@%&')
for line in lines:
newlines.append(line.strip())
text = '\n'.join(newlines)
text = re.sub('<span.*?>|</span>', '', text)
text = re.sub('<creator>.*?</creator>', '', text)
text = re.sub('<date>.*?</date>', '', text)
text = re.sub(r'<span.*?>|</span>', '', text)
if text:
self.novel.sections[scId].sectionContent = f'{text.strip()}\n'
else:
Expand Down
14 changes: 14 additions & 0 deletions src/mdnvlib/yw7/yw7_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,20 @@ def _to_yw(self, text):
Return a yw7 markup string.
"""
if text:
while '\n\n' in text:
text = text.replace('\n\n', '@%&').strip()
while '***' in text:
text = text.replace('***', '§%§')
text = re.sub(r'([^\*])\*\*(.+?)\*\*', '\\1[b]\\2[/b]', text)
text = re.sub(r'([^\*])\*(.+?)\*', '\\1[i]\\2[/i]', text)
while '§%§' in text:
text = text.replace('§%§', '***')
newlines = []
for line in text.split('@%&'):
line = f'<p>{line}</p>'
newlines.append(line)
text = '\n'.join(newlines)
text = re.sub(r'\*\*(.+?)\*\*', '[b]\\1[/b]', text)
text = re.sub(r'\*([^ ].+?[^ ])\*', '[i]\\1[/i]', text)
MD_REPLACEMENTS = [
Expand Down
7 changes: 1 addition & 6 deletions tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
sys.path.insert(0, f'{os.getcwd()}/../../mdnovel/tools')
from package_builder import PackageBuilder

VERSION = '0.1.1'
VERSION = '0.1.2'


class ApplicationBuilder(PackageBuilder):
Expand All @@ -24,12 +24,7 @@ def __init__(self, version):
super().__init__(version)
self.sourceFile = f'{self.sourceDir}{self.PRJ_NAME}_.py'

def add_css(self):
print('\nAdding css ...')
copytree(f'../../novxlib/css', f'{self.buildDir}/css')

def add_extras(self):
self.add_css()
self.add_icons()

def build_script(self):
Expand Down
2 changes: 1 addition & 1 deletion tools/package_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def run(self):
self.build_package()
self.clean_up()
self.write_version_ini()
# self.update_landing_page()
self.update_landing_page()
print('\nDone')

def update_landing_page(self):
Expand Down

0 comments on commit 993e3eb

Please # to comment.