Commit graph

53 commits

Author SHA1 Message Date
efc48e83e8
fix(app): encode slashes in wiki article requests
Ensure slashes in Wiki article titles are URL encoded to prevent request errors. This change resolves issues where titles containing slashes could break the API calls.

Fixes #23
2024-08-25 17:09:45 +02:00
90c068d128
feat: add responsive styling for Wikisource index and remarks
Added comprehensive styling for Wikisource index and remarks
content to enhance visual consistency and user experience.
Key updates include container layouts, text formatting, image
display, collapsible sections, and link styles. Adjusted
styles for better responsiveness on smaller devices.

Addresses issues with unattractive and inconsistent layout
in Wikisource index.
2024-08-25 17:04:18 +02:00
00bd64413d
fix: handle missing body in wiki article response
Updated the error handling to address cases where the body is missing in the wiki article response. Instead of returning an error page, the code now constructs a default HTML structure and uses BeautifulSoup to parse it, ensuring the body content can still be located and processed. This improves robustness and user experience when dealing with incomplete or malformed article data.

Fixes #24.
2024-08-25 17:04:07 +02:00
e2793d4ef6
fix(app): handle missing body in wiki article parsing
Add a check for a missing body element when parsing wiki articles and return an error message with a 500 status code if the body is not found. This improves error handling and prevents crashes caused by unexpected HTML structures.
2024-08-25 16:56:48 +02:00
88d20e6e6e
feat(style): add evolution charts and improve gallery styling
Extended CSS with new styling rules for evolution charts, enhancing the
visual presentation and interactivity of clade elements. Improved gallery
layout with responsive styling for a more user-friendly and aesthetically
pleasing experience, especially on smaller screens.

Fixes #20
2024-08-25 16:55:16 +02:00
08b03e7989
feat: add style for listing metadata
Introduced a new CSS class for listing metadata to ensure consistent font size and color across the UI. This enhances the readability of metadata elements and aligns with the overall design aesthetics.

Fixes #26
2024-08-25 16:42:06 +02:00
8a07e7a1ef
feat: center and resize media files uniformly
Added styles for .mw-file-element to ensure media files are centered, displayed as blocks, and resized proportionally to fit within their containers. This enhances layout consistency across the application.

Fixes #14.
2024-08-20 08:06:37 +02:00
69cf1656fe
feat(css): improve category link and infobox styling
Enhanced the display rules for category links by enclosing them in brackets and setting them to be hidden by default outside of sections. Improved infobox image dimensions and alignment to ensure consistent display. Adjusted media queries for larger device padding.

Fixes #12.
2024-08-20 07:53:35 +02:00
1e31998f50
feat: improve language and project handling
- Default values for `lang` and `project` added in `render_template` to ensure consistent rendering parameters.
- Included `lang` and `project` parameters in error and article templates for better context in error messages.
- Enhanced search form in base template to persist selected `lang` and `project` improving user experience.

These changes provide a more consistent and localized user experience by maintaining language and project context across different parts of the application.

Fixes #17.
2024-08-20 07:25:07 +02:00
f91ccba437
feat: enhance category links display and functionality
Transformed specific 'link' elements into anchor tags with improved styling
for better readability and usability. Added CSS styling for category links
to ensure they are displayed inline with appropriate spacing, improving
the user experience.
2024-08-19 19:00:43 +02:00
f1b5b81050
fix: improve search input validation and error handling
Added validation to ensure both language and project are selected before proceeding with the search. Redirects to the homepage if the query is empty. Enhanced error handling in index redirect function to catch invalid project/language combinations and inform users appropriately.

Resolves issues with user experience and input handling.
2024-08-19 17:33:35 +02:00
a4a9cbbdb3
feat: add type annotations and docstrings to API routes
Enhanced the code by adding type annotations and comprehensive
docstrings for better clarity and maintainability. The changes
include detailed explanations of return types and parameters for
all major functions and routes in the application. Additionally,
reordered imports for better readability and added a new typing
import to support the annotations.

These improvements facilitate easier understanding and usage of
the codebase, align with best practices, and provide hints for
static type checkers, leading to fewer runtime errors.
2024-08-19 17:28:29 +02:00
04e3828f7e
fix: correctly handle 'ku-arab' script direction in articles
Addressed an edge case where articles with the 'ku-arab' variant were displayed in left-to-right (LTR) direction despite being in Arabic script. Added logic to force right-to-left (RTL) direction for such cases, ensuring correct display.

