Commit graph

75 commits

Author SHA1 Message Date
5c933d4089
chore: bump version to 0.1.4
All checks were successful
Python Package CI/CD / Publish to PyPI (push) Successful in 1m12s
Updated the project version to 0.1.4 to reflect the latest changes and improvements made. Ensures consistency and clarity in version tracking.
2024-09-19 19:14:14 +02:00
b095d8c9df
fix: standardize quote usage in URL generation
Updated single quote usage in URL generation for consistency and readability in `wiki_article` function. This improves code maintainability and avoids potential issues with character escaping.
2024-09-19 19:13:34 +02:00
00d4f9694a
fix(api): correct API request URL handling of spaces
Switched double quotes to single quotes in URL handling code for better consistency and to avoid potential issues with escaping characters. This ensures the proper construction of the API request URL, improving reliability when fetching wiki articles.
2024-09-19 19:11:49 +02:00
203e6cd2cf
docs: add bloat.cat public instance to list
Included a new public instance of Wikimore provided by bloat.cat based in Germany. This update helps users find more public instances for better accessibility and redundancy.

Closes #39
2024-09-11 18:16:01 +02:00
3c617b0dd6
fix(error-handling): remove unused exception variable
Removed the unused exception variable from the error handling block during MediaWiki API request. This helps in reducing potential future linting errors and maintains cleaner code. No functional changes.
2024-09-01 16:02:22 +02:00
a484b18989
feat: cache license info for better efficiency
Introduced caching for license data retrieved from the MediaWiki API. This avoids redundant API requests by storing the license information for each base URL. Enhances performance and reduces the risk of hitting request limits or encountering errors due to multiple API calls.
2024-09-01 16:02:07 +02:00
872157139a
feat(app): enhance article rendering with project/lang params
Extended the home route to accept optional project and language
parameters to dynamically render content based on these inputs.
Improved handling within the article fetching function, including
validating projects and languages, adding variant headers, and
following redirects conditionally. Updated links to accommodate
internal, external, and interwiki links, with structured checks
for main page redirections. Removed redundant meta links and edit
sections to clean up the rendered content. Added proxying for images
and videos, converted category elements to links, and improved class
assignments for reference links. Ensured right-to-left languages are
handled appropriately.

Fixes #29.
2024-08-31 08:11:55 +02:00
219a36cad8
fix: properly escape titles and queries in API requests
Updated URL construction to correct escaping order of title and query parameters using `escape` after `quote`. This ensures proper encoding of characters and prevents potential errors when fetching articles and search results from the API.

Additionally, added a debug log for search result fetching URL to aid in troubleshooting.

Fixes #36.
2024-08-30 17:43:06 +02:00
87a4f07285
feat: display license information on article page
Added functionality to fetch and display license information for wiki
articles. This enhancement provides users with clarity on content usage
permissions by showing a link to the article's license in the footer.

Fixes #35.
2024-08-30 17:35:40 +02:00
70c40fd979
fix(wiki_article): ensure RTL text direction for ku-arab variant
Added explicit setting for text direction to RTL in the HTML body
for Kurdish Arabic variant articles. This change ensures proper
display alignment for right-to-left languages, addressing layout
issues arising from API response inconsistencies.
2024-08-30 17:31:16 +02:00
1bbb37be7e
fix(routing): handle slashes in search queries
Changed query parameter type to 'path' in search endpoint to ensure that slashes in search queries are correctly handled. This resolves issues with queries containing slashes not being processed properly.

Fixes #37.
2024-08-30 17:05:26 +02:00
9b62a5704b
fix(error-handling): improve search results error handling
Added a try-except block around the search results API call to handle potential errors gracefully. Now, if an exception occurs, an error message is logged, and the user is redirected to an error page with a 500 status code. This improves user experience by providing clear feedback when the search functionality fails.
2024-08-30 17:01:30 +02:00
249fba16a6
fix(css): remove floating from infobox images
Unset the float property for images within the infobox with the class 'mw-default-size'. This resolves layout issues where images were not aligning correctly in certain contexts. Ensures more consistent and expected rendering of infobox content.
2024-08-30 17:01:12 +02:00
df4f1f6f45
style: remove .noprint class
Deleted .noprint class from stylesheet as its intent is unclear, simplifying the CSS file and reducing potential maintenance overhead. This change helps streamline the styling rules, making the codebase cleaner and easier to manage.
2024-08-30 16:55:54 +02:00
2105850846
fix(ui): refine layout and infobox styling
Removed redundant general styling and adjusted the widths in several elements to improve responsive behavior. Enhanced infobox design with a distinct title section for better readability and visual separation. These changes address layout issues on smaller screens and improve overall user experience.

Fixes #14, maybe?
2024-08-28 13:47:39 +02:00
286a73cbc6
feat: improve error handling and add special projects
Enhanced error handling for fetching Wikimedia projects with specific log messages for various exceptions including JSON decode, HTTP error, and URL error. Introduced support for "special" Wikimedia projects and updated functions to handle missing base URLs by checking special projects. Added detailed debug logging in `wiki_article` function for debugging failed article fetches.

style: add CSS rules for Wikidata content

Implemented new CSS styles for improved display and readability of Wikidata content elements such as entity views, statements, and references. These styles enhance the user interface, making it cleaner and more user-friendly.

Fixes #27.
2024-08-28 07:52:09 +02:00
4d47441fdb
fix(logging): remove default Flask logger
Removed the default Flask logger to prevent duplicate logging entries.
Refined log output by adding a custom handler and formatter to ensure logs
are consistent and properly formatted.
2024-08-27 13:46:17 +02:00
1fca3bce13
feat: improve footnote display and data attributes
Added functionality in `app.py` to propagate `data-mw-group` attribute classes to `mw-reflink-text` spans, enhancing footnote grouping. Updated CSS to properly style these footnotes, accounting for various numeral systems (alpha, roman, decimal) and ensuring consistent display of references.

Fixes #33.
2024-08-26 16:38:34 +02:00
426964a798
fix: update search placeholder text
Changed the placeholder text from "Search Wikipedia" to "Search Wiki" to prevent confusion if a different project was selected.

Ref: #18
2024-08-26 13:18:21 +02:00
4312ec4ac3
feat(css): add placeholder for comments section
Added a placeholder for the link to the comments section in the CSS to support a future implementation of comments retrieval in the backend. The placeholder includes styles for displaying a comment request link and setting its font properties.

Ref: #22
2024-08-26 12:59:36 +02:00
03993a8fce
fix(css): adjust selector to target only the last section
Updated CSS to ensure .category-link applies only to the last
section element. This change prevents unintended styling of
elements in other sections, enhancing the page's visual accuracy. Fixes #30.
2024-08-26 12:48:49 +02:00
dd5ed051b9
fix(styles): change code block to inline-block display
Modified the display property of code blocks from block to inline-block to improve layout consistency and handle overflow-x better. This ensures better alignment with surrounding elements and more predictable rendering behavior. No visible design alterations should occur.
2024-08-25 18:50:00 +02:00
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