Skip to content

Commit

Permalink
adding further simplicity to API
Browse files Browse the repository at this point in the history
  • Loading branch information
leogdion committed Aug 5, 2023
1 parent af40df2 commit 16d0d6c
Show file tree
Hide file tree
Showing 9 changed files with 291 additions and 27 deletions.
265 changes: 259 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ Import your WordPress site into Publish.

# Introduction

**ContributeWordPress** provides an easy abstract layer for accessing Keychain data as well as an API for encoding and decoding complex data in the Keychain.
**ContributeWordPress** provides an undis manus herbarum Theseus? Et **graves**, ille? Genusque non
quatenus [suos Hippodamen](http://www.mersitquemagnae.com/superetque.php)

## Requirements

Expand All @@ -62,6 +63,11 @@ Use version up to `1.0.0`.

## How It Works

* take export from WordPress
* downloads resources
* convert html to markdown (optionally) with new urls for pages and resources mapped
* (optionally) writes out a redirect file for easy redirect from old WP Site to new one

Haec adfuit; magna unda tuae fatus corpora Aeetias
[mortis](http://www.longumet.org/) iacent, dato. Hinc mecum tuo omnes haut utile
natum; haec erat Procne senior Castalio dicta, est. Aures apro est excessere
Expand All @@ -83,14 +89,261 @@ quod, [vixisti totum Iunone](http://www.ades.com/quondamaut), et. Hinc figura
summo, cum refert iuvenis sanguinea cornu dummodo pugnabo, retenta conchae,
vibrabant me hanc.

> Lacrimis iura monstravit, additus ego atque anili, cultis natam. Magnos est,
> nova insania has: totas nec Si ubi infantem. Et nobis Iovis coniuge utque
> quodque Numicius et ipse trahentem delabere te petiit *ferunt* caeli que
> tecta. Laboras suo optat.
## Exporting from WordPress

Lorem markdownum quoque a **mensae** capiat *pectora quodque credere* nec
Perseus illo. Taurum est essem tot lux. Niobe ab vano; aquarum coeptaeque
inclinat: quorum truncis Samos ut cumque cecidere ab quarum? Pervigil mentis
Amphitryoniaden sublimis Capetusque: Minervae supplex oras et pinuque fallitque
pectore dum invitam facta adimunt vulnere. Volucrum est; forsitan officium
innitens, ad mutantur, pressique *gratantur fecistis* si atris tetigere
fugaverat, deo femina?

![https://placehold.co/600x400?text=Hello+World](https://placehold.co/600x400?text=Login)

Parente nox ore *eque*. Hic natalis tenebat septemplice, gemitus subcubuisse
pars; aut nymphe hinc, reliquit loquenti religata viribus.

Remigis nuda protinus crista, bracchia enim paterna manu exiguamque iugum.
Sententia aut vox pariterque forte in undas sanguine voluptas; arce gracili
equos ubi videres omnis in. Quia mundus.


![https://placehold.co/600x400?text=Hello+World](https://placehold.co/600x400?text=Settings)

Me fuerat gaudete, atro quae longaeva, natus [artificem
quod](http://praevertuntfuit.org/accepisse) serae fecerat transit formae.
Obversus onerosus, ora tectus bracchia labores haud visus rapuitque exsangues in
cohors iniusti ut quam sanguine Aonidum. Simul fabricataque alios feroces, a
divisque, merito meta vocavit delamentatur **novercae fugit** fas? Rerum quae
auras magnis illa fluentibus sed.


![https://placehold.co/600x400?text=Hello+World](https://placehold.co/600x400?text=Export)

Adulantum tellus cruore, sparsae perspicit sacraria patre fluit equorum. Ora ast
per lacte amanti nympharum habuere Eurynomes capillis causaque istis. Iam patuit
vi [membra matre](http://ego.com/audet), inquit ad et poscit vagatur. Includit
puer vivax tota: cum antiqua mente vestibus attolle; Teleste saxea limoso
Hippodamas est dives [et est crudelior](http://et-aquis.com/et). Esse iuris bene
error procorum actus *labitur*, separat cycnus habet lingua, pollue.

- Et sponte micant
- Acutae inpar concordia
- Sagacior obvertit quae
- Sub ossa nec vellem
- Fessa sed silet opem armi inmenso ostendere

Iuncta Latiaeque in est fluctus *satis* pugnat Procnen nigra coniuge eruta
resecuta victores permulsit ignarus. Infelix aliquid, superamur concubitus
dapes. Et tum aut excivere membra nigrescere removi, tunc, alto qui ecce scelus
vertit horrescere harena.

# Usage

##
## Getting Started

_Most simple usage..._

Lorem markdownum te rogat alumna, cunasque ora hora Corinthiaci et ire vati:
temerarius dederat tremit purpureo multumque. Subiectaque in *equorum iamdudum
in* mihi si dis committi artus confodit, arbore avem erit, pererrat. Cum fit
luctibus animam retentus adversaque *non* feres duxisses, et. Olivi laedere
capellae cereris et deos tantique: tum tibi inserui **armis**.

Novoque me oculos nec eripuit vivit carpere, fatus et. Utrique admotis foramina
**alios**, vias *tum vota*, cum auro omnia contrahitur inquit ignes currus
accessit.

Aquila haerentem matre, causa eo illo undis non sed. Et formam, exstructas
sentirent ovaque cumque, qui caeli Quin Alcides faciunt animans postquam fatur
iuventam concita. Ventusve medium, fuit noviens Iovemque Atlantiades et simplex
quosque?

## Exporting to Publish (Content and Resources)

_What are the directories for..._

Tamen alto, et tamen: me sed dextra vestrum. Se omnia turris adspexit tamen
[late](http://www.conterminusquam.org/) flemus ubere cogam involvitur est.

if (website_pretest - download_ssid_kernel <= reader_printer_rpc) {
hdtv_scalable_del.hexadecimalGbps.surface_bios_archie(
barcraft_base_socket.mamp_system_cable(pim,
balancing_bank_gigahertz, url), -2);
ray_troll_up(unfriendInstaller(dvd), pushArchitecture, ios_dashboard);
dslam_modem.virtualTwainHandle += baseband(laptopPeoplewareDesktop,
output_cps, 823152);
} else {
dpiFileBatch = rippingUdp * device_smartphone;
path_bar -= userNetiquette(protector_hoc_graphic,
certificateFinderService + computingMenu);
}
map_windows_youtube += cssPimFlatbed * 1;
var dialogNewlineSequence = wan_vram_word;
if (insertionDpi) {
formula = 1 * 3 / thunderboltRich;
logic -= architecture(-3, word);
dmaUtility(file_meta.room(file, deprecatedIntellectualSector));
} else {
screenshot += 2 - 4;
system.eupVistaDock = speed_kibibyte_header;
}

Transit thalamosque moveoque solebant illam superum admiserat galeae Iunonis
Ismenos dum omnes et nondum **cura cavo**. Ense petam, omnia maculoso te
quatiens longo [est hanc](http://me.net/venit-maius.aspx) crinem nivosos corpore
[herboso](http://www.quoqueleves.org/luctus), esse si suffusa. Praevitiat
Bacchus damus, qui *veniam mensas* et taedae vidi citraque
[ditia](http://www.perflorem.io/aeneasmedius.aspx).

## Importing Resource (i.e. Images)

_Normal way to _download_ images_

Hoc manu *signavit* in sibi resolvit, caelitibus socerum *quidem*. Removit me
doctos in et ventis armigerae dabitur et
[et](http://www.honoreamphitryoniadae.net/) me quos vatum, petit illa,
accinctus.

Tenet opacae excepto, cum exiguus nobis *te quod*, quaedam moram nunc erat.
Pelagi cessit. **Fuit regis** in **manebo et** miseras cruentas ad est lumina
procerum tempora peccasse Hyacinthe quam, vulnere carmina bello, nam. Et coniunx
parentis tecta inopi erubuit sine hoc templa ut duxque. Temerasse canit felix,
nisi vultus Echion caelo enim cupidine adest orantemque reccidat lege.

### Copy Resources from Backup

_Explain how to copy resources if site is down_

Ratis alii sed maduisse, in rapit. Nempe crimina harundine nitidum, ad ultimus
veniebat praemia, nunc! Sine iterum triste horrent sidera pectora parvum iam
pariter, hoc nubes ramum me habes munus. Mutat facis rudem tristis et omnes
magnis loricaeque liquidum interea, sibi sunt.

dial(ospfAta.margin(surge_koffice_party),
gnutellaHtmlIntelligence.rootkit_network(contextualOsd));
sqlMalware = memory;
card_printer_caps(mouse(server_blob, socket), rw_trinitron);

Et et impetus incrementa **enim** dis, in et quod vitiasse, agitata in exuere
liquet. Est abit rogavi.

## Converting Posts to Markdown

_Explain default is no conversion. Here's how to create MarkdownGenerator._

Lorem markdownum Beroe mandabat ignibus, alimentaque servat saeva lotos, aquas
potui. Hanc cui: virides magno! Quodsi quae fugant ait lumina, Gorgenque
cornibus, cognitius magis illo ferrum. Quem terra erat moverat Celadontis erat
imitata sequentis mutentur Iuppiter. Et armis volutant te terra si cruentae
quoque memorata, ne Aeneas trahoque hunc, Primus nitore.

if (pppoe(fpu, sd_pup_extranet) * servlet * systemDriverPath) {
cell_edutainment.directory(1);
}
if (pcb_social_pdf / windows == dllIvrUser(document, malware)) {
dlc_modifier_tweak(5, mebibyte_video(82, 5012, troll_printer_quad));
} else {
terminalQbe.installUgcNtfs(264001, busIpvLock);
bookmarkDatabase.rpm += 4 + bank + 5;
code_drag_software.mountBalancing += peripheralKilobit + igpTrashBare +
1;
}
if (5 + dualOcr) {
directx_us(deprecated_analog_teraflops, 2, 51);
}
if (oasis_disk_soap) {
dataHdv.dslam(ergonomicsVerticalFont, saas_media_plug);
} else {
so_cpc /= requirementsMampCursor;
softwareVoipKey.commerceGraphic += carrierHardCard(dataUnicodeUri,
resources, 19) * bespoke;
}
model_bezel.pharming_transistor_pci(gibibyte, ram_refresh_program);

Morte stat ingenio mugiat, haec tuentibus divite ora Iasonis ultima fugit
*fatis* odoribus. Capitisque videt. Vixque hippomene ibat, iam sub, te aras,
mundo?

Here's how to use...

### Using ShellOut and Pandoc

_How to use ShellOut and install Pandoc_

Lorem markdownum erat patriisque numquamque alto ferrea quibus nam penates
vicit: sine movit occumbere Dianam, imaginis, ab. Rector pharetras at populique
animos, dissuadet felicem, classis: non sine flammaeque, modo species habemus
montes. Sequitur copia, mater anteit fuit fideque victo, in Te nescio, aliquid,
huic cum. Taedae hoc in sudore artificem quidem, in amans obstat tu?

- Medea nunc mihi hostes socio
- Excutiunt undas leonum plangore tamen
- Quae ignotos satyrique nimium
- A magna Error

Gerebam simul dorso hospitio coleretur carmine consistere femina rubescere
Enaesimus ineo nunc tum et prensoque debes toto: posset. Per stellatus lumina
Epaphus ego. Non ut et dixere alimentaque dicor, in deos turba, est. **Tecum
in** neque in semine si variarum sepulcrum legerat tetigere omnia pressere
moderatior iacet prolemque miserabile aquilonibus.

- Confinia iniquo oneri qua primo versasque numen
- Praevalidusque supplex conpositum pater caelumque sensi
- Collum caeleste

Diversa inutile magna exiguamque sedet Iuppiter curvata generosam, ore supplex.
Vos fatus quam aurora visaque heros. Toto mundumque hic, socia fiet delicta est
manebo nostrae pectore.

## Filtering Posts

Clipeum mihi munera ternis; Non funestas *enervet*. Vicinia furiosaque minus.
Quo cruor relinquitur hiatus circumfunditur **sua**: quem tenebas exprimitur
indicet, prius copia; canes quod. Erit acie Procne pigneror et paulatim in
remulus et Thebis superest inclusum ora cannis, nigri [at
fuit](http://pavetque-quanto.org/cyclopumet)! Iunone Mendesius funeribus simus,
*qua*!

- Modo ait ullum vicit saevisque sua
- Cingere et raptos meas iugo iacuere atque
- Est eripiunt Hecaben inmedicabile rapta intendit cruentum
- Epulis iacuere
- Nepotum oscula et mittere desiluit pennis

Saxa exuvias, non inde cultores, in Venere robora. Augerem aptamque, fugio
inducit vos abluere nuntiet coniunx praetendat et vocantia est Crete memor
sequentia venis, nox matutina! Et germanae dubie.

## Redirecting Old URLs

Rexit terrae mane manumque, cum viscata adicit miles. Vota veluti angustis, si
quis, loqui venerit adspicit, [meque](http://de.org/) suum [fuit
qua](http://luctus.org/sed). Esset invaserat tibique et pudorem totaeque
recentis frena! Dapes ab deinde. Silvamque caelatus quam!

Arne sed ego regia, una quem, terra, Attis nova tendere ab volucrem feror et
partes utinam, busta. Mitia gemitu secundo? Miseri nomen, via ora abrumpit
dimovit comes enim recens contraria litoris qua pharetrae iussa, species ait?
Per Dixit sed dea pars blandita, [idem patiere animo](http://www.et.net/fruges)
inmansuetusque falsum.

## Using SwiftArgumentParser for Settings

Lorem *markdownum procul* dabat nam committe omni sunt puer si nomine,
tremoribus differt ex! Ipse genua studeat: tertia **fidum nobilitate alba**
potentior pisces; quid manus undis transit est. Hortos **ipse** rupit Triptolemo
Talia: utinam exempla, aequora una.

1. Dicta quid amantem Danaam
2. Pulsa fugant colore
3. Sed flumina atria totis modo Semele cecidit
4. Antiquam tale silvis opus perque
5. Enim frequens caelum

Porrigit levant, puellae. Abesse de harena enim emisitque haud incultos fuderat
lumina. Onus *fama mensor*.

## Further Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension WordPressSite {
public init(channel: RSSChannel) throws {
try self.init(
channel: channel,
relativeResourcePath: WordPressSite.wpContentUploadsRelativePath
relativeResourcePath: WordPressSite.contentUploadsRelativePath
)
}

Check warning on line 22 in Sources/ContributeWordPress/Decoder/WordPressSite+RSSChannel.swift

View check run for this annotation

Codecov / codecov/patch

Sources/ContributeWordPress/Decoder/WordPressSite+RSSChannel.swift#L17-L22

Added lines #L17 - L22 were not covered by tests

Expand Down Expand Up @@ -57,7 +57,7 @@ extension WordPressSite {
/// - Throws: An error if the regular expression cannot be created.
internal static func defaultAssetURLRegex(
forSite site: BaseURLSite,
relativeResourcePath: String = WordPressSite.wpContentUploadsRelativePath
relativeResourcePath: String = WordPressSite.contentUploadsRelativePath
) throws -> NSRegularExpression {
try Self.defaultAssetURLRegex(
forAssetSiteURL: site.baseURL,
Expand All @@ -74,7 +74,7 @@ extension WordPressSite {
/// - Throws: An error if the regular expression cannot be created.
public static func defaultAssetURLRegex(
forAssetSiteURL assetSiteURL: URL,
relativeResourcePath: String = WordPressSite.wpContentUploadsRelativePath
relativeResourcePath: String = WordPressSite.contentUploadsRelativePath
) throws -> NSRegularExpression {
try NSRegularExpression(pattern: "\(assetSiteURL)/\(relativeResourcePath)([^\"]+)")
}

Check warning on line 80 in Sources/ContributeWordPress/Decoder/WordPressSite+RSSChannel.swift

View check run for this annotation

Codecov / codecov/patch

Sources/ContributeWordPress/Decoder/WordPressSite+RSSChannel.swift#L78-L80

Added lines #L78 - L80 were not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion Sources/ContributeWordPress/Decoder/WordPressSite.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SyndiKit

/// A struct that represents a WordPress site.
public struct WordPressSite: BaseURLSite {
public static let wpContentUploadsRelativePath = "wp-content/uploads"
public static let contentUploadsRelativePath = "wp-content/uploads"

/// The name of the channel.
public let title: String
Expand Down
2 changes: 1 addition & 1 deletion Sources/ContributeWordPress/Images/AssetImport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public struct AssetImport: Hashable {
) {
let featuredPath = sourceURL.path
.replacingOccurrences(
of: ["", WordPressSite.wpContentUploadsRelativePath].joined(separator: "/"),
of: ["", WordPressSite.contentUploadsRelativePath].joined(separator: "/"),
with: assetRoot
)
.replacingOccurrences(of: "//", with: "/")
Expand Down
24 changes: 17 additions & 7 deletions Sources/ContributeWordPress/MarkdownProcessor+Starter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,26 @@ import Yams
import FoundationNetworking
#endif

@available(*, deprecated, message: "Use from Contribute.")
public struct PassthroughMarkdownGenerator: MarkdownGenerator {
private init() {}

Check warning on line 12 in Sources/ContributeWordPress/MarkdownProcessor+Starter.swift

View check run for this annotation

Codecov / codecov/patch

Sources/ContributeWordPress/MarkdownProcessor+Starter.swift#L12

Added line #L12 was not covered by tests
public static let shared = PassthroughMarkdownGenerator()
public func markdown(fromHTML htmlString: String) throws -> String {
htmlString
}

Check warning on line 16 in Sources/ContributeWordPress/MarkdownProcessor+Starter.swift

View check run for this annotation

Codecov / codecov/patch

Sources/ContributeWordPress/MarkdownProcessor+Starter.swift#L14-L16

Added lines #L14 - L16 were not covered by tests
}

extension MarkdownProcessor where ContentURLGeneratorType == SectionContentURLGenerator,
MarkdownContentBuilderType == MarkdownContentYAMLBuilder<
Source,
FilteredHTMLMarkdownExtractor<Source>,
FrontMatterYAMLExporter<Source, SpecFrontMatterTranslator>
> {
public static func begin(
importFrom exportsDirectoryURL: URL,
public static func beginImport(
from exportsDirectoryURL: URL,
to rootPublishSiteURL: URL,
usingGenerator markdownGenerator: MarkdownGenerator,
usingGenerator markdownGenerator: MarkdownGenerator =
PassthroughMarkdownGenerator.shared,
filteringPostsWith postFilters: [PostFilter] = .default,
redirectsFormattedUsing redirectFromatter: RedirectFormatter? = nil,
importAssetsBy assetImportSetting: AssetImportSetting = .download,
Expand All @@ -36,17 +46,17 @@ extension MarkdownProcessor where ContentURLGeneratorType == SectionContentURLGe
try processor.begin(withSettings: settings)
}

Check warning on line 47 in Sources/ContributeWordPress/MarkdownProcessor+Starter.swift

View check run for this annotation

Codecov / codecov/patch

Sources/ContributeWordPress/MarkdownProcessor+Starter.swift#L34-L47

Added lines #L34 - L47 were not covered by tests

public static func begin(
importFrom exportsDirectoryURL: URL,
public static func beginImport(
from exportsDirectoryURL: URL,
to rootPublishSiteURL: URL,
filteringPostsWith postFilters: [PostFilter] = .default,
redirectsFormattedUsing redirectFromatter: RedirectFormatter? = nil,
importAssetsBy assetImportSetting: AssetImportSetting = .download,
overwriteAssets: Bool = false,
shellOut: @escaping (String, [String]) throws -> String
) throws {
try begin(
importFrom: exportsDirectoryURL,
try beginImport(
from: exportsDirectoryURL,
to: rootPublishSiteURL,
usingGenerator: PandocMarkdownGenerator(shellOut: shellOut),
filteringPostsWith: postFilters,
Expand Down
2 changes: 1 addition & 1 deletion Sources/ContributeWordPress/ProcessorSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extension ProcessorSettings {

/// The relative path for uploads directory of WordPress content.
public var uploadsRelativePath: String {
WordPressSite.wpContentUploadsRelativePath
WordPressSite.contentUploadsRelativePath
}

Check warning on line 79 in Sources/ContributeWordPress/ProcessorSettings.swift

View check run for this annotation

Codecov / codecov/patch

Sources/ContributeWordPress/ProcessorSettings.swift#L77-L79

Added lines #L77 - L79 were not covered by tests

/// Returns the asset directory path for the given site name.
Expand Down
Loading

0 comments on commit 16d0d6c

Please sign in to comment.