Resolves issue with incorrect article formatting.
2024-08-19 17:16:43 +02:00
4dfbd002f6
feat: add redirect handling for /index.php route
Added a new route to handle redirects from /<project>/<lang>/w/index.php. The redirect fetches the main page from the Wiki API and redirects to it. This improves user navigation by dynamically redirecting to the main page of the relevant project and language.
2024-08-19 17:06:48 +02:00
a4272eaf8e
fix(error-handling): improve article fetch error handling
Added try-except block to handle HTTP errors when fetching wiki articles. Specifically, handle 404 errors with a user-friendly "Article not found" message and log other errors with a generic error message displayed to the user. This enhances user experience by providing clearer feedback and more robust error logging.
2024-08-19 17:01:59 +02:00
ac5e542727
refactor: centralize template rendering logic
Centralized the addition of 'wikimedia_projects' and 'languages'
in templates by wrapping 'render_template' from Flask. This
reduces repetition and simplifies controller functions. Updated
error templates to provide clearer messages.
2024-08-19 16:57:23 +02:00
e7cfd4a4c6
feat(search): switch to MediaWiki API for search results
Updated the search functionality to use MediaWiki's API endpoint, enhancing query performance and accuracy. Adjusted the URL format to align with the new API endpoint specifications and modified the parsing logic to extract search results accordingly. This transition provides more reliable and structured search results.
2024-08-19 14:08:10 +02:00
a3395e118e
feat: update API endpoints and add custom headers
Replaced outdated Wikimedia API endpoints with updated REST API endpoints for fetching articles and search results. Introduced custom headers to include User-Agent for requests, which helps in identifying the source of traffic. Enhanced error handling for article fetch by changing the container element from 'body' to 'div' and handling potential language variants in requests.

Ref: #16
2024-08-19 13:59:42 +02:00
a182e71661
feat(i18n): add RTL support for article pages
Enhanced article rendering to support right-to-left (RTL) languages. Updated templates, styles, and HTML to conditionally apply RTL styling based on content direction. Improved readability and user experience for RTL language users.

Relates: #16
2024-08-19 13:37:49 +02:00
056c19225a
feat(css): Highlight non-existent pages with distinct styling
Added a new CSS class to highlight links to non-existent pages in red and appended a descriptive text indicator. This improves user navigation by clearly distinguishing between existing and non-existing pages, reducing confusion and enhancing the overall user experience.
2024-08-19 07:51:06 +02:00
013bc1ec71
fix: improve URL parsing and linkage for wiki articles
Refine wiki article URL parsing to handle paths with minimal segments and ensure proper language and project mapping. Updated href assignment to use `url_for` for more precise route generation. These changes improve the accuracy and reliability of linking external wiki pages within the project ecosystem.

Fixes #13.
2024-08-19 07:47:52 +02:00
2eeb4d30cf
fix: handle Unicode in titles and improve error handling
Encoded titles using `quote` to handle Unicode characters correctly in API requests. Added error handling for cases where article content is not found, returning a 404 page with an appropriate message. This ensures a more resilient and user-friendly application.

Fixed #15.
2024-08-19 07:27:49 +02:00
5bf7554619
chore(release): bump version to 0.1.3
All checks were successful
Python Package CI/CD / Publish to PyPI (push) Successful in 1m7s
Upgraded project version from 0.1.2 to 0.1.3 to include recent updates and improvements. This prepares the project for the next release cycle, ensuring compatibility and stability for the new features and bug fixes introduced since the last version.
2024-08-18 15:55:47 +02:00
a77ad1af7a
style: clean up CSS comments for better readability
Moved comments to their own lines to improve readability and maintainability of the CSS code. This change separates the comments from the declarations, making it easier for developers to understand the purpose of each style rule at a glance.
2024-08-18 15:51:25 +02:00
81c63244dc
feat: enhance sidebar styling and introduce collapsible sections
Updated the sidebar background color, border, and various styles for better aesthetics and usability. Added styling for titles, images, content links, and lists within the sidebar. Introduced collapsible sections with smooth transitions to improve the user experience by allowing users to manage sidebar content visibility. These changes enhance readability and interactivity.
2024-08-18 15:43:09 +02:00
2803d530fa
feat: Add new side-box styling for improved layout
Introduced .side-box and related classes to enhance the styling
and layout of side boxes. This includes background color, border,
padding, margin, float, and display properties.

