From c25a842ae640ab0fb97b42bb24a8e4a53c68ceab Mon Sep 17 00:00:00 2001 From: Javier Ramos Nistal <43531047+Radioamatoro@users.noreply.github.com> Date: Thu, 14 Sep 2023 00:20:43 -0300 Subject: [PATCH] first useful fetch first useful fetch call to Esperanto wikiquote API + styles --- README.md | 460 ++++++++++++++++++++++++++++++-- docs/eo-wikiquote.html | 36 ++- docs/js/eo-wikiquote.js | 49 ++-- styles/style-1.css | 13 + styles/style-javiramoslab-1.css | 0 5 files changed, 490 insertions(+), 68 deletions(-) create mode 100644 styles/style-1.css create mode 100644 styles/style-javiramoslab-1.css diff --git a/README.md b/README.md index 4d72e46..e9a190c 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,38 @@ Wikiquote API - Quote Of The Day (QOTD) ===================== +___Free unlimited quote API___ + Fetch info from Wikiquote API's +## Badges +[![GitHub forks](https://img.shields.io/github/forks/JaviRamosLab/Wikiquote-API?branch=master&label=Forks&logo=GitHub&logoColor=ffffff&labelColor=282828&color=informational&style=flat)]() +[![GitHub stars](https://img.shields.io/github/stars/JaviRamosLab/Wikiquote-API?branch=master&label=Stars&logo=GitHub&logoColor=ffffff&labelColor=282828&color=informational&style=flat)]() +[![GitHub watchers](https://img.shields.io/github/watchers/JaviRamosLab/Wikiquote-API?branch=master&label=Watchers&logo=GitHub&logoColor=ffffff&labelColor=282828&color=informational&style=flat)]() +[![GitHub release](https://img.shields.io/github/release/JaviRamosLab/Wikiquote-API.svg)](https://GitHub.com/JaviRamosLab/Wikiquote-API/releases/) +[![GitHub commits](https://badgen.net/github/commits/JaviRamosLab/Wikiquote-API.js)](https://GitHub.com/JaviRamosLab/Wikiquote-API/commit/) +![GitHub pull requests](https://img.shields.io/github/issues-pr/JaviRamosLab/mediawiki) +![GitHub milestones](https://img.shields.io/github/milestones/all/JaviRamosLab/mediawiki) +![GitHub repo size](https://img.shields.io/github/repo-size/JaviRamosLab/Wikiquote-API) + +![GitHub contributors (via allcontributors.org)](https://img.shields.io/github/all-contributors/JaviRamosLab/Wikiquote-API/master) +![GitHub contributors (via allcontributors.org)](https://img.shields.io/github/all-contributors/all-contributors/all-contributors/master) + +sin branch +[![GitHub forks](https://img.shields.io/github/forks/JaviRamosLab/Wikiquote-API&label=Forks&logo=GitHub&logoColor=ffffff&labelColor=282828&color=informational&style=flat)]() + + +## Suport + **Quote Of The Day (QOTD)** Active QOTD in languages: -- en -- it -- es -- eo -- pt -- fr -- zh +- [x] eo (https://eo.wikiquote.org/wiki/Vikicitaro:Citaĵo_de_la_tago) +- [] en () +- [] it () +- [] es () +- [] pt () +- [] fr () +- [] zh () Others projects - as @@ -27,44 +48,431 @@ Others projects - bn (https://bn.wikiquote.org/wiki/উইকিউক্তি:আজকের_উক্তি) - ar (https://ar.wikiquote.org/wiki/ويكي_الاقتباس:اقتباسات_مختارة) +## Installation +### Demo +## API documentation -## Usefull APIs +**endpoint** +``` +https://en.wikiquote.org/w/api.php?format=json&action=parse&page=Template:QoD +``` -APITemplate.io Dynamically generate images and PDFs from templates with a simple API +**URL encode** -https://apitemplate.io/ +url= ```https://``` -Dagpi Image manipulation and processing +language= ```en``` -https://dagpi.xyz/ +url= ```wikiquote.org/w/api.php``` -Duply Generate, Edit, Scale and Manage Images and Videos Smarter & Faster +?format= ```json``` -https://duply.co/docs#getting-started-api +&action= ```parse``` -DynaPictures Generate Hundreds of Personalized Images in Minutes +&origin= ```*``` -https://dynapictures.com/docs/ +&page= ```page name on wq``` -Readme typing SVG Customizable typing and deleting text SVG -https://github.com/DenverCoder1/readme-typing-svg +**API documentation** -Movie Quote Random Movie and Series Quotes +https://es.wikiquote.org/w/api.php -https://github.com/F4R4N/movie-quote/ -### Cloudinary +## Roadmap/Issues +If you have ideas for releases in the future, it is a good idea to list them in the README or open an Issue. +[x] Basic fetch API +[x] Quote info +[x] Author info +[] Tags info +[] Img info +[] Date info +[] Bio info +- <lang>-wikiquote.js al CDN +- <lang>-wikiquote-full.js (all info: Quote, Author, Tags, Img, Date, Bio...) +- Integration with oters API's +- +- Telegram bot + +**Issues** +- Ramdon quotes (365 days) +- personalized quote list = create the subpage in your userpage (https://en.wikiquote.org/wiki/User:<YourUsername>/Wikiquote-API) +- wikicode generator for your personalized list +- Integration: QOTD + img from pixabay (elected by tags) + download button with html2canvas.js + + +### by language +[x] (eo) Esperanto wikiquote (eo-wikiquote.js) v0.1.0 +[] (en) Esperanto wikiquote (en-wikiquote.js) +[] (es) Esperanto wikiquote (es-wikiquote.js) +[] (it) italian wikiquote (it-wikiquote.js) +[] (tr) Turkish wikiquote (https://tr.wikiquote.org/wiki/Vikisöz:Günün_sözü) + +## Contributing +Open to contributions! +- Contribute to the codebase and submit a pull request. +- Suggest features you'd like to see (add new Issue) +- Track bugs you've found +- Add your own CSS style document at /styles + +## CSS styles +**Basic** +- style/style-<number>.css +- ```style/style-1.css``` + +**For authors** +- style/style-<authorname>-1.css +- ```style/style-javiramoslab-1.css``` + +## Change log/versions +v0.1.0 +- Esperanto suported +- first styles + +v0.2.0 +- English suported + +v0.3.0 +- Spanish suported + +v1.0.0 +- Full .js + +v2.0.0 +- CDN +v2.0.0 +- Integration: pixabay + + + + + +## Usefull APIs + +APITemplate.io +Dynamically generate images and PDFs from templates with a simple API +- https://apitemplate.io/ + +Dagpi +Image manipulation and processing +- https://dagpi.xyz/ + +Duply +Generate, Edit, Scale and Manage Images and Videos Smarter & Faster +- https://duply.co/docs#getting-started-api + +DynaPictures +Generate Hundreds of Personalized Images in Minutes +- https://dynapictures.com/docs/ + +Readme typing SVG +Customizable typing and deleting text SVG +- https://github.com/DenverCoder1/readme-typing-svg + +Filestack +API for image and file manipulation, 250 uploads and 500 uploads per month for free, free CDN, HTML widget. +- https://filestack.com/docs/ + +### Cloudinary API for image and video storage and manipulation - free for up to 75,000 images and 7,500 manipulations per month, good documentation, it can also manipulate GIFs and PDFs. +- http://cloudinary.com/documentation +- https://cloudinary.com/documentation/image_transformations +- https://cloudinary.com/documentation/layers + + + + + +## Quotation marks +https://symbl.cc/en/collections/quotation-marks/ + +## HTML tags and CSS +Aditional info and comments about HTML tags ```
``` and CSS ```lang="en" hreflang="en" translate="no" :lang()``` + +### HTML tags +Style of HTML was copied from MDN read more at: +https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote + +```html +
+ + + +``` + +```html +
+
+

Words can be like X-rays, if you use them properly—they’ll go through anything. You read and you’re pierced.

+
+
—Aldous Huxley, Brave New World
+
+``` + + +#### blockquote + +**Bootstrap 4** + +```html +
+

In the digital age, knowledge is our lifeblood. And documents are the DNA of knowledge.

+
Rick Thoman, CEO, Xerox
+
+``` + +**Twitter** + +```html + +``` + +**MDN** + +```html +
+
+

Words can be like X-rays, if you use them properly—they’ll go through anything. You read and you’re pierced.

+
+
—Aldous Huxley, Brave New World
+
+``` + +**Authors** +La plej granda manko ĉe HTML estas por AŬTORO de la citaĵoj kaj neniu norma solvo ekzistas, vi vidos amasegon da proponoj. Interalie mi vidis: +```Napoleon Bonaparte``` + +HTML 5 documentation says, "Small print typically features disclaimers, caveats, legal restrictions, or copyrights. Small print is also sometimes used for attribution, or for satisfying licensing requirements." + +#### q + +inline citation + +`````` + +#### cite +`````` + +Source: + +https://developer.mozilla.org/en-US/docs/Web/HTML/Element/cite + +**wikisource**------ +CITE ĉe vikifontaro kie ĝi multe gravas! + +#### poem +`````` + +used in: +https://it.wikiquote.org/wiki/Wikiquote:Modello_di_voce#Formattazione + +### Lang + + +`````` + +ĉe parágrafo + +```

This paragraph is written in english.

``` + +ĉe ligilo + +```ekzemplo``` + + + + + + +Source: + +https://www.w3.org/International/questions/qa-html-language-declarations.es + + + + + + +#### hreflang +In multilingual webs + +`````` + +Ekz: + +```html + + + +``` + + +### Atributoj and CCS + +lang="eo" + +translate + +:lang() + +#### Atributo translate +En vikicitaro ĝi multege utilus ĉe la devenlingvaj tekstoj tiel ke tradukiloj (kiel google traslate, yandex ka.) lasu ilin senĉanĝoj! + +```translate``` + +```How Far Can You Go?``` + +```class="notranslate"``` + + + + +toda una página que no debería ser traducida, puede agregar + +```html + dentro del elemento head de su página y Google no traducirá ningún contenido en esa página. (Sin embargo, también apoya .) +``` + +Source: + +https://www.w3.org/International/questions/qa-translate-flag + +```html +
+ © 2020 BrandName +
+``` + +Source: + +https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/translate + + + +#### :lang() + +Por CCS uzado, atentu ke ĝi ne deklaras lingvon de iu ajn teksto ĝi nur modifas la stilon de iu teksto surbaze de ties lingvo. Ekzemple kiajn citilojn uzi kio multe varias laŭ lingvoj. + +```CSS +/* Selects any

in English (en) */ +p:lang(en) { + quotes: '\201C' '\201D' '\2018' '\2019'; +} +``` + +```html +

This English quote has a nested quote inside.
+
This French quote has a nested quote inside.
+
This German quote has a nested quote inside.
+``` + +```CSS +:lang(en) > q { quotes: '\201C' '\201D' '\2018' '\2019'; } +:lang(fr) > q { quotes: '« ' ' »'; } +:lang(de) > q { quotes: '»' '«' '\2039' '\203A'; } +``` + +Source: + +https://developer.mozilla.org/en-US/docs/Web/CSS/:lang + +and + +https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang + +**Standard** + +BCP47 + +https://tools.ietf.org/html/bcp47 + +ISO 639 + +https://www.loc.gov/standards/iso639-2/php/code_list.php + +```html + + +.... + +

Esta página esta escrita en español.

+

But this paragraph is written in english.

+

Customizar, del inglés customize, que significa personalizar.

+ + +``` + +```CSS +/* General para todos los elementos q */ + +q:before { content: open-quote; } +q:after { content: close-quote; } + +/* Inglés */ + +:lang(en) q { quotes: '“' '”'; } + +/* Francés */ + +:lang(fr) q { quotes: '«' '»'; } + +/* Alemán */ + +:lang(de) q { quotes: '»' '«'; } +``` + +Source: + +https://cybmeta.com/el-atributo-lang-en-html + +https://tutorialesenlinea.es/2739-el-atributo-lang_hreflang-y-su-importancia-en-accesibilidad.html + +https://www.w3.org/International/questions/qa-lang-why + + + + + +## Ĝeneralaj fontoj + +https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang +https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/translate +https://www.w3.org/International/questions/qa-translate-flag +https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote +https://developer.mozilla.org/en-US/docs/Web/API/HTMLQuoteElement +https://developer.mozilla.org/en-US/docs/Web/HTML/Element/cite +https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figure +https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figcaption + + + + + + + + + +### Official Site +[Web Site](http://javiramo.github.io/Wikiquote-API "Wikiquote-API Site") + +## Authors and acknowledgment + +### Support me -http://cloudinary.com/documentation -https://cloudinary.com/documentation/image_transformations -https://cloudinary.com/documentation/layers +## License +[![licensebuttons by-sa](https://licensebuttons.net/l/by-sa/3.0/88x31.png)](https://creativecommons.org/licenses/by-sa/4.0) -Filestack API for image and file manipulation, 250 uploads and 500 uploads per month for free, free CDN, HTML widget. +### Show some ❤️ by starring some of the repositories! -https://filestack.com/docs/ +### Developed by Javier Ramos @JaviRamosLab from 🇨🇺 Cuba with "❤️ and ⏰" \ No newline at end of file diff --git a/docs/eo-wikiquote.html b/docs/eo-wikiquote.html index 69da4ca..fc3aebd 100644 --- a/docs/eo-wikiquote.html +++ b/docs/eo-wikiquote.html @@ -6,6 +6,7 @@ + Esperanto (EO) Wikiquote API @@ -15,18 +16,31 @@

Esperanto (EO) Wikiquote API - Quote Of The Day (QOTD)

Esperanto Wikiquote (eo.wikiquote.org)

Esperanto wikiquote (Quote Of The Day) API call

Vikicitaro:Citaĵo de la tago

-

Today QOTD Vikicitaro:Citaĵo_de_la_tago/CDLT

+

Today QOTD Vikicitaro:Citaĵo_de_la_tago/CDLT +

Endpoint:

- https://eo.wikiquote.org/w/api.php?format=json&action=parse&page=Vikicitaro:Citaĵo_de_la_tago/CDLT - - - - - + https://eo.wikiquote.org/w/api.php?format=json&origin=*&action=parse&page=Vikicitaro:Citaĵo_de_la_tago/CDLT + +
+
+ + + + + + + + \ No newline at end of file diff --git a/docs/js/eo-wikiquote.js b/docs/js/eo-wikiquote.js index 3652f0a..5c65154 100644 --- a/docs/js/eo-wikiquote.js +++ b/docs/js/eo-wikiquote.js @@ -1,31 +1,18 @@ -// let url = "https://eo.wikiquote.org/w/api.php?format=json&action=parse&page=Vikicitaro:Citaĵo_de_la_tago/CDLT"; -// let url = "json/eo.wikiquote.org_api-result.json"; -let QOTD = ""; -let quote = ""; -let author = ""; - -fetch('json/eo.wikiquote.org_api-result.json') -.then(res => res.json()) -.then(data => console.log(data.parse.text)) -.then(frase=data.parse.text['*']) -.catch(err => console.log(err)); - -var pon_frase_en_span = function (data) { - -frase=data['parse']['text']['*']; - -//para los enlaces -frase=frase.replace(/\/wiki\//g, "http://es.wikiquote.org/wiki/") - -/////////////////////////////////// -//si para dentro de un span es asi: -document.getElementById ('seoo').innerHTML =frase; -/////////////////////////////////// - -}; - -// quote = data.parse - -console.log(quote); -console.log(frase); - +let url = 'https://eo.wikiquote.org/w/api.php?format=json&origin=*&action=parse&page=Vikicitaro:Citaĵo_de_la_tago/CDLT' + +let wqQuoteHtml = ""; +let wqAuthorHtml = ""; + +fetch(url) + .then(response => response.json()) + .then(data => fecthData(data)) + .catch(error => console.log(error)) + + const fecthData = (data) => { + let body = `${data.parse.text['*']}` + bodyHtml = body.replace(/\n*/gm, "").replace(/\/wiki\//gm, "https://eo.wikiquote.org/wiki/"); + wqQuoteHtml = bodyHtml.replace(/.+
.+/gm, ""); + + document.getElementById('eoWikiquote').innerHTML = `
${wqQuoteHtml} +
—${wqAuthorHtml}
` +} \ No newline at end of file diff --git a/styles/style-1.css b/styles/style-1.css new file mode 100644 index 0000000..86725ef --- /dev/null +++ b/styles/style-1.css @@ -0,0 +1,13 @@ +#figEoWikiquote { + background-color: aquamarine; + color: brown; +} + +#Citaĵo_CDLT { + color: rgb(51, 6, 253); +} + +#Aŭtoro_CDLT { + font-size: 150%; + color: red; +} \ No newline at end of file diff --git a/styles/style-javiramoslab-1.css b/styles/style-javiramoslab-1.css new file mode 100644 index 0000000..e69de29