Also added media queries to ensure side-box responsiveness on
devices with max widths of 768px and 480px.

Enhances page design, providing a more flexible and visually
consistent user interface. Fixes #11.
2024-08-18 13:33:11 +02:00
f828386be8
fix(css): ensure infobox links are readable
Updated the color of links in infobox components to white for better readability and visual consistency with the infobox background. This adjustment helps maintain a uniform look and improve user experience.

Fixes #10.
2024-08-18 13:20:57 +02:00
b7ba63688d
fix(wiki_article): correct URL escaping for title
Corrected the URL escaping for titles in `wiki_article` function by setting `escape` flag to `False`. This ensures the correct handling of titles with special characters. Resolves potential issues with fetching article content due to over-escaping.
2024-08-18 11:22:19 +02:00
c4e7acdae4
feat(css): add styling for warning message boxes
Introduced new CSS class .ambox to provide consistent styling for warning and alert message boxes. The style includes margin, padding, background color, border, and font size to improve the visibility and readability of such messages.
2024-08-18 11:17:48 +02:00
4d274d8073
fix(css): adjust float and clear for alignment classes
Updated CSS rules to properly handle alignment by adding `clear: left` for elements floating left and `clear: right` for elements floating right. Also corrected `.mw-default-size` to float right instead of left. These changes aim to improve layout consistency and avoid potential overlapping issues.
2024-08-18 11:12:23 +02:00
f9add6305b
fix(styles): improve layout and responsiveness
Added 'display: flex' to h1 for better alignment and spacing. Set 'clear: left' and 'max-width: 300px' for images with the 'mw-default-size' class to ensure proper text flow and prevent overflow in smaller viewports. Enhances overall page layout and mobile responsiveness.
2024-08-18 11:07:36 +02:00
10f354a240
fix(css): improve hover and layout consistency
Unified hover text-decoration styles to underline on hover for all elements and reduced redundant style rules across different classes. Adjusted layout styling for better alignment and clarity, addressing margin and padding inconsistencies in various components including sidebar, infobox, and table elements. Improved responsive design by clearing float issues for infoboxes and sidebars on smaller screens.
2024-08-18 09:15:00 +02:00
f92d3ce79b
feat(css): Add class for default size adjustment
Added `.mw-default-size` CSS class with `width: fit-content` to ensure elements with this class adjust width based on their content. This enhancement improves the layout for dynamically sized components, ensuring they are appropriately sized without overflow issues.
2024-08-18 08:55:21 +02:00
b5744d1e0d
fix(css): replace width with max-width for better layout
Switched multiple instances of `width: 100%` to `max-width: 100%` in the CSS. This adjustment prevents elements from stretching beyond their container's bounds, improving the overall responsiveness and visual presentation of the layout. Helps ensure better alignment and avoids potential overflow issues on smaller screens.
2024-08-18 08:49:35 +02:00
98a5349ac2
feat: improve responsiveness and layout of the site
Enhanced the website's responsiveness by introducing global box-sizing,
setting max-width to 100%, and adding media queries for devices with
maximum widths of 768px and 480px. Updated the layout to use flexbox,
ensuring content adapts seamlessly across various screen sizes.

These changes aim to provide a better user experience on mobile and
tablet devices. Also, resolved overflow issues in multiple sections
ensuring the elements don't exceed the viewport width.
2024-08-18 08:41:09 +02:00
4b08c70261
fix(wikimore): ensure links from image maps are processed
Enhanced link extraction to include `<area>` elements for better handling of image maps. This change ensures that all navigable links within an article, including those from image maps, are processed correctly.

Fixes #8.
2024-08-18 07:17:18 +02:00
6cc25796a2
fix(search): properly escape and format search queries
Refined the search URL construction to correctly escape and format the search queries by replacing spaces with underscores and escaping characters. This ensures more accurate search results and improved reliability of the search functionality.

Fixes #6.
2024-08-18 07:12:37 +02:00
301cf90778
feat: add hatnote styling and improve code readability
Introduced new styles for hatnote elements to enhance visual distinction with margin, padding, background color, border, and font adjustments. Also, improved readability of existing CSS by reformatting multi-line selectors for figures and file elements.

These updates aim to make the content presentation more engaging and the CSS code easier to maintain. Fixes #7.
2024-08-18 07:06:27 +02:00
797cfc7a45
style: update element sizing and interwiki link styles
Adjusted font size for h1 headers to small for better readability.
Clarified width and height rules for image elements within .tmulti class.
Added specific styling for interwiki links with .sister-logo and .sister-link
classes to enhance UI alignment and spacing.
2024-08-17 11:48:53 +02:00
6f5863b746
fix(routing): handle redirects for nested wiki routes
Updated the route to accept nested paths for wiki titles.
Added logic to handle redirects within wiki articles, checking
for redirection messages and appropriately redirecting if the
"redirect" query parameter is not set to "no".

This ensures smoother navigation between articles, even when
dealing with paths that include slashes, which helps enhance
user experience.

Fixes #3.
2024-08-17 11:42:09 +02:00
dbb3ab0e98
feat: enhance proxy URL handling and add static CSS
Extended proxy URL support to include maps.wikimedia.org, improving the range of URLs that can be proxied. Established a static folder for serving CSS files by modifying the application’s static folder path. Transferred inline CSS from the base HTML template into an external stylesheet to improve maintainability and separation of concerns.

Fixes #2, also some progress on #1.
2024-08-17 09:27:46 +02:00
11d1c610a8
chore: update dependencies management for development
Migrated development dependencies to requirements-dev.txt and removed old runtime dependencies from requirements.txt. This aligns dependency management with current development practices and configurations.
2024-08-17 08:26:25 +02:00
c028219245
chore: bump version to 0.1.2
All checks were successful
Python Package CI/CD / Publish to PyPI (push) Successful in 1m6s
Updated project version to 0.1.2 to incorporate recent changes and improvements. Ensures consistency across the project and prepares for the upcoming release.
2024-07-16 10:20:05 +02:00
0e37e0524b
fix(wiki-article): correct URL escaping issue
Some checks failed
Python Package CI/CD / Publish to PyPI (push) Failing after 1m3s
Switched to single quotes for the title replacement in the URL to ensure compatibility with older Python versions.
2024-07-16 10:18:44 +02:00
e8823de045
feat: add CI/CD workflow for publishing Python package
All checks were successful
Python Package CI/CD / Publish to PyPI (push) Successful in 1m6s
Introduced a GitHub Actions workflow to automate the CI/CD process for publishing Python packages to PyPI. The workflow triggers on push tags and provides tasks for checking out code, installing dependencies, and uploading the package to PyPI using twine. This automation aims to streamline the release process and ensure consistency in package deployment.
2024-07-16 10:08:07 +02:00
bb97ff0ad9
chore: bump version to 0.1.1 and fix license
Updated the project version from 0.1.0 to 0.1.1 to indicate minor changes. Switched the license field in pyproject.toml from GNU AGPLv3 to MIT License.
2024-07-16 10:00:48 +02:00
9d25954448
chore: update .gitignore to include /dist/ directory
Added the /dist/ directory to .gitignore to prevent distribution artifacts from being tracked in the repository. This helps in keeping the repository clean and reduces unnecessary clutter in version control.
2024-07-16 09:59:11 +02:00
ae73156fc9
refactor: restructure project for PyPI packaging
- Added `pyproject.toml` for project metadata and dependency management
- Moved application code to `src/wikimore` directory for better organization
- Updated `launch.json` configuration for Flask app
- Enhanced README with installation, development instructions, and badges
- Introduced `main` function in `app.py` for environment-based configuration

These changes streamline packaging and improve project maintainability.
2024-07-16 09:58:18 +02:00
31687723aa
feat: set English as default language in dropdown
Modified the language selection dropdown to default to English by marking the 'en' option as selected. Enhances user experience by pre-selecting the most commonly used language. This may help users who are primarily English speakers to have a faster and more intuitive interaction with the form.
2024-07-16 08:31:32 +02:00
b9b407a737
fix: replace underscores with spaces in article titles
Updated article titles to replace underscores with spaces when rendering the wiki article. Enhances readability and ensures a more user-friendly display format.
2024-07-16 08:26:34 +02